307 Commits
Author SHA1 Message Date
Sylvestre Ledru 9e7ceb7480 prepare version 3.6.3 2018-09-19 10:00:36 +02:00
Sylvestre Ledru e7ad0850a1 remove a trailing whitespace 2018-09-19 09:59:31 +02:00
Franck HOUSSEN ee9a93a853 Update CHANGES. (#156) 2018-09-16 16:05:43 +02:00
Franck HOUSSEN 2d969e902d [CLEAN] Run MPI tests with "mpirun -n 2". (#152) 2018-09-15 17:46:24 +02:00
Franck HOUSSEN 5872987e67 [BUG FIX] howmny is defined as character*1 in pdseupd subroutine. (#153)
Cosmetic bug ("safer" way to get same thing).
2018-09-15 17:38:27 +02:00
Franck HOUSSEN bbb87ba0ff Fix issue 144. Add -fdefault-integer-8/-i8 in FCFLAGS. (#147) 2018-09-15 17:36:42 +02:00
Franck HOUSSEN 78d781286a stat: initialize common block. (#148)
* stat: initialize common block.

* Move debug_init.f90/stat_init.f90 to dbgini.f/staini.f.

In cases where one has 2 fortran compilers (F77+F90), the reference code
base and (missing) related common initialisations will be compiled
consistently by the same (F77) compiler. F90 will handle ICB (f2003-f2008)
that could not be compiled by F77.

Note: in F77, code starts at col 7, continuation line with & at col 6,
length line is limited, names must be smaller than 7 chars (no underscore).

* [BUG FIX] compile dbgini.f staini.f with AND without ICB.
2018-09-15 17:35:57 +02:00
Franck HOUSSEN 3829c449c0 Add missing test binaries in gitignore. (#151) 2018-09-15 17:35:12 +02:00
Franck HOUSSEN b7ce7debe5 [BUG FIX] When using *zneupd, sigma is complex. (#154)
Cosmetic bug ("better" way to get same thing - without this, sigma which
is used as an input, is implicitely converted from real to complex. Same
thing for the callee, but more "logical" for the caller).
2018-09-15 17:31:35 +02:00
caliarim 31854cadaf Give up forcing the initial residual to be in the range of the operator OP after a restart (Closes: #142). (#143) 2018-08-07 19:00:50 +02:00
Sylvestre Ledru deb35559a6 Improve the changelog 2018-07-22 17:39:33 +02:00
Franck HOUSSEN cdfb08aac2 Travis-CI: use jobs (easier to check out what's wrong). (#138) 2018-06-30 22:43:31 +02:00
Franck HOUSSEN f532cc06a1 Various improvement on build systems
* [CLEAN] ICB saves you from old-fashion-boring-cumbersome-fortran/C crap...

* Run old-fashion cubersome Fortan/C tests only if ICB=OFF.
Getting them to work with BOTH ICB=ON/OFF would be adding tricky-messy
to already cubersome-crappy black magic...

Note that icb_arpack_c test (ICB=ON) do the same than bug_1315_*
tests (ICB=OFF): icb_arpack_c was initially a copy of bug_1315_*.
In the end, you don't loose anything (same functional coverage).
2018-06-29 11:41:41 +02:00
Franck HOUSSEN c61bb2c16a Clean (#136)
* [CLEAN] always define ICB.

* [BUG FIX] Can't call AC_PROG_CXX conditionally.
https://lists.gnu.org/archive/html/bug-automake/2002-11/msg00020.html

* [BUG FIX] ICB: set default value.

* Check options are set as expected.
Note: before previous fix, options were NOT set correctly !...
2018-06-26 17:35:32 +02:00
Franck HOUSSEN eb9d23dd3f Add configuration summary. (#135) 2018-06-26 14:51:14 +02:00
Franck HOUSSEN 68a420889c [BUG FIX] Missing include. (#134) 2018-06-26 14:18:35 +02:00
Franck HOUSSEN 277a6c8cfe C++11 (for ICB): do NOT use hard-coded gnu++11. (#133) 2018-06-25 21:38:48 +02:00
Sylvestre Ledru 2fede344e2 Update the changes file 2018-06-24 09:14:08 +02:00
Franck HOUSSEN e7e50bbc1b Auto-generated pc/cmake files: headers in dedicated files. 2018-06-24 09:12:41 +02:00
Franck HOUSSEN a4eaab6952 Revert " * Rename debug.h to debug-arpack.h to avoid collision (Closes #126)"
This reverts commit a48e17f7af.
2018-06-24 09:12:41 +02:00
Franck HOUSSEN 7a123870b2 Fix issue#130 for autotools. 2018-06-24 09:12:41 +02:00
Franck HOUSSEN e74e01dfc6 Fix issue#130 for cmake. 2018-06-24 09:12:41 +02:00
Sylvestre Ledru 9db8c86fdf fix some typos 2018-06-23 15:17:57 +02:00
Sylvestre Ledru 7f7c6fd93d Remove all trailing whitespaces 2018-06-23 15:17:57 +02:00
Sylvestre Ledru 26b936ba17 add the bug number 2018-06-23 09:58:36 +02:00
Sylvestre Ledru a48e17f7af * Rename debug.h to debug-arpack.h to avoid collision (Closes #126) 2018-06-23 09:54:52 +02:00
Sylvestre Ledru 63bde34786 fix a regression 2018-06-09 18:29:52 +02:00
Ruslan Kabatsayev 449dc71690 Fix C and C++ bindings for PARPACK 2018-06-09 18:28:12 +02:00
Ruslan Kabatsayev a50b68b48d Extend C++ test to also include double, not only float 2018-06-09 18:28:12 +02:00
Ruslan Kabatsayev ccd45494a8 Synchronize C++ bindings with the fixed C bindings
This no longer includes a tweaked copy of arpack.h. Maintaining both
sets of prototypes separately is too much manual labor.
2018-06-09 18:28:12 +02:00
Ruslan Kabatsayev 6194e09c65 Fix correctness of C bindings
Main problems found in the original version are:
I. C vs iso_c_binding:
    1. Mismatch between float complex and float parameters in C prototypes and
    icba*.f90 files
    2. Mismatch between passing of some arguments by pointer vs by value
II. iso_c_binding vs Fortran:
    1. Mismatch between real and complex parameters
    2. Wrong intent for 'workev'

These problems lead to UB, which, in particular, resulted in test
crashes on i686 targets. This patch fixes them.
2018-06-09 18:28:12 +02:00
Darcy Beurle 390a4457cf Update contribution 2018-06-04 16:52:54 +02:00
Darcy Beurle 9c9affa982 External "C" for .h file incase we have pre c++11 2018-06-04 16:52:54 +02:00
Darcy Beurle 2333f73976 Parpack bindings modernised 2018-06-04 16:52:54 +02:00
ypnos 278774b072 Add includedir to pkg-config file
Without this line, pkg-config 0.29.2 refuses to parse the arpack.pc file:

# pkg-config --libs arpack
Variable 'includedir' not defined in '/usr/lib/pkgconfig/arpack.pc'
2018-05-29 11:41:34 -07:00
Darcy Beurle d5153b941f Remove last comment 2018-05-22 14:43:00 +02:00
Darcy Beurle 34a81d09fb Remove _c and dead comments. Apply formatting. 2018-05-22 14:43:00 +02:00
Denis Davydov 834c9c53e3 add missing header (#120) 2018-05-22 14:41:27 +02:00
Darcy Beurle 079ca38ee6 Update CHANGES (#118) 2018-05-21 11:40:47 +02:00
Darcy Beurle 74784a5309 Add C++11 interface (#117) 2018-05-21 10:31:12 +02:00
Darcy Beurle d7deefda82 Add clang-format using the Google coding style (#116) 2018-05-20 23:31:47 +02:00
Sylvestre Ledru 534d6272d8 Merge pull request #113 from dbeurle/master
Test C++11 support on travis for autotools
2018-04-18 22:47:07 +02:00
Darcy Beurle 69f5411c1c Test C++11 support on travis for autotools 2018-04-18 22:32:47 +02:00
Sylvestre Ledru 9f6945657c Merge pull request #112 from dbeurle/master
Provide extern "C" when using C++ compiler for the C bindings
2018-04-18 22:00:55 +02:00
Darcy Beurle 33024f7d78 Provide extern "C" when using C++ compiler for the C bindings 2018-04-18 21:49:10 +02:00
Sylvestre Ledru 39258b58d4 Merge pull request #109 from fghoussen/icb_stat
iso_c_binding: add statistics support.
2018-04-12 16:54:17 +02:00
Sylvestre Ledru f686312826 Merge pull request #111 from fghoussen/cmake
[BUG FIX] CMake: test names should be different from exe names.
2018-04-12 16:46:56 +02:00
Franck HOUSSEN 9ffcb48193 [BUG FIX] CMake: test names should be different from exe names. 2018-04-12 16:03:05 +02:00
Sylvestre Ledru 194be499be Merge pull request #110 from fghoussen/cmake
CMake: merge "make test" and "make check"
2018-04-12 15:51:59 +02:00
Franck HOUSSEN 4db49c4687 CMake: kill "make check" as it's fully covered by "make test".
make check (autotools way) <=> make test ARGS="-V" (cmake way).
2018-04-12 13:16:22 +02:00
Franck HOUSSEN aaa357d96d CMake: get 100% tests OK when running "make test".
Kill EXCLUDE_FROM_ALL. Test name != executable name.
2018-04-12 13:09:14 +02:00
Franck HOUSSEN b521af291d iso_c_binding: README.md. 2018-04-11 18:40:43 +02:00
Franck HOUSSEN d67b323399 iso_c_binding: add statistics support. 2018-04-09 17:54:03 +02:00
Sylvestre Ledru 18e6709a2b Merge pull request #107 from fghoussen/icb_dbg
iso_c_binding: add debug support.
2018-04-08 14:27:06 +02:00
Sylvestre Ledru 87178d7ce1 Merge pull request #108 from fghoussen/ignore
Add bug_79_double_complex in .gitignore.
2018-04-08 10:39:34 +02:00
Franck HOUSSEN 76b5c5017a Initialize debug common block with "block data" (at Fortran side). 2018-04-08 10:37:02 +02:00
Franck HOUSSEN 2652660765 [BUG FIX] : debug.h should always be installed. 2018-04-07 22:44:57 +02:00
Franck HOUSSEN 5829df36a7 Add bug_79_double_complex in .gitignore. 2018-04-07 21:56:03 +02:00
Franck HOUSSEN be538c87c2 Revert "Move init debug common block from debug_icb.f90 to debug.h : this way you"
This reverts commit 22d1b3b0b5.
2018-04-07 17:21:38 +02:00
Franck HOUSSEN 22d1b3b0b5 Move init debug common block from debug_icb.f90 to debug.h : this way you
should benefit from that whatever you use (or not !) icb.
2018-04-07 17:16:09 +02:00
Franck HOUSSEN 64f3c1b8dc Initialisation of the debug common block to "no debug". 2018-04-07 17:04:39 +02:00
Franck HOUSSEN a9c71f3180 iso_c_binding : debug - stupid coverage....
CI fails because of -0.2% coveralls reg + noticed that cnappas.f and
friend are NOT fully covered => turn ALL flags to 1 hoping this will
get back a +0.2% coverage...
2018-04-07 16:53:36 +02:00
Franck HOUSSEN 533b9487b0 iso_c_binding : debug - cosmetic changes hoping the coverage
will get back from 69.8 to 70 % !...
2018-04-07 16:16:49 +02:00
Franck HOUSSEN 40ed22e42f iso_c_binding: debug - examples with and without debug traces. 2018-04-06 22:25:50 +02:00
Franck HOUSSEN 449ae6b95a iso_c_binding: add debug support. 2018-04-05 18:47:35 +02:00
Sylvestre Ledru ececcc167b Merge pull request #106 from fghoussen/cmake
CMake: cmake files install.
2018-04-05 15:25:29 +02:00
Franck HOUSSEN 2ed9d33a13 CMake: cmake files install.
find_package files (*.cmake) stand for pkg-config files (*.pc).
pc files are supposed to be installed in local/lib/pkgconfig.
cmake files are supposed to be installed in local/lib/cmake.
2018-04-05 10:31:02 +02:00
Sylvestre Ledru edce634363 Merge pull request #105 from luzpaz/misc-typos
Misc. typos
2018-04-04 09:05:17 +02:00
luz.paz 442e2ee534 Misc. typos
Found via `codespell -q 3`
2018-04-03 18:46:31 -04:00
Sylvestre Ledru 431d45b5a2 update of the makefile as the readme as be renamed 2018-03-26 00:41:48 +02:00
Sylvestre Ledru 5360fb7885 Fix the syntax 2018-03-26 00:31:57 +02:00
Sylvestre Ledru f3974f9720 Update of the doc to use markdown 2018-03-26 00:28:40 +02:00
Sylvestre Ledru 4d26789a53 Merge franck work 2018-03-26 00:21:08 +02:00
Sylvestre Ledru a07c391906 Detail the code coverage change 2018-03-26 00:20:22 +02:00
Sylvestre Ledru 930b29d6ce add badges about the quality 2018-03-26 00:19:21 +02:00
Sylvestre Ledru c92f5d63d4 cosmetic 2018-03-26 00:19:21 +02:00
Sylvestre Ledru 95997a6cf0 Rename the readme to markdown 2018-03-26 00:19:21 +02:00
Sylvestre Ledru cf62285f34 Merge pull request #103 from sylvestre/master
Fix the management of files without code coverage
2018-03-26 00:14:06 +02:00
Sylvestre Ledru e78134a671 remove trailing spaces 2018-03-26 00:03:27 +02:00
Sylvestre Ledru 72163e85b8 fix the empty file processing 2018-03-26 00:03:15 +02:00
Sylvestre Ledru df740d197f Merge pull request #102 from sylvestre/master
Try to add code coverage
2018-03-25 19:14:35 +02:00
Sylvestre Ledru 3073998f84 Build as many things as possible 2018-03-25 16:46:01 +02:00
Sylvestre Ledru b347211d95 how to build with code coverage 2018-03-25 15:57:11 +02:00
Sylvestre Ledru 84bd771150 Update travis to start the code coverage builds 2018-03-25 15:52:02 +02:00
Sylvestre Ledru f8754b29bc Try to add code coverage 2018-03-25 15:47:44 +02:00
Franck HOUSSEN 54c8e0b18c autotools: run parpack tests with "mpirun -n 2". (#101) 2018-03-24 18:39:25 +01:00
Franck HOUSSEN b52efe5f2c parpack: configuration check (use iso_c_binding, MPI_Comm_c2f). (#100)
* parpack: check for MPI_Comm_c2f.

* iso_c_binding: check for icb module compilation.
2018-03-23 11:39:15 +01:00
Franck HOUSSEN 4985c11b19 parpack: running autotools tests. (#99)
note: ax_mpi must be ran twice (first run in --enable-mpi scope
is lost when entering --enable-icb scope).
2018-03-22 15:27:38 +01:00
Franck HOUSSEN 6c1bd3053d [BUG FIX] CMake: use ${PROJECT_SOURCE_DIR}. (#97)
.. is OK only when the BUILD dir in under the root dir.
2018-03-21 17:54:43 +01:00
Franck HOUSSEN 2daaeaf2e9 TravisCI: kill libc++-dev. (#96) 2018-03-21 16:26:50 +01:00
Franck HOUSSEN 7bdcee1b23 parpack : add iso_c_binding support. (#95) 2018-03-21 13:24:10 +01:00
Darcy Beurle 946dc3db7b Test imaginary eigenvalue (#91) 2018-03-12 20:19:57 +01:00
Denis Davydov 70af492b6f cmake: use standard BUILD_SHARED_LIBS to control static vs shared (#94) 2018-03-12 15:42:43 +01:00
Franck HOUSSEN 264603d284 arpack.hpp: adding comments. (#93) 2018-03-12 15:21:36 +01:00
Sylvestre Ledru 6752fbca20 fix more typos 2018-03-10 17:05:05 +01:00
Darcy Beurle 7fc42e5f77 Fixed header typo (#92) 2018-03-10 17:01:56 +01:00
Franck HOUSSEN 3e841c8b13 Add CMake build directories in .gitignore. (#90) 2018-03-10 16:26:30 +01:00
Franck HOUSSEN f14261dcb0 arpack.hpp: add const to improve C++ integration. (#89)
note: as const is added on function arguments, this should be safe from C <-> C++ pitfalls.
2018-03-10 16:26:14 +01:00
caliarim d04bdf19b9 Force the residual vector to be in the range of OP. (#79) (#80)
* Force the residual vector to be in the range of OP. (#79)

Force the residual vector to be in the range of the operator OP for bmar .eq. 'I', too.
2018-03-02 12:36:47 +01:00
Ruslan Kabatsayev cd6366097d Fix C and C++ bindings ABI (#84)
Fortran's logical type has size of 4 bytes, while C and C++ have
sizeof(bool)==1. Thus it's no good to pass bool[ncv] array to a function
expecting logical(ncv).
Currently attempt to do this results in successful compilation and
subsequent buffer overflow in e.g. dseupd_c. This is actually caught at
run time by gcc>=5 by its stack smashing detector, leading to test
failures.
This patch replaces bool* types expected by C and C++ bindings with
int*, and corresponding declarations of the arrays in callers in the
tests from bool[3*ncv] to int[ncv].
This fixes #83.
2018-03-02 11:54:50 +01:00
Denis Davydov db1d49b60f rename pslamch to pslamch10 to avoid symbol collision with Scalapack (#85) 2018-03-02 11:54:35 +01:00
Franck HOUSSEN 1d912add4f CMake: kill useless lines (coming from bad merge ?). (#78) 2017-11-09 10:43:11 +01:00
Sylvestre Ledru ebe3091d8e Update CHANGES 2017-10-31 09:07:16 +01:00
Franck HOUSSEN 2f721dbade Issue 62: generate static/shared libraries. (#75) 2017-10-29 21:48:55 +01:00
Franck HOUSSEN 0e7d01d34b CMake: find_package for both parpack and arpack. (#76)
/tmp> cp /path/to/arpack-ng/PARPACK/EXAMPLES/MPI/*.f .
/tmp> cp /path/to/arpack-ng/PARPACK/EXAMPLES/MPI/*.h .

/tmp> more CMakeLists.txt
cmake_minimum_required(VERSION 3.7)
project(pdndrv1 Fortran)
find_package(MPI REQUIRED)
find_package(arpack-ng 3.5 REQUIRED)
find_package(BLAS REQUIRED)
find_package(LAPACK REQUIRED)
add_executable(pdndrv1 pdndrv1.f)
target_link_libraries(pdndrv1 "${arpack_ng_LIBRARIES}" "${MPI_Fortran_LIBRARIES}" "${BLAS_LIBRARIES}" "${LAPACK_LIBRARIES}")
target_include_directories(pdndrv1 PUBLIC "${arpack_ng_INCLUDE_DIRS}" "${MPI_Fortran_INCLUDE_PATH}")

/tmp> export CMAKE_PREFIX_PATH=/path/to/arpack-ng/local # Should be done by module load.

/tmp> mkdir BUILD; cd BUILD; cmake ..; make

/tmp> mpirun -n 2 ./pdndrv1
2017-10-29 21:48:38 +01:00
luzpaz 59bd5543e9 Fixed some trivial comment code typos (#77)
Found them in a downstream project and decided to submit fixes upstream.
2017-10-29 21:47:42 +01:00
Franck HOUSSEN da46ff3d4b Provide tarball generation using cmake (cpack). (#70)
Provide tarball generation using cmake (cpack)
2017-10-26 16:56:06 +02:00
Franck HOUSSEN 282fe8aa79 Run the testsuite in the CI with cmake. Fixes issue #64. 2017-10-26 15:49:37 +02:00
Franck HOUSSEN 19ac60166b Improve iso_c_binding coverage (#73)
* Provide arpack.h/hpp in install directory.

>> tree local/
local/
├── include
│   ├── arpack.h
│   └── arpack.hpp
└── lib
    ├── libarpack.a
    ...

* [BUG FIX] Provide arpack.h/hpp in install directory: fix make distcheck.

* Move iso_c_binding to icb_arpack.
This will ease iso_c_binding implementation for parpack (future dev).

* Improve iso_c_binding coverage. Add tests involving complex.
2017-10-26 11:46:24 +02:00
Sylvestre Ledru 79f7ecc4ed Merge the work from Franck under a single item 2017-10-16 17:48:22 +02:00
Franck HOUSSEN 771cbbd9c8 Add support for iso_c_binding (portability, f/c/c++ binding). (#68)
* Add support for iso_c_binding (portability, f/c/c++ binding).

* Add support for iso_c_binding: add README and comment examples.
2017-10-16 17:47:23 +02:00
Sylvestre Ledru c5102cd602 Next version will be 3.6.0 2017-10-16 14:49:05 +02:00
Sylvestre Ledru 6fd243b674 Fix consistency issues over the arpack name (#71) 2017-10-16 14:47:01 +02:00
Franck HOUSSEN be3a61cfee Provide find_package for (cmake) users to find arpack-ng. (#69)
This is the cmake equivalent of pkg-config.

The make install will ship config files:
/path/to/arpack-ng/BUILD> cmake ..; make install
[100%] Built target arpack
Install the project...
-- Install configuration: "Release"
-- Installing: /path/to/arpack-ng/local/lib/libarpack.a
-- Installing: /path/to/arpack-ng/local/*[Cc]onfig*.cmake

Now, the user who wants to use arpack-ng can use find_package:

/tmp> export CMAKE_PREFIX_PATH="/path/to/arpack-ng/local:${CMAKE_PREFIX_PATH}" # Should be done by module load arpack-ng.

/tmp> more CMakeLists.txt
cmake_minimum_required(VERSION 3.7)
find_package(arpack-ng 3.5 REQUIRED) # Find *Config*.cmake.

/tmp> mkdir BUILD; cd BUILD; cmake ..
...
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/BUILD

/tmp/BUILD> cmake -LA .. | grep Arpack
ArpackNG_DIR:PATH=/path/to/arpack-ng/local
ArpackNG_INCLUDE_DIRS:PATH=/path/to/arpack-ng/local/include
ArpackNG_LIBRARIES:FILEPATH=/path/to/arpack-ng/local/lib/libarpack.a

The user can use ArpackNG_INCLUDE_DIRS and ArpackNG_LIBRARIES to compile/link with arpack-ng in his own CMakeLists.txt (after find_package).

If the user asks for an newer version, cmake breaks at configure time: this is checked by ArpackNGConfigVersion.cmake.
2017-10-16 14:38:51 +02:00
Edward Betts 7a91e3a665 correct spelling mistakes (#67) 2017-08-31 07:31:09 +02:00
adamadanandy 5820b39ade fix {d|s}lahqr comment, which should be LAPACK routine (#66) 2017-08-19 19:28:32 +02:00
turboencabulator 616a91547d Minor autoconf cleanup (#61)
* Move some generated files to build-aux

* Remove unnecessary includes

aclocal handles these includes.

* Update changelog

* Update .gitignore
2017-07-02 15:23:28 -07:00
Sylvestre Ledru 9233f7f86f cosmetic changes on the changelog 2017-05-16 11:47:12 +02:00
Sylvestre Ledru 81ef2f1a54 Fix the wrong changelog 2017-05-15 14:25:07 +02:00
Sylvestre Ledru 5705571117 Prepare 3.5.0 release 2017-05-15 14:23:29 +02:00
Sylvestre Ledru c7bd8e70bc Fix the position in the CHANGES file 2017-05-15 14:16:31 +02:00
Ondřej Čertík 2279a76924 Fix a typo: commuication -> communication (#60) 2017-05-15 14:13:16 +02:00
caliarim 26e31ba431 Test for issue #58 (#59)
* Avoid purification stage in [d,s]neupd.f if it requires division by zero (Closes: #58)
2017-05-15 14:13:02 +02:00
turboencabulator 0e2ed1b2f2 Improvements to configure.ac (#52)
* Add the --with-pkgconfigdir option

* Ignore more autoreconf-generated files

* Various portability improvements

Use the 2nd argument to AX_BLAS and AX_LAPACK to handle errors.  Don't
rely on $ax_blas_ok and $ax_lapack_ok having any particular value.

AC_ARG_ENABLE([x], ...) will define $enable_x to $enableval.  No need to
do this ourselves.

The default for $enable_mpi is "no", so only compare to "no".

* Add gitignore patterns for files generated by test-driver

* Add a workaround for those without pkg-config >= 0.27

* Update CHANGES
2017-03-29 16:35:22 +02:00
turboencabulator 9631eb8b5f Improvements to CMake (#53)
* Automatically determine installation locations

* Set the library version to match the autotools build

* First attempt at generating arpack.pc from CMake

* Update CHANGES
2016-12-16 09:59:38 +01:00
Sylvestre Ledru b16d8700a8 Merge branch 'master' of github.com:opencollab/arpack-ng 2016-09-20 17:53:42 +02:00
Sylvestre Ledru 747a7d811f we also have a testsuite, show it in the README 2016-09-20 08:25:39 +02:00
Sergei Iskakov f9927db4cf Fix a potential deadlock when using custom communicators (Fix issue #46) (#48)
Fix a potential deadlock when using custom communicators (Fix issue #46) (#48)
2016-09-19 23:04:09 +02:00
matzeri 00a6affb9b removing AC_FC_LINE_LENGTH to solve #41 on Cygwin (#42)
* removing AC_FC_LINE_LENGTH to solve
https://github.com/opencollab/arpack-ng/issues/41
on Cygwin

* reimplementing AC_FC_LINE_LENGTH

* changelog entry for AC_PROG_FC usage
2016-09-19 08:07:28 +02:00
Sylvestre Ledru 7ec2f3e7e5 Merge pull request #43 from vtjnash/jn/intel-fix
fix usages of DLACPY to not alias inputs
2016-09-14 18:37:42 +02:00
Jameson Nash fdbf8ffe98 Update CHANGES 2016-09-14 12:37:08 -04:00
Sylvestre Ledru eaeaebbc7d Merge pull request #47 from jschueller/patch-1
Update CHANGES
2016-09-14 13:36:50 +02:00
Julien Schueller bbf870f3e7 Update CHANGES 2016-09-14 12:09:08 +02:00
Sylvestre Ledru 6aeef41c11 Merge pull request #45 from jschueller/patch-1
Disable C++ compiler detection
2016-09-13 19:27:46 +02:00
Julien Schueller 1b42f88e11 Add a comment about cmp0042 2016-09-13 19:23:06 +02:00
Julien Schueller b0e2a14258 Set policy CMP0042 2016-09-13 17:50:55 +02:00
Julien Schueller b8aa09a548 Disable C++ 2016-09-13 16:42:37 +02:00
Jameson Nash b4ed4cadd1 Update CHANGES 2016-09-05 17:21:17 -04:00
Zhang Z. (Intel) 3c6c210dc4 fix usage of DLACPY to not alias inputs
https://software.intel.com/en-us/articles/how-to-resolve-arpack-issues-with-intel-mkl-110-update-3
2016-08-08 17:36:34 -04:00
Sylvestre Ledru 08a6349ff7 remove an old email address for Allan 2016-07-28 11:37:23 +02:00
Sylvestre Ledru 4a3502b11f Merge pull request #39 from davydden/fix/cmake
Improve cmake build
2016-07-25 12:32:31 +02:00
Denis Davydov d1cd023783 cmake: whitespaces 2016-07-06 14:28:21 +02:00
Denis Davydov 70a97f8f22 add an antry in change and improve readme 2016-07-06 13:13:49 +02:00
Denis Davydov a9ab2a11af cmake: add missing dependency of parpack on arpack 2016-07-06 13:12:42 +02:00
Denis Davydov cc2466c635 cmake: add install targets 2016-07-06 13:12:42 +02:00
Sylvestre Ledru a3ce584000 occured => occurred 2016-07-03 11:07:35 +02:00
Sylvestre Ledru 894faaa243 prepare a new version 2016-07-02 21:54:15 +02:00
Sylvestre Ledru 54f244612e Update the date for release 2016-07-02 21:52:15 +02:00
Sylvestre Ledru bdaab9995a cosmetic 2016-07-02 21:51:41 +02:00
Sylvestre Ledru d66b8b4b0a Merge pull request #35 from davydden/pdlamch10_return
fix pdlamch10 return variable
2016-03-14 14:07:51 +01:00
Denis Davydov 56e6e9f763 fix pdlamch10 return variable 2016-03-14 07:21:40 +01:00
Sylvestre Ledru b55cc59146 Merge the two changelog items. 3.4.0 hasn't been released yet 2016-02-15 14:40:06 +01:00
Sylvestre Ledru a0b3de6b82 Merge pull request #32 from nalimilan/suffix
ILP64 support
2016-02-15 14:38:38 +01:00
Milan Bouchet-Valat a97e5c53b4 Update changelog 2016-01-25 14:37:45 +01:00
Milan Bouchet-Valat 0e19885160 Add CMake support 2016-01-25 14:23:32 +01:00
Milan Bouchet-Valat 69ff75af05 Improve portability by using more autoconf macros 2016-01-25 14:23:29 +01:00
Milan Bouchet-Valat 5f47b8df2e Support building with ILP64 interface
This adds a configure variable INTERFACE64 which changes the integer
size to 64 bits for ARPACK as well as BLAS and LAPACK. The tests are
also updated to use a BLASINT type reflecting the BLAS integer.
2016-01-25 13:47:43 +01:00
Milan Bouchet-Valat f4f5173864 Support adding suffix to ARPACK, BLAS and LAPACK names
This adds three configure variables:
- LIBSUFFIX to add a suffix to the ARPACK library name
- SYMBOLSUFFIX to add a suffix to ARPACK, BLAS and LAPACK symbol names
2016-01-25 13:47:43 +01:00
Sylvestre Ledru c9ace29448 Merge pull request #31 from turboencabulator/autotools-fixes
Autotools fixes
2016-01-20 16:20:07 +01:00
Kyle Guinn 86df5b062e Follow autoconf's error message style suggestions
"The error-description should start with a lower-case letter"
2016-01-08 01:45:31 -06:00
Kyle Guinn 7fc73aae63 Delete an AC_MSG_CHECKING without a corresponding AC_MSG_RESULT
This is meant to be used around something like AC_TRY_COMPILE.  The
ax_mpi.m4 script will print out several similar lines, so there's no
need to convert it to AC_MSG_NOTICE.
2016-01-08 01:39:46 -06:00
Kyle Guinn 1131e093af Simplify MPI/BLACS selection
Set up the BLACS variant to install libparpack and build examples just
like the MPI variant.  You can now choose one of the two from
configure.ac.  The BLACS variant is disabled for now.  Because it is
disabled, note that the sources are no longer built and then left
unused.
2016-01-08 01:08:43 -06:00
Kyle Guinn c6e5122c8e Remove another libtool convenience library
Repeats the last commit on the PARPACK sources.
2016-01-08 00:54:41 -06:00
Kyle Guinn 3d94a2cd3d Remove a libtool convenience library
Instead of creating a convenience lib of everything in SRC and linking
it in the root directory, create the actual libarpack library in SRC
instead.
2016-01-08 00:40:46 -06:00
Kyle Guinn d8f2020144 Shorten the names of some targets
Let the directory name distinguish between BLACS and MPI variants.
2016-01-07 00:32:32 -06:00
Kyle Guinn 33a3efd6ee Remove test-dnsimp.sh
AC_CONFIG_LINKS copies testA.mtx to the build directory, making this
script unnecessary.
2016-01-06 22:47:58 -06:00
Kyle Guinn ddfd843e29 Do not link bug_1315 tests to LAPACK/BLAS
LAPACK/BLAS is not a direct dependency.  If it was, we would also need
to link with $(FLIBS) as determined by AC_F77_LIBRARY_LDFLAGS since
we're mixing C and Fortran.
2016-01-06 22:44:28 -06:00
Kyle Guinn 29e06320f6 Remove AM_DEFAULT_SOURCE_EXT
Each executable has a _SOURCES variable defined.  No need for automake
to guess a default value for _SOURCES.
2016-01-06 22:42:32 -06:00
Kyle Guinn e8267ce709 Fix order of BLAS/LAPACK libraries 2016-01-04 22:41:00 -06:00
Sylvestre Ledru 337ab26e85 Update the version to 3.4.0 2015-10-27 10:22:31 +01:00
Sylvestre Ledru 01b5490e68 Describe Martin's change with cmake 2015-10-27 10:19:50 +01:00
Sylvestre Ledru 30a3e266e4 also ship CMakeLists.txt with the autotool build system 2015-10-27 10:19:37 +01:00
Sylvestre Ledru a3379944dc Merge pull request #26 from m-reuter/master
Add the cmake build support
2015-10-21 10:16:23 +02:00
Martin Reuter 5a16aaf287 Added cmake check to travis 2015-10-20 23:46:32 -04:00
Martin Reuter f0c4d81627 Added checks to cmake 2015-10-20 23:43:54 -04:00
Martin Reuter cdbce13db0 Added Cmake info 2015-10-20 16:58:20 -04:00
Sylvestre Ledru 08cea42566 Merge pull request #27 from thrasibule/use_blasref
Try to use reference blas to avoid a random issue in test bug_1315
2015-10-19 22:12:06 +02:00
Sylvestre Ledru 99ef033832 Merge pull request #28 from thrasibule/missing_free
Add missing free in a test
2015-10-19 22:09:44 +02:00
Guillaume Horel 6a6f8528cd add missing free 2015-10-19 14:43:29 -04:00
Guillaume Horel 0704e64ff4 try to use reference blas 2015-10-19 14:30:27 -04:00
Martin Reuter 7bbfb50ad7 cmake project name revert 2015-10-15 16:41:58 -04:00
Martin Reuter 639e42a5ca cmake project name should be arpack-ng 2015-10-15 16:33:43 -04:00
Martin Reuter 5e0617f859 Cmake change library order 2015-10-15 16:12:58 -04:00
Martin Reuter e511e06a33 fix directory names in CMake 2015-10-15 15:54:00 -04:00
Martin Reuter 664123a8d6 adding MPI to cmake for travis 2015-10-15 15:44:17 -04:00
Martin Reuter ceda2ef405 fix: now using BUILD env var 2015-10-15 15:42:26 -04:00
Martin Reuter 6c859f2e67 adding EXAMPLES to cmake travis 2015-10-15 15:39:00 -04:00
Martin Reuter db90ad5881 adding CMAKE to travis (parallel) 2015-10-15 15:12:13 -04:00
Martin Reuter 8f020e2715 force external Lapack and BLAS and adjust local dir names to upper case 2015-10-14 15:46:04 -04:00
Martin Reuter 16b445ec08 Adopted Cmake from https://github.com/feymark/arpack.git 2015-10-14 15:46:04 -04:00
Sylvestre Ledru b0f7a6008f remove trailing spaces + minor update of the doc 2015-10-12 09:23:54 +02:00
Sylvestre Ledru 5c2d41f710 update of the date for release day 2015-10-12 09:21:16 +02:00
Sylvestre Ledru 5c020ea005 remove trailing spaces 2015-10-12 09:20:48 +02:00
Sylvestre Ledru 99ab5a9a29 Merge pull request #24 from thrasibule/update-travis
Use the new travis infrastructure
2015-09-26 14:45:10 +02:00
Guillaume Horel e0a4cbbaec Use the new travis infrastructure 2015-09-24 15:22:02 -04:00
Sylvestre Ledru 36be08bf41 Merge pull request #21 from davydden/pdlamch
Rename pdlamch to pdlamch10 to avoid symbol collision with Scalapack
2015-09-17 11:33:04 +02:00
Sylvestre Ledru afacb275c5 Revert "Simplify the test-dnsimp.sh script"
This reverts commit 82de5c6bed.
2015-09-17 11:13:56 +02:00
Sylvestre Ledru 34882f42c4 Merge pull request #19 from thrasibule/dlaqrb
* reverts using {d,s}lahqr from lapack 2
* use dlahqr from lapack 3 instead of dlaqrb (credit to Marco Caliari)
2015-09-17 11:05:42 +02:00
Sylvestre Ledru 82de5c6bed Simplify the test-dnsimp.sh script 2015-09-17 11:04:09 +02:00
Sylvestre Ledru f571587ddf Merge pull request #15 from rwirth/issue_14
execute the dnsimp test in the right directory
2015-09-17 11:02:47 +02:00
Denis Davydov 333a5e4f33 rename pdlamch to pdlamch10 to avoid symbol collision with Scalapack 2.0.2 where this function is different 2015-08-30 12:51:19 +02:00
Guillaume Horel 5b475d1c1c update CHANGES 2015-08-26 22:39:02 -04:00
Guillaume Horel 9568032129 remove source and update Makefile 2015-08-25 15:12:26 -04:00
Guillaume Horel 2268b7bf82 fix the parpack MPI routines 2015-08-25 15:11:05 -04:00
Guillaume Horel 04a138eb68 also fix the parpack BLACS routines 2015-08-25 15:11:05 -04:00
Guillaume Horel a29e13bd15 replace {s,d}laqrb with {s,d}lahqr 2015-08-25 15:11:05 -04:00
Guillaume Horel 93d6e45696 Revert "add note to explain the name change"
This reverts commit 793da95cb6.
2015-08-25 15:11:04 -04:00
Guillaume Horel c71a0fd5a7 Revert: force the use of the old {d,s}lahqr 2015-08-25 15:11:04 -04:00
Guillaume Horel b553f707d2 Revert "forgot some 2"
This reverts commit cbb0bf599d.
2015-08-25 15:11:04 -04:00
Roland Wirth 77028b5853 add test-dnsimp.sh to distribution 2015-06-23 14:15:25 +02:00
Roland Wirth 0a8dac28c4 execute the dnsimp test in the right directory
Fixes opencollab/arpack-ng#14
2015-06-22 11:48:10 +02:00
Sylvestre Ledru 5cd31c69d4 Merge pull request #9 from elezar/master
Address Visual Studio build for Issue #8.
2015-03-04 18:33:05 +01:00
Evan Lezar 513d2088c3 Address Visual Studio build for Issue #8.
Added two missing files to the visual studio project, and set the paths
to be consistent.
2015-03-04 18:22:45 +01:00
Sylvestre Ledru ca1acab481 Describe one of the change 2015-02-13 16:29:16 +01:00
Sylvestre Ledru 2d0900d503 Disable the execution of the MPI tests (fails for now) 2015-02-13 16:29:07 +01:00
Sylvestre Ledru e1fd52ac21 bump the version to 3.3.0 2015-01-30 09:06:23 +01:00
Sylvestre Ledru 18b8c25fee document the recent changes from Kyle 2015-01-30 08:41:55 +01:00
Sylvestre Ledru ddaa55d8b8 Merge pull request #5 from turboencabulator/automake-cleanup
General improvements on the build system
2015-01-30 08:38:26 +01:00
Kyle Guinn 0a8e936c7a Fix make distcheck
As a compromise for anyone who doesn't have MPI support but wants to run
`make distcheck`, only check PARPACK if --enable-mpi was given during
./configure.
2014-12-31 18:37:11 -06:00
Kyle Guinn 607877d0b2 Enable the PARPACK examples as tests 2014-12-31 18:28:55 -06:00
Kyle Guinn 36f8d20f0f Re-add PARPACK psndrv1 examples 2014-12-31 18:22:50 -06:00
Kyle Guinn 595618eebc Re-add the bug_1323 test 2014-12-31 18:22:50 -06:00
Kyle Guinn 872b44c592 Fix the order of LAPACK/BLAS libs
LAPACK may depend on BLAS, therefore -llapack needs to be given before
-lblas.
2014-12-31 18:22:50 -06:00
Kyle Guinn 8600fd13e4 Clean up EXTRA_DIST for the examples 2014-12-31 18:22:49 -06:00
Kyle Guinn 8a6d23a38f Simplify automake input files
Copy some description comments from the original makefiles.
2014-12-31 18:22:49 -06:00
Kyle Guinn ad373111a0 Fix several whitespace nitpicks 2014-12-31 18:15:44 -06:00
Kyle Guinn 60777efcad Link libparpack to libarpack
Avoids having a duplicate copy of libarpack inside of libparpack, thus
saving disk space.
2014-12-31 18:15:33 -06:00
Kyle Guinn a6395d059d Don't install the examples 2014-12-31 18:15:06 -06:00
Kyle Guinn 1f6cf9d86a Remove two unnecessary automake variables
Fixes the following autoreconf warnings:
EXAMPLES/BAND/Makefile.am:84: variable `snband_SOURCES' is defined but no program or
EXAMPLES/BAND/Makefile.am:84: library has `snband' as canonical name (possible typo)
EXAMPLES/BAND/Makefile.am:86: variable `snband_LDADD' is defined but no program or
EXAMPLES/BAND/Makefile.am:86: library has `snband' as canonical name (possible typo)
2014-12-31 18:15:02 -06:00
Kyle Guinn 209bc9967b Remove an extra trailing '/' 2014-12-31 18:14:56 -06:00
Kyle Guinn ff75ef2384 Improve the pkg-config file
Get the library name and URL from configure.ac.
Make the description an actual description.
Remove the empty Cflags.
2014-12-31 18:14:51 -06:00
Kyle Guinn fe9b38df33 Prevent overlinking to BLAS/LAPACK 2014-12-31 18:14:47 -06:00
Kyle Guinn c8dda4c1e7 Update ax_blas.m4 to serial 14
This adds support for OpenBLAS, among other things.
2014-12-31 18:14:38 -06:00
Kyle Guinn 23e4995054 Update .gitignore 2014-12-31 18:14:25 -06:00
Kyle Guinn 4eab7e3a60 Replace auto-generated files with a bootstrap script 2014-12-31 18:13:59 -06:00
Sylvestre Ledru 4e72fd240f update travis directives 2014-12-23 19:29:55 +01:00
Sylvestre Ledru ce36b0e26e disable useless travis directives 2014-12-23 19:23:36 +01:00
Sylvestre Ledru 7b8343c9af add a travis configuration file 2014-12-23 19:16:47 +01:00
Sylvestre Ledru 8fc8fbe349 remove trailing spaces + warnings 2014-11-14 15:47:06 +01:00
Sylvestre Ledru 393e0c85a7 Regenerate files 2014-11-14 15:36:50 +01:00
Sylvestre Ledru 671a410c8e fix presentation 2014-11-14 15:35:44 +01:00
Sylvestre Ledru b8c7fdb000 Merge pull request #2 from thrasibule/dlahqr2
Dlahqr2
2014-11-14 15:31:19 +01:00
Guillaume Horel 6b9c613db7 update CHANGES 2014-11-06 22:13:54 -05:00
Guillaume Horel 793da95cb6 add note to explain the name change 2014-11-06 22:11:19 -05:00
Guillaume Horel f1fe1b7427 regenerate configure and Makefile.in 2014-11-06 20:56:01 -05:00
Guillaume Horel 97fbcbf6aa Add tests for bug 1315
since they're written in C, need to add AC_PROG_CC to config.ac as well
2014-11-06 20:53:51 -05:00
Guillaume Horel cbb0bf599d forgot some 2 2014-09-14 18:40:16 -04:00
Guillaume Horel d783b264da force the use of the old {d,s}lahqr 2014-09-14 18:30:24 -04:00
Sylvestre Ledru ff8c6d325f Working on the 3.2.0 release 2014-06-03 18:08:38 +02:00
Sylvestre Ledru 0dee07b43c Fix the URL 2014-06-03 18:08:12 +02:00
Sylvestre Ledru 3ab47c9e81 Switch to github 2014-05-17 16:26:26 +02:00
Sylvestre Ledru 2e58090484 remove trailing spaces + update my email 2014-05-17 16:24:27 +02:00
Sylvestre Ledru 8a82ceaa0a Revert "Fix the diagonal matrice example (dndrv5). Thanks to Nikita Styopin for the fix. close ticket 1397"
My bad. I missunderstood the bug report

This reverts commit cdfee6183f.
2014-02-21 20:14:41 +01:00
Sylvestre Ledru ab45bdb757 Fix typo + date 2014-02-15 15:04:14 +01:00
Sylvestre Ledru 1371fd6bf8 * Build all examples and run them as tests 2014-02-15 15:00:55 +01:00
Sylvestre Ledru d3796928af Update of the changelog 2014-02-14 13:37:51 +01:00
Sylvestre Ledru cdfee6183f Fix the diagonal matrice example (dndrv5). Thanks to Nikita Styopin for the fix. close ticket 1397 2014-02-14 12:05:10 +01:00
Sylvestre Ledru f28b75cf5d * Fix the version of arpack-ng itself 2014-02-14 12:02:05 +01:00
Sylvestre Ledru b0693f6bcd * Switch to automake 1.14.1 2014-02-14 12:01:45 +01:00
Ruediger Meier e90e4f65c4 Do not install test binaries 2013-12-10 13:48:39 +01:00
Sylvestre Ledru 9fe0e320ee Fix the symlink 2013-11-13 10:05:43 +01:00
Édouard Canot 30ee9d7c3d * dsaupd and 'BE' option returns wrong eigenvalues for a SPD matrix
Thanks to Edouard Canot (Closes: #1329)
2013-11-06 11:59:11 +01:00
Sylvestre Ledru 616222b89b Ignore the tests results 2013-11-06 11:46:00 +01:00
Sylvestre Ledru 8446648c95 Add the 'make check' target and add a test for bug 1323 2013-11-06 11:44:58 +01:00
Édouard Canot ca8f3fc66c * dseupd routine may lead to a segmentation fault
Thanks to Edouard Canot (Closes: #1323)
2013-11-06 11:39:52 +01:00
Sylvestre Ledru aa5cc620ec replace the symlink by a copy 2013-10-14 11:13:33 +02:00
Ward Poelmans 9e319b3c1a Updated autoconf, automake and libtool scripts
Using autoreconf -i -f and more recent version of the autotools. This
should fix a problem with libtool not recognizing Intel MPI.
2013-10-14 11:03:25 +02:00
Sylvestre Ledru 29d8cbe63f Update of the release notes 2013-10-07 14:25:51 +02:00
Ward Poelmans c124f0c2fc Use configure supplied blas and lapack in the pkg-config
Use the blas and lapack library found by the configure script in the
pkg-config file instead of hardcoded libraries.
2013-10-07 14:23:14 +02:00
Sylvestre Ledru 0fea7c6990 update of the changelog 2013-08-29 10:54:15 +02:00
Pauli Virtanen 1ae47e63dd Fix issue #1259 in DSEUPD and SSEUPD
The Ritz vector purification step assumes workl(iq) still contains the
original Q matrix. This is however overwritten by the call to xGEQR2
earlier.

This patch fixes the issue by making a copy of the last row of the
eigenvector matrix, after it is recomputed after QR by xORM2R. The work
space WORKL(IW+NCV:IW+2*NCV) is not used later in the routine, and can
be used for this.

Thanks to Wimmer for tracing the issue.

--HG--
extra : amend_source : 3ba6513783201433d5f7b9b2d1bcbc08a0554007
2013-08-28 15:20:28 -04:00
Sylvestre Ledru 94200e60c0 automake 1.13.3 + new upstream autoconf 2013-08-06 15:16:53 +02:00
Sylvestre Ledru 343b151f12 Update of the changelog 2013-08-06 15:16:18 +02:00
Sylvestre Ledru 072f08e313 Missing the dependency on mpi from libparpack. See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718790 2013-08-06 15:14:46 +02:00
Jordi Gutiérrez Hermoso 8b60cd295c Replace LAPACK second function with ARPACK's own arscnd in PARPACK 2013-06-17 12:59:19 -04:00
Sylvestre Ledru c1264cfef0 Do not build but still ship the sources 2013-04-02 11:57:51 +02:00
Sylvestre Ledru 972038c699 Do not build the BLACS example (not sure BLACS has a long and prosper life + it is not managed in the configure 2013-04-02 11:55:01 +02:00
Sylvestre Ledru 0d0437a758 Rename the name of the library to match the MPI one 2013-04-02 11:54:18 +02:00
Sylvestre Ledru a6848a5c6c Compile libparpack before the examples 2013-04-02 11:36:23 +02:00
Sylvestre Ledru 2a3d8f7494 Remove the generated file 2013-04-02 11:35:58 +02:00
Sylvestre Ledru c555cdd10c Update of the changelog for the release 2013-04-02 10:54:54 +02:00
Sylvestre Ledru b437a82d17 Make sure all files are installed during the 'make dist' process 2013-04-02 10:48:46 +02:00
Sylvestre Ledru 7ff6566790 Also build libparpackblacssrc 2013-04-02 10:42:41 +02:00
Sylvestre Ledru 6243c08d44 Regenerate with same version of the autotools 2013-03-09 11:44:58 +01:00
Sylvestre Ledru 6365c9e931 Make sure that all arpack-ng is built
Prepare "make dist" (not finished yet)
2013-03-09 11:44:28 +01:00
Jordi Gutiérrez Hermoso d33ff2e405 Commit WIP towards ensuring that "make dist" works 2013-02-27 16:31:24 -05:00
Jordi Gutiérrez Hermoso 5c89955f38 restore auto-generated files 2013-01-09 17:14:55 -05:00
Jordi Gutiérrez Hermoso bf328ccd96 Document more 3.1.3 changes 2013-01-09 17:05:37 -05:00
Jordi Gutiérrez Hermoso 3d4e6942ea Add debug.h to sources in TESTS/Makefile.am 2013-01-09 17:04:16 -05:00
Jordi Gutiérrez Hermoso 5744ca1e18 Fix arpack.pc, turn it into arpack.pc.in
--HG--
rename : arpack.pc => arpack.pc.in
2013-01-09 16:23:09 -05:00
Jordi Gutiérrez Hermoso e2538f38f1 Update .gitignore and add .hgignore 2013-01-09 16:22:11 -05:00
Jordi Gutiérrez Hermoso 79526a1c62 Document 3.1.3 changes 2013-01-09 16:09:02 -05:00
Jordi Gutiérrez Hermoso d108516fd6 Version bump to 3.1.3 2013-01-09 15:32:00 -05:00
John W. Eaton b43a0eda6f Update libtool usage. Link with Fortran compiler.
* Makefile.am (libarpack_la_LDFLAGS): Use -no-undefined.
(nodist_EXTRA_libarpack_la_SOURCES): New variable.
(libarpack_la_LIBADD): Don't link with $(FLIBS).
* PARPACK/Makefile.am (libparpack_la_LDFLAGS): Use -no-undefined.
(nodist_EXTRA_libparpack_la_SOURCES): New variable.
(libparpack_la_LIBADD): Don't link with $(FLIBS) and $(MPILIBS).
* configure.ac: Use LT_INIT with win32-dll option instead of
AC_PROG_LIBTOOL.  Require libtool 2.2.2 or later.
2013-01-09 15:06:21 -05:00
Jordi Gutiérrez Hermoso 49887a41b0 Replace depcomp symlink with actual file 2013-01-09 15:44:23 -05:00
Jordi Gutiérrez Hermoso 7a25d0f10c Replace auto-generated files with bootstrap script 2013-01-09 15:43:13 -05:00
Sylvestre Ledru 576120a26c Description of the last changes 2012-08-02 11:36:39 +02:00
Umberto De Giovannini 168aaf5a3f Fixed division by zero in smlnum by usind p[d,s]lamch instead of the serial [d,s]lamch. I am not sure why but this fix all the issues (crash pcndrv1 and wrong numbers in pzndr1) with gfortran.. 2012-08-01 17:10:54 +02:00
Sylvestre Ledru b4b959850e * Configure detected built-in LAPACK and BLAS, but refused to use them
(Closes: #784)
2012-07-17 14:30:24 +02:00
Sylvestre Ledru 37120660f3 New version off automake 2012-07-12 03:53:09 -06:00
Sylvestre Ledru 30fca4c6c1 Update the git ignore list 2012-07-12 03:52:47 -06:00
Sylvestre Ledru 628e80b2ec * Compile also PARPACK / MPI example (Closes: #783) 2012-07-12 03:52:10 -06:00
Sylvestre Ledru 7834970e92 * Compile aussi PARPACK / MPI example (Closes: #783) 2012-07-11 23:23:58 -06:00
Sylvestre Ledru 1e814091ff * Get rid of the mpif.h occurences in the source code (Closes: #782) 2012-07-11 23:10:08 -06:00
Sylvestre Ledru b105070b63 Update of the changelog 2012-06-22 22:05:57 +02:00
Sylvestre Ledru 171f59a65a * Wrong call to pdlamch was causing segfaults
Thanks to Kyrre Sjøbæk for finding the bug and the fix.
2012-06-22 21:59:32 +02:00
Sylvestre Ledru 434a1a002a * Option --enable-maintainer-mode added to the configure
* --disable-mpi disables the build of parpack (Closes: #714)
   * Switch to automake 1.11.3
2012-05-21 09:24:05 +02:00
424 changed files with 23328 additions and 64303 deletions
+1
View File
@@ -0,0 +1 @@
BasedOnStyle: Google
+55 -9
View File
@@ -1,14 +1,62 @@
*.o
*.lo
Makefile
*.la
.libs/
SRC/.libs/
UTIL/.libs/
.hgignore
# Generated by `autoreconf`
Makefile.in
aclocal.m4
configure
autom4te.cache/
build-aux/
m4/libtool.m4
m4/lt*.m4
# Generated by `./configure`
Makefile
config.log
config.status
libtool
.deps/
arpack.pc
# Generated by `make`
*.o
*.mod
*.lo
*.la
.libs/
# CMake build directories
BUILD
Build
build
# Generated by `make check`
*.log
*.trs
TESTS/dnsimp
TESTS/bug_1315_double
TESTS/bug_1315_single
TESTS/bug_1323
TESTS/bug_58_double
TESTS/bug_79_double_complex
TESTS/icb_arpack_c
TESTS/icb_arpack_cpp
TESTS/bug_142
TESTS/bug_142_gen
EXAMPLES/BAND/[sd][sn]bdr[123456]
EXAMPLES/BAND/[cz]nbdr[1234]
EXAMPLES/COMPLEX/[cz]ndrv[1234]
EXAMPLES/NONSYM/[sd]ndrv[123456]
EXAMPLES/SIMPLE/[sd]ssimp
EXAMPLES/SIMPLE/[sdcz]nsimp
EXAMPLES/SVD/[sd]svd
EXAMPLES/SYM/[sd]sdrv[123456]
PARPACK/EXAMPLES/MPI/p[sd]ndrv[13]
PARPACK/EXAMPLES/MPI/p[sd]sdrv1
PARPACK/EXAMPLES/MPI/p[cz]ndrv1
PARPACK/TESTS/MPI/icb_parpack_c
PARPACK/TESTS/MPI/icb_parpack_cpp
PARPACK/TESTS/MPI/issue46
*.lib
*.def
*.dll
@@ -18,5 +66,3 @@ libtool
*.suo
VISUAL_STUDIO/Release MKL/
VISUAL_STUDIO/bin/
TESTS/dnsimp
+34
View File
@@ -0,0 +1,34 @@
syntax: glob
.gitignore
Makefile
*.o
*.lo
*.la
.libs/
SRC/.libs/
UTIL/.libs/
arpack.pc
autom4te.cache/
config.log
config.status
libtool
*.lib
*.def
*.dll
*.bak
*.exp
*.u2d
*.suo
VISUAL_STUDIO/Release MKL/
VISUAL_STUDIO/bin/
TESTS/dnsimp
PARPACK/EXAMPLES/MPI/pcndrv1
PARPACK/EXAMPLES/MPI/pdndrv1
PARPACK/EXAMPLES/MPI/pdndrv3
PARPACK/EXAMPLES/MPI/pdsdrv1
PARPACK/EXAMPLES/MPI/psndrv3
PARPACK/EXAMPLES/MPI/pssdrv1
PARPACK/EXAMPLES/MPI/pzndrv1
+32
View File
@@ -0,0 +1,32 @@
sudo: false
language: c
compiler:
- gcc
addons:
apt:
packages:
- gfortran
- gcc
- g++
- openmpi-bin
- libopenmpi-dev
- cmake
- automake
- autoconf
- libblas-dev
- liblapack-dev
jobs:
include:
- script: mkdir -p build && cd build && cmake -D EXAMPLES=ON -D MPI=OFF -D ICB=OFF .. && make VERBOSE=1 && make test;
- script: mkdir -p build && cd build && cmake -D EXAMPLES=ON -D MPI=ON -D ICB=OFF .. && make VERBOSE=1 && make test;
- script: mkdir -p build && cd build && cmake -D EXAMPLES=ON -D MPI=OFF -D ICB=ON .. && make VERBOSE=1 && make test;
- script: mkdir -p build && cd build && cmake -D EXAMPLES=ON -D MPI=ON -D ICB=ON .. && make VERBOSE=1 && make test;
- script: mkdir -p build && cd build && cmake -D EXAMPLES=ON -D MPI=ON -D ICB=ON -DCOVERALLS=ON .. && make VERBOSE=1 && make test;
- script: ./bootstrap && ./configure && make VERBOSE=1 && make check && make distcheck;
- script: ./bootstrap && ./configure --enable-mpi && make VERBOSE=1 && make check && make distcheck;
- script: ./bootstrap && ./configure --enable-icb && make VERBOSE=1 && make check && make distcheck;
- script: ./bootstrap && ./configure --enable-mpi --enable-icb && make VERBOSE=1 && make check && make distcheck;
+216 -4
View File
@@ -1,12 +1,224 @@
arpack-ng - 3.6.3
[ Franck Houssen ]
* Add Fortran common initialization (block data).
[ Marco Caliari ]
* Give up forcing the initial residual to be in the range of the operator OP after a restart (Closes: #142).
-- Sylvestre Ledru <sylvestre@debian.org> Wed, 19 Sep 2018 09:59:59 +0200
arpack-ng - 3.6.2
* Remove all trailing whitespaces
[ Franck Houssen ]
* Install: move headers into a dedicated directory (local/include/arpack).
(Closes #126)
* Add configuration summary.
* Improve the flag detection. Hopefully fix the ppc64el and other archs
issues in Debian
-- Sylvestre Ledru <sylvestre@debian.org> Sat, 23 Jun 2018 14:56:54 +0200
arpack-ng - 3.6.1
[ Ruslan Kabatsayev ]
* Fix a regression on i386 and other archs (Closes #123)
-- Sylvestre Ledru <sylvestre@debian.org> Thu Jun 7 21:41:16 2018 +0200
arpack-ng - 3.6.0
[ Franck Houssen ]
* Add support for ISO_C_BINDING (Fortran 2003) for ARPACK, PARPACK (Fortran <-> C/C++).
ARPACK: example of C/Fortran binding can be found in the TESTS/icb_arpack_c.c file.
ARPACK: example of C++/Fortran binding can be found in the TESTS/icb_arpack_cpp.cpp file.
PARPACK: example of C/Fortran binding can be found in the PARPACK/TESTS/MPI/icb_parpack_c.c file.
PARPACK: example of C++/Fortran binding can be found in the PARPACK/TESTS/MPI/icb_parpack_cpp.cpp file.
DEBUG: add support for debug.
STAT: add support for statistics (timers, nb operations, ...).
* Provide tarball generation using cmake (cpack).
* Provide find_package for (cmake) users to find arpack-ng.
[ Denis Davydov ]
* Rename pslamch to pslamch10 to avoid symbol collision with Scalapack 2.0.2 in MPI context.
[ Kyle Guinn ]
* Autoconf cleanup; move generated files to the build-aux subdirectory.
[ Marco Caliari ]
* Force the initial residual to be in the range of the operator OP in the standard case, too (Closes: #79).
[ Sylvestre Ledru ]
* Add coverage information to improve testing: https://coveralls.io/github/opencollab/arpack-ng
[ Darcy Beurle]
* Add C++11 interface through arpack.hpp and parpack.hpp
* Rewrite C++ examples / tests demonstrating new C++11 interface
* Pre-C++11 interface available through arpack.h and parpack.h
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 30 Oct 2017 14:21:48 +0200
arpack-ng - 3.5.0
[ Julien Schueller ]
* Improve cmake build system: disable C++ detection, set default build type.
[ Marco Atzeri]
* Use AC_PROG_FC instead of AC_PROG_F77 for proper inizialization
for the usage of AC_FC_LINE_LENGTH. Noted on Cygwin.
[ Denis Davydov ]
* Improve cmake build system: add make install and fix shared libraries.
[ Zhang Z ]
* fix usages of DLACPY to not alias inputs
(patch from https://software.intel.com/en-us/articles/how-to-resolve-arpack-issues-with-intel-mkl-110-update-3)
[ Iskakov Sergei ]
* Fix possible deadlock when PARPACK call uses communicator with a larger
number of CPUs than previous call
[ Kyle Guinn ]
* Portability improvements to the autotools build system.
* Let cmake guess the default installation directories. Can be
overridden by changing CMAKE_INSTALL_LIBDIR and CMAKE_INSTALL_BINDIR.
* Shared libraries built by cmake now have their SONAME set identical to
those built by autotools.
[ Marco Caliari ]
* Avoid purification stage in [d,s]neupd.f if it requires division
by zero (Closes: #58)
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 15 May 2017 14:21:48 +0200
arpack-ng - 3.4.0
[ Milan Bouchet-Valat ]
* Allow adding suffixes to symbols and library names to build ILP64 version
based on ILP64 BLAS/LAPACK with suffixes. This avoids conflicts when loading
libraries with different integer sizes in the same program.
[ Martin Reuter ]
* Add the support of cmake build system
-- Sylvestre Ledru <sylvestre@debian.org> Sat, 02 Jul 2016 21:51:52 +0200
arpack-ng - 3.3.0
[ Denis Davydov ]
* Rename pdlamch to pdlamch10 to avoid symbol collision with Scalapack 2.0.2 in MPI context.
[ Kyle Guinn ]
* General improvements on the build system
* libparpack links against libarpack (instead of doing a static link)
[ Guillaume Horel ]
* reverts using {d,s}lahqr from lapack 2
* use dlahqr from lapack 3 instead of dlaqrb (credit to Marco Caliari)
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 12 October 2015 08:40:51 +0200
arpack-ng - 3.2.0
* Switch to github - https://github.com/opencollab/arpack-ng/
* Fix dsneupd select/calculate wrong eigenpairs if rvec = true
by using dlahqr and slahqr from lapack2 (Closes: #3)
-- Sylvestre Ledru <sylvestre@debian.org> Sat, 14 Nov 2014 16:25:36 +0200
arpack-ng - 3.1.5
* Build all examples and run them as tests
* Fix the version of arpack-ng itself
* Switch to automake 1.14.1
[ Ruediger Meier ]
* Do not install test binaries (Closes: #1348)
[ Nikita Styopin ]
* Fix the diagonal matrix example (dndrv5) (Closes: #1397)
-- Sylvestre Ledru <sylvestre@debian.org> Sat, 15 Feb 2014 14:24:42 +0200
arpack-ng - 3.1.4
* libparpack2: missing dependency on MPI:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=718790
* Replace LAPACK second function with ARPACK's own arscnd in PARPACK
* Fix issue #1259 in DSEUPD and SSEUPD
The Ritz vector purification step assumes workl(iq) still contains the
original Q matrix. This is however overwritten by the call to xGEQR2
earlier.
.
This patch fixes the issue by making a copy of the last row of the
eigenvector matrix, after it is recomputed after QR by xORM2R. The work
space WORKL(IW+NCV:IW+2*NCV) is not used later in the routine, and can
be used for this.
* Use configure supplied blas and lapack in the pkg-config.
Thanks to Ward Poelmans (Closes: #1320)
* Switch to automake 1.14 + libtool 2.4.2.
Thanks to Ward Poelmans (Closes: #1321)
* dseupd routine may lead to a segmentation fault
Thanks to Edouard Canot (Closes: #1323)
* dsaupd and 'BE' option returns wrong eigenvalues for a SPD matrix
Thanks to Edouard Canot (Closes: #1329)
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Mon, 07 Oct 2013 14:24:42 +0200
arpack-ng - 3.1.3
[ Jordi Gutiérrez Hermoso ]
* Replace depcomp symlink with actual file.
* Update libtool usage. Thanks to John W. Eaton <jwe@octave.org>.
* Replace arpack.pc with proper autotooled arpack.pc.in
* Add debug.h to TESTS/Makefile.am sources
* "make dist" is functionnal
* Also build the library "libparpacksrcblacs" (PARPACK/UTIL/BLACS/)
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Tue, 02 Apr 2013 10:53:08 +0200
arpack-ng - 3.1.2
* Wrong call to pdlamch was causing segfaults
Thanks to Kyrre Sjøbæk for finding the bug and the fix.
* Get rid of the mpif.h occurrences in the source code (Closes: #782)
* Compile also PARPACK / MPI example (Closes: #783)
* Configure detected built-in LAPACK and BLAS, but refused to use them
(Closes: #784)
* Fixed division by zero in smlnum by usind p[d,s]lamch instead of the
serial. Thanks to Umberto De Giovannini.
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Fri, 22 Jun 2012 22:05:41 +0200
arpack-ng - 3.1.1
* Option --enable-maintainer-mode added to the configure
* --disable-mpi disables the build of parpack (Closes: #714)
* Switch to automake 1.11.3
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Mon, 21 May 2012 09:08:41 +0200
arpack-ng - 3.1.0
* Many bug fixes in the parpack lib. It is an old patch from upstream.
Thanks to Viral Shah for pinging us on this subject.
See the PARPACK_CHANGES file for the details.
* Change the bug report from arpack@caam.rice.edu to
* Change the bug report from arpack@caam.rice.edu to
http://forge.scilab.org/index.php/p/arpack-ng/issues/
* Provide a M4 macro (detect_arpack_bug.m4) to check if the underlying
arpack is buggy (ie not arpack-ng). This allows developper applications
arpack is buggy (ie not arpack-ng). This allows developer applications
to perform the check in their autotools build system (configure).
* Fixed a lack of appropriate bounds check in DNAUP2. Thanks to Pauli Virtanen
for the patch (Closes: #632)
@@ -45,8 +257,8 @@ arpack-ng - 3.0
second_NONE works with all fortrans compilers (used by default with Scilab)
sneupd.f, cneupd.f: modified for scilab add a check on nconv value (Scilab bug fix)
dnaupd.f: modified NEV Integer: INPUT/OUTPUT before only INPUT (Scilab bug fix)
dnaupd.f: modified NEV Integer: INPUT/OUTPUT before only INPUT (Scilab bug fix)
* Patches from Octave: (Thanks to John W. EATON)
dneupd.f: Restore value of nconv
dseupd.f: Restore value of nconv
+648
View File
@@ -0,0 +1,648 @@
cmake_minimum_required(VERSION 2.8.6)
if (NOT DEFINED CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
endif ()
project(arpack C Fortran)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
# Adopted from https://github.com/feymark/arpack.git
if (POLICY CMP0042)
# enable MACOSX_RPATH by default
cmake_policy (SET CMP0042 NEW)
endif ()
option(MPI "Enable parallel support" OFF)
option(ICB "Enable support for *[ae]upd_c with ISO_C_BINDING" OFF)
#option(SYSTEM_BLAS "Use system BLAS" ON)
#option(SYSTEM_LAPACK "Use system LAPACK" ON)
option(EXAMPLES "Compile ARPACK examples" OFF)
set(LIBSUFFIX ""
CACHE STRING "suffix to add to ARPACK libraries names")
set(SYMBOLSUFFIX ""
CACHE STRING "suffix to add to ARPACK, BLAS and LAPACK function names")
option(INTERFACE64 "use the 64-bit integer interface (ILP64) for ARPACK, BLAS and LAPACK")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
if (COVERALLS)
include(Coveralls)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage")
set(EXTRA_LDLAGS "${EXTRA_LDLAGS}-lgcov")
endif()
function(prefixlist list_name prefix)
set(${list_name}_TMP)
foreach(l ${${list_name}})
list(APPEND ${list_name}_TMP ${prefix}${l} )
endforeach()
set(${list_name} "${${list_name}_TMP}" PARENT_SCOPE)
endfunction(prefixlist)
function(examples list_name)
foreach(l ${${list_name}})
get_filename_component(lwe ${l} NAME_WE)
add_executable(${lwe} ${arpackexample_DIR}/${l} ${examples_EXTRA_SRCS})
target_link_libraries(${lwe} arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_test(NAME "${lwe}_ex" COMMAND ${lwe} WORKING_DIRECTORY ${arpackexample_DIR})
endforeach()
endfunction(examples)
function(pexamples list_name)
foreach(l ${${list_name}})
get_filename_component(lwe ${l} NAME_WE)
add_executable(${lwe} ${parpackexample_DIR}/${l} )
target_link_libraries(${lwe} parpack arpack ${MPI_Fortran_LIBRARIES})
endforeach()
endfunction(pexamples)
# Enable language(s) before any find_package (in particular before MPI find_package).
if (ICB)
enable_language(C CXX) # For testing binding with c/c++.
set(CMAKE_CXX_STANDARD 11) # OK, since cmake-3.1 only.
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/PROG_ICB.f90
"
PROGRAM PROG_ICB
USE iso_c_binding
IMPLICIT NONE
INTEGER(C_INT) :: a
a = 1
END PROGRAM PROG_ICB
")
try_compile(COMPILE_ICB ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/PROG_ICB.f90)
if(NOT ${COMPILE_ICB})
message(FATAL_ERROR "-- Fortran compiler does not support iso_c_binding.")
else()
message("-- Fortran compiler does support iso_c_binding.")
endif()
else()
# ICB saves you from old-fashion-boring-cumbersome-fortran/C crap...
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp -ffixed-line-length-none")
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -extend-source")
else ()
message(WARNING "build script does not know how to enable your Fortran compiler's preprocessor and support for lines longer than 72 characters: set them manually via FFLAGS.")
endif ()
set(SCALARFUNS naitr napps naup2 naupd nconv neigh neupd ngets statn saitr sapps saup2 saupd sconv seigt seupd sgets stats getv0 sortc sortr sesrt stqrb)
set(COMPLEXFUNS, naitr napps naup2 naupd neigh neupd ngets statn getv0 sortc)
set(BLASFUNS1 axpy copy gemv geqr2 lacpy lae2 lahqr lanhs larnv lartg lascl laset lasrt scal trevc trmm trsen gbmv gbtrf gbtrs gttrf gttrs pttrf pttrs)
set(BLASFUNS2 dot ger labad laev2 lamch lanst lanv2 lapy2 larf larfg lasr nrm2 orm2r rot steqr swap)
set(BLASFUNS3 dotc geru unm2r)
set(BLASFUNS4 COPY LABAD LAMCH LANHS LANV2 LARFG ROT GEMV)
set(BLASFUNS5 scnrm2 dznrm2 csscal zdscal)
if (SYMBOLSUFFIX)
foreach (f IN LISTS SCALARFUNS BLASFUNS1 BLASFUNS2)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Ds${f}=s${f}${SYMBOLSUFFIX} -Dd${f}=d${f}${SYMBOLSUFFIX}")
endforeach ()
foreach (f IN LISTS COMPLEXFUNS BLASFUNS1 BLASFUNS3)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Dc${f}=c${f}${SYMBOLSUFFIX} -Dz${f}=z${f}${SYMBOLSUFFIX}")
endforeach ()
foreach (f IN LISTS BLASFUNS4)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -DS${f}=S${f}${SYMBOLSUFFIX} -DD${f}=D${f}${SYMBOLSUFFIX}")
endforeach ()
foreach (f IN LISTS BLASFUNS5)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -D${f}=${f}${SYMBOLSUFFIX}")
endforeach ()
endif ()
set(CFUNS sgemm snaupd sneupd dnaupd dneupd cheev)
foreach (f IN LISTS CFUNS)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D${f}=${f}${SYMBOLSUFFIX}")
list(APPEND CFUNS_SUFFIXED ${f}${SYMBOLSUFFIX})
endforeach ()
include(FortranCInterface)
FortranCInterface_HEADER(FCMangle.h SYMBOLS ${CFUNS_SUFFIXED})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DINCLUDE_FCMANGLE")
FortranCInterface_VERIFY()
endif ()
#if (SYSTEM_BLAS)
find_package(BLAS REQUIRED)
#endif()
#if (BLAS_LIBRARIES)
# set(SYSTEM_BLAS ON)
#endif()
if (MPI)
include(FindMPI)
find_package(MPI REQUIRED)
include_directories(${MPI_Fortran_INCLUDE_PATH})
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAG}")
if(ICB)
include_directories(${MPI_C_INCLUDE_PATH})
include_directories(${MPI_CXX_INCLUDE_PATH})
check_symbol_exists(MPI_Comm_c2f "${MPI_C_INCLUDE_PATH}/mpi.h" MPI_Comm_c2f_FOUND)
if(NOT ${MPI_Comm_c2f_FOUND})
message(FATAL_ERROR "symbol MPI_Comm_c2f does not exist")
endif()
endif()
endif()
#if (SYSTEM_LAPACK)
find_package(LAPACK REQUIRED)
#endif()
#if (BLAS_LIBRARIES)
# set(SYSTEM_LAPACK ON)
#endif()
if (MPI)
set(parpackutil_DIR ${arpack_SOURCE_DIR}/PARPACK/UTIL/)
set(parpacksrc_DIR ${arpack_SOURCE_DIR}/PARPACK/SRC/)
endif()
#if (NOT SYSTEM_BLAS)
# file(GLOB arpackblas_STAT_SRCS blas/*.f)
#endif()
#if (NOT SYSTEM_LAPACK)
# file(GLOB arpacklapack_STAT_SRCS lapack/*.f)
#endif()
#file(GLOB arpackutil_STAT_SRCS util/*.f)
file(GLOB arpacksrc_STAT_SRCS dbgini.f staini.f ${arpack_SOURCE_DIR}/SRC/*.f)
set(arpacksrc_ICB "")
set(parpacksrc_ICB "")
if(ICB)
file(GLOB arpacksrc_ICB SRC/icba*.f90 debug_icb.f90 stat_icb.f90)
file(GLOB parpacksrc_ICB PARPACK/SRC/MPI/icbp*.f90 debug_icb.f90 stat_icb.f90)
endif()
set(arpackutil_STAT_SRCS
${arpack_SOURCE_DIR}/UTIL/icnteq.f
${arpack_SOURCE_DIR}/UTIL/icopy.f
${arpack_SOURCE_DIR}/UTIL/iset.f
${arpack_SOURCE_DIR}/UTIL/iswap.f
${arpack_SOURCE_DIR}/UTIL/ivout.f
${arpack_SOURCE_DIR}/UTIL/second_NONE.f
${arpack_SOURCE_DIR}/UTIL/svout.f
${arpack_SOURCE_DIR}/UTIL/smout.f
${arpack_SOURCE_DIR}/UTIL/dvout.f
${arpack_SOURCE_DIR}/UTIL/dmout.f
${arpack_SOURCE_DIR}/UTIL/cvout.f
${arpack_SOURCE_DIR}/UTIL/cmout.f
${arpack_SOURCE_DIR}/UTIL/zvout.f
${arpack_SOURCE_DIR}/UTIL/zmout.f )
if (MPI)
file(GLOB parpackutil_STAT_SRCS PARPACK/UTIL/MPI/*.f)
file(GLOB parpacksrc_STAT_SRCS dbgini.f staini.f PARPACK/SRC/MPI/*.f)
endif()
# use -DBUILD_SHARED_LIBS=ON|OFF to control static/shared
add_library(arpack ${arpackutil_STAT_SRCS} ${arpacksrc_STAT_SRCS} ${arpacksrc_ICB})
if(ICB)
install(FILES arpack.h DESTINATION include/arpack)
install(FILES arpack.hpp DESTINATION include/arpack)
if (MPI)
install(FILES parpack.h DESTINATION include/arpack)
install(FILES parpack.hpp DESTINATION include/arpack)
endif()
endif()
install(FILES debug.h DESTINATION include/arpack)
if(ICB)
install(FILES debug_c.h DESTINATION include/arpack)
install(FILES debug_c.hpp DESTINATION include/arpack)
endif()
install(FILES stat.h DESTINATION include/arpack)
if(ICB)
install(FILES stat_c.h DESTINATION include/arpack)
install(FILES stat_c.hpp DESTINATION include/arpack)
endif()
target_link_libraries(arpack ${BLAS_LIBRARIES})
target_link_libraries(arpack ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
set_target_properties(arpack PROPERTIES OUTPUT_NAME arpack${LIBSUFFIX})
set_target_properties(arpack PROPERTIES VERSION 2.0.0)
set_target_properties(arpack PROPERTIES SOVERSION 2)
if (MPI)
# use -DBUILD_SHARED_LIBS=ON|OFF to control static/shared
add_library(parpack ${parpacksrc_STAT_SRCS} ${parpackutil_STAT_SRCS} ${parpacksrc_ICB})
if (ICB)
target_include_directories(parpack PUBLIC ${MPI_C_INCLUDE_DIRS})
target_include_directories(parpack PUBLIC ${MPI_CXX_INCLUDE_DIRS})
target_link_libraries(parpack ${MPI_C_LIBRARIES})
target_link_libraries(parpack ${MPI_CXX_LIBRARIES})
endif()
target_include_directories(parpack PUBLIC ${MPI_Fortran_INCLUDE_DIRS})
target_link_libraries(parpack ${MPI_Fortran_LIBRARIES})
target_link_libraries(parpack arpack)
set_target_properties(parpack PROPERTIES OUTPUT_NAME parpack${LIBSUFFIX})
set_target_properties(parpack PROPERTIES VERSION 2.0.0)
set_target_properties(parpack PROPERTIES SOVERSION 2)
endif ()
if (INTERFACE64)
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-integer-8")
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -i8")
else ()
message(WARNING "build script does not know how to make your Fortran compiler use 64-bit integers: set it manually via FFLAGS.")
endif ()
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DBLASINT=int64_t")
endif ()
set(CMAKE_INCLUDE_CURRENT_DIR ON)
############################
# EXAMPLES
############################
if (EXAMPLES)
############################
# EXAMPLES/BAND
############################
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/BAND/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Examples/band/)
set(examples_EXTRA_SRCS ${arpackexample_DIR}/cnband.f)
set(examples_STAT_SRCS
cnbdr1.f
cnbdr2.f
cnbdr3.f
cnbdr4.f)
examples(examples_STAT_SRCS)
set(examples_EXTRA_SRCS ${arpackexample_DIR}/dnband.f)
set(examples_STAT_SRCS
dnbdr1.f
dnbdr2.f
dnbdr3.f
dnbdr4.f
dnbdr5.f
dnbdr6.f)
examples(examples_STAT_SRCS)
set(examples_EXTRA_SRCS ${arpackexample_DIR}/dsband.f)
set(examples_STAT_SRCS
dsbdr1.f
dsbdr2.f
dsbdr3.f
dsbdr4.f
dsbdr5.f
dsbdr6.f)
examples(examples_STAT_SRCS)
set(examples_EXTRA_SRCS ${arpackexample_DIR}/snband.f)
set(examples_STAT_SRCS
snbdr1.f
snbdr2.f
snbdr3.f
snbdr4.f
snbdr5.f
snbdr6.f)
examples(examples_STAT_SRCS)
set(examples_EXTRA_SRCS ${arpackexample_DIR}/ssband.f)
set(examples_STAT_SRCS
ssbdr1.f
ssbdr2.f
ssbdr3.f
ssbdr4.f
ssbdr5.f
ssbdr6.f)
examples(examples_STAT_SRCS)
set(examples_EXTRA_SRCS ${arpackexample_DIR}/znband.f)
set(examples_STAT_SRCS
znbdr1.f
znbdr2.f
znbdr3.f
znbdr4.f)
examples(examples_STAT_SRCS)
set(examples_EXTRA_SRCS)
############################
# EXAMPLES/COMPLEX
############################
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/COMPLEX/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Examples/complex/)
set(examples_STAT_SRCS
cndrv1.f
cndrv2.f
cndrv3.f
cndrv4.f
zndrv1.f
zndrv2.f
zndrv3.f
zndrv4.f)
examples(examples_STAT_SRCS)
############################
# examples/nonsym
############################
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/NONSYM/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Examples/nonsym/)
set(examples_STAT_SRCS
dndrv1.f
dndrv2.f
dndrv3.f
dndrv4.f
dndrv5.f
dndrv6.f
sndrv1.f
sndrv2.f
sndrv3.f
sndrv4.f
sndrv5.f
sndrv6.f)
examples(examples_STAT_SRCS)
############################
# examples/SIMPLE
############################
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/SIMPLE/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Examples/simple/)
set(examples_STAT_SRCS
cnsimp.f
dnsimp.f
dssimp.f
snsimp.f
sssimp.f
znsimp.f)
examples(examples_STAT_SRCS)
############################
# examples/svd
############################
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/SVD/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Examples/svd/)
set(examples_STAT_SRCS
ssvd.f)
examples(examples_STAT_SRCS)
############################
# examples/sym
############################
set(arpackexample_DIR ${arpack_SOURCE_DIR}/EXAMPLES/SYM/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Examples/sym/)
set(examples_STAT_SRCS
dsdrv1.f
dsdrv2.f
dsdrv3.f
dsdrv4.f
dsdrv5.f
dsdrv6.f
ssdrv1.f
ssdrv2.f
ssdrv3.f
ssdrv4.f
ssdrv5.f
ssdrv6.f)
examples(examples_STAT_SRCS)
############################
# parpack/examples
############################
if (MPI)
set(parpackexample_DIR ${arpack_SOURCE_DIR}/PARPACK/EXAMPLES/MPI/)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Examples/parpack)
set(pexamples_STAT_SRCS
pcndrv1.f
pdndrv1.f
pdndrv3.f
pdsdrv1.f
psndrv1.f
psndrv3.f
pssdrv1.f
pzndrv1.f)
pexamples(pexamples_STAT_SRCS)
endif()
endif()
############################
# TEST
############################
enable_testing()
set(CMAKE_CTEST_COMMAND ctest -V)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/Tests)
add_executable(dnsimp_test TESTS/dnsimp.f TESTS/mmio.f TESTS/debug.h)
set_target_properties( dnsimp_test PROPERTIES OUTPUT_NAME dnsimp )
target_link_libraries(dnsimp_test arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_custom_command(TARGET dnsimp_test POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/TESTS/testA.mtx testA.mtx
)
add_test(dnsimp_tst Tests/dnsimp)
if (NOT ICB)
add_executable(bug_1315_single TESTS/bug_1315_single.c)
target_link_libraries(bug_1315_single arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_test(bug_1315_single_tst Tests/bug_1315_single)
add_executable(bug_1315_double TESTS/bug_1315_double.c)
target_link_libraries(bug_1315_double arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_test(bug_1315_double_tst Tests/bug_1315_double)
endif()
add_executable(bug_1323 TESTS/bug_1323.f)
target_link_libraries(bug_1323 arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_test(bug_1323_tst Tests/bug_1323)
add_executable(bug_58_double TESTS/bug_58_double.f)
target_link_libraries(bug_58_double arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_test(bug_58_double_tst Tests/bug_58_double)
add_executable(bug_79_double_complex TESTS/bug_79_double_complex.f)
target_link_libraries(bug_79_double_complex arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_test(bug_79_double_complex_tst Tests/bug_79_double_complex)
add_executable(bug_142 TESTS/bug_142.f)
target_link_libraries(bug_142 arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_test(bug_142_tst Tests/bug_142)
add_executable(bug_142_gen TESTS/bug_142_gen.f)
target_link_libraries(bug_142_gen arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_test(bug_142_gen_tst Tests/bug_142_gen)
if(MPI)
add_executable(issue46 PARPACK/TESTS/MPI/issue46.f)
target_link_libraries(issue46 parpack arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_test(issue46_tst Tests/issue46)
endif()
if(ICB)
add_executable(icb_arpack_c TESTS/icb_arpack_c.c)
target_include_directories(icb_arpack_c PUBLIC ${PROJECT_SOURCE_DIR}) # Get arpack.h
target_link_libraries(icb_arpack_c arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_test(icb_arpack_c_tst Tests/icb_arpack_c)
add_executable(icb_arpack_cpp TESTS/icb_arpack_cpp.cpp)
target_include_directories(icb_arpack_cpp PUBLIC ${PROJECT_SOURCE_DIR}) # Get arpack.hpp
target_link_libraries(icb_arpack_cpp arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS})
add_test(icb_arpack_cpp_tst Tests/icb_arpack_cpp)
if (MPI)
add_executable(icb_parpack_c PARPACK/TESTS/MPI/icb_parpack_c.c)
target_include_directories(icb_parpack_c PUBLIC ${PROJECT_SOURCE_DIR} ${MPI_C_INCLUDE_DIRS}) # Get parpack.h mpi.h
target_link_libraries(icb_parpack_c parpack arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS} ${MPI_C_LIBRARIES})
add_test(icb_parpack_c_tst mpirun -n 2 Tests/icb_parpack_c)
add_executable(icb_parpack_cpp PARPACK/TESTS/MPI/icb_parpack_cpp.cpp)
target_include_directories(icb_parpack_cpp PUBLIC ${PROJECT_SOURCE_DIR} ${MPI_CXX_INCLUDE_DIRS}) # Get parpack.hpp mpi.h
target_link_libraries(icb_parpack_cpp parpack arpack ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES} ${EXTRA_LDLAGS} ${MPI_CXX_LIBRARIES})
add_test(icb_parpack_cpp_tst mpirun -n 2 Tests/icb_parpack_cpp)
endif()
endif()
############################
# install
############################
# 'make install' to the correct location
include(GNUInstallDirs)
# Convert variable names to those expected by the .pc file.
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix \${prefix})
set(libdir \${exec_prefix}/${CMAKE_INSTALL_LIBDIR})
set(PACKAGE_NAME ${PROJECT_NAME})
# TODO: Fill these in with something appropriate.
#set(PACKAGE_VERSION)
#set(PACKAGE_URL)
#set(LAPACK_LIBS)
#set(BLAS_LIBS)
configure_file(arpack.pc.in arpack${LIBSUFFIX}.pc @ONLY)
#install(FILES ${CMAKE_CURRENT_BINARY_DIR}/arpack${LIBSUFFIX}.pc
# DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(TARGETS arpack
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
if (MPI)
install(TARGETS parpack
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif ()
# Provide find_package for arpack-ng to users.
configure_file(arpack-ng-config.cmake.in "${PROJECT_BINARY_DIR}/arpack-ng-config.cmake" @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/arpack-ng-config.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake") # find_package(arpack-ng)
set(arpack_ng_MAJOR_VERSION 3)
set(arpack_ng_MINOR_VERSION 6)
set(arpack_ng_PATCH_VERSION 0)
set(arpack_ng_VERSION ${arpack_ng_MAJOR_VERSION}.${arpack_ng_MINOR_VERSION}.${arpack_ng_PATCH_VERSION})
configure_file(arpack-ng-config-version.cmake.in "${PROJECT_BINARY_DIR}/arpack-ng-config-version.cmake" @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/arpack-ng-config-version.cmake" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/cmake")
# Packaging: ease arpack-ng distribution (precompiled binaries and sources tarballs).
set(CPACK_VERSION_MAJOR "${arpack_ng_MAJOR_VERSION}")
set(CPACK_VERSION_MINOR "${arpack_ng_MINOR_VERSION}")
set(CPACK_VERSION_PATCH "${arpack_ng_PATCH_VERSION}")
set(CPACK_SOURCE_IGNORE_FILES "/BUILD/" "/Build/" "/build/" "/local/") # Do not ship (eventual) build or install directories in tarballs.
set(CPACK_SOURCE_PACKAGE_FILE_NAME "arpack-ng-${CPACK_VERSION_MAJOR}.${CPACK_VERSION_MINOR}.${CPACK_VERSION_PATCH}")
include(CPack)
# We don't want this to run on every build.
option(COVERALLS "Generate coveralls data" OFF)
if (COVERALLS)
set(COVERAGE_SRCS awesome.c code.c files.c)
# Create the coveralls target.
coveralls_setup(
"${arpackutil_STAT_SRCS} ${arpacksrc_STAT_SRCS} ${arpacksrc_ICB}" # The source files.
ON # If we should upload.
"${PROJECT_SOURCE_DIR}/cmake/") # (Optional) Alternate project cmake module path.
endif()
function(libsummary title include libraries)
message(" -- ${title}:")
foreach(inc ${include})
message(" -- compile: ${inc}")
endforeach()
foreach(lib ${libraries})
message(" -- link: ${lib}")
endforeach()
endfunction(libsummary)
function(cprsummary title compiler debug_flags minsizerel_flags release_flags relwithdebinfo_flags more_flags)
message(" -- ${title}: ${compiler}")
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug" OR "${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG")
message(" -- ${title}FLAGS: ${debug_flags} ${more_flags}")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "MinSizeRel" OR "${CMAKE_BUILD_TYPE}" STREQUAL "MINSIZEREL")
message(" -- ${title}FLAGS: ${minsizerel_flags} ${more_flags}")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RELEASE")
message(" -- ${title}FLAGS: ${release_flags} ${more_flags}")
endif()
if("${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RELWITHDEBINFO")
message(" -- ${title}FLAGS: ${relwithdebinfo_flags} ${more_flags}")
endif()
endfunction(cprsummary)
message("-- Configuration summary for arpack-ng-${arpack_ng_VERSION}:")
message(" -- prefix: ${CMAKE_INSTALL_PREFIX}")
message(" -- MPI: ${MPI}")
message(" -- ICB: ${ICB}")
cprsummary("FC" "${CMAKE_Fortran_COMPILER}"
"${CMAKE_Fortran_FLAGS_DEBUG}"
"${CMAKE_Fortran_FLAGS_MINSIZEREL}"
"${CMAKE_Fortran_FLAGS_RELEASE}"
"${CMAKE_Fortran_FLAGS_RELWITHDEBINFO}"
"${CMAKE_Fortran_FLAGS}")
if (ICB)
cprsummary("CC" "${CMAKE_C_COMPILER}"
"${CMAKE_C_FLAGS_DEBUG}"
"${CMAKE_C_FLAGS_MINSIZEREL}"
"${CMAKE_C_FLAGS_RELEASE}"
"${CMAKE_C_FLAGS_RELWITHDEBINFO}"
"${CMAKE_C_FLAGS}")
cprsummary("CXX" "${CMAKE_CXX_COMPILER}"
"${CMAKE_CXX_FLAGS_DEBUG}"
"${CMAKE_CXX_FLAGS_MINSIZEREL}"
"${CMAKE_CXX_FLAGS_RELEASE}"
"${CMAKE_CXX_FLAGS_RELWITHDEBINFO}"
"${CMAKE_CXX_FLAGS}")
endif()
if (MPI)
libsummary("MPIFC" "${MPI_Fortran_INCLUDE_PATH}" "${MPI_Fortran_LIBRARIES}")
if (ICB)
libsummary("MPICC" "${MPI_C_INCLUDE_PATH}" "${MPI_C_LIBRARIES}")
libsummary("MPICXX" "${MPI_CXX_INCLUDE_PATH}" "${MPI_CXX_LIBRARIES}")
endif()
endif()
libsummary("BLAS" "" "${BLAS_LIBRARIES}")
libsummary("LAPACK" "" "${LAPACK_LIBRARIES}")
+9 -10
View File
@@ -3,7 +3,7 @@ BSD Software License
Pertains to ARPACK and P_ARPACK
Copyright (c) 1996-2008 Rice University.
Copyright (c) 1996-2008 Rice University.
Developed by D.C. Sorensen, R.B. Lehoucq, C. Yang, and K. Maschhoff.
All rights reserved.
@@ -21,26 +21,25 @@ modification, are permitted provided that the following conditions are
met:
- Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer listed
in this license in the documentation and/or other materials
provided with the distribution.
- Neither the name of the copyright holders nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+2 -2
View File
@@ -219,7 +219,7 @@ c %---------------------------------%
of the Hessenberg matrix and their the corresponding
error bounds, KEV, NP.
mnapps > 0: *Print information about where deflation occured.
mnapps > 0: *Print information about where deflation occurred.
mnapps > 1: *Print sigmak, betak, order of the final Hessenberg matrix,
and the final compressed upper Hessenberg matrix.
mnapps > 2: *Print implicit application of shift number, real and imaginary
@@ -303,7 +303,7 @@ c %---------------------------------%
of the Hessenberg matrix and their the corresponding
error bounds, KEV, NP.
mcapps > 0: *Print information about where deflation occured.
mcapps > 0: *Print information about where deflation occurred.
mcapps > 1: *Print sigmak, betak, order of the final Hessenberg matrix,
and the final compressed upper Hessenberg matrix.
mcapps > 2: *Print implicit application of shift number, the shift.
+58
View File
@@ -0,0 +1,58 @@
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
SSBDR = ssbdr1 ssbdr2 ssbdr3 ssbdr4 ssbdr5 ssbdr6
DSBDR = dsbdr1 dsbdr2 dsbdr3 dsbdr4 dsbdr5 dsbdr6
SNBDR = snbdr1 snbdr2 snbdr3 snbdr4 snbdr5 snbdr6
DNBDR = dnbdr1 dnbdr2 dnbdr3 dnbdr4 dnbdr5 dnbdr6
CNBDR = cnbdr1 cnbdr2 cnbdr3 cnbdr4
ZNBDR = znbdr1 znbdr2 znbdr3 znbdr4
BAND = $(SSBDR) $(DSBDR) $(SNBDR) $(DNBDR) $(CNBDR) $(ZNBDR)
check_PROGRAMS = $(BAND)
TESTS = $(check_PROGRAMS)
EXTRA_DIST = README
# Simple symmetric problem using BAND solver (single precision)
ssbdr1_SOURCES = ssbdr1.f ssband.f
ssbdr2_SOURCES = ssbdr2.f ssband.f
ssbdr3_SOURCES = ssbdr3.f ssband.f
ssbdr4_SOURCES = ssbdr4.f ssband.f
ssbdr5_SOURCES = ssbdr5.f ssband.f
ssbdr6_SOURCES = ssbdr6.f ssband.f
# Simple symmetric problem using BAND solver (double precision)
dsbdr1_SOURCES = dsbdr1.f dsband.f
dsbdr2_SOURCES = dsbdr2.f dsband.f
dsbdr3_SOURCES = dsbdr3.f dsband.f
dsbdr4_SOURCES = dsbdr4.f dsband.f
dsbdr5_SOURCES = dsbdr5.f dsband.f
dsbdr6_SOURCES = dsbdr6.f dsband.f
# Simple nonsymmetric problem using BAND solver (single precision)
snbdr1_SOURCES = snbdr1.f snband.f
snbdr2_SOURCES = snbdr2.f snband.f
snbdr3_SOURCES = snbdr3.f snband.f
snbdr4_SOURCES = snbdr4.f snband.f
snbdr5_SOURCES = snbdr5.f snband.f
snbdr6_SOURCES = snbdr6.f snband.f
# Simple nonsymmetric problem using BAND solver (double precision)
dnbdr1_SOURCES = dnbdr1.f dnband.f
dnbdr2_SOURCES = dnbdr2.f dnband.f
dnbdr3_SOURCES = dnbdr3.f dnband.f
dnbdr4_SOURCES = dnbdr4.f dnband.f
dnbdr5_SOURCES = dnbdr5.f dnband.f
dnbdr6_SOURCES = dnbdr6.f dnband.f
# Complex problem using BAND solver (single precision complex)
cnbdr1_SOURCES = cnbdr1.f cnband.f
cnbdr2_SOURCES = cnbdr2.f cnband.f
cnbdr3_SOURCES = cnbdr3.f cnband.f
cnbdr4_SOURCES = cnbdr4.f cnband.f
# Complex problem using BAND solver (double precision complex)
znbdr1_SOURCES = znbdr1.f znband.f
znbdr2_SOURCES = znbdr2.f znband.f
znbdr3_SOURCES = znbdr3.f znband.f
znbdr4_SOURCES = znbdr4.f znband.f
+97 -97
View File
@@ -3,27 +3,27 @@ c
c \Name: cnband
c
c \Description:
c This subroutine returns the converged approximations to eigenvalues
c of A*z = lambda*B*z and (optionally):
c
c (1) The corresponding approximate eigenvectors;
c
c (2) An orthonormal basis for the associated approximate
c invariant subspace;
c
c (3) Both.
c This subroutine returns the converged approximations to eigenvalues
c of A*z = lambda*B*z and (optionally):
c
c (1) The corresponding approximate eigenvectors;
c
c (2) An orthonormal basis for the associated approximate
c invariant subspace;
c
c (3) Both.
c
c Matrices A and B are stored in LAPACK-style banded form.
c
c There is negligible additional cost to obtain eigenvectors. An orthonormal
c There is negligible additional cost to obtain eigenvectors. An orthonormal
c basis is always computed. There is an additional storage cost of n*nev
c if both are requested (in this case a separate array Z must be supplied).
c if both are requested (in this case a separate array Z must be supplied).
c
c The approximate eigenvalues and eigenvectors of A*z = lambda*B*z
c are commonly called Ritz values and Ritz vectors respectively. They are
c referred to as such in the comments that follow. The computed orthonormal
c basis for the invariant subspace corresponding to these Ritz values is
c referred to as a Schur basis.
c are commonly called Ritz values and Ritz vectors respectively. They are
c referred to as such in the comments that follow. The computed orthonormal
c basis for the invariant subspace corresponding to these Ritz values is
c referred to as a Schur basis.
c
c cnband can be called with one of the following modes:
c
@@ -41,14 +41,14 @@ c Choice of different modes can be specified in IPARAM(7) defined below.
c
c \Usage
c call cnband
c ( RVEC, HOWMNY, SELECT, D , Z, LDZ, SIGMA, WORKEV, N, AB,
c MB, LDA, FAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV,
c ( RVEC, HOWMNY, SELECT, D , Z, LDZ, SIGMA, WORKEV, N, AB,
c MB, LDA, FAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV,
c V, LDV, IPARAM, WORKD, WORKL, LWORKL, RWORK, IWORK, INFO )
c
c \Arguments
c RVEC LOGICAL (INPUT)
c RVEC LOGICAL (INPUT)
c Specifies whether a basis for the invariant subspace corresponding
c to the converged Ritz value approximations for the eigenproblem
c to the converged Ritz value approximations for the eigenproblem
c A*z = lambda*B*z is computed.
c
c RVEC = .FALSE. Compute Ritz values only.
@@ -56,8 +56,8 @@ c
c RVEC = .TRUE. Compute Ritz vectors or Schur vectors.
c See Remarks below.
c
c HOWMNY Character*1 (INPUT)
c Specifies the form of the invariant subspace to be computed
c HOWMNY Character*1 (INPUT)
c Specifies the form of the invariant subspace to be computed
c corresponding to the converged Ritz values.
c = 'A': Compute NEV Ritz vectors;
c = 'P': Compute NEV Schur vectors;
@@ -67,7 +67,7 @@ c
c SELECT Logical array of dimension NCV. (INPUT)
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
c computed. To select the real Ritz vector corresponding to a
c Ritz value D(j), SELECT(j) must be set to .TRUE..
c Ritz value D(j), SELECT(j) must be set to .TRUE..
c If HOWMNY = 'A' or 'P', SELECT need not be initialized
c but it is used as internal workspace.
c
@@ -76,16 +76,16 @@ c On exit, D contains the Ritz approximations
c to the eigenvalues lambda for A*z = lambda*B*z.
c
c Z Complex N by NEV array (OUTPUT)
c On exit, if RVEC = .TRUE. and HOWMNY = 'A', then the columns of
c Z represents approximate eigenvectors (Ritz vectors) corresponding
c On exit, if RVEC = .TRUE. and HOWMNY = 'A', then the columns of
c Z represents approximate eigenvectors (Ritz vectors) corresponding
c to the NCONV=IPARAM(5) Ritz values for eigensystem
c A*z = lambda*B*z.
c
c If RVEC = .FALSE. or HOWMNY = 'P', then Z is NOT REFERENCED.
c
c NOTE: If if RVEC = .TRUE. and a Schur basis is not required,
c the array Z may be set equal to first NEV columns of the
c array V.
c NOTE: If if RVEC = .TRUE. and a Schur basis is not required,
c the array Z may be set equal to first NEV columns of the
c array V.
c
c LDZ Integer. (INPUT)
c The leading dimension of the array Z. If Ritz vectors are
@@ -97,7 +97,7 @@ c If IPARAM(7) = 3 then SIGMA represents the shift.
c Not referenced if IPARAM(7) = 1 or 2.
c
c WORKEV Complex work array of dimension NCV. (WORKSPACE)
c
c
c N Integer. (INPUT)
c Dimension of the eigenproblem.
c
@@ -110,7 +110,7 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
c
c MB Complex array of dimension LDA by N. (INPUT)
c The matrix M in band storage, in rows KL+1 to
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c The j-th column of M is stored in the j-th column of the
c array MB as follows:
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
@@ -134,7 +134,7 @@ c
c WHICH Character*2. (INPUT)
c When mode 1,2 are used, WHICH can be set to any one of
c the following.
c
c
c 'LM' -> want the NEV eigenvalues of largest magnitude.
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
c 'LR' -> want the NEV eigenvalues of largest real part.
@@ -142,8 +142,8 @@ c 'SR' -> want the NEV eigenvalues of smallest real part.
c 'LI' -> want the NEV eigenvalues of largest imaginary part.
c 'SI' -> want the NEV eigenvalues of smallest imaginary part.
c
c When mode 3 is used, WHICH should be set to 'LM' only.
c
c When mode 3 is used, WHICH should be set to 'LM' only.
c
c BMAT Character*1. (INPUT)
c BMAT specifies the type of the matrix B that defines the
c semi-inner product for the operator OP.
@@ -152,13 +152,13 @@ c BMAT = 'G' -> generalized eigenvalue problem A*x = lambda*M*x
c NEV Integer. (INPUT)
c Number of eigenvalues of to be computed.
c
c
c TOL Real scalar. (INPUT)
c Stopping criteria: the relative accuracy of the Ritz value
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I))
c where ABS(RITZ(I)) is the magnitude when RITZ(I) is complex.
c DEFAULT = slamch('EPS') (machine precision as computed
c by the LAPACK auxilliary subroutine slamch).
c by the LAPACK auxiliary subroutine slamch).
c
c RESID Complex array of length N. (INPUT/OUTPUT)
c On INPUT:
@@ -171,12 +171,12 @@ c
c NCV Integer. (INPUT)
c Number of columns of the matrix V. NCV must satisfy the two
c inequalities 2 <= NCV-NEV and NCV <= N.
c This will indicate how many Arnoldi vectors are generated
c at each iteration. After the startup phase in which NEV
c Arnoldi vectors are generated, the algorithm generates
c approximately NCV-NEV Arnoldi vectors at each subsequent update
c iteration. Most of the cost in generating each Arnoldi vector is
c in the matrix-vector operation OP*x.
c This will indicate how many Arnoldi vectors are generated
c at each iteration. After the startup phase in which NEV
c Arnoldi vectors are generated, the algorithm generates
c approximately NCV-NEV Arnoldi vectors at each subsequent update
c iteration. Most of the cost in generating each Arnoldi vector is
c in the matrix-vector operation OP*x.
c
c V Complex array N by NCV. (OUTPUT)
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
@@ -184,8 +184,8 @@ c contain approximate Schur vectors that span the
c desired invariant subspace.
c
c NOTE: If the array Z has been set equal to first NEV+1 columns
c of the array V and RVEC=.TRUE. and HOWMNY= 'A', then
c the first NCONV=IPARAM(5) columns of V will contain Ritz vectors
c of the array V and RVEC=.TRUE. and HOWMNY= 'A', then
c the first NCONV=IPARAM(5) columns of V will contain Ritz vectors
c of the eigensystem A*z = lambda*B*z.
c
c LDV Integer. (INPUT)
@@ -193,7 +193,7 @@ c Leading dimension of V exactly as declared in the calling
c program. LDV must be great than or equal to N.
c
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
c IPARAM(1) = ISHIFT:
c IPARAM(1) = ISHIFT:
c The shifts selected at each iteration are used to restart
c the Arnoldi iteration in an implicit fashion.
c It is set to 1 in this subroutine. The user do not need
@@ -223,12 +223,12 @@ c Not referenced. Implicit restarting is ALWAYS used.
c
c IPARAM(7) = MODE
c On INPUT determines what type of eigenproblem is being solved.
c Must be 1,2 or 3; See under \Description of cnband for the
c Must be 1,2 or 3; See under \Description of cnband for the
c three modes available.
c
c WORKD Complex work array of length at least 3*n. (WORKSPACE)
c
c WORKL Complex work array of length LWORKL. (WORKSPACE)
c WORKL Complex work array of length LWORKL. (WORKSPACE)
c
c LWORKL Integer. (INPUT)
c LWORKL must be at least 3*NCV**2 + 5*NCV.
@@ -237,9 +237,9 @@ c RWORK Real array of length N (WORKSPACE)
c Workspace used in cnaupd.
c
c IWORK Integer array of dimension at least N. (WORKSPACE)
c Used to mode 2,3. Store the pivot information in the
c Used to mode 2,3. Store the pivot information in the
c factorization of M or (A-SIGMA*M).
c
c
c INFO Integer. (INPUT/OUTPUT)
c Error flag on output.
c = 0: Normal exit.
@@ -300,21 +300,21 @@ c
c-----------------------------------------------------------------------
c
subroutine cnband(rvec, howmny, select, d , z, ldz, sigma,
& workev, n, ab, mb, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workev, n, ab, mb, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, rwork, iwork, info )
c
c %------------------%
c | Scalar Arguments |
c %------------------%
c
c
Character which*2, bmat, howmny
Logical rvec
Integer n, lda, kl, ku, nev, ncv, ldv,
& ldz, lworkl, info
Complex
& sigma
Real
& ldz, lworkl, info
Complex
& sigma
Real
& tol
c
c %-----------------%
@@ -323,11 +323,11 @@ c %-----------------%
c
Integer iparam(*), iwork(*)
Logical select(*)
Complex
Complex
& d(*), resid(*), v(ldv,*), z(ldz,*),
& ab(lda,*), mb(lda,*), fac(lda,*),
& ab(lda,*), mb(lda,*), fac(lda,*),
& workd(*), workl(*), workev(*)
Real
Real
& rwork(*)
c
c %--------------%
@@ -346,7 +346,7 @@ c %------------%
c | Parameters |
c %------------%
c
Complex
Complex
& one, zero
parameter (one = (1.0E+0, 0.0E+0) ,
& zero = (0.0E+0, 0.0E+0) )
@@ -355,14 +355,14 @@ c %-----------------------------%
c | LAPACK & BLAS routines used |
c %-----------------------------%
c
Real
Real
& scnrm2
external ccopy, cgbmv, cgbtrf, cgbtrs, scnrm2, clacpy
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
c
c
mode = iparam(7)
c
c %------------------------%
@@ -398,9 +398,9 @@ c | to factor M. |
c %-----------------------------------------------%
c
call clacpy ('A', ibot, n, mb, lda, fac, lda )
call cgbtrf(n, n, kl, ku, fac, lda, iwork, ierr)
call cgbtrf(n, n, kl, ku, fac, lda, iwork, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*,'_band: error in _gbtrf'
print*, ' '
go to 9000
@@ -426,7 +426,7 @@ c | Construct (A - sigma*M) |
c %---------------------------%
c
do 30 j = 1,n
do 20 i = itop, ibot
do 20 i = itop, ibot
fac(i,j) = ab(i,j) - sigma*mb(i,j)
20 continue
30 continue
@@ -451,7 +451,7 @@ c %--------------------------------------------%
c | M A I N L O O P (reverse communication) |
c %--------------------------------------------%
c
40 continue
40 continue
c
call cnaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
@@ -466,8 +466,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( mode .eq. 2 ) then
@@ -476,11 +476,11 @@ c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c %-----------------------------------%
c
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
@@ -493,21 +493,21 @@ c
c
c %-----------------------------------------%
c | Perform y <-- OP*x |
c | = inv[A-SIGMA*M]*M* x
c | = inv[A-SIGMA*M]*M* x
c | to force the starting vector into the |
c | range of OP. |
c %-----------------------------------------%
c
call cgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call cgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*, '_band: error in _gbtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -521,8 +521,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( mode .eq. 2 ) then
@@ -531,16 +531,16 @@ c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c %-----------------------------------%
c
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call cgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
& iwork, workd(ipntr(2)), ldv, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, '_band: error in sbgtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -563,19 +563,19 @@ c
end if
c
else
c
c
c %--------------------------------------%
c | Perform y <-- inv(A-sigma*M)*(M*x). |
c | (M*x) has been computed and stored |
c | in workd(ipntr(3)). |
c | in workd(ipntr(3)). |
c %--------------------------------------%
c
call ccopy(n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
call cgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_band: error in _gbtrs.'
print*, '_band: error in _gbtrs.'
print*, ' '
go to 9000
end if
@@ -590,14 +590,14 @@ c %--------------------%
c | Perform y <-- M*x |
c %--------------------%
c
call cgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call cgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else
else
c
c %-------------------------------------------%
c | Either we have convergence, or there is |
c | Either we have convergence, or there is |
c | error. |
c %-------------------------------------------%
c
@@ -613,7 +613,7 @@ c
print *, ' Check the documentation of _naupd '
print *, ' '
c
else
else
c
call cneupd (rvec, howmny , select, d, z, ldz, sigma,
& workev, bmat, n, which, nev, tol,
@@ -621,17 +621,17 @@ c
& workl, lworkl, rwork, info)
c
if ( info .ne. 0) then
c
c
c %------------------------------------%
c | Check the documentation of cneupd. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd = ', info
print *, ' Check the documentation of _neupd '
print *, ' '
c
endif
print *, ' '
c
endif
c
end if
c
@@ -643,7 +643,7 @@ c %----------------------------------------%
c | L O O P B A C K to call cnaupd again. |
c %----------------------------------------%
c
go to 40
go to 40
c
9000 continue
c
+39 -39
View File
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -64,12 +64,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Complex
Complex
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workev(2*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv), ax(maxn)
Real
Real
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -81,28 +81,28 @@ c
& n, nx, lo, isub, isup, idiag, maxitr, mode,
& nconv
logical rvec
Real
Real
& tol
Complex
Complex
& rho, h, h2, sigma
c
c
c %------------%
c | Parameters |
c %------------%
c
Complex
Complex
& one, zero, two
parameter ( one = (1.0E+0, 0.0E+0) ,
& zero = (0.0E+0, 0.0E+0) ,
parameter ( one = (1.0E+0, 0.0E+0) ,
& zero = (0.0E+0, 0.0E+0) ,
& two = (2.0E+0, 0.0E+0) )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& scnrm2, slapy2
external scnrm2, cgbmv, caxpy, slapy2, claset
external scnrm2, cgbmv, caxpy, slapy2, claset
c
c %-----------------------%
c | Executable Statements |
@@ -112,7 +112,7 @@ c %-------------------------------------------------%
c | The number NX is the number of interior points |
c | in the discretization of the 2-dimensional |
c | convection-diffusion operator on the unit |
c | square with zero Dirichlet boundary condition. |
c | square with zero Dirichlet boundary condition. |
c | The number N(=NX*NX) is the dimension of the |
c | matrix. A standard eigenvalue problem is |
c | solved (BMAT = 'I'). NEV is the number of |
@@ -123,13 +123,13 @@ c | the spectrum. However, the following |
c | conditions must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR1: N is greater than MAXN '
go to 9000
@@ -154,7 +154,7 @@ c | Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
tol = 0.0
info = 0
c
c %---------------------------------------------------%
@@ -168,7 +168,7 @@ c
maxitr = 300
mode = 1
c
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %----------------------------------------%
@@ -190,10 +190,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -203,13 +203,13 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = (4.0E+0, 0.0E+0) / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
rho = (1.0E+2, 0.0E+0)
c
rho = (1.0E+2, 0.0E+0)
isup = kl+ku
isub = kl+ku+2
do 50 i = 1, nx
@@ -217,8 +217,8 @@ c
do 40 j = lo+1, lo+nx-1
a(isup,j+1) = -one/h2 + rho/two/h
a(isub,j) = -one/h2 - rho/two/h
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -232,8 +232,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %-----------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -241,11 +241,11 @@ c | and eigenvectors. Eigenvalues are returned in |
c | the one dimensional array D. Eigenvectors |
c | are returned in the first NCONV (=IPARAM(5)) |
c | columns of V. |
c %-----------------------------------------------%
c %-----------------------------------------------%
c
rvec = .true.
rvec = .true.
call cnband(rvec, 'A', select, d, v, ldv, sigma,
& workev, n, a, m, lda, fac, kl, ku, which,
& workev, n, a, m, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, rwork, iwork, info)
c
@@ -294,11 +294,11 @@ c
rd(j,2) = aimag(d(j))
rd(j,3) = scnrm2(n, ax, 1)
rd(j,3) = rd(j,3) / slapy2(rd(j,1),rd(j,2))
90 continue
90 continue
call smout(6, nconv, 3, rd, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -309,8 +309,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+37 -37
View File
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -64,12 +64,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Complex
Complex
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workev(2*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv), ax(maxn)
Real
Real
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -81,18 +81,18 @@ c
& n, nxi, lo, isub, isup, idiag, maxitr, mode,
& nconv
logical rvec
Real
Real
& tol
Complex
Complex
& rho, h, h2, sigma
c
c
c %------------%
c | Parameters |
c %------------%
c
Complex
Complex
& one, zero, two
parameter (one = (1.0E+0, 0.0E+0) ,
parameter (one = (1.0E+0, 0.0E+0) ,
& zero = (0.0E+0, 0.0E+0) ,
& two = (2.0E+0, 0.0E+0) )
c
@@ -100,7 +100,7 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& scnrm2, slapy2
external scnrm2, cgbmv, caxpy, slapy2, claset
c
@@ -112,7 +112,7 @@ c %-------------------------------------------------%
c | The number NX is the number of interior points |
c | in the discretization of the 2-dimensional |
c | convection-diffusion operator on the unit |
c | square with zero Dirichlet boundary condition. |
c | square with zero Dirichlet boundary condition. |
c | The number N(=NX*NX) is the dimension of the |
c | matrix. A standard eigenvalue problem is |
c | solved (BMAT = 'I'). NEV is the number of |
@@ -122,16 +122,16 @@ c | is used, WHICH is set to 'LM'. The user can |
c | modify NX, NEV and NCV to solve problems of |
c | different sizes, and to get different parts the |
c | spectrum. However, the following conditions |
c | must be satisfied: |
c | must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
nxi = 10
nxi = 10
n = nxi*nxi
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR2: N is greater than MAXN '
go to 9000
@@ -157,7 +157,7 @@ c | Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
tol = 0.0
info = 0
c
c %---------------------------------------------------%
@@ -193,10 +193,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nxi
ku = nxi
kl = nxi
ku = nxi
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -206,13 +206,13 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = (4.0E+0, 0.0E+0) / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
rho = (1.0E+2, 0.0E+0)
c
rho = (1.0E+2, 0.0E+0)
isup = kl+ku
isub = kl+ku+2
do 50 i = 1, nxi
@@ -220,8 +220,8 @@ c
do 40 j = lo+1, lo+nxi-1
a(isup,j+1) = -one/h2 + rho/two/h
a(isub,j) = -one/h2 - rho/two/h
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -235,8 +235,8 @@ c
do 70 j = lo+1, lo+nxi
a(isup,nxi+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %-----------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -244,11 +244,11 @@ c | and eigenvectors. Eigenvalues are returned in |
c | the one dimensional array D. Eigenvectors |
c | are returned in the first NCONV (=IPARAM(5)) |
c | columns of V. |
c %-----------------------------------------------%
c %-----------------------------------------------%
c
rvec = .true.
rvec = .true.
call cnband(rvec, 'A', select, d, v, ldv, sigma,
& workev, n, a, m, lda, fac, kl, ku, which,
& workev, n, a, m, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, rwork, iwork, info)
c
@@ -297,11 +297,11 @@ c
rd(j,2) = aimag(d(j))
rd(j,3) = scnrm2(n, ax, 1)
rd(j,3) = rd(j,3) / slapy2(rd(j,1),rd(j,2))
90 continue
90 continue
call smout(6, nconv, 3, rd, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -312,8 +312,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+33 -33
View File
@@ -1,9 +1,9 @@
program cnbdr3
c
c ... Construct matrices A and M in LAPACK-style band form.
c Matrices A and M are derived from the finite
c element discretization of the 1-dimensional
c convection-diffusion operator
c Matrices A and M are derived from the finite
c element discretization of the 1-dimensional
c convection-diffusion operator
c (d^2u/dx^2) + rho*(du/dx)
c on the interval [0,1] with zero boundary condition using
c piecewise linear elements.
@@ -51,13 +51,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn)
c
c %--------------%
@@ -66,12 +66,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Complex
Complex
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workev(2*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv), ax(maxn), mx(maxn)
Real
Real
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -83,16 +83,16 @@ c
& n, idiag, isup, isub, maxitr,
& mode, nconv
logical rvec
Real
Real
& tol
Complex
Complex
& rho, h, sigma
c
c
c %------------%
c | Parameters |
c %------------%
c
Complex
Complex
& one, zero, two
parameter (one = (1.0E+0, 0.0E+0) ,
& zero = (0.0E+0, 0.0E+0) ,
@@ -102,9 +102,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& scnrm2, slapy2
external scnrm2, cgbmv, caxpy, slapy2, claset
external scnrm2, cgbmv, caxpy, slapy2, claset
c
c %-----------------------%
c | Executable Statements |
@@ -129,8 +129,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR3: N is greater than MAXN '
go to 9000
@@ -146,13 +146,13 @@ c
sigma = zero
c
c %----------------------------------------------------%
c | The work array WORKL is used in CNAUPD as |
c | The work array WORKL is used in CNAUPD as |
c | workspace. Its dimension LWORKL has to be set as |
c | illustrated below. The parameter TOL determines |
c | the stopping criterion. If TOL<=0, machine machine |
c | precision is used. Setting INFO=0 indicates that |
c | using a randomly generated vector to start the |
c | the ARNOLDI process. |
c | the ARNOLDI process. |
c %----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
@@ -195,7 +195,7 @@ c
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -203,23 +203,23 @@ c
c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = (2.0E+0, 0.0E+0) / h
m(idiag,j) = (4.0E+0, 0.0E+0) * h
30 continue
c
a(idiag,j) = (2.0E+0, 0.0E+0) / h
m(idiag,j) = (4.0E+0, 0.0E+0) * h
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
rho = (1.0E+1, 0.0E+0)
rho = (1.0E+1, 0.0E+0)
do 40 j = 1, n-1
a(isup,j+1) = -one/h + rho/two
a(isub,j) = -one/h - rho/two
m(isup,j+1) = one*h
m(isub,j) = one*h
40 continue
40 continue
c
c %-----------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -229,7 +229,7 @@ c | are returned in the first NCONV (=IPARAM(5)) |
c | columns of V. |
c %-----------------------------------------------%
c
rvec = .true.
rvec = .true.
call cnband(rvec, 'A', select, d, v, ldv, sigma,
& workev, n, a, m, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
@@ -277,24 +277,24 @@ c
rd(j,1) = real (d(j))
rd(j,2) = aimag(d(j))
rd(j,3) = scnrm2(n, ax, 1)
rd(j,3) = rd(j,3) / slapy2(rd(j,1), rd(j,2))
50 continue
rd(j,3) = rd(j,3) / slapy2(rd(j,1), rd(j,2))
50 continue
call smout(6, nconv, 3, rd, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
c | is error. Check the documentation |
c | for cnband. |
c | for cnband. |
c %-------------------------------------%
c
print *, ' '
print *, ' Error with _band, info= ', info
print *, ' Check the documentation of _band '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+28 -28
View File
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn)
c
c %--------------%
@@ -64,12 +64,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Complex
Complex
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workev(2*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv), ax(maxn), mx(maxn)
Real
Real
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -81,16 +81,16 @@ c
& n, idiag, isup, isub, maxitr, mode,
& nconv
logical rvec
Real
Real
& tol
Complex
Complex
& rho, h, sigma
c
c
c %------------%
c | Parameters |
c %------------%
c
Complex
Complex
& one, zero, two, four, six
parameter (one = (1.0E+0, 0.0E+0) ,
& zero = (0.0E+0, 0.0E+0) ,
@@ -102,7 +102,7 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& scnrm2, slapy2
external scnrm2, cgbmv, caxpy, slapy2, claset
c
@@ -121,7 +121,7 @@ c | solved (BMAT = 'G'). NEV is the number of |
c | eigenvalues (closest to the shift SIGMA) to be |
c | approximated. Since the shift and invert mode |
c | is used, WHICH is set to 'LM'. The user can |
c | modify NX, NEV and NCV to solve problems of |
c | modify NX, NEV and NCV to solve problems of |
c | different sizes, and to get different parts the |
c | spectrum. However, the following conditions |
c | must be satisfied: |
@@ -131,8 +131,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR4: N is greater than MAXN '
go to 9000
@@ -145,16 +145,16 @@ c
end if
bmat = 'G'
which = 'LM'
sigma = (1.0E+1, 0.0E+0)
sigma = (1.0E+1, 0.0E+0)
c
c %----------------------------------------------------%
c | The work array WORKL is used in CNAUPD as |
c | The work array WORKL is used in CNAUPD as |
c | workspace. Its dimension LWORKL has to be set as |
c | illustrated below. The parameter TOL determines |
c | the stopping criterion. If TOL<=0, machine machine |
c | precision is used. Setting INFO=0 indicates that |
c | we using a randomly generated vector to start the |
c | the ARNOLDI process. |
c | the ARNOLDI process. |
c %----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
@@ -197,30 +197,30 @@ c
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
h = one / cmplx(n+1)
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = two / h
a(idiag,j) = two / h
m(idiag,j) = four * h / six
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
rho = (1.0E+1, 0.0E+0)
rho = (1.0E+1, 0.0E+0)
do 40 j = 1, n-1
a(isup,j+1) = -one/h + rho/two
a(isub,j) = -one/h - rho/two
m(isup,j+1) = one*h / six
m(isub,j) = one*h / six
40 continue
40 continue
c
c %-----------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -230,7 +230,7 @@ c | are returned in the first NCONV (=IPARAM(5)) |
c | columns of V. |
c %-----------------------------------------------%
c
rvec = .true.
rvec = .true.
call cnband(rvec, 'A', select, d, v, ldv, sigma,
& workev, n, a, m, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
@@ -279,11 +279,11 @@ c
rd(j,2) = aimag(d(j))
rd(j,3) = scnrm2(n, ax, 1)
rd(j,3) = rd(j,3) / slapy2(rd(j,1), rd(j,2))
90 continue
90 continue
call smout(6, nconv, 3, rd, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -294,8 +294,8 @@ c
print *, ' '
print *, ' Error with _band, info= ', info
print *, ' Check the documentation of _band '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+201 -201
View File
@@ -35,18 +35,18 @@ c Mode 2: A*z = lambda*M*z, M symmetric positive definite
c ===> OP = inv[M]*A and B = M.
c
c Mode 3: A*z = lambda*M*z, M symmetric semi-definite
c ===> OP = Real_Part{ inv[A - sigma*M]*M } and B = M.
c ===> OP = Real_Part{ inv[A - sigma*M]*M } and B = M.
c ===> shift-and-invert mode (in real arithmetic)
c If OP*z = amu*z, then
c If OP*z = amu*z, then
c amu = 1/2 * [ 1/(lambda-sigma) + 1/(lambda-conjg(sigma)) ].
c Note: If sigma is real, i.e. imaginary part of sigma is zero;
c Real_Part{ inv[A - sigma*M]*M } == inv[A - sigma*M]*M
c amu == 1/(lambda-sigma).
c
c Real_Part{ inv[A - sigma*M]*M } == inv[A - sigma*M]*M
c amu == 1/(lambda-sigma).
c
c Mode 4: A*z = lambda*M*z, M symmetric semi-definite
c ===> OP = Imaginary_Part{ inv[A - sigma*M]*M } and B = M.
c ===> OP = Imaginary_Part{ inv[A - sigma*M]*M } and B = M.
c ===> shift-and-invert mode (in real arithmetic)
c If OP*z = amu*z, then
c If OP*z = amu*z, then
c amu = 1/2i * [ 1/(lambda-sigma) - 1/(lambda-conjg(sigma)) ].
c
c
@@ -54,28 +54,28 @@ c The choice of mode must be specified in IPARAM(7) defined below.
c
c \Usage
c call dnband
c ( RVEC, HOWMNY, SELECT, DR, DI, Z, LDZ, SIGMAR, SIGMAI,
c WORKEV, V, N, AB, MB, LDA, RFAC, CFAC, KL, KU, WHICH,
c BMAT, NEV, TOL, RESID, NCV, V, LDV, IPARAM, WORKD,
c ( RVEC, HOWMNY, SELECT, DR, DI, Z, LDZ, SIGMAR, SIGMAI,
c WORKEV, V, N, AB, MB, LDA, RFAC, CFAC, KL, KU, WHICH,
c BMAT, NEV, TOL, RESID, NCV, V, LDV, IPARAM, WORKD,
c WORKL, LWORKL, WORKC, IWORK, INFO )
c
c \Arguments
c
c RVEC LOGICAL (INPUT)
c Specifies whether a basis for the invariant subspace corresponding
c to the converged Ritz value approximations for the eigenproblem
c
c RVEC LOGICAL (INPUT)
c Specifies whether a basis for the invariant subspace corresponding
c to the converged Ritz value approximations for the eigenproblem
c A*z = lambda*B*z is computed.
c
c RVEC = .FALSE. Compute Ritz values only.
c
c RVEC = .TRUE. Compute the Ritz vectors or Schur vectors.
c See Remarks below.
c See Remarks below.
c
c HOWMNY Character*1 (INPUT)
c Specifies the form of the basis for the invariant subspace
c HOWMNY Character*1 (INPUT)
c Specifies the form of the basis for the invariant subspace
c corresponding to the converged Ritz values that is to be computed.
c
c = 'A': Compute NEV Ritz vectors;
c = 'A': Compute NEV Ritz vectors;
c = 'P': Compute NEV Schur vectors;
c = 'S': compute some of the Ritz vectors, specified
c by the logical array SELECT.
@@ -83,23 +83,23 @@ c
c SELECT Logical array of dimension NCV. (INPUT)
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
c computed. To select the Ritz vector corresponding to a
c Ritz value (DR(j), DI(j)), SELECT(j) must be set to .TRUE..
c Ritz value (DR(j), DI(j)), SELECT(j) must be set to .TRUE..
c If HOWMNY = 'A' or 'P', SELECT is used as internal workspace.
c
c DR Double precision array of dimension NEV+1. (OUTPUT)
c On exit, DR contains the real part of the Ritz value approximations
c to the eigenvalues of A*z = lambda*B*z.
c On exit, DR contains the real part of the Ritz value approximations
c to the eigenvalues of A*z = lambda*B*z.
c
c DI Double precision array of dimension NEV+1. (OUTPUT)
c On exit, DI contains the imaginary part of the Ritz value
c On exit, DI contains the imaginary part of the Ritz value
c approximations to the eigenvalues of A*z = lambda*B*z associated
c with DR.
c with DR.
c
c NOTE: When Ritz values are complex, they will come in complex
c conjugate pairs. If eigenvectors are requested, the
c corresponding Ritz vectors will also come in conjugate
c pairs and the real and imaginary parts of these are
c represented in two consecutive columns of the array Z
c NOTE: When Ritz values are complex, they will come in complex
c conjugate pairs. If eigenvectors are requested, the
c corresponding Ritz vectors will also come in conjugate
c pairs and the real and imaginary parts of these are
c represented in two consecutive columns of the array Z
c (see below).
c
c Z Real N by NEV+1 array if RVEC = .TRUE. and HOWMNY = 'A'. (OUTPUT)
@@ -124,24 +124,24 @@ c the array Z may be set equal to first NEV+1 columns of the Arnoldi
c basis array V computed by DNAUPD. In this case the Arnoldi basis
c will be destroyed and overwritten with the eigenvector basis.
c
c LDZ Integer. (INPUT)
c The leading dimension of the array Z. If Ritz vectors are
c desired, then LDZ >= max( 1, N ). In any case, LDZ >= 1.
c
c SIGMAR Double precision (INPUT)
c If IPARAM(7) = 3 or 4, represents the real part of the shift.
c Not referenced if IPARAM(7) = 1 or 2.
c
c SIGMAI Double precision (INPUT)
c If IPARAM(7) = 3 or 4, represents the imaginary part of the
c shift.
c Not referenced if IPARAM(7) = 1 or 2.
c
c WORKEV Double precision work array of dimension 3*NCV. (WORKSPACE)
c
c N Integer. (INPUT)
c Dimension of the eigenproblem.
c
c LDZ Integer. (INPUT)
c The leading dimension of the array Z. If Ritz vectors are
c desired, then LDZ >= max( 1, N ). In any case, LDZ >= 1.
c
c SIGMAR Double precision (INPUT)
c If IPARAM(7) = 3 or 4, represents the real part of the shift.
c Not referenced if IPARAM(7) = 1 or 2.
c
c SIGMAI Double precision (INPUT)
c If IPARAM(7) = 3 or 4, represents the imaginary part of the
c shift.
c Not referenced if IPARAM(7) = 1 or 2.
c
c WORKEV Double precision work array of dimension 3*NCV. (WORKSPACE)
c
c N Integer. (INPUT)
c Dimension of the eigenproblem.
c
c AB Double precision array of dimension LDA by N. (INPUT)
c The matrix A in band storage, in rows KL+1 to
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
@@ -151,25 +151,25 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
c
c MB Double precision array of dimension LDA by N. (INPUT)
c The matrix M in band storage, in rows KL+1 to
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c The j-th column of M is stored in the j-th column of the
c array AB as follows:
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
c Not referenced if IPARAM(7) = 1
c
c LDA Integer. (INPUT)
c Leading dimension of AB, MB, RFAC and CFAC.
c Leading dimension of AB, MB, RFAC and CFAC.
c
c RFAC Double precision array of LDA by N. (WORKSPACE/OUTPUT)
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
c is invoked. It is used to store the LU factors of
c (A-sigma*M) when IPARAM(7) = 3 is invoked with a real shift.
c It is not referenced when IPARAM(7) = 1 or 4.
c
c CFAC Complex*16 array of LDA by N. (WORKSPACE/OUTPUT)
c CFAC is used to store (A-SIGMA*M) and its LU factors
c when IPARAM(7) = 3 or 4 are used with a complex shift SIGMA.
c On exit, it contains the LU factors of (A-SIGMA*M).
c when IPARAM(7) = 3 or 4 are used with a complex shift SIGMA.
c On exit, it contains the LU factors of (A-SIGMA*M).
c It is not referenced when IPARAM(7) = 1 or 2.
c
c KL Integer. (INPUT)
@@ -181,7 +181,7 @@ c
c WHICH Character*2. (INPUT)
c When IPARAM(7)= 1 or 2, WHICH can be set to any one of
c the following.
c
c
c 'LM' -> want the NEV eigenvalues of largest magnitude.
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
c 'LR' -> want the NEV eigenvalues of largest real part.
@@ -189,8 +189,8 @@ c 'SR' -> want the NEV eigenvalues of smallest real part.
c 'LI' -> want the NEV eigenvalues of largest imaginary part.
c 'SI' -> want the NEV eigenvalues of smallest imaginary part.
c
c When IPARAM(7) = 3 or 4, WHICH should be set to 'LM' only.
c
c When IPARAM(7) = 3 or 4, WHICH should be set to 'LM' only.
c
c BMAT Character*1. (INPUT)
c BMAT specifies the type of the matrix B that defines the
c semi-inner product for the operator OP.
@@ -199,9 +199,9 @@ c BMAT = 'G' -> generalized eigenvalue problem A*z = lambda*M*z
c NEV Integer. (INPUT)
c Number of eigenvalues to be computed.
c
c
c TOL Double precision scalar. (INPUT)
c Stopping criteria: the relative accuracy of the Ritz value
c Stopping criteria: the relative accuracy of the Ritz value
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I)).
c If TOL .LE. 0. is passed a default is set:
c DEFAULT = DLAMCH('EPS') (machine precision as computed
@@ -221,12 +221,12 @@ c Represents the dimension of the Arnoldi basis constructed
c by dnaupd for OP.
c
c V Double precision array N by NCV+1. (OUTPUT)
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
c represent approximate Schur vectors that span the
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
c represent approximate Schur vectors that span the
c desired invariant subspace.
c NOTE: The array Z may be set equal to first NEV+1 columns of the
c NOTE: The array Z may be set equal to first NEV+1 columns of the
c Arnoldi basis vector array V computed by DNAUPD. In this case
c if RVEC = .TRUE. and HOWMNY='A', then the first NCONV=IPARAM(5)
c if RVEC = .TRUE. and HOWMNY='A', then the first NCONV=IPARAM(5)
c are the desired Ritz vectors.
c
c LDV Integer. (INPUT)
@@ -234,7 +234,7 @@ c Leading dimension of V exactly as declared in the calling
c program.
c
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
c IPARAM(1) = ISHIFT:
c IPARAM(1) = ISHIFT:
c The shifts selected at each iteration are used to restart
c the Arnoldi iteration in an implicit fashion.
c It is set to 1 in this subroutine. The user do not need
@@ -248,7 +248,7 @@ c combination of Ritz vectors associated with the
c "wanted" eigenvalues.
c -------------------------------------------------------------
c
c IPARAM(2) = No longer referenced.
c IPARAM(2) = No longer referenced.
c
c IPARAM(3) = MXITER
c On INPUT: max number of Arnoldi update iterations allowed.
@@ -262,9 +262,9 @@ c
c IPARAM(6) = IUPD
c Not referenced. Implicit restarting is ALWAYS used.
c
c IPARAM(7) = IPARAM(7):
c IPARAM(7) = IPARAM(7):
c On INPUT determines what type of eigenproblem is being solved.
c Must be 1,2,3,4; See under \Description of dnband for the
c Must be 1,2,3,4; See under \Description of dnband for the
c four modes available.
c
c IPARAM(9) = NUMOP, IPARAM(10) = NUMOPB, IPARAM(11) = NUMREO,
@@ -280,22 +280,22 @@ c LWORKL Integer. (INPUT)
c LWORKL must be at least 3*NCV**2 + 6*NCV.
c
c WORKC Complex*16 array of length N. (WORKSPACE)
c Workspace used when IPARAM(7) = 3 or 4 for storing a temporary
c Workspace used when IPARAM(7) = 3 or 4 for storing a temporary
c complex vector.
c
c IWORK Integer array of dimension at least N. (WORKSPACE)
c Used when IPARAM(7)=2,3,4 to store the pivot information in the
c Used when IPARAM(7)=2,3,4 to store the pivot information in the
c factorization of M or (A-SIGMA*M).
c
c
c INFO Integer. (INPUT/OUTPUT)
c Error flag on output.
c = 0: Normal exit.
c = 1: The Schur form computed by LAPACK routine dlahqr
c could not be reordered by LAPACK routine dtrsen.
c Re-enter subroutine DNEUPD with IPARAM(5)=NCV and
c increase the size of the arrays DR and DI to have
c dimension at least NCV and allocate at least NCV
c columns for Z. NOTE: Not necessary if Z and V share
c Re-enter subroutine DNEUPD with IPARAM(5)=NCV and
c increase the size of the arrays DR and DI to have
c dimension at least NCV and allocate at least NCV
c columns for Z. NOTE: Not necessary if Z and V share
c the same space. Please notify the authors.
c
c = -1: N must be positive.
@@ -314,9 +314,9 @@ c = -12: HOWMNY = 'S' not yet implemented
c = -13: HOWMNY must be one of 'A' or 'P'
c = -14: DNAUPD did not find any eigenvalues to sufficient
c accuracy.
c = -15: Overflow occurs when we try to transform the Ritz
c = -15: Overflow occurs when we try to transform the Ritz
c values returned from DNAUPD to those of the original
c problem using Rayleigh Quotient.
c problem using Rayleigh Quotient.
c = -9999: Could not build an Arnoldi factorization.
c IPARAM(5) returns the size of the current
c Arnoldi factorization.
@@ -332,7 +332,7 @@ c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in
c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992),
c pp 357-385.
c
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
c Restarted Arnoldi Iteration", Ph.D thesis, TR95-13, Rice Univ,
c May 1995.
c
@@ -363,9 +363,9 @@ c Ritz vectors. Thus, their numerical properties are often superior.
c If RVEC = .TRUE. then the relationship
c A * V(:,1:IPARAM(5)) = V(:,1:IPARAM(5)) * T, and
c V(:,1:IPARAM(5))' * V(:,1:IPARAM(5)) = I are approximately satisfied.
c Here T is the leading submatrix of order IPARAM(5) of the real
c Here T is the leading submatrix of order IPARAM(5) of the real
c upper quasi-triangular matrix stored workl(ipntr(12)). That is,
c T is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks;
c T is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks;
c each 2-by-2 diagonal block has its diagonal elements equal and its
c off-diagonal elements of opposite sign. Corresponding to each 2-by-2
c diagonal block is a complex conjugate pair of Ritz values. The real
@@ -387,20 +387,20 @@ c\EndLib
c
c---------------------------------------------------------------------
c
subroutine dnband( rvec, howmny, select, dr, di, z, ldz, sigmar,
& sigmai, workev, n, ab, mb, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv,
subroutine dnband( rvec, howmny, select, dr, di, z, ldz, sigmar,
& sigmai, workev, n, ab, mb, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv,
& iparam, workd, workl, lworkl, workc, iwork, info)
c
c %------------------%
c | Scalar Arguments |
c %------------------%
c
c
character which*2, bmat, howmny
integer n, lda, kl, ku, nev, ncv, ldv,
& ldz, lworkl, info
& ldz, lworkl, info
Double precision
& tol, sigmar, sigmai
& tol, sigmar, sigmai
c
c %-----------------%
c | Array Arguments |
@@ -410,7 +410,7 @@ c
logical select(*)
Double precision
& dr(*), di(*), resid(*), v(ldv,*), z(ldz,*),
& ab(lda,*), mb(lda,*), rfac(lda,*),
& ab(lda,*), mb(lda,*), rfac(lda,*),
& workd(*), workl(*), workev(*)
Complex*16
& cfac(lda,*), workc(*)
@@ -426,9 +426,9 @@ c | Local Scalars |
c %---------------%
c
integer ido, i, j, type, imid, itop, ibot, ierr
Double precision
& numr, denr, deni, dmdul, safmin
logical rvec, first
Double precision
& numr, denr, deni, dmdul, safmin
logical rvec, first
c
c %------------%
c | Parameters |
@@ -445,7 +445,7 @@ c %-----------------------------%
c
Double precision
& ddot, dnrm2, dlapy2, dlamch
external ddot, dcopy, dgbmv, zgbtrf, zgbtrs, dgbtrf,
external ddot, dcopy, dgbmv, zgbtrf, zgbtrs, dgbtrf,
& dgbtrs, dnrm2, dlapy2, dlacpy, dlamch
c
c %---------------------%
@@ -464,17 +464,17 @@ c | that 1/sfmin does not overflow |
c %--------------------------------%
c
safmin = dlamch('safmin')
c
c
c %----------------------------------------------------------------%
c | Set type of the problem to be solved. Check consistency |
c | between BMAT and IPARAM(7). |
c | type = 1 --> Solving standard problem in regular mode. |
c | type = 2 --> Solving standard problem in shift-invert mode. |
c | type = 2 --> Solving standard problem in shift-invert mode. |
c | type = 3 --> Solving generalized problem in regular mode. |
c | type = 4 --> Solving generalized problem in shift-invert mode. |
c | type = 5 --> Solving standard problem in shift-invert mode |
c | using iparam(7) = 4 in DNAUPD. |
c | type = 6 --> Solving generalized problem in shift-invert mode. |
c | type = 6 --> Solving generalized problem in shift-invert mode. |
c | using iparam(7) = 4 in DNAUPD. |
c %----------------------------------------------------------------%
c
@@ -485,19 +485,19 @@ c
else if ( iparam(7) .eq. 2 ) then
type = 3
else if ( iparam(7) .eq. 3 .and. bmat .eq. 'G') then
type = 4
type = 4
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'I') then
type = 5
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'G') then
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'G') then
type = 6
else
print*, ' '
print*, 'BMAT is inconsistent with IPARAM(7).'
print*, ' '
print*, ' '
go to 9000
end if
c
c %----------------------------------%
c %----------------------------------%
c | When type = 5,6 are used, sigmai |
c | must be nonzero. |
c %----------------------------------%
@@ -505,16 +505,16 @@ c
if ( type .eq. 5 .or. type .eq. 6 ) then
if ( sigmai .eq. zero ) then
print*, ' '
print*, '_NBAND: sigmai must be nonzero when type 5 or 6
print*, '_NBAND: sigmai must be nonzero when type 5 or 6
& is used. '
print*, ' '
go to 9000
end if
end if
end if
c
c %------------------------%
c | Initialize the reverse |
c | communication flag. |
c | communication flag. |
c %------------------------%
c
ido = 0
@@ -546,7 +546,7 @@ c | Factor (A-sigma*I). |
c %-------------------------------%
c
if (sigmai .eq. zero) then
c
c
c %-----------------------------------%
c | Construct (A-sigmar*I) and factor |
c | in real arithmetic. |
@@ -558,7 +558,7 @@ c
10 continue
call dgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr )
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*, ' _NBAND: Error with _gbtrf. '
print*, ' '
go to 9000
@@ -574,24 +574,24 @@ c
do 30 j = 1, n
do 20 i = itop, ibot
cfac(i,j) = dcmplx(ab(i,j))
20 continue
20 continue
30 continue
c
do 40 j = 1, n
cfac(imid,j) = cfac(imid,j)
cfac(imid,j) = cfac(imid,j)
$ - dcmplx(sigmar, sigmai)
40 continue
c
call zgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr )
40 continue
c
call zgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr )
if ( ierr .ne. 0) then
print*, ' '
print*, ' _NBAND: Error with _gbtrf. '
print*, ' '
go to 9000
end if
c
c
end if
else if ( type .eq. 3 ) then
c
c %-----------------------------------------------%
@@ -603,7 +603,7 @@ c
call dlacpy ('A', ibot, n, mb, lda, rfac, lda )
call dgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*,'_NBAND: Error with _gbtrf.'
print*, ' '
go to 9000
@@ -615,7 +615,7 @@ c %-------------------------------------------%
c | Solving generalized eigenvalue problem in |
c | shift-invert mode. |
c %-------------------------------------------%
c
c
if ( sigmai .eq. zero ) then
c
c %--------------------------------------------%
@@ -624,7 +624,7 @@ c | arithmetic. |
c %--------------------------------------------%
c
do 60 j = 1,n
do 50 i = itop, ibot
do 50 i = itop, ibot
rfac(i,j) = ab(i,j) - sigmar*mb(i,j)
50 continue
60 continue
@@ -642,13 +642,13 @@ c
c %-----------------------------------------------%
c | Construct (A - sigma*M) and factor in complex |
c | arithmetic. |
c %-----------------------------------------------%
c %-----------------------------------------------%
c
do 80 j = 1,n
do 70 i = itop, ibot
cfac(i,j) = dcmplx( ab(i,j)-sigmar*mb(i,j),
do 70 i = itop, ibot
cfac(i,j) = dcmplx( ab(i,j)-sigmar*mb(i,j),
& -sigmai*mb(i,j) )
70 continue
70 continue
80 continue
c
call zgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr)
@@ -658,7 +658,7 @@ c
print*, ' '
go to 9000
end if
c
c
end if
c
end if
@@ -667,7 +667,7 @@ c %--------------------------------------------%
c | M A I N L O O P (reverse communication) |
c %--------------------------------------------%
c
90 continue
90 continue
c
call dnaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
@@ -681,8 +681,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( type .eq. 2 ) then
@@ -690,7 +690,7 @@ c
if (sigmai .eq. zero) then
c
c %----------------------------------%
c | Shift is real. Perform |
c | Shift is real. Perform |
c | y <--- OP*x = inv[A-sigmar*I]*x |
c | to force the starting vector |
c | into the range of OP. |
@@ -700,7 +700,7 @@ c
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' '
print*, ' _NBAND: Error with _bgtrs. '
print*, ' '
go to 9000
@@ -711,8 +711,8 @@ c
c %--------------------------------------------%
c | Shift is COMPLEX. Perform |
c | y <--- OP*x = Real_Part{inv[A-sigma*I]*x} |
c | to force the starting vector into the |
c | range of OP. |
c | to force the starting vector into the |
c | range of OP. |
c %--------------------------------------------%
c
do 100 j = 1, n
@@ -732,21 +732,21 @@ c
workd(ipntr(2)+j-1) = dble(workc(j))
110 continue
c
end if
c
end if
c
else if ( type .eq. 3 ) then
c
c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c | to force the starting vector into |
c | to force the starting vector into |
c | the range of OP. |
c %-----------------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
@@ -759,13 +759,13 @@ c
c
c %-----------------------------------------%
c | Perform y <-- OP*x |
c | = Real_part{inv[A-SIGMA*M]*M}*x |
c | = Real_part{inv[A-SIGMA*M]*M}*x |
c | to force the starting vector into the |
c | range of OP. |
c %-----------------------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
if ( sigmai .eq. zero ) then
@@ -773,14 +773,14 @@ c
c %---------------------%
c | Shift is real, stay |
c | in real arithmetic. |
c %---------------------%
c %---------------------%
c
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -792,26 +792,26 @@ c %--------------------------%
c
do 120 i = 1,n
workc(i) = dcmplx(workd(ipntr(2)+i-1))
120 continue
120 continue
c
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
& iwork, workc, n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
c
do 130 i = 1, n
workd(ipntr(2)+i-1) = dble(workc(i))
130 continue
130 continue
c
end if
c
else if ( type .eq. 5) then
c
c %---------------------------------------%
c %---------------------------------------%
c | Perform y <-- OP*x |
c | = Imaginary_part{inv[A-SIGMA*I]}*x |
c | to force the starting vector into the |
@@ -839,32 +839,32 @@ c
c
c %----------------------------------------%
c | Perform y <-- OP*x |
c | Imaginary_part{inv[A-SIGMA*M]*M} |
c | Imaginary_part{inv[A-SIGMA*M]*M} |
c | to force the starting vector into the |
c | range of OP. |
c %----------------------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
do 160 i = 1,n
workc(i) = dcmplx(workd(ipntr(2)+i-1))
160 continue
160 continue
c
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
& iwork, workc, n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
c
do 170 i = 1, n
workd(ipntr(2)+i-1) = dimag(workc(i))
170 continue
c
170 continue
c
end if
c
else if (ido .eq. 1) then
@@ -875,8 +875,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( type .eq. 2) then
@@ -907,7 +907,7 @@ c
& iwork, workc, n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
@@ -924,16 +924,16 @@ c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c %-----------------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error with _bgtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -942,7 +942,7 @@ c
c %--------------------------------------%
c | Perform y <-- inv(A-sigma*M)*(M*x). |
c | (M*x) has been computed and stored |
c | in workd(ipntr(3)). |
c | in workd(ipntr(3)). |
c %--------------------------------------%
c
if ( sigmai .eq. zero ) then
@@ -953,16 +953,16 @@ c | real arithmetic. |
c %------------------------%
c
call dcopy(n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
c
else
c
else
c
c %---------------------------%
c | Go to COMPLEX arithmetic. |
@@ -970,26 +970,26 @@ c %---------------------------%
c
do 200 i = 1,n
workc(i) = dcmplx(workd(ipntr(3)+i-1))
200 continue
200 continue
c
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
& iwork, workc, n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error in _gbtrs.'
print*, ' '
print*, '_NBAND: Error in _gbtrs.'
print*, ' '
go to 9000
end if
c
do 210 i = 1,n
workd(ipntr(2)+i-1) = dble(workc(i))
210 continue
210 continue
c
end if
c
else if ( type .eq. 5 ) then
c
c %---------------------------------------%
c %---------------------------------------%
c | Perform y <-- OP*x |
c | = Imaginary_part{inv[A-SIGMA*I]*x} |
c %---------------------------------------%
@@ -1015,25 +1015,25 @@ c
c
c %-----------------------------------------%
c | Perform y <-- OP*x |
c | = Imaginary_part{inv[A-SIGMA*M]*M}*x. |
c | = Imaginary_part{inv[A-SIGMA*M]*M}*x. |
c %-----------------------------------------%
c
do 240 i = 1,n
workc(i) = dcmplx(workd(ipntr(3)+i-1))
240 continue
240 continue
c
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
call zgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
& iwork, workc, n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
c
do 250 i = 1, n
workd(ipntr(2)+i-1) = dimag(workc(i))
250 continue
250 continue
c
end if
c
@@ -1045,14 +1045,14 @@ c | Not used when |
c | type = 1,2. |
c %--------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else
else
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
c | Either we have convergence, or there is |
c | error. |
c %-----------------------------------------%
c
@@ -1069,7 +1069,7 @@ c
print *, ' '
go to 9000
c
else
else
c
if ( info .eq. 1) then
print *, ' '
@@ -1084,29 +1084,29 @@ c
c
if (iparam(5) .gt. 0) then
c
call dneupd ( rvec, 'A', select, dr, di, z, ldz,
& sigmar, sigmai, workev, bmat, n, which,
call dneupd ( rvec, 'A', select, dr, di, z, ldz,
& sigmar, sigmai, workev, bmat, n, which,
& nev, tol, resid, ncv, v, ldv, iparam,
& ipntr, workd, workl, lworkl, info )
& ipntr, workd, workl, lworkl, info )
c
if ( info .ne. 0) then
c
c
c %------------------------------------%
c | Check the documentation of DNEUPD. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd = ', info
print *, ' Check the documentation of _neupd '
print *, ' '
print *, ' '
go to 9000
c
else if ( sigmai .ne. zero ) then
c
else if ( sigmai .ne. zero ) then
c
if ( type .eq. 4 .or. type .eq. 6 ) then
c
c
first = .true.
do 270 j = 1, iparam(5)
do 270 j = 1, iparam(5)
c
c %----------------------------------%
c | Use Rayleigh Quotient to recover |
@@ -1118,16 +1118,16 @@ c
c
c %--------------------------------------%
c | Eigenvalue is real. Compute |
c | d = (x'*inv[A-sigma*M]*M*x) / (x'*x) |
c | d = (x'*inv[A-sigma*M]*M*x) / (x'*x) |
c %--------------------------------------%
c
call dgbmv('Nontranspose', n, n, kl, ku, one,
call dgbmv('Nontranspose', n, n, kl, ku, one,
$ mb(itop,1), lda, z(1,j), 1, zero,
$ workd, 1)
do i = 1, n
workc(i) = dcmplx(workd(i))
end do
call zgbtrs ('Notranspose', n, kl, ku, 1,
call zgbtrs ('Notranspose', n, kl, ku, 1,
$ cfac, lda, iwork, workc, n, info)
do i = 1, n
workd(i) = dble(workc(i))
@@ -1151,7 +1151,7 @@ c
go to 9000
end if
c
else if (first) then
else if (first) then
c
c %------------------------%
c | Eigenvalue is complex. |
@@ -1166,7 +1166,7 @@ c
call dgbmv('Nontranspose', n, n, kl, ku,
$ one, mb(itop,1), lda, z(1,j), 1, zero,
$ workd, 1)
call dgbmv('Nontranspose', n, n, kl, ku,
call dgbmv('Nontranspose', n, n, kl, ku,
$ one, mb(itop,1), lda, z(1,j+1), 1,
$ zero, workd(n+1), 1)
do i = 1, n
@@ -1177,7 +1177,7 @@ c %----------------------------%
c | Compute inv(A-sigma*M)*M*x |
c %----------------------------%
c
call zgbtrs('Notranspose',n,kl,ku,1,cfac,
call zgbtrs('Notranspose',n,kl,ku,1,cfac,
$ lda, iwork, workc, n, info)
c
c %-------------------------------%
@@ -1197,7 +1197,7 @@ c %----------------%
c | Compute (x'*x) |
c %----------------%
c
numr = dlapy2( dnrm2(n, z(1,j), 1),
numr = dlapy2( dnrm2(n, z(1,j), 1),
& dnrm2(n, z(1, j+1), 1) )**2
c
c %----------------------------------------%
@@ -1237,7 +1237,7 @@ c
c
end if
c
270 continue
270 continue
c
else if ( type .eq. 2 .or. type .eq. 5) then
c
@@ -1260,7 +1260,7 @@ c
do i = 1, n
workc(i) = dcmplx(z(i,j))
end do
call zgbtrs ('Notranspose', n, kl, ku, 1,
call zgbtrs ('Notranspose', n, kl, ku, 1,
$ cfac, lda, iwork, workc, n, info)
do i = 1, n
workd(i) = dble(workc(i))
@@ -1329,7 +1329,7 @@ c | Compute (x'x) / (x'*inv(A-sigma*I)*x). |
c %----------------------------------------%
c
dmdul = dlapy2(denr,deni)**2
if (dmdul .ge. safmin) then
if (dmdul .ge. safmin) then
dr(j) = sigmar+numr*denr / dmdul
di(j) = sigmai-numr*deni / dmdul
first = .false.
@@ -1378,7 +1378,7 @@ c %----------------------------------------%
c | L O O P B A C K to call DNAUPD again. |
c %----------------------------------------%
c
go to 90
go to 90
c
9000 continue
c
+51 -51
View File
@@ -1,4 +1,4 @@
program dnbdr1
program dnbdr1
c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is derived from the discretization of
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -64,12 +64,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn)
Complex*16
Complex*16
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -81,25 +81,25 @@ c
& n, nx, lo, isub, isup, idiag, mode, maxitr,
& nconv
logical rvec, first
Double precision
Double precision
& tol, rho, h, h2, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
& two = 2.0D+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
c
c %--------------------%
c | Intrinsic function |
@@ -115,7 +115,7 @@ c %-------------------------------------------------%
c | The number NX is the number of interior points |
c | in the discretization of the 2-dimensional |
c | convection-diffusion operator on the unit |
c | square with zero Dirichlet boundary condition. |
c | square with zero Dirichlet boundary condition. |
c | The number N(=NX*NX) is the dimension of the |
c | matrix. A standard eigenvalue problem is |
c | solved (BMAT = 'I'). NEV is the number of |
@@ -126,13 +126,13 @@ c | spectrum. However, The following conditions |
c | must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR1: N is greater than MAXN '
go to 9000
@@ -158,7 +158,7 @@ c | generated in DNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -173,7 +173,7 @@ c
maxitr = 300
mode = 1
c
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %----------------------------------------%
@@ -195,10 +195,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -208,13 +208,13 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0D+0 / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
rho = 1.0D+2
c
rho = 1.0D+2
isup = kl+ku
isub = kl+ku+2
do 50 i = 1, nx
@@ -222,8 +222,8 @@ c
do 40 j = lo+1, lo+nx-1
a(isup,j+1) = -one/h2 + rho/two/h
a(isub,j) = -one/h2 - rho/two/h
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -237,8 +237,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -247,12 +247,12 @@ c | eigenvalues are returned in the first column |
c | of D, the imaginary parts are returned in the |
c | second column of D. Eigenvectors are returned |
c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c %------------------------------------------------%
c
rvec = .true.
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar, sigmai,
& workev, n, a, m, lda, rfac, cfac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam, workd,
rvec = .true.
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar, sigmai,
& workev, n, a, m, lda, rfac, cfac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam, workd,
& workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -285,8 +285,8 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
do 90 j = 1, nconv
first = .true.
do 90 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
c
@@ -294,11 +294,11 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
d(j,3) = dnrm2 (n, ax, 1)
d(j,3) = dnrm2 (n, ax, 1)
d(j,3) = d(j,3) / abs(d(j,1))
c
else if ( first ) then
@@ -307,17 +307,17 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
call daxpy (n, d(j,2), v(1,j+1), 1, ax, 1)
d(j,3) = dnrm2 (n, ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call daxpy (n, -d(j,2), v(1,j), 1, ax, 1)
call daxpy (n, -d(j,1), v(1,j+1), 1, ax, 1)
@@ -329,11 +329,11 @@ c
first = .true.
end if
c
90 continue
90 continue
call dmout (6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -344,8 +344,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+47 -47
View File
@@ -1,4 +1,4 @@
program dnbdr2
program dnbdr2
c
c ... Construct matrices A in LAPACK-style band form.
c The matrix A is derived from the discretization of
@@ -53,13 +53,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -68,12 +68,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn)
Complex*16
Complex*16
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -85,25 +85,25 @@ c
& n, nx, lo, idiag, isub, isup, mode, maxitr,
& nconv
logical rvec, first
Double precision
Double precision
& tol, rho, h2, h, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
& two = 2.0D+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , daxpy , dgbmv
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , daxpy , dgbmv
c
c %--------------------%
c | Intrinsic function |
@@ -135,10 +135,10 @@ c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 20
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR2: N is greater than MAXN '
go to 9000
@@ -151,8 +151,8 @@ c
end if
bmat = 'I'
which = 'LM'
sigmar = 1.0D+4
sigmai = 0.0D+0
sigmar = 1.0D+4
sigmai = 0.0D+0
c
c %-----------------------------------------------------%
c | The work array WORKL is used in DNAUPD as |
@@ -166,7 +166,7 @@ c | generated in DNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -181,7 +181,7 @@ c
maxitr = 300
mode = 3
c
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %----------------------------------------%
@@ -203,10 +203,10 @@ c | and subdiagonals within the band of |
c | matrices A. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -216,22 +216,22 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0D+0 / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
rho = 1.0D+1
rho = 1.0D+1
do 50 i = 1, nx
lo = (i-1)*nx
do 40 j = lo+1, lo+nx-1
a(isub,j+1) = -one/h2 + rho/two/h
a(isup,j) = -one/h2 - rho/two/h
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -245,8 +245,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -258,9 +258,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c
rvec = .true.
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -293,8 +293,8 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
do 90 j = 1, nconv
first = .true.
do 90 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
c
@@ -302,8 +302,8 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
d(j,3) = dnrm2 (n, ax, 1)
@@ -315,17 +315,17 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
call daxpy (n, d(j,2), v(1,j+1), 1, ax, 1)
d(j,3) = dnrm2 (n, ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call daxpy (n, -d(j,1), v(1,j+1), 1, ax, 1)
call daxpy (n, -d(j,2), v(1,j), 1, ax, 1)
@@ -337,11 +337,11 @@ c
first = .true.
end if
c
90 continue
90 continue
call dmout (6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -352,8 +352,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+55 -55
View File
@@ -1,8 +1,8 @@
program dnbdr3
program dnbdr3
c
c ... Construct matrices A and M in LAPACK-style band form.
c The matrix A and M are derived from the finite element
c discretization of the 1-dimensional convection-diffusion operator
c discretization of the 1-dimensional convection-diffusion operator
c (d^2u/dx^2) + rho*(du/dx)
c on the interval [0,1] with zero boundary condition,
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn)
c
c %--------------%
@@ -64,12 +64,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
Complex*16
Complex*16
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -81,25 +81,25 @@ c
& n, idiag, isup, isub, mode, maxitr,
& nconv
logical rvec, first
Double precision
Double precision
& tol, rho, h, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
& two = 2.0D+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
c
c %--------------------%
c | Intrinsic function |
@@ -126,8 +126,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR3: N is greater than MAXN '
go to 9000
@@ -142,7 +142,7 @@ c
which = 'LM'
c
c %----------------------------------------------------%
c | The work array WORKL is used in DNAUPD as |
c | The work array WORKL is used in DNAUPD as |
c | workspace. Its dimension LWORKL has to be set as |
c | illustrated below. The parameter TOL determines |
c | the stopping criterion. If TOL<=0, machine machine |
@@ -150,12 +150,12 @@ c | precision is used. The number IDO is used for |
c | reverse communication and has to be set to 0 at |
c | the beginning. Setting INFO=0 indicates that we |
c | using a randomly generated vector to start the |
c | the ARNOLDI process. |
c | the ARNOLDI process. |
c %----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
info = 0
tol = zero
tol = zero
ido = 0
c
c %---------------------------------------------------%
@@ -169,8 +169,8 @@ c
mode = 2
maxitr = 300
c
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %--------------------------------------------%
c | Construct matrices A and M in LAPACK-style |
@@ -191,10 +191,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -204,21 +204,21 @@ c
do 30 j = 1, n
a(idiag,j) = 2.0D+0 / h
m(idiag,j) = 4.0D+0 * h
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
rho = 1.0D+1
rho = 1.0D+1
do 50 j = 1, n
a(isup,j+1) = -one/h + rho/two
a(isub,j) = -one/h - rho/two
m(isup,j+1) = one*h
m(isub,j) = one*h
50 continue
50 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -229,10 +229,10 @@ c | second column of D. Eigenvectors are returned |
c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c
rvec = .true.
call dnband ( rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
rvec = .true.
call dnband ( rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -265,7 +265,7 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
first = .true.
do 90 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
@@ -274,11 +274,11 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy (n, -d(j,1), mx, 1, ax, 1)
d(j,3) = dnrm2 (n, ax, 1)
@@ -290,30 +290,30 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy (n, -d(j,1), mx, 1, ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call daxpy (n, d(j,2), mx, 1, ax, 1)
d(j,3) = dnrm2 (n, ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call daxpy (n, -d(j,1), mx, 1, ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy (n, -d(j,2), mx, 1, ax, 1)
d(j,3) = dlapy2 ( d(j,3), dnrm2 (n, ax, 1) )
@@ -324,11 +324,11 @@ c
first = .true.
end if
c
90 continue
90 continue
call dmout (6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -339,8 +339,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+46 -46
View File
@@ -50,14 +50,14 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn)
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn)
c
c %--------------%
c | Local Arrays |
@@ -67,10 +67,10 @@ c
logical select(maxncv)
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
Complex*16
Complex*16
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -82,16 +82,16 @@ c
& n, idiag, isup, isub, mode, maxitr,
& nconv
logical rvec, first
Double precision
Double precision
& tol, rho, h, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two, six
parameter (one = 1.0D+0, zero = 0.0D+0,
parameter (one = 1.0D+0, zero = 0.0D+0,
& two = 2.0D+0, six = 6.0D+0)
c
c %-----------------------------%
@@ -100,7 +100,7 @@ c %-----------------------------%
c
Double precision
& dlapy2, dnrm2
external dlapy2, dnrm2, dgbmv, daxpy
external dlapy2, dnrm2, dgbmv, daxpy
c
c %--------------------%
c | Intrinsic function |
@@ -127,8 +127,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR4: N is greater than MAXN '
go to 9000
@@ -142,7 +142,7 @@ c
bmat = 'G'
which = 'LM'
sigmar = 1.0D+1
sigmai = 0.0D+0
sigmai = 0.0D+0
c
c %-----------------------------------------------------%
c | The work array WORKL is used in DNAUPD as |
@@ -157,7 +157,7 @@ c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
info = 0
tol = zero
tol = zero
ido = 0
c
c %---------------------------------------------------%
@@ -171,7 +171,7 @@ c
maxitr = 300
mode = 3
c
iparam(3) = n
iparam(3) = n
iparam(7) = 3
c
c %--------------------------------------------%
@@ -194,9 +194,9 @@ c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -205,12 +205,12 @@ c
do 30 j = 1, n
a(idiag,j) = 2.0D+0 / h
m(idiag,j) = 4.0D+0 * h / six
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
rho = 1.0D+1
@@ -218,8 +218,8 @@ c
a(isup,j+1) = -one/h + rho/two
a(isub,j) = -one/h - rho/two
m(isup,j+1) = one*h/six
m(isub,j) = one*h/six
40 continue
m(isub,j) = one*h/six
40 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -231,9 +231,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c
rvec = .true.
call dnband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
call dnband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -266,7 +266,7 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
first = .true.
do 50 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
@@ -275,11 +275,11 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call dgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy(n, -d(j,1), mx, 1, ax, 1)
d(j,3) = dnrm2(n, ax, 1)
@@ -291,30 +291,30 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call dgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy(n, -d(j,1), mx, 1, ax, 1)
call dgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call daxpy(n, d(j,2), mx, 1, ax, 1)
d(j,3) = dnrm2(n, ax, 1)
call dgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call dgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call daxpy(n, -d(j,1), mx, 1, ax, 1)
call dgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy(n, -d(j,2), mx, 1, ax, 1)
d(j,3) = dlapy2( d(j,3), dnrm2(n, ax, 1) )
@@ -325,11 +325,11 @@ c
first = .true.
end if
c
50 continue
50 continue
call dmout(6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relatve residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -340,8 +340,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+48 -48
View File
@@ -1,7 +1,7 @@
program dnbdr5
program dnbdr5
c
c ... Construct matrices A and M in LAPACK-style band form.
c The matrix A is a block tridiagonal matrix. Each
c The matrix A is a block tridiagonal matrix. Each
c diagonal block is a tridiagonal matrix with
c 4 on the diagonal, 1-rho*h/2 on the subdiagonal and
c 1+rho*h/2 on the superdiagonal. Each off-diagonal block
@@ -51,13 +51,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -66,12 +66,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn)
Complex*16
Complex*16
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -83,25 +83,25 @@ c
& n, nx, lo, idiag, isup, isub, mode, maxitr,
& nconv
logical rvec, first
Double precision
Double precision
& tol, rho, h, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
& two = 2.0D+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
c
c %--------------------%
c | Intrinsic function |
@@ -132,8 +132,8 @@ c %--------------------------------------------------%
c
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR5: N is greater than MAXN '
go to 9000
@@ -146,8 +146,8 @@ c
end if
bmat = 'I'
which = 'LM'
sigmar = 4.0D-1
sigmai = 6.0D-1
sigmar = 4.0D-1
sigmai = 6.0D-1
c
c %-----------------------------------------------------%
c | The work array WORKL is used in DNAUPD as |
@@ -161,7 +161,7 @@ c | generated in DNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -198,34 +198,34 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0D+0
m(idiag,j) = 4.0D+0
30 continue
c
a(idiag,j) = 4.0D+0
m(idiag,j) = 4.0D+0
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+kl+2
h = one / dble (nx+1)
rho = 1.0D+2
rho = 1.0D+2
do 50 i = 1, nx
lo = (i-1)*nx
do 40 j = lo+1, lo+nx-1
a(isup,j+1) = -one+h*rho/two
a(isub,j) = -one-h*rho/two
40 continue
50 continue
40 continue
50 continue
c
do 60 j = 1, n-1
m(isup,j+1) = one
@@ -244,8 +244,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one
a(isub,j) = -one
70 continue
80 continue
70 continue
80 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -253,13 +253,13 @@ c | and eigenvectors. The real parts of the |
c | eigenvalues are returned in the first column |
c | of D, the imaginary parts are returned in the |
c | second column of D. Eigenvectors are returned |
c | in the first NCONV (=IPARAM(5)) columns of V. |
c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c
rvec = .true.
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -292,7 +292,7 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
first = .true.
do 90 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
@@ -301,8 +301,8 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
d(j,3) = dnrm2 (n, ax, 1)
@@ -314,17 +314,17 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
call daxpy (n, d(j,2), v(1,j+1), 1, ax, 1)
d(j,3) = dnrm2 (n, ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call daxpy (n, -d(j,1), v(1,j+1), 1, ax, 1)
call daxpy (n, -d(j,2), v(1,j), 1, ax, 1)
@@ -336,11 +336,11 @@ c
first = .true.
end if
c
90 continue
90 continue
call dmout (6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -351,8 +351,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+61 -61
View File
@@ -1,7 +1,7 @@
program dnbdr6
program dnbdr6
c
c ... Construct matrices A and M in LAPACK-style band form.
c The matrix A is a block tridiagonal matrix. Each
c The matrix A is a block tridiagonal matrix. Each
c diagonal block is a tridiagonal matrix with
c 4 on the diagonal, 1-rho*h/2 on the subdiagonal and
c 1+rho*h/2 on the superdiagonal. Each subdiagonal block
@@ -53,13 +53,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -68,12 +68,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
Complex*16
Complex*16
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -85,16 +85,16 @@ c
& n, nx, lo, idiag, isup, isub, mode, maxitr,
& nconv
logical rvec, first
Double precision
Double precision
& tol, rho, h, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
parameter (one = 1.0D+0 , zero = 0.0D+0 ,
& two = 2.0D+0 )
c
c %--------------------%
@@ -107,9 +107,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
c
c %-----------------------%
c | Executable Statements |
@@ -129,13 +129,13 @@ c | to get different parts the spectrum. However, the |
c | following rules must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %-----------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %-----------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR6: N is greater than MAXN '
go to 9000
@@ -148,8 +148,8 @@ c
end if
bmat = 'G'
which = 'LM'
sigmar = 4.0D-1
sigmai = 6.0D-1
sigmar = 4.0D-1
sigmai = 6.0D-1
c
c %-----------------------------------------------------%
c | The work array WORKL is used in DNAUPD as |
@@ -163,7 +163,7 @@ c | generated in DNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -178,7 +178,7 @@ c
maxitr = 300
mode = 4
c
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %--------------------------------------------%
@@ -200,34 +200,34 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0D+0
m(idiag,j) = 4.0D+0
30 continue
c
a(idiag,j) = 4.0D+0
m(idiag,j) = 4.0D+0
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
h = one / dble (nx+1)
rho = 1.0D+2
rho = 1.0D+2
do 50 i = 1, nx
lo = (i-1)*nx
do 40 j = lo+1, lo+nx-1
a(isub,j+1) = -one+h*rho/two
a(isup,j) = -one-h*rho/two
40 continue
50 continue
40 continue
50 continue
c
do 60 j = 1, n-1
m(isub,j+1) = one
@@ -246,8 +246,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one
a(isub,j) = -one
70 continue
80 continue
70 continue
80 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -259,9 +259,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c
rvec = .true.
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
call dnband (rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -294,7 +294,7 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
first = .true.
do 90 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
@@ -303,11 +303,11 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy (n, -d(j,1), mx, 1, ax, 1)
d(j,3) = dnrm2 (n, ax, 1)
@@ -319,30 +319,30 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy (n, -d(j,1), mx, 1, ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call daxpy (n, d(j,2), mx, 1, ax, 1)
d(j,3) = dnrm2 (n, ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call daxpy (n, -d(j,1), mx, 1, ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy (n, -d(j,2), mx, 1, ax, 1)
d(j,3) = dlapy2 ( d(j,3), dnrm2 (n, ax, 1) )
@@ -353,11 +353,11 @@ c
first = .true.
end if
c
90 continue
90 continue
call dmout (6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -368,8 +368,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+152 -152
View File
@@ -17,19 +17,19 @@ c
c Matrices A and B are stored in LAPACK-style band form.
c
c There is negligible additional cost to obtain eigenvectors. An orthonormal
c (Lanczos) basis is always computed. There is an additional storage cost
c of n*nev if both are requested (in this case a separate array Z must be
c (Lanczos) basis is always computed. There is an additional storage cost
c of n*nev if both are requested (in this case a separate array Z must be
c supplied).
c
c The approximate eigenvalues and eigenvectors of A*z = lambda*B*z
c are called Ritz values and Ritz vectors respectively. They are referred
c to as such in the comments that follow. The computed orthonormal basis
c for the invariant subspace corresponding to these Ritz values is referred
c are called Ritz values and Ritz vectors respectively. They are referred
c to as such in the comments that follow. The computed orthonormal basis
c for the invariant subspace corresponding to these Ritz values is referred
c to as a Lanczos basis.
c
c dsband can be called with one of the following modes:
c
c Mode 1: A*x = lambda*x, A symmetric
c Mode 1: A*x = lambda*x, A symmetric
c ===> OP = A and B = I.
c
c Mode 2: A*x = lambda*M*x, A symmetric, M symmetric positive definite
@@ -37,10 +37,10 @@ c ===> OP = inv[M]*A and B = M.
c ===> (If M can be factored see remark 3 in DSAUPD)
c
c Mode 3: K*x = lambda*M*x, K symmetric, M symmetric positive semi-definite
c ===> OP = (inv[K - sigma*M])*M and B = M.
c ===> OP = (inv[K - sigma*M])*M and B = M.
c ===> Shift-and-Invert mode
c
c Mode 4: K*x = lambda*KG*x, K symmetric positive semi-definite,
c Mode 4: K*x = lambda*KG*x, K symmetric positive semi-definite,
c KG symmetric indefinite
c ===> OP = (inv[K - sigma*KG])*K and B = K.
c ===> Buckling mode
@@ -53,21 +53,21 @@ c The choice of mode must be specified in IPARAM(7) defined below.
c
c \Usage
c call dsband
c ( RVEC, HOWMNY, SELECT, D, Z, LDZ, SIGMA, N, AB, MB, LDA,
c RFAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV, V,
c ( RVEC, HOWMNY, SELECT, D, Z, LDZ, SIGMA, N, AB, MB, LDA,
c RFAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV, V,
c LDV, IPARAM, WORKD, WORKL, LWORKL, IWORK, INFO )
c
c \Arguments
c
c RVEC Logical (INPUT)
c Specifies whether Ritz vectors corresponding to the Ritz value
c Specifies whether Ritz vectors corresponding to the Ritz value
c approximations to the eigenproblem A*z = lambda*B*z are computed.
c
c RVEC = .FALSE. Compute Ritz values only.
c
c RVEC = .TRUE. Compute the associated Ritz vectors.
c RVEC = .TRUE. Compute the associated Ritz vectors.
c
c HOWMNY Character*1 (INPUT)
c HOWMNY Character*1 (INPUT)
c Specifies how many Ritz vectors are wanted and the form of Z
c the matrix of Ritz vectors. See remark 1 below.
c = 'A': compute all Ritz vectors;
@@ -77,7 +77,7 @@ c
c SELECT Logical array of dimension NCV. (INPUT)
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
c computed. To select the Ritz vector corresponding to a
c Ritz value D(j), SELECT(j) must be set to .TRUE..
c Ritz value D(j), SELECT(j) must be set to .TRUE..
c If HOWMNY = 'A' , SELECT is not referenced.
c
c D Double precision array of dimension NEV. (OUTPUT)
@@ -85,8 +85,8 @@ c On exit, D contains the Ritz value approximations to the
c eigenvalues of A*z = lambda*B*z. The values are returned
c in ascending order. If IPARAM(7) = 3,4,5 then D represents
c the Ritz values of OP computed by dsaupd transformed to
c those of the original eigensystem A*z = lambda*B*z. If
c IPARAM(7) = 1,2 then the Ritz values of OP are the same
c those of the original eigensystem A*z = lambda*B*z. If
c IPARAM(7) = 1,2 then the Ritz values of OP are the same
c as the those of A*z = lambda*B*z.
c
c Z Double precision N by NEV array if HOWMNY = 'A'. (OUTPUT)
@@ -95,20 +95,20 @@ c eigensystem A*z = lambda*B*z corresponding to the Ritz
c value approximations.
c
c If RVEC = .FALSE. then Z is not referenced.
c NOTE: The array Z may be set equal to first NEV columns of the
c NOTE: The array Z may be set equal to first NEV columns of the
c Lanczos basis array V computed by DSAUPD.
c
c LDZ Integer. (INPUT)
c LDZ Integer. (INPUT)
c The leading dimension of the array Z. If Ritz vectors are
c desired, then LDZ .ge. max( 1, N ). In any case, LDZ .ge. 1.
c
c SIGMA Double precision (INPUT)
c If IPARAM(7) = 3,4,5 represents the shift. Not referenced if
c IPARAM(7) = 1 or 2.
c
c N Integer. (INPUT)
c Dimension of the eigenproblem.
c
c
c N Integer. (INPUT)
c Dimension of the eigenproblem.
c
c AB Double precision array of dimension LDA by N. (INPUT)
c The matrix A in band storage, in rows KL+1 to
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
@@ -118,7 +118,7 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
c
c MB Double precision array of dimension LDA by N. (INPUT)
c The matrix M in band storage, in rows KL+1 to
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c The j-th column of M is stored in the j-th column of the
c array AB as follows:
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
@@ -128,7 +128,7 @@ c LDA Integer. (INPUT)
c Leading dimension of AB, MB, RFAC.
c
c RFAC Double precision array of LDA by N. (WORKSPACE/OUTPUT)
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
c is invoked. It is used to store the LU factors of
c (A-sigma*M) when IPARAM(7) = 3,4,5 is invoked.
c It is not referenced when IPARAM(7) = 1.
@@ -142,17 +142,17 @@ c
c WHICH Character*2. (INPUT)
c When IPARAM(7)= 1 or 2, WHICH can be set to any one of
c the following.
c
c
c 'LM' -> want the NEV eigenvalues of largest magnitude.
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
c 'LA' -> want the NEV eigenvalues of largest REAL part.
c 'SA' -> want the NEV eigenvalues of smallest REAL part.
c 'BE' -> Compute NEV eigenvalues, half from each end of the
c spectrum. When NEV is odd, compute one more from
c the high end than from the low end.
c 'BE' -> Compute NEV eigenvalues, half from each end of the
c spectrum. When NEV is odd, compute one more from
c the high end than from the low end.
c
c When IPARAM(7) = 3, 4, or 5, WHICH should be set to 'LM' only.
c
c When IPARAM(7) = 3, 4, or 5, WHICH should be set to 'LM' only.
c
c BMAT Character*1. (INPUT)
c BMAT specifies the type of the matrix B that defines the
c semi-inner product for the operator OP.
@@ -161,9 +161,9 @@ c BMAT = 'G' -> generalized eigenvalue problem A*x = lambda*M*x
c NEV Integer. (INPUT)
c Number of eigenvalues of OP to be computed.
c
c
c TOL Double precision scalar. (INPUT)
c Stopping criterion: the relative accuracy of the Ritz value
c Stopping criterion: the relative accuracy of the Ritz value
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I)).
c If TOL .LE. 0. is passed a default is set:
c DEFAULT = DLAMCH('EPS') (machine precision as computed
@@ -183,35 +183,35 @@ c Represents the dimension of the Lanczos basis constructed
c by dsaupd for OP.
c
c V Double precision array N by NCV. (OUTPUT)
c Upon INPUT: the NCV columns of V contain the Lanczos basis
c Upon INPUT: the NCV columns of V contain the Lanczos basis
c vectors as constructed by dsaupd for OP.
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
c represent the Ritz vectors that span the desired
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
c represent the Ritz vectors that span the desired
c invariant subspace.
c NOTE: The array Z may be set equal to first NEV columns of the
c NOTE: The array Z may be set equal to first NEV columns of the
c Lanczos basis vector array V computed by dsaupd. In this case
c if RVEC=.TRUE., the first NCONV=IPARAM(5) columns of V contain
c the desired Ritz vectors.
c the desired Ritz vectors.
c
c LDV Integer. (INPUT)
c Leading dimension of V exactly as declared in the calling
c program.
c
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
c IPARAM(1) = ISHIFT:
c IPARAM(1) = ISHIFT:
c The shifts selected at each iteration are used to restart
c the Arnoldi iteration in an implicit fashion.
c It is set to 1 in this subroutine. The user do not need
c to set this parameter.
c ------------------------------------------------------------
c ISHIFT = 1: exact shifts with respect to the reduced
c tridiagonal matrix T. This is equivalent to
c restarting the iteration with a starting vector
c that is a linear combination of Ritz vectors
c ISHIFT = 1: exact shifts with respect to the reduced
c tridiagonal matrix T. This is equivalent to
c restarting the iteration with a starting vector
c that is a linear combination of Ritz vectors
c associated with the "wanted" Ritz values.
c -------------------------------------------------------------
c
c IPARAM(2) = No longer referenced.
c IPARAM(2) = No longer referenced.
c
c IPARAM(3) = MXITER
c On INPUT: max number of Arnoldi update iterations allowed.
@@ -225,11 +225,11 @@ c This represents the number of Ritz values that satisfy
c the convergence criterion.
c
c IPARAM(6) = IUPD
c No longer referenced. Implicit restarting is ALWAYS used.
c No longer referenced. Implicit restarting is ALWAYS used.
c
c IPARAM(7) = MODE
c On INPUT determines what type of eigenproblem is being solved.
c Must be 1,2,3,4,5; See under \Description of dsband for the
c Must be 1,2,3,4,5; See under \Description of dsband for the
c five modes available.
c
c IPARAM(8) = NP
@@ -248,18 +248,18 @@ c LWORKL Integer. (INPUT)
c LWORKL must be at least NCV**2 + 8*NCV.
c
c IWORK Integer array of dimension at least N. (WORKSPACE)
c Used when IPARAM(7)=2,3,4,5 to store the pivot information in the
c Used when IPARAM(7)=2,3,4,5 to store the pivot information in the
c factorization of M or (A-SIGMA*M).
c
c
c INFO Integer. (INPUT/OUTPUT)
c Error flag on output.
c = 0: Normal exit.
c = 1: Maximum number of iterations taken.
c All possible eigenvalues of OP has been found. IPARAM(5)
c All possible eigenvalues of OP has been found. IPARAM(5)
c returns the number of wanted converged Ritz values.
c = 3: No shifts could be applied during a cycle of the
c Implicitly restarted Arnoldi iteration. One possibility
c is to increase the size of NCV relative to NEV.
c = 3: No shifts could be applied during a cycle of the
c Implicitly restarted Arnoldi iteration. One possibility
c is to increase the size of NCV relative to NEV.
c See remark 4 in DSAUPD.
c
c = -1: N must be positive.
@@ -292,7 +292,7 @@ c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in
c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992),
c pp 357-385.
c
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
c Restarted Arnoldi Iteration", Ph.D thesis, TR95-13, Rice Univ,
c May 1995.
c
@@ -301,7 +301,7 @@ c dsaupd ARPACK reverse communication interface routine.
c dseupd ARPACK routine that returns Ritz values and (optionally)
c Ritz vectors.
c dgbtrf LAPACK band matrix factorization routine.
c dgbtrs LAPACK band linear system solve routine.
c dgbtrs LAPACK band linear system solve routine.
c dlacpy LAPACK matrix copy routine.
c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
c dcopy Level 1 BLAS that copies one vector to another.
@@ -310,13 +310,13 @@ c dnrm2 Level 1 BLAS that computes the norm of a vector.
c dgbmv Level 2 BLAS that computes the band matrix vector product.
c
c\Remarks
c 1. The converged Ritz values are always returned in increasing
c 1. The converged Ritz values are always returned in increasing
c (algebraic) order.
c
c 2. Currently only HOWMNY = 'A' is implemented. It is included at this
c stage for the user who wants to incorporate it.
c
c\Author
c\Author
c Danny Sorensen
c Richard Lehoucq
c Chao Yang
@@ -332,18 +332,18 @@ c\EndLib
c
c---------------------------------------------------------------------
c
subroutine dsband( rvec, howmny, select, d, z, ldz, sigma,
& n, ab, mb, lda, rfac, kl, ku, which, bmat, nev,
& tol, resid, ncv, v, ldv, iparam, workd, workl,
subroutine dsband( rvec, howmny, select, d, z, ldz, sigma,
& n, ab, mb, lda, rfac, kl, ku, which, bmat, nev,
& tol, resid, ncv, v, ldv, iparam, workd, workl,
& lworkl, iwork, info)
c
c %------------------%
c | Scalar Arguments |
c %------------------%
c
c
character which*2, bmat, howmny
integer n, lda, kl, ku, nev, ncv, ldv,
& ldz, lworkl, info
& ldz, lworkl, info
Double precision
& tol, sigma
logical rvec
@@ -356,7 +356,7 @@ c
logical select(*)
Double precision
& d(*), resid(*), v(ldv,*), z(ldz,*),
& ab(lda,*), mb(lda,*), rfac(lda,*),
& ab(lda,*), mb(lda,*), rfac(lda,*),
& workd(*), workl(*)
c
c %--------------%
@@ -386,22 +386,22 @@ c %-----------------------------%
c
Double precision
& ddot, dnrm2, dlapy2
external ddot, dcopy, dgbmv, dgbtrf,
external ddot, dcopy, dgbmv, dgbtrf,
& dgbtrs, dnrm2, dlapy2, dlacpy
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
c
c
c %----------------------------------------------------------------%
c | Set type of the problem to be solved. Check consistency |
c | between BMAT and IPARAM(7). |
c | type = 1 --> Solving standard problem in regular mode. |
c | type = 2 --> Solving standard problem in shift-invert mode. |
c | type = 2 --> Solving standard problem in shift-invert mode. |
c | type = 3 --> Solving generalized problem in regular mode. |
c | type = 4 --> Solving generalized problem in shift-invert mode. |
c | type = 5 --> Solving generalized problem in Buckling mode. |
c | type = 6 --> Solving generalized problem in Cayley mode. |
c | type = 6 --> Solving generalized problem in Cayley mode. |
c %----------------------------------------------------------------%
c
if ( iparam(7) .eq. 1 ) then
@@ -411,15 +411,15 @@ c
else if ( iparam(7) .eq. 2 ) then
type = 3
else if ( iparam(7) .eq. 3 .and. bmat .eq. 'G') then
type = 4
type = 4
else if ( iparam(7) .eq. 4 ) then
type = 5
else if ( iparam(7) .eq. 5 ) then
else if ( iparam(7) .eq. 5 ) then
type = 6
else
print*, ' '
print*, 'BMAT is inconsistent with IPARAM(7).'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -432,9 +432,9 @@ c
c
c %----------------%
c | Exact shift is |
c | used. |
c | used. |
c %----------------%
c
c
iparam(1) = 1
c
c %-----------------------------------%
@@ -462,7 +462,7 @@ c
10 continue
call dgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr )
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*, ' _SBAND: Error with _gbtrf. '
print*, ' '
go to 9000
@@ -477,28 +477,28 @@ c | routine dgbtrf to factor M. |
c %----------------------------------------------%
c
call dlacpy ('A', ibot, n, mb, lda, rfac, lda )
call dgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
if (ierr .ne. 0) then
call dgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
if (ierr .ne. 0) then
print*, ' '
print*,'_SBAND: Error with _gbtrf.'
print*, ' '
go to 9000
print*,'_SBAND: Error with _gbtrf.'
print*, ' '
go to 9000
end if
c
else if ( type .eq. 4 .or. type .eq. 5 .or. type .eq. 6
else if ( type .eq. 4 .or. type .eq. 5 .or. type .eq. 6
& .and. bmat .eq. 'G' ) then
c
c %-------------------------------------------%
c | Solving generalized eigenvalue problem in |
c | shift-invert, Buckling, or Cayley mode. |
c %-------------------------------------------%
c
c
c %-------------------------------------%
c | Construct and factor (A - sigma*M). |
c %-------------------------------------%
c
do 60 j = 1,n
do 50 i = itop, ibot
do 50 i = itop, ibot
rfac(i,j) = ab(i,j) - sigma*mb(i,j)
50 continue
60 continue
@@ -510,14 +510,14 @@ c
print*, ' '
go to 9000
end if
c
end if
c
end if
c
c %--------------------------------------------%
c | M A I N L O O P (reverse communication) |
c %--------------------------------------------%
c
90 continue
90 continue
c
call dsaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
@@ -531,8 +531,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( type .eq. 2 ) then
@@ -548,7 +548,7 @@ c
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' '
print*, ' _SBAND: Error with _bgtrs. '
print*, ' '
go to 9000
@@ -558,15 +558,15 @@ c
c
c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c | to force the starting vector into |
c | to force the starting vector into |
c | the range of OP. |
c %-----------------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
call dcopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
@@ -579,36 +579,36 @@ c
c
c %-----------------------------------------%
c | Perform y <-- OP*x |
c | = inv[A-SIGMA*M]*M |
c | = inv[A-SIGMA*M]*M |
c | to force the starting vector into the |
c | range of OP. |
c %-----------------------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*, '_SBAND: Error with _gbtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
else if ( type .eq. 5) then
c
c %---------------------------------------%
c %---------------------------------------%
c | Perform y <-- OP*x |
c | = inv[A-SIGMA*M]*A |
c | to force the starting vector into the |
c | range of OP. |
c %---------------------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
c
if ( ierr .ne. 0 ) then
@@ -622,31 +622,31 @@ c
c
c %---------------------------------------%
c | Perform y <-- OP*x |
c | = (inv[A-SIGMA*M])*(A+SIGMA*M)*x |
c | = (inv[A-SIGMA*M])*(A+SIGMA*M)*x |
c | to force the starting vector into the |
c | range of OP. |
c | range of OP. |
c %---------------------------------------%
c
if ( bmat .eq. 'G' ) then
call dgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
call dgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
& zero, workd(ipntr(2)), 1)
call dgbmv('Notranspose', n, n, kl, ku, sigma,
& mb(itop,1), lda, workd(ipntr(1)), 1,
call dgbmv('Notranspose', n, n, kl, ku, sigma,
& mb(itop,1), lda, workd(ipntr(1)), 1,
& one, workd(ipntr(2)), 1)
else
else
call dcopy(n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, sigma,
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, sigma,
& workd(ipntr(2)), 1)
end if
end if
c
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
c
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_SBAND: Error with _gbtrs.'
print*, '_SBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
@@ -661,8 +661,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( type .eq. 2) then
@@ -677,7 +677,7 @@ c
& iwork, workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, '_SBAND: Error with _gbtrs.'
print*, '_SBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
@@ -688,16 +688,16 @@ c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c %-----------------------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
call dcopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call dcopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, '_SBAND: error with _bgtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -706,22 +706,22 @@ c
c %-------------------------------------%
c | Perform y <-- inv(A-sigma*M)*(M*x). |
c | (M*x) has been computed and stored |
c | in workd(ipntr(3)). |
c | in workd(ipntr(3)). |
c %-------------------------------------%
c
call dcopy(n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call dgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_SBAND: Error with _gbtrs.'
print*, '_SBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
c
c
else if ( type .eq. 5 ) then
c
c %-------------------------------%
c %-------------------------------%
c | Perform y <-- OP*x |
c | = inv[A-SIGMA*M]*A*x |
c | B*x = A*x has been computed |
@@ -729,7 +729,7 @@ c | and saved in workd(ipntr(3)). |
c %-------------------------------%
c
call dcopy (n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -742,24 +742,24 @@ c
c
c %---------------------------------%
c | Perform y <-- OP*x |
c | = inv[A-SIGMA*M]*(A+SIGMA*M)*x. |
c | = inv[A-SIGMA*M]*(A+SIGMA*M)*x. |
c | (M*x) has been saved in |
c | workd(ipntr(3)). |
c %---------------------------------%
c
if ( bmat .eq. 'G' ) then
call dgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
call dgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
& zero, workd(ipntr(2)), 1)
call daxpy( n, sigma, workd(ipntr(3)), 1,
call daxpy( n, sigma, workd(ipntr(3)), 1,
& workd(ipntr(2)), 1 )
else
else
call dcopy (n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, sigma,
call dgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, sigma,
& workd(ipntr(2)), 1)
end if
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
call dgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
c
end if
@@ -767,9 +767,9 @@ c
else if (ido .eq. 2) then
c
c %----------------------------------%
c | Perform y <-- B*x |
c | Perform y <-- B*x |
c | Note when Buckling mode is used, |
c | B = A, otherwise B=M. |
c | B = A, otherwise B=M. |
c %----------------------------------%
c
if (type .eq. 5) then
@@ -778,20 +778,20 @@ c %---------------------%
c | Buckling Mode, B=A. |
c %---------------------%
c
call dgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
call dgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
& zero, workd(ipntr(2)), 1)
else
call dgbmv('Notranspose', n, n, kl, ku, one,
& mb(itop,1), lda, workd(ipntr(1)), 1,
call dgbmv('Notranspose', n, n, kl, ku, one,
& mb(itop,1), lda, workd(ipntr(1)), 1,
& zero, workd(ipntr(2)), 1)
end if
c
else
else
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
c | Either we have convergence, or there is |
c | error. |
c %-----------------------------------------%
c
@@ -808,7 +808,7 @@ c
print *, ' '
go to 9000
c
else
else
c
if ( info .eq. 1) then
print *, ' '
@@ -823,22 +823,22 @@ c
c
if (iparam(5) .gt. 0) then
c
call dseupd ( rvec, 'A', select, d, z, ldz, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, info )
call dseupd ( rvec, 'A', select, d, z, ldz, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, info )
c
if ( info .ne. 0) then
c
c
c %------------------------------------%
c | Check the documentation of dneupd. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd = ', info
print *, ' Check the documentation of _neupd '
print *, ' '
print *, ' '
go to 9000
c
c
end if
c
end if
@@ -853,7 +853,7 @@ c %----------------------------------------%
c | L O O P B A C K to call DSAUPD again. |
c %----------------------------------------%
c
go to 90
go to 90
c
9000 continue
c
+42 -42
View File
@@ -1,14 +1,14 @@
program dsbdr1
program dsbdr1
c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is derived from the discretization of
c the 2-dimensional Laplacian on the unit square with
c zero Dirichlet boundary condition using standard
c the 2-dimensional Laplacian on the unit square with
c zero Dirichlet boundary condition using standard
c central difference.
c
c ... Call DSBAND to find eigenvalues LAMBDA such that
c A*x = x*LAMBDA.
c
c
c ... Use mode 1 of DSAUPD .
c
c\BeginLib
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -62,9 +62,9 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn)
c
@@ -76,15 +76,15 @@ c
integer nev, ncv, ku, kl, info, i, j, ido,
& n, nx, lo, isub, isup, idiag, maxitr, mode,
& nconv
Double precision
Double precision
& tol, sigma, h2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 )
c
@@ -92,9 +92,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
c
c %--------------------%
c | Intrinsic function |
@@ -121,13 +121,13 @@ c | However, the following conditions must be |
c | satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR1: N is greater than MAXN '
go to 9000
@@ -153,7 +153,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv**2+8*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -169,7 +169,7 @@ c
mode = 1
c
iparam(3) = maxitr
iparam(7) = mode
iparam(7) = mode
c
c %----------------------------------------%
c | Construct the matrix A in LAPACK-style |
@@ -190,10 +190,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -201,12 +201,12 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0D+0 / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
do 50 i = 1, nx
@@ -214,8 +214,8 @@ c
do 40 j = lo+1, lo+nx-1
a(isup,j+1) = -one / h2
a(isub,j) = -one / h2
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -229,8 +229,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %-------------------------------------%
c | Call DSBAND to find eigenvalues and |
@@ -239,18 +239,18 @@ c | returned in the first column of D. |
c | Eigenvectors are returned in the |
c | first NCONV (=IPARAM(5)) columns of |
c | V. |
c %-------------------------------------%
c %-------------------------------------%
c
rvec = .true.
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
c
nconv = iparam(5)
c
c
c %-----------------------------------%
c | Print out convergence information |
c %-----------------------------------%
@@ -278,18 +278,18 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
d(j,2) = dnrm2 (n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call dmout (6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -300,8 +300,8 @@ c
print *, ' '
print *, ' Error with _sband, info= ', info
print *, ' Check the documentation of _sband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+41 -41
View File
@@ -1,12 +1,12 @@
program dsbdr2
program dsbdr2
c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is derived from the discretization of
c the 2-dimensional Laplacian on the unit square
c the 2-dimensional Laplacian on the unit square
c with zero Dirichlet boundary condition using standard
c central difference.
c
c ... Call DSBAND to find eigenvalues LAMBDA closest to
c ... Call DSBAND to find eigenvalues LAMBDA closest to
c SIGMA such that
c A*x = x*LAMBDA.
c
@@ -48,13 +48,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -63,10 +63,10 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn)
c
c %---------------%
@@ -77,15 +77,15 @@ c
integer nev, ncv, ku, kl, info, i, j, ido,
& n, nx, lo, isub, isup, idiag, maxitr, mode,
& nconv
Double precision
Double precision
& tol, sigma, h2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 )
c
@@ -93,9 +93,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , daxpy , dgbmv
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , daxpy , dgbmv
c
c %-----------------------%
c | Executable Statements |
@@ -118,13 +118,13 @@ c | However, the following conditions must be |
c | satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR2: N is greater than MAXN '
go to 9000
@@ -151,7 +151,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -167,7 +167,7 @@ c
mode = 3
c
iparam(3) = maxitr
iparam(7) = mode
iparam(7) = mode
c
c %----------------------------------------%
c | Construct the matrix A in LAPACK-style |
@@ -188,10 +188,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -199,12 +199,12 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0D+0 / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
do 50 i = 1, nx
@@ -212,8 +212,8 @@ c
do 40 j = lo+1, lo+nx-1
a(isup,j+1) = -one / h2
a(isub,j) = -one / h2
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -227,8 +227,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %-------------------------------------%
c | Call DSBAND to find eigenvalues and |
@@ -239,10 +239,10 @@ c | first NCONV (=IPARAM(5)) columns of |
c | V. |
c %-------------------------------------%
c
rvec = .true.
call dsband ( rvec,'A', select, d, v, ldv, sigma, n, a, m,
& lda, rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
rvec = .true.
call dsband ( rvec,'A', select, d, v, ldv, sigma, n, a, m,
& lda, rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
@@ -276,18 +276,18 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call daxpy (n, -d(j,1), v(1,j), 1, ax, 1)
d(j,2) = dnrm2 (n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call dmout (6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -298,8 +298,8 @@ c
print *, ' '
print *, ' Error with _sband, info= ', info
print *, ' Check the documentation of _sband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+35 -35
View File
@@ -1,11 +1,11 @@
program dsbdr3
program dsbdr3
c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
c with zero Dirichlet boundary condition, M is the mass
c formed by using piecewise linear elements on [0,1].
c
c ... Call DSBAND with regular mode to find eigenvalues LAMBDA
c ... Call DSBAND with regular mode to find eigenvalues LAMBDA
c such that
c A*x = LAMBDA*M*x.
c
@@ -46,13 +46,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -61,9 +61,9 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn), mx(maxn)
c
@@ -74,15 +74,15 @@ c
character which*2, bmat
integer nev, ncv, ku, kl, info, j, ido,
& n, isub, isup, idiag, maxitr, mode, nconv
Double precision
Double precision
& tol, h, sigma, r1, r2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two, four, six
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 ,
& four = 4.0D+0 , six = 6.0D+0 )
@@ -91,9 +91,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , daxpy , dgbmv
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , daxpy , dgbmv
c
c %--------------------%
c | Intrinsic function |
@@ -116,12 +116,12 @@ c | However, the following conditions must be |
c | satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
n = 100
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR3: N is greater than MAXN '
go to 9000
@@ -147,7 +147,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv**2+8*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -184,10 +184,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -197,12 +197,12 @@ c
do 30 j = 1, n
a(idiag,j) = two / h
m(idiag,j) = r1 * h
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
r2 = one / six
isup = kl+ku
isub = kl+ku+2
@@ -223,9 +223,9 @@ c | V. |
c %-------------------------------------%
c
rvec = .true.
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
@@ -259,21 +259,21 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy (n, -d(j,1), mx, 1, ax, 1)
d(j,2) = dnrm2 (n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call dmout (6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -284,8 +284,8 @@ c
print *, ' '
print *, ' Error with _sband, info= ', info
print *, ' Check the documentation of _sband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+36 -36
View File
@@ -1,11 +1,11 @@
program dsbdr4
program dsbdr4
c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
c with zero Dirichlet boundary condition, M is the mass
c formed by using piecewise linear elements on [0,1].
c
c ... Call DSBAND with shift-invert mode to find eigenvalues LAMBDA
c ... Call DSBAND with shift-invert mode to find eigenvalues LAMBDA
c closest to SIGMA such that
c A*x = LAMBDA*M*x.
c
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -62,9 +62,9 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn), mx(maxn)
c
@@ -75,15 +75,15 @@ c
character which*2, bmat
integer nev, ncv, ku, kl, info, j, ido,
& n, isub, isup, idiag, maxitr, mode, nconv
Double precision
Double precision
& tol, h, sigma, r1, r2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two, four, six
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 ,
& four = 4.0D+0 , six = 6.0D+0 )
@@ -92,9 +92,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , daxpy , dgbmv
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , daxpy , dgbmv
c
c %-----------------------%
c | Executable Statements |
@@ -113,12 +113,12 @@ c | However, the following conditions must be |
c | satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR4: N is greater than MAXN '
go to 9000
@@ -145,7 +145,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv**2+8*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -182,10 +182,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -195,19 +195,19 @@ c
do 30 j = 1, n
a(idiag,j) = two / h
m(idiag,j) = r1 * h
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
r2 = one / six
isup = kl+ku
isub = kl+ku+2
do 60 j = 1, n-1
a(isup,j+1) = -one / h
a(isub,j) = -one / h
m(isup,j+1) = r2 * h
m(isup,j+1) = r2 * h
m(isub,j) = r2 * h
60 continue
c
@@ -221,9 +221,9 @@ c | V. |
c %-------------------------------------%
c
rvec = .true.
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m,
& lda, rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m,
& lda, rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
@@ -243,7 +243,7 @@ c
print *, ' The number of Lanczos vectors generated',
& ' (NCV) is ', ncv
print *, ' The number of converged Ritz values is ',
& nconv
& nconv
print *, ' What portion of the spectrum ', which
print *, ' The number of Implicit Arnoldi',
& ' update taken is ', iparam(3)
@@ -257,21 +257,21 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy (n, -d(j,1), mx, 1, ax, 1)
d(j,2) = dnrm2 (n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call dmout (6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -282,8 +282,8 @@ c
print *, ' '
print *, ' Error with _sband, info= ', info
print *, ' Check the documentation of _sband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+35 -35
View File
@@ -1,11 +1,11 @@
program dsbdr5
program dsbdr5
c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
c with zero Dirichlet boundary condition, KG is the mass
c formed by using piecewise linear elements on [0,1].
c formed by using piecewise linear elements on [0,1].
c
c ... Call DSBAND with Buckling mode to find eigenvalues LAMBDA
c ... Call DSBAND with Buckling mode to find eigenvalues LAMBDA
c such that
c A*x = M*x*LAMBDA.
c
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -62,9 +62,9 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn), mx(maxn)
c
@@ -75,15 +75,15 @@ c
character which*2, bmat
integer nev, ncv, kl, ku, info, j, ido,
& n, isub, isup, idiag, maxitr, mode, nconv
Double precision
Double precision
& tol, h, sigma, r1, r2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two, four, six
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 ,
& four = 4.0D+0 , six = 6.0D+0 )
@@ -92,9 +92,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , dgbmv , daxpy
c
c %--------------------%
c | Intrinsic function |
@@ -118,12 +118,12 @@ c | the spectrum. However, the following conditions |
c | must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR5: N is greater than MAXN '
go to 9000
@@ -150,7 +150,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv**2+8*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -187,10 +187,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -200,12 +200,12 @@ c
do 30 j = 1, n
a(idiag,j) = two / h
m(idiag,j) = r1 * h
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
r2 = one / six
isup = kl+ku
isub = kl+ku+2
@@ -226,9 +226,9 @@ c | V. |
c %-------------------------------------%
c
rvec = .true.
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
@@ -262,21 +262,21 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy (n, -d(j,1), mx, 1, ax, 1)
d(j,2) = dnrm2 (n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call dmout (6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -287,8 +287,8 @@ c
print *, ' '
print *, ' Error with _sband, info= ', info
print *, ' Check the documentation of _sband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+34 -34
View File
@@ -1,10 +1,10 @@
program dsbdr6
program dsbdr6
c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
c with zero Dirichlet boundary condition, M is the mass
c formed by using piecewise linear elements on [0,1].
c
c
c ... Call DSBAND with Cayley mode to find eigenvalues LAMBDA such that
c A*x = LAMBDA*M*x.
c
@@ -46,13 +46,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -61,9 +61,9 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Double precision
Double precision
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn), mx(maxn)
c
@@ -74,15 +74,15 @@ c
character which*2, bmat
integer nev, ncv, ku, kl, info, j, ido,
& n, isub, isup, idiag, maxitr, mode, nconv
Double precision
Double precision
& tol, h, sigma, r1, r2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& one, zero, two, four, six
parameter (one = 1.0D+0 , zero = 0.0D+0 , two = 2.0D+0 ,
& four = 4.0D+0 , six = 6.0D+0 )
@@ -91,9 +91,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , daxpy , dgbmv
Double precision
& dlapy2 , dnrm2
external dlapy2 , dnrm2 , daxpy , dgbmv
c
c %--------------------%
c | Intrinsic function |
@@ -117,12 +117,12 @@ c | the spectrum. However, the following conditions |
c | must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR6: N is greater than MAXN '
go to 9000
@@ -149,7 +149,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv**2+8*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -186,10 +186,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -199,12 +199,12 @@ c
do 30 j = 1, n
a(idiag,j) = two / h
m(idiag,j) = r1 * h
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
r2 = one / six
isup = kl+ku
isub = kl+ku+2
@@ -225,9 +225,9 @@ c | V. |
c %-------------------------------------%
c
rvec = .true.
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
call dsband ( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
@@ -261,21 +261,21 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call dgbmv ('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call daxpy (n, -d(j,1), mx, 1, ax, 1)
d(j,2) = dnrm2 (n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call dmout (6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -286,8 +286,8 @@ c
print *, ' '
print *, ' Error with _band, info= ', info
print *, ' Check the documentation of _band '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
-158
View File
@@ -1,158 +0,0 @@
#
# makefile to run simple examples of the reverse communication
# protocol.
#
# Modify if ARPACK library was built somewhere else.
#
# If ALIBS (defined in ../../ARmake.inc) contains the BLAS and LAPACK
# libraries installed on your system, you DO NOT need to change this
# makefile. OTHERWISE, you may need to modify the Makefile in the top level
# ARPACK directory tree to include sdrv, ddrv, cdrv, or zdrv in the
# definition of the PRECISION variable, and issue 'make lib' there.
# For example:
#
# PRECISION = single double sdrv ddrv
#
#\SCCS Information: @(#)
# FILE: makefile SID: 2.2 DATE OF SID: 9/24/96 RELEASE: 2
#
include ../../ARmake.inc
# Issue "make band" to make all 32 band drivers.
# Issue "make ssbdr" to make 6 single precision symmetric band drivers.
# Issue "make dsbdr" to make 6 double precision symmetric band drivers.
# Issue "make snbdr" to make 6 single precision nonsymmetric band drivers.
# Issue "make dnbdr" to make 6 double precision nonsymmetric band drivers.
# Issue "make cnbdr" to make 4 single precision complex band drivers.
# Issue "make znbdr" to make 4 double precision complex band drivers.
#
band: ssbdr dsbdr snbdr dnbdr cnbdr znbdr
#
#---------------------------------------------------------------------
# Simple symetric problem using BAND solver (single precision)
#
ssbdr: ssbdr1 ssbdr2 ssbdr3 ssbdr4 ssbdr5 ssbdr6
ssbdr1: ssbdr1.o ssband.o
$(FC) $(FFLAGS) ssbdr1.o ssband.o $(ALIBS) -o ssbdr1
#
ssbdr2: ssbdr2.o ssband.o
$(FC) $(FFLAGS) ssbdr2.o ssband.o $(ALIBS) -o ssbdr2
#
ssbdr3: ssbdr3.o ssband.o
$(FC) $(FFLAGS) ssbdr3.o ssband.o $(ALIBS) -o ssbdr3
#
ssbdr4: ssbdr4.o ssband.o
$(FC) $(FFLAGS) ssbdr4.o ssband.o $(ALIBS) -o ssbdr4
#
ssbdr5: ssbdr5.o ssband.o
$(FC) $(FFLAGS) ssbdr5.o ssband.o $(ALIBS) -o ssbdr5
#
ssbdr6: ssbdr6.o ssband.o
$(FC) $(FFLAGS) ssbdr6.o ssband.o $(ALIBS) -o ssbdr6
#
#-------------------------------------------------------------
#
# Simple symmetric problem using BAND solver (double precision)
#
dsbdr: dsbdr1 dsbdr2 dsbdr3 dsbdr4 dsbdr5 dsbdr6
dsbdr1: dsbdr1.o dsband.o
$(FC) $(FFLAGS) dsbdr1.o dsband.o $(ALIBS) -o dsbdr1
#
dsbdr2: dsbdr2.o dsband.o
$(FC) $(FFLAGS) dsbdr2.o dsband.o $(ALIBS) -o dsbdr2
#
dsbdr3: dsbdr3.o dsband.o
$(FC) $(FFLAGS) dsbdr3.o dsband.o $(ALIBS) -o dsbdr3
#
dsbdr4: dsbdr4.o dsband.o
$(FC) $(FFLAGS) dsbdr4.o dsband.o $(ALIBS) -o dsbdr4
#
dsbdr5: dsbdr5.o dsband.o
$(FC) $(FFLAGS) dsbdr5.o dsband.o $(ALIBS) -o dsbdr5
#
dsbdr6: dsbdr6.o dsband.o
$(FC) $(FFLAGS) dsbdr6.o dsband.o $(ALIBS) -o dsbdr6
#
#----------------------------------------------------------------------
# Simple nonsymmetric problem using BAND solver (single precision)
#
snbdr: snbdr1 snbdr2 snbdr3 snbdr4 snbdr5 snbdr6
snbdr1: snbdr1.o snband.o
$(FC) $(FFLAGS) snbdr1.o snband.o $(ALIBS) -o snbdr1
#
snbdr2: snbdr2.o snband.o
$(FC) $(FFLAGS) snbdr2.o snband.o $(ALIBS) -o snbdr2
#
snbdr3: snbdr3.o snband.o
$(FC) $(FFLAGS) snbdr3.o snband.o $(ALIBS) -o snbdr3
#
snbdr4: snbdr4.o snband.o
$(FC) $(FFLAGS) snbdr4.o snband.o $(ALIBS) -o snbdr4
#
snbdr5: snbdr5.o snband.o
$(FC) $(FFLAGS) snbdr5.o snband.o $(ALIBS) -o snbdr5
#
snbdr6: snbdr6.o snband.o
$(FC) $(FFLAGS) snbdr6.o snband.o $(ALIBS) -o snbdr6
#
#-------------------------------------------------------------------------
# Simple nonsymmetric problem using BAND solver (double precision)
#
dnbdr: dnbdr1 dnbdr2 dnbdr3 dnbdr4 dnbdr5 dnbdr6
dnbdr1: dnbdr1.o dnband.o
$(FC) $(FFLAGS) dnbdr1.o dnband.o $(ALIBS) -o dnbdr1
#
dnbdr2: dnbdr2.o dnband.o
$(FC) $(FFLAGS) dnbdr2.o dnband.o $(ALIBS) -o dnbdr2
#
dnbdr3: dnbdr3.o dnband.o
$(FC) $(FFLAGS) dnbdr3.o dnband.o $(ALIBS) -o dnbdr3
#
dnbdr4: dnbdr4.o dnband.o
$(FC) $(FFLAGS) dnbdr4.o dnband.o $(ALIBS) -o dnbdr4
#
dnbdr5: dnbdr5.o dnband.o
$(FC) $(FFLAGS) dnbdr5.o dnband.o $(ALIBS) -o dnbdr5
#
dnbdr6: dnbdr6.o dnband.o
$(FC) $(FFLAGS) dnbdr6.o dnband.o $(ALIBS) -o dnbdr6
#
#-------------------------------------------------------------------------
# Complex problem using BAND solver (single precision complex)
#
cnbdr: cnbdr1 cnbdr2 cnbdr3 cnbdr4
cnbdr1: cnbdr1.o cnband.o
$(FC) $(FFLAGS) cnbdr1.o cnband.o $(ALIBS) -o cnbdr1
#
cnbdr2: cnbdr2.o cnband.o
$(FC) $(FFLAGS) cnbdr2.o cnband.o $(ALIBS) -o cnbdr2
#
cnbdr3: cnbdr3.o cnband.o
$(FC) $(FFLAGS) cnbdr3.o cnband.o $(ALIBS) -o cnbdr3
#
cnbdr4: cnbdr4.o cnband.o
$(FC) $(FFLAGS) cnbdr4.o cnband.o $(ALIBS) -o cnbdr4
#
#-------------------------------------------------------------------------
# Complex problem using BAND solver (double precision complex)
#
znbdr: znbdr1 znbdr2 znbdr3 znbdr4
znbdr1: znbdr1.o znband.o
$(FC) $(FFLAGS) znbdr1.o znband.o $(ALIBS) -o znbdr1
#
znbdr2: znbdr2.o znband.o
$(FC) $(FFLAGS) znbdr2.o znband.o $(ALIBS) -o znbdr2
#
znbdr3: znbdr3.o znband.o
$(FC) $(FFLAGS) znbdr3.o znband.o $(ALIBS) -o znbdr3
#
znbdr4: znbdr4.o znband.o
$(FC) $(FFLAGS) znbdr4.o znband.o $(ALIBS) -o znbdr4
+201 -201
View File
@@ -35,18 +35,18 @@ c Mode 2: A*z = lambda*M*z, M symmetric positive definite
c ===> OP = inv[M]*A and B = M.
c
c Mode 3: A*z = lambda*M*z, M symmetric semi-definite
c ===> OP = Real_Part{ inv[A - sigma*M]*M } and B = M.
c ===> OP = Real_Part{ inv[A - sigma*M]*M } and B = M.
c ===> shift-and-invert mode (in real arithmetic)
c If OP*z = amu*z, then
c If OP*z = amu*z, then
c amu = 1/2 * [ 1/(lambda-sigma) + 1/(lambda-conjg(sigma)) ].
c Note: If sigma is real, i.e. imaginary part of sigma is zero;
c Real_Part{ inv[A - sigma*M]*M } == inv[A - sigma*M]*M
c amu == 1/(lambda-sigma).
c
c Real_Part{ inv[A - sigma*M]*M } == inv[A - sigma*M]*M
c amu == 1/(lambda-sigma).
c
c Mode 4: A*z = lambda*M*z, M symmetric semi-definite
c ===> OP = Imaginary_Part{ inv[A - sigma*M]*M } and B = M.
c ===> OP = Imaginary_Part{ inv[A - sigma*M]*M } and B = M.
c ===> shift-and-invert mode (in real arithmetic)
c If OP*z = amu*z, then
c If OP*z = amu*z, then
c amu = 1/2i * [ 1/(lambda-sigma) - 1/(lambda-conjg(sigma)) ].
c
c
@@ -54,28 +54,28 @@ c The choice of mode must be specified in IPARAM(7) defined below.
c
c \Usage
c call snband
c ( RVEC, HOWMNY, SELECT, DR, DI, Z, LDZ, SIGMAR, SIGMAI,
c WORKEV, V, N, AB, MB, LDA, RFAC, CFAC, KL, KU, WHICH,
c BMAT, NEV, TOL, RESID, NCV, V, LDV, IPARAM, WORKD,
c ( RVEC, HOWMNY, SELECT, DR, DI, Z, LDZ, SIGMAR, SIGMAI,
c WORKEV, V, N, AB, MB, LDA, RFAC, CFAC, KL, KU, WHICH,
c BMAT, NEV, TOL, RESID, NCV, V, LDV, IPARAM, WORKD,
c WORKL, LWORKL, WORKC, IWORK, INFO )
c
c \Arguments
c
c RVEC LOGICAL (INPUT)
c Specifies whether a basis for the invariant subspace corresponding
c to the converged Ritz value approximations for the eigenproblem
c
c RVEC LOGICAL (INPUT)
c Specifies whether a basis for the invariant subspace corresponding
c to the converged Ritz value approximations for the eigenproblem
c A*z = lambda*B*z is computed.
c
c RVEC = .FALSE. Compute Ritz values only.
c
c RVEC = .TRUE. Compute the Ritz vectors or Schur vectors.
c See Remarks below.
c See Remarks below.
c
c HOWMNY Character*1 (INPUT)
c Specifies the form of the basis for the invariant subspace
c HOWMNY Character*1 (INPUT)
c Specifies the form of the basis for the invariant subspace
c corresponding to the converged Ritz values that is to be computed.
c
c = 'A': Compute NEV Ritz vectors;
c = 'A': Compute NEV Ritz vectors;
c = 'P': Compute NEV Schur vectors;
c = 'S': compute some of the Ritz vectors, specified
c by the logical array SELECT.
@@ -83,23 +83,23 @@ c
c SELECT Logical array of dimension NCV. (INPUT)
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
c computed. To select the Ritz vector corresponding to a
c Ritz value (DR(j), DI(j)), SELECT(j) must be set to .TRUE..
c Ritz value (DR(j), DI(j)), SELECT(j) must be set to .TRUE..
c If HOWMNY = 'A' or 'P', SELECT is used as internal workspace.
c
c DR Real array of dimension NEV+1. (OUTPUT)
c On exit, DR contains the real part of the Ritz value approximations
c to the eigenvalues of A*z = lambda*B*z.
c On exit, DR contains the real part of the Ritz value approximations
c to the eigenvalues of A*z = lambda*B*z.
c
c DI Real array of dimension NEV+1. (OUTPUT)
c On exit, DI contains the imaginary part of the Ritz value
c On exit, DI contains the imaginary part of the Ritz value
c approximations to the eigenvalues of A*z = lambda*B*z associated
c with DR.
c with DR.
c
c NOTE: When Ritz values are complex, they will come in complex
c conjugate pairs. If eigenvectors are requested, the
c corresponding Ritz vectors will also come in conjugate
c pairs and the real and imaginary parts of these are
c represented in two consecutive columns of the array Z
c NOTE: When Ritz values are complex, they will come in complex
c conjugate pairs. If eigenvectors are requested, the
c corresponding Ritz vectors will also come in conjugate
c pairs and the real and imaginary parts of these are
c represented in two consecutive columns of the array Z
c (see below).
c
c Z Real N by NEV+1 array if RVEC = .TRUE. and HOWMNY = 'A'. (OUTPUT)
@@ -124,24 +124,24 @@ c the array Z may be set equal to first NEV+1 columns of the Arnoldi
c basis array V computed by SNAUPD. In this case the Arnoldi basis
c will be destroyed and overwritten with the eigenvector basis.
c
c LDZ Integer. (INPUT)
c The leading dimension of the array Z. If Ritz vectors are
c desired, then LDZ >= max( 1, N ). In any case, LDZ >= 1.
c
c SIGMAR Real (INPUT)
c If IPARAM(7) = 3 or 4, represents the real part of the shift.
c Not referenced if IPARAM(7) = 1 or 2.
c
c SIGMAI Real (INPUT)
c If IPARAM(7) = 3 or 4, represents the imaginary part of the
c shift.
c Not referenced if IPARAM(7) = 1 or 2.
c
c WORKEV Real work array of dimension 3*NCV. (WORKSPACE)
c
c N Integer. (INPUT)
c Dimension of the eigenproblem.
c
c LDZ Integer. (INPUT)
c The leading dimension of the array Z. If Ritz vectors are
c desired, then LDZ >= max( 1, N ). In any case, LDZ >= 1.
c
c SIGMAR Real (INPUT)
c If IPARAM(7) = 3 or 4, represents the real part of the shift.
c Not referenced if IPARAM(7) = 1 or 2.
c
c SIGMAI Real (INPUT)
c If IPARAM(7) = 3 or 4, represents the imaginary part of the
c shift.
c Not referenced if IPARAM(7) = 1 or 2.
c
c WORKEV Real work array of dimension 3*NCV. (WORKSPACE)
c
c N Integer. (INPUT)
c Dimension of the eigenproblem.
c
c AB Real array of dimension LDA by N. (INPUT)
c The matrix A in band storage, in rows KL+1 to
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
@@ -151,25 +151,25 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
c
c MB Real array of dimension LDA by N. (INPUT)
c The matrix M in band storage, in rows KL+1 to
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c The j-th column of M is stored in the j-th column of the
c array AB as follows:
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
c Not referenced if IPARAM(7) = 1
c
c LDA Integer. (INPUT)
c Leading dimension of AB, MB, RFAC and CFAC.
c Leading dimension of AB, MB, RFAC and CFAC.
c
c RFAC Real array of LDA by N. (WORKSPACE/OUTPUT)
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
c is invoked. It is used to store the LU factors of
c (A-sigma*M) when IPARAM(7) = 3 is invoked with a real shift.
c It is not referenced when IPARAM(7) = 1 or 4.
c
c CFAC Complex array of LDA by N. (WORKSPACE/OUTPUT)
c CFAC is used to store (A-SIGMA*M) and its LU factors
c when IPARAM(7) = 3 or 4 are used with a complex shift SIGMA.
c On exit, it contains the LU factors of (A-SIGMA*M).
c when IPARAM(7) = 3 or 4 are used with a complex shift SIGMA.
c On exit, it contains the LU factors of (A-SIGMA*M).
c It is not referenced when IPARAM(7) = 1 or 2.
c
c KL Integer. (INPUT)
@@ -181,7 +181,7 @@ c
c WHICH Character*2. (INPUT)
c When IPARAM(7)= 1 or 2, WHICH can be set to any one of
c the following.
c
c
c 'LM' -> want the NEV eigenvalues of largest magnitude.
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
c 'LR' -> want the NEV eigenvalues of largest real part.
@@ -189,8 +189,8 @@ c 'SR' -> want the NEV eigenvalues of smallest real part.
c 'LI' -> want the NEV eigenvalues of largest imaginary part.
c 'SI' -> want the NEV eigenvalues of smallest imaginary part.
c
c When IPARAM(7) = 3 or 4, WHICH should be set to 'LM' only.
c
c When IPARAM(7) = 3 or 4, WHICH should be set to 'LM' only.
c
c BMAT Character*1. (INPUT)
c BMAT specifies the type of the matrix B that defines the
c semi-inner product for the operator OP.
@@ -199,9 +199,9 @@ c BMAT = 'G' -> generalized eigenvalue problem A*z = lambda*M*z
c NEV Integer. (INPUT)
c Number of eigenvalues to be computed.
c
c
c TOL Real scalar. (INPUT)
c Stopping criteria: the relative accuracy of the Ritz value
c Stopping criteria: the relative accuracy of the Ritz value
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I)).
c If TOL .LE. 0. is passed a default is set:
c DEFAULT = SLAMCH('EPS') (machine precision as computed
@@ -221,12 +221,12 @@ c Represents the dimension of the Arnoldi basis constructed
c by snaupd for OP.
c
c V Real array N by NCV+1. (OUTPUT)
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
c represent approximate Schur vectors that span the
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
c represent approximate Schur vectors that span the
c desired invariant subspace.
c NOTE: The array Z may be set equal to first NEV+1 columns of the
c NOTE: The array Z may be set equal to first NEV+1 columns of the
c Arnoldi basis vector array V computed by SNAUPD. In this case
c if RVEC = .TRUE. and HOWMNY='A', then the first NCONV=IPARAM(5)
c if RVEC = .TRUE. and HOWMNY='A', then the first NCONV=IPARAM(5)
c are the desired Ritz vectors.
c
c LDV Integer. (INPUT)
@@ -234,7 +234,7 @@ c Leading dimension of V exactly as declared in the calling
c program.
c
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
c IPARAM(1) = ISHIFT:
c IPARAM(1) = ISHIFT:
c The shifts selected at each iteration are used to restart
c the Arnoldi iteration in an implicit fashion.
c It is set to 1 in this subroutine. The user do not need
@@ -248,7 +248,7 @@ c combination of Ritz vectors associated with the
c "wanted" eigenvalues.
c -------------------------------------------------------------
c
c IPARAM(2) = No longer referenced.
c IPARAM(2) = No longer referenced.
c
c IPARAM(3) = MXITER
c On INPUT: max number of Arnoldi update iterations allowed.
@@ -262,9 +262,9 @@ c
c IPARAM(6) = IUPD
c Not referenced. Implicit restarting is ALWAYS used.
c
c IPARAM(7) = IPARAM(7):
c IPARAM(7) = IPARAM(7):
c On INPUT determines what type of eigenproblem is being solved.
c Must be 1,2,3,4; See under \Description of snband for the
c Must be 1,2,3,4; See under \Description of snband for the
c four modes available.
c
c IPARAM(9) = NUMOP, IPARAM(10) = NUMOPB, IPARAM(11) = NUMREO,
@@ -280,22 +280,22 @@ c LWORKL Integer. (INPUT)
c LWORKL must be at least 3*NCV**2 + 6*NCV.
c
c WORKC Complex array of length N. (WORKSPACE)
c Workspace used when IPARAM(7) = 3 or 4 for storing a temporary
c Workspace used when IPARAM(7) = 3 or 4 for storing a temporary
c complex vector.
c
c IWORK Integer array of dimension at least N. (WORKSPACE)
c Used when IPARAM(7)=2,3,4 to store the pivot information in the
c Used when IPARAM(7)=2,3,4 to store the pivot information in the
c factorization of M or (A-SIGMA*M).
c
c
c INFO Integer. (INPUT/OUTPUT)
c Error flag on output.
c = 0: Normal exit.
c = 1: The Schur form computed by LAPACK routine slahqr
c could not be reordered by LAPACK routine strsen.
c Re-enter subroutine SNEUPD with IPARAM(5)=NCV and
c increase the size of the arrays DR and DI to have
c dimension at least NCV and allocate at least NCV
c columns for Z. NOTE: Not necessary if Z and V share
c Re-enter subroutine SNEUPD with IPARAM(5)=NCV and
c increase the size of the arrays DR and DI to have
c dimension at least NCV and allocate at least NCV
c columns for Z. NOTE: Not necessary if Z and V share
c the same space. Please notify the authors.
c
c = -1: N must be positive.
@@ -314,9 +314,9 @@ c = -12: HOWMNY = 'S' not yet implemented
c = -13: HOWMNY must be one of 'A' or 'P'
c = -14: SNAUPD did not find any eigenvalues to sufficient
c accuracy.
c = -15: Overflow occurs when we try to transform the Ritz
c = -15: Overflow occurs when we try to transform the Ritz
c values returned from SNAUPD to those of the original
c problem using Rayleigh Quotient.
c problem using Rayleigh Quotient.
c = -9999: Could not build an Arnoldi factorization.
c IPARAM(5) returns the size of the current
c Arnoldi factorization.
@@ -332,7 +332,7 @@ c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in
c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992),
c pp 357-385.
c
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
c Restarted Arnoldi Iteration", Ph.D thesis, TR95-13, Rice Univ,
c May 1995.
c
@@ -363,9 +363,9 @@ c Ritz vectors. Thus, their numerical properties are often superior.
c If RVEC = .TRUE. then the relationship
c A * V(:,1:IPARAM(5)) = V(:,1:IPARAM(5)) * T, and
c V(:,1:IPARAM(5))' * V(:,1:IPARAM(5)) = I are approximately satisfied.
c Here T is the leading submatrix of order IPARAM(5) of the real
c Here T is the leading submatrix of order IPARAM(5) of the real
c upper quasi-triangular matrix stored workl(ipntr(12)). That is,
c T is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks;
c T is block upper triangular with 1-by-1 and 2-by-2 diagonal blocks;
c each 2-by-2 diagonal block has its diagonal elements equal and its
c off-diagonal elements of opposite sign. Corresponding to each 2-by-2
c diagonal block is a complex conjugate pair of Ritz values. The real
@@ -387,20 +387,20 @@ c\EndLib
c
c---------------------------------------------------------------------
c
subroutine snband( rvec, howmny, select, dr, di, z, ldz, sigmar,
& sigmai, workev, n, ab, mb, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv,
subroutine snband( rvec, howmny, select, dr, di, z, ldz, sigmar,
& sigmai, workev, n, ab, mb, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv,
& iparam, workd, workl, lworkl, workc, iwork, info)
c
c %------------------%
c | Scalar Arguments |
c %------------------%
c
c
character which*2, bmat, howmny
integer n, lda, kl, ku, nev, ncv, ldv,
& ldz, lworkl, info
& ldz, lworkl, info
Real
& tol, sigmar, sigmai
& tol, sigmar, sigmai
c
c %-----------------%
c | Array Arguments |
@@ -410,7 +410,7 @@ c
logical select(*)
Real
& dr(*), di(*), resid(*), v(ldv,*), z(ldz,*),
& ab(lda,*), mb(lda,*), rfac(lda,*),
& ab(lda,*), mb(lda,*), rfac(lda,*),
& workd(*), workl(*), workev(*)
Complex
& cfac(lda,*), workc(*)
@@ -426,9 +426,9 @@ c | Local Scalars |
c %---------------%
c
integer ido, i, j, type, imid, itop, ibot, ierr
Real
& numr, denr, deni, dmdul, safmin
logical rvec, first
Real
& numr, denr, deni, dmdul, safmin
logical rvec, first
c
c %------------%
c | Parameters |
@@ -445,7 +445,7 @@ c %-----------------------------%
c
Real
& sdot, snrm2, slapy2, slamch
external sdot, scopy, sgbmv, cgbtrf, cgbtrs, sgbtrf,
external sdot, scopy, sgbmv, cgbtrf, cgbtrs, sgbtrf,
& sgbtrs, snrm2, slapy2, slacpy, slamch
c
c %---------------------%
@@ -464,17 +464,17 @@ c | that 1/sfmin does not overflow |
c %--------------------------------%
c
safmin = slamch('safmin')
c
c
c %----------------------------------------------------------------%
c | Set type of the problem to be solved. Check consistency |
c | between BMAT and IPARAM(7). |
c | type = 1 --> Solving standard problem in regular mode. |
c | type = 2 --> Solving standard problem in shift-invert mode. |
c | type = 2 --> Solving standard problem in shift-invert mode. |
c | type = 3 --> Solving generalized problem in regular mode. |
c | type = 4 --> Solving generalized problem in shift-invert mode. |
c | type = 5 --> Solving standard problem in shift-invert mode |
c | using iparam(7) = 4 in SNAUPD. |
c | type = 6 --> Solving generalized problem in shift-invert mode. |
c | type = 6 --> Solving generalized problem in shift-invert mode. |
c | using iparam(7) = 4 in SNAUPD. |
c %----------------------------------------------------------------%
c
@@ -485,19 +485,19 @@ c
else if ( iparam(7) .eq. 2 ) then
type = 3
else if ( iparam(7) .eq. 3 .and. bmat .eq. 'G') then
type = 4
type = 4
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'I') then
type = 5
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'G') then
else if ( iparam(7) .eq. 4 .and. bmat .eq. 'G') then
type = 6
else
print*, ' '
print*, 'BMAT is inconsistent with IPARAM(7).'
print*, ' '
print*, ' '
go to 9000
end if
c
c %----------------------------------%
c %----------------------------------%
c | When type = 5,6 are used, sigmai |
c | must be nonzero. |
c %----------------------------------%
@@ -505,16 +505,16 @@ c
if ( type .eq. 5 .or. type .eq. 6 ) then
if ( sigmai .eq. zero ) then
print*, ' '
print*, '_NBAND: sigmai must be nonzero when type 5 or 6
print*, '_NBAND: sigmai must be nonzero when type 5 or 6
& is used. '
print*, ' '
go to 9000
end if
end if
end if
c
c %------------------------%
c | Initialize the reverse |
c | communication flag. |
c | communication flag. |
c %------------------------%
c
ido = 0
@@ -546,7 +546,7 @@ c | Factor (A-sigma*I). |
c %-------------------------------%
c
if (sigmai .eq. zero) then
c
c
c %-----------------------------------%
c | Construct (A-sigmar*I) and factor |
c | in real arithmetic. |
@@ -558,7 +558,7 @@ c
10 continue
call sgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr )
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*, ' _NBAND: Error with _gbtrf. '
print*, ' '
go to 9000
@@ -574,24 +574,24 @@ c
do 30 j = 1, n
do 20 i = itop, ibot
cfac(i,j) = cmplx(ab(i,j))
20 continue
20 continue
30 continue
c
do 40 j = 1, n
cfac(imid,j) = cfac(imid,j)
cfac(imid,j) = cfac(imid,j)
$ - cmplx(sigmar, sigmai)
40 continue
c
call cgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr )
40 continue
c
call cgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr )
if ( ierr .ne. 0) then
print*, ' '
print*, ' _NBAND: Error with _gbtrf. '
print*, ' '
go to 9000
end if
c
c
end if
else if ( type .eq. 3 ) then
c
c %-----------------------------------------------%
@@ -603,7 +603,7 @@ c
call slacpy ('A', ibot, n, mb, lda, rfac, lda )
call sgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*,'_NBAND: Error with _gbtrf.'
print*, ' '
go to 9000
@@ -615,7 +615,7 @@ c %-------------------------------------------%
c | Solving generalized eigenvalue problem in |
c | shift-invert mode. |
c %-------------------------------------------%
c
c
if ( sigmai .eq. zero ) then
c
c %--------------------------------------------%
@@ -624,7 +624,7 @@ c | arithmetic. |
c %--------------------------------------------%
c
do 60 j = 1,n
do 50 i = itop, ibot
do 50 i = itop, ibot
rfac(i,j) = ab(i,j) - sigmar*mb(i,j)
50 continue
60 continue
@@ -642,13 +642,13 @@ c
c %-----------------------------------------------%
c | Construct (A - sigma*M) and factor in complex |
c | arithmetic. |
c %-----------------------------------------------%
c %-----------------------------------------------%
c
do 80 j = 1,n
do 70 i = itop, ibot
cfac(i,j) = cmplx( ab(i,j)-sigmar*mb(i,j),
do 70 i = itop, ibot
cfac(i,j) = cmplx( ab(i,j)-sigmar*mb(i,j),
& -sigmai*mb(i,j) )
70 continue
70 continue
80 continue
c
call cgbtrf(n, n, kl, ku, cfac, lda, iwork, ierr)
@@ -658,7 +658,7 @@ c
print*, ' '
go to 9000
end if
c
c
end if
c
end if
@@ -667,7 +667,7 @@ c %--------------------------------------------%
c | M A I N L O O P (reverse communication) |
c %--------------------------------------------%
c
90 continue
90 continue
c
call snaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
@@ -681,8 +681,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( type .eq. 2 ) then
@@ -690,7 +690,7 @@ c
if (sigmai .eq. zero) then
c
c %----------------------------------%
c | Shift is real. Perform |
c | Shift is real. Perform |
c | y <--- OP*x = inv[A-sigmar*I]*x |
c | to force the starting vector |
c | into the range of OP. |
@@ -700,7 +700,7 @@ c
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' '
print*, ' _NBAND: Error with _bgtrs. '
print*, ' '
go to 9000
@@ -711,8 +711,8 @@ c
c %--------------------------------------------%
c | Shift is COMPLEX. Perform |
c | y <--- OP*x = Real_Part{inv[A-sigma*I]*x} |
c | to force the starting vector into the |
c | range of OP. |
c | to force the starting vector into the |
c | range of OP. |
c %--------------------------------------------%
c
do 100 j = 1, n
@@ -732,21 +732,21 @@ c
workd(ipntr(2)+j-1) = real(workc(j))
110 continue
c
end if
c
end if
c
else if ( type .eq. 3 ) then
c
c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c | to force the starting vector into |
c | to force the starting vector into |
c | the range of OP. |
c %-----------------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
@@ -759,13 +759,13 @@ c
c
c %-----------------------------------------%
c | Perform y <-- OP*x |
c | = Real_part{inv[A-SIGMA*M]*M}*x |
c | = Real_part{inv[A-SIGMA*M]*M}*x |
c | to force the starting vector into the |
c | range of OP. |
c %-----------------------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
if ( sigmai .eq. zero ) then
@@ -773,14 +773,14 @@ c
c %---------------------%
c | Shift is real, stay |
c | in real arithmetic. |
c %---------------------%
c %---------------------%
c
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -792,26 +792,26 @@ c %--------------------------%
c
do 120 i = 1,n
workc(i) = cmplx(workd(ipntr(2)+i-1))
120 continue
120 continue
c
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
& iwork, workc, n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
c
do 130 i = 1, n
workd(ipntr(2)+i-1) = real(workc(i))
130 continue
130 continue
c
end if
c
else if ( type .eq. 5) then
c
c %---------------------------------------%
c %---------------------------------------%
c | Perform y <-- OP*x |
c | = Imaginary_part{inv[A-SIGMA*I]}*x |
c | to force the starting vector into the |
@@ -839,32 +839,32 @@ c
c
c %----------------------------------------%
c | Perform y <-- OP*x |
c | Imaginary_part{inv[A-SIGMA*M]*M} |
c | Imaginary_part{inv[A-SIGMA*M]*M} |
c | to force the starting vector into the |
c | range of OP. |
c %----------------------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
do 160 i = 1,n
workc(i) = cmplx(workd(ipntr(2)+i-1))
160 continue
160 continue
c
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
& iwork, workc, n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
c
do 170 i = 1, n
workd(ipntr(2)+i-1) = aimag(workc(i))
170 continue
c
170 continue
c
end if
c
else if (ido .eq. 1) then
@@ -875,8 +875,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( type .eq. 2) then
@@ -907,7 +907,7 @@ c
& iwork, workc, n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
@@ -924,16 +924,16 @@ c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c %-----------------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error with _bgtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -942,7 +942,7 @@ c
c %--------------------------------------%
c | Perform y <-- inv(A-sigma*M)*(M*x). |
c | (M*x) has been computed and stored |
c | in workd(ipntr(3)). |
c | in workd(ipntr(3)). |
c %--------------------------------------%
c
if ( sigmai .eq. zero ) then
@@ -953,16 +953,16 @@ c | real arithmetic. |
c %------------------------%
c
call scopy(n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
c
else
c
else
c
c %---------------------------%
c | Go to COMPLEX arithmetic. |
@@ -970,26 +970,26 @@ c %---------------------------%
c
do 200 i = 1,n
workc(i) = cmplx(workd(ipntr(3)+i-1))
200 continue
200 continue
c
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
& iwork, workc, n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error in _gbtrs.'
print*, ' '
print*, '_NBAND: Error in _gbtrs.'
print*, ' '
go to 9000
end if
c
do 210 i = 1,n
workd(ipntr(2)+i-1) = real(workc(i))
210 continue
210 continue
c
end if
c
else if ( type .eq. 5 ) then
c
c %---------------------------------------%
c %---------------------------------------%
c | Perform y <-- OP*x |
c | = Imaginary_part{inv[A-SIGMA*I]*x} |
c %---------------------------------------%
@@ -1015,25 +1015,25 @@ c
c
c %-----------------------------------------%
c | Perform y <-- OP*x |
c | = Imaginary_part{inv[A-SIGMA*M]*M}*x. |
c | = Imaginary_part{inv[A-SIGMA*M]*M}*x. |
c %-----------------------------------------%
c
do 240 i = 1,n
workc(i) = cmplx(workd(ipntr(3)+i-1))
240 continue
240 continue
c
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
call cgbtrs ('Notranspose', n, kl, ku, 1, cfac, lda,
& iwork, workc, n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_NBAND: Error with _gbtrs.'
print*, '_NBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
c
do 250 i = 1, n
workd(ipntr(2)+i-1) = aimag(workc(i))
250 continue
250 continue
c
end if
c
@@ -1045,14 +1045,14 @@ c | Not used when |
c | type = 1,2. |
c %--------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else
else
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
c | Either we have convergence, or there is |
c | error. |
c %-----------------------------------------%
c
@@ -1069,7 +1069,7 @@ c
print *, ' '
go to 9000
c
else
else
c
if ( info .eq. 1) then
print *, ' '
@@ -1084,29 +1084,29 @@ c
c
if (iparam(5) .gt. 0) then
c
call sneupd ( rvec, 'A', select, dr, di, z, ldz,
& sigmar, sigmai, workev, bmat, n, which,
call sneupd ( rvec, 'A', select, dr, di, z, ldz,
& sigmar, sigmai, workev, bmat, n, which,
& nev, tol, resid, ncv, v, ldv, iparam,
& ipntr, workd, workl, lworkl, info )
& ipntr, workd, workl, lworkl, info )
c
if ( info .ne. 0) then
c
c
c %------------------------------------%
c | Check the documentation of SNEUPD. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd = ', info
print *, ' Check the documentation of _neupd '
print *, ' '
print *, ' '
go to 9000
c
else if ( sigmai .ne. zero ) then
c
else if ( sigmai .ne. zero ) then
c
if ( type .eq. 4 .or. type .eq. 6 ) then
c
c
first = .true.
do 270 j = 1, iparam(5)
do 270 j = 1, iparam(5)
c
c %----------------------------------%
c | Use Rayleigh Quotient to recover |
@@ -1118,16 +1118,16 @@ c
c
c %--------------------------------------%
c | Eigenvalue is real. Compute |
c | d = (x'*inv[A-sigma*M]*M*x) / (x'*x) |
c | d = (x'*inv[A-sigma*M]*M*x) / (x'*x) |
c %--------------------------------------%
c
call sgbmv('Nontranspose', n, n, kl, ku, one,
call sgbmv('Nontranspose', n, n, kl, ku, one,
$ mb(itop,1), lda, z(1,j), 1, zero,
$ workd, 1)
do i = 1, n
workc(i) = cmplx(workd(i))
end do
call cgbtrs ('Notranspose', n, kl, ku, 1,
call cgbtrs ('Notranspose', n, kl, ku, 1,
$ cfac, lda, iwork, workc, n, info)
do i = 1, n
workd(i) = real(workc(i))
@@ -1151,7 +1151,7 @@ c
go to 9000
end if
c
else if (first) then
else if (first) then
c
c %------------------------%
c | Eigenvalue is complex. |
@@ -1166,7 +1166,7 @@ c
call sgbmv('Nontranspose', n, n, kl, ku,
$ one, mb(itop,1), lda, z(1,j), 1, zero,
$ workd, 1)
call sgbmv('Nontranspose', n, n, kl, ku,
call sgbmv('Nontranspose', n, n, kl, ku,
$ one, mb(itop,1), lda, z(1,j+1), 1,
$ zero, workd(n+1), 1)
do i = 1, n
@@ -1177,7 +1177,7 @@ c %----------------------------%
c | Compute inv(A-sigma*M)*M*x |
c %----------------------------%
c
call cgbtrs('Notranspose',n,kl,ku,1,cfac,
call cgbtrs('Notranspose',n,kl,ku,1,cfac,
$ lda, iwork, workc, n, info)
c
c %-------------------------------%
@@ -1197,7 +1197,7 @@ c %----------------%
c | Compute (x'*x) |
c %----------------%
c
numr = slapy2( snrm2(n, z(1,j), 1),
numr = slapy2( snrm2(n, z(1,j), 1),
& snrm2(n, z(1, j+1), 1) )**2
c
c %----------------------------------------%
@@ -1237,7 +1237,7 @@ c
c
end if
c
270 continue
270 continue
c
else if ( type .eq. 2 .or. type .eq. 5) then
c
@@ -1260,7 +1260,7 @@ c
do i = 1, n
workc(i) = cmplx(z(i,j))
end do
call cgbtrs ('Notranspose', n, kl, ku, 1,
call cgbtrs ('Notranspose', n, kl, ku, 1,
$ cfac, lda, iwork, workc, n, info)
do i = 1, n
workd(i) = real(workc(i))
@@ -1329,7 +1329,7 @@ c | Compute (x'x) / (x'*inv(A-sigma*I)*x). |
c %----------------------------------------%
c
dmdul = slapy2(denr,deni)**2
if (dmdul .ge. safmin) then
if (dmdul .ge. safmin) then
dr(j) = sigmar+numr*denr / dmdul
di(j) = sigmai-numr*deni / dmdul
first = .false.
@@ -1378,7 +1378,7 @@ c %----------------------------------------%
c | L O O P B A C K to call SNAUPD again. |
c %----------------------------------------%
c
go to 90
go to 90
c
9000 continue
c
+49 -49
View File
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -64,12 +64,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Real
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn)
Complex
Complex
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -81,25 +81,25 @@ c
& n, nx, lo, isub, isup, idiag, mode, maxitr,
& nconv
logical rvec, first
Real
Real
& tol, rho, h, h2, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
& two = 2.0E+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& slapy2, snrm2
external slapy2, snrm2, sgbmv, saxpy
external slapy2, snrm2, sgbmv, saxpy
c
c %--------------------%
c | Intrinsic function |
@@ -115,7 +115,7 @@ c %-------------------------------------------------%
c | The number NX is the number of interior points |
c | in the discretization of the 2-dimensional |
c | convection-diffusion operator on the unit |
c | square with zero Dirichlet boundary condition. |
c | square with zero Dirichlet boundary condition. |
c | The number N(=NX*NX) is the dimension of the |
c | matrix. A standard eigenvalue problem is |
c | solved (BMAT = 'I'). NEV is the number of |
@@ -126,13 +126,13 @@ c | spectrum. However, The following conditions |
c | must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR1: N is greater than MAXN '
go to 9000
@@ -158,7 +158,7 @@ c | generated in SNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -173,7 +173,7 @@ c
maxitr = 300
mode = 1
c
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %----------------------------------------%
@@ -195,10 +195,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -208,13 +208,13 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0E+0 / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
rho = 1.0E+2
c
rho = 1.0E+2
isup = kl+ku
isub = kl+ku+2
do 50 i = 1, nx
@@ -222,8 +222,8 @@ c
do 40 j = lo+1, lo+nx-1
a(isup,j+1) = -one/h2 + rho/two/h
a(isub,j) = -one/h2 - rho/two/h
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -237,8 +237,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -247,12 +247,12 @@ c | eigenvalues are returned in the first column |
c | of D, the imaginary parts are returned in the |
c | second column of D. Eigenvectors are returned |
c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c %------------------------------------------------%
c
rvec = .true.
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar, sigmai,
& workev, n, a, m, lda, rfac, cfac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam, workd,
rvec = .true.
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar, sigmai,
& workev, n, a, m, lda, rfac, cfac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam, workd,
& workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -285,8 +285,8 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
do 90 j = 1, nconv
first = .true.
do 90 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
c
@@ -294,11 +294,11 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
d(j,3) = snrm2(n, ax, 1)
d(j,3) = d(j,3) / abs(d(j,1))
c
else if ( first ) then
@@ -307,17 +307,17 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
call saxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call saxpy(n, -d(j,2), v(1,j), 1, ax, 1)
call saxpy(n, -d(j,1), v(1,j+1), 1, ax, 1)
@@ -329,11 +329,11 @@ c
first = .true.
end if
c
90 continue
90 continue
call smout(6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -344,8 +344,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+45 -45
View File
@@ -53,13 +53,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -68,12 +68,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Real
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn)
Complex
Complex
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -85,25 +85,25 @@ c
& n, nx, lo, idiag, isub, isup, mode, maxitr,
& nconv
logical rvec, first
Real
Real
& tol, rho, h2, h, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
& two = 2.0E+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& slapy2, snrm2
external slapy2, snrm2, saxpy, sgbmv
external slapy2, snrm2, saxpy, sgbmv
c
c %--------------------%
c | Intrinsic function |
@@ -135,10 +135,10 @@ c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 20
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR2: N is greater than MAXN '
go to 9000
@@ -151,8 +151,8 @@ c
end if
bmat = 'I'
which = 'LM'
sigmar = 1.0E+4
sigmai = 0.0E+0
sigmar = 1.0E+4
sigmai = 0.0E+0
c
c %-----------------------------------------------------%
c | The work array WORKL is used in SNAUPD as |
@@ -166,7 +166,7 @@ c | generated in SNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -181,7 +181,7 @@ c
maxitr = 300
mode = 3
c
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %----------------------------------------%
@@ -203,10 +203,10 @@ c | and subdiagonals within the band of |
c | matrices A. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -216,22 +216,22 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0E+0 / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
rho = 1.0E+1
rho = 1.0E+1
do 50 i = 1, nx
lo = (i-1)*nx
do 40 j = lo+1, lo+nx-1
a(isub,j+1) = -one/h2 + rho/two/h
a(isup,j) = -one/h2 - rho/two/h
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -245,8 +245,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -258,9 +258,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c
rvec = .true.
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -293,8 +293,8 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
do 90 j = 1, nconv
first = .true.
do 90 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
c
@@ -302,8 +302,8 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
@@ -315,17 +315,17 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
call saxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call saxpy(n, -d(j,1), v(1,j+1), 1, ax, 1)
call saxpy(n, -d(j,2), v(1,j), 1, ax, 1)
@@ -337,11 +337,11 @@ c
first = .true.
end if
c
90 continue
90 continue
call smout(6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -352,8 +352,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+53 -53
View File
@@ -2,7 +2,7 @@
c
c ... Construct matrices A and M in LAPACK-style band form.
c The matrix A and M are derived from the finite element
c discretization of the 1-dimensional convection-diffusion operator
c discretization of the 1-dimensional convection-diffusion operator
c (d^2u/dx^2) + rho*(du/dx)
c on the interval [0,1] with zero boundary condition,
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn)
c
c %--------------%
@@ -64,12 +64,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Real
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
Complex
Complex
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -81,25 +81,25 @@ c
& n, idiag, isup, isub, mode, maxitr,
& nconv
logical rvec, first
Real
Real
& tol, rho, h, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
& two = 2.0E+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& slapy2, snrm2
external slapy2, snrm2, sgbmv, saxpy
external slapy2, snrm2, sgbmv, saxpy
c
c %--------------------%
c | Intrinsic function |
@@ -126,8 +126,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR3: N is greater than MAXN '
go to 9000
@@ -142,7 +142,7 @@ c
which = 'LM'
c
c %----------------------------------------------------%
c | The work array WORKL is used in SNAUPD as |
c | The work array WORKL is used in SNAUPD as |
c | workspace. Its dimension LWORKL has to be set as |
c | illustrated below. The parameter TOL determines |
c | the stopping criterion. If TOL<=0, machine machine |
@@ -150,12 +150,12 @@ c | precision is used. The number IDO is used for |
c | reverse communication and has to be set to 0 at |
c | the beginning. Setting INFO=0 indicates that we |
c | using a randomly generated vector to start the |
c | the ARNOLDI process. |
c | the ARNOLDI process. |
c %----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
info = 0
tol = zero
tol = zero
ido = 0
c
c %---------------------------------------------------%
@@ -169,8 +169,8 @@ c
mode = 2
maxitr = 300
c
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %--------------------------------------------%
c | Construct matrices A and M in LAPACK-style |
@@ -191,10 +191,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -204,21 +204,21 @@ c
do 30 j = 1, n
a(idiag,j) = 2.0E+0 / h
m(idiag,j) = 4.0E+0 * h
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
rho = 1.0E+1
rho = 1.0E+1
do 50 j = 1, n
a(isup,j+1) = -one/h + rho/two
a(isub,j) = -one/h - rho/two
m(isup,j+1) = one*h
m(isub,j) = one*h
50 continue
50 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -229,10 +229,10 @@ c | second column of D. Eigenvectors are returned |
c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c
rvec = .true.
call snband( rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
rvec = .true.
call snband( rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -265,7 +265,7 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
first = .true.
do 90 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
@@ -274,11 +274,11 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
@@ -290,30 +290,30 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call saxpy(n, d(j,2), mx, 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,2), mx, 1, ax, 1)
d(j,3) = slapy2( d(j,3), snrm2(n, ax, 1) )
@@ -324,11 +324,11 @@ c
first = .true.
end if
c
90 continue
90 continue
call smout(6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -339,8 +339,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+46 -46
View File
@@ -50,14 +50,14 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn)
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn)
c
c %--------------%
c | Local Arrays |
@@ -67,10 +67,10 @@ c
logical select(maxncv)
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
Complex
Complex
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -82,16 +82,16 @@ c
& n, idiag, isup, isub, mode, maxitr,
& nconv
logical rvec, first
Real
Real
& tol, rho, h, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two, six
parameter (one = 1.0E+0, zero = 0.0E+0,
parameter (one = 1.0E+0, zero = 0.0E+0,
& two = 2.0E+0, six = 6.0E+0)
c
c %-----------------------------%
@@ -100,7 +100,7 @@ c %-----------------------------%
c
Real
& slapy2, snrm2
external slapy2, snrm2, sgbmv, saxpy
external slapy2, snrm2, sgbmv, saxpy
c
c %--------------------%
c | Intrinsic function |
@@ -127,8 +127,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR4: N is greater than MAXN '
go to 9000
@@ -142,7 +142,7 @@ c
bmat = 'G'
which = 'LM'
sigmar = 1.0E+1
sigmai = 0.0E+0
sigmai = 0.0E+0
c
c %-----------------------------------------------------%
c | The work array WORKL is used in SNAUPD as |
@@ -157,7 +157,7 @@ c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
info = 0
tol = zero
tol = zero
ido = 0
c
c %---------------------------------------------------%
@@ -171,7 +171,7 @@ c
maxitr = 300
mode = 3
c
iparam(3) = n
iparam(3) = n
iparam(7) = 3
c
c %--------------------------------------------%
@@ -194,9 +194,9 @@ c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -205,12 +205,12 @@ c
do 30 j = 1, n
a(idiag,j) = 2.0E+0 / h
m(idiag,j) = 4.0E+0 * h / six
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
rho = 1.0E+1
@@ -218,8 +218,8 @@ c
a(isup,j+1) = -one/h + rho/two
a(isub,j) = -one/h - rho/two
m(isup,j+1) = one*h/six
m(isub,j) = one*h/six
40 continue
m(isub,j) = one*h/six
40 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -231,9 +231,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c
rvec = .true.
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, A, M, lda, rfac, cfac, kl, ku,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -266,7 +266,7 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
first = .true.
do 50 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
@@ -275,11 +275,11 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
@@ -291,30 +291,30 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call saxpy(n, d(j,2), mx, 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,2), mx, 1, ax, 1)
d(j,3) = slapy2( d(j,3), snrm2(n, ax, 1) )
@@ -325,11 +325,11 @@ c
first = .true.
end if
c
50 continue
50 continue
call smout(6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relatve residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -340,8 +340,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+46 -46
View File
@@ -1,7 +1,7 @@
program snbdr5
c
c ... Construct matrices A and M in LAPACK-style band form.
c The matrix A is a block tridiagonal matrix. Each
c The matrix A is a block tridiagonal matrix. Each
c diagonal block is a tridiagonal matrix with
c 4 on the diagonal, 1-rho*h/2 on the subdiagonal and
c 1+rho*h/2 on the superdiagonal. Each off-diagonal block
@@ -51,13 +51,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -66,12 +66,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Real
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn)
Complex
Complex
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -83,25 +83,25 @@ c
& n, nx, lo, idiag, isup, isub, mode, maxitr,
& nconv
logical rvec, first
Real
Real
& tol, rho, h, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
& two = 2.0E+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& slapy2, snrm2
external slapy2, snrm2, sgbmv, saxpy
external slapy2, snrm2, sgbmv, saxpy
c
c %--------------------%
c | Intrinsic function |
@@ -132,8 +132,8 @@ c %--------------------------------------------------%
c
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR5: N is greater than MAXN '
go to 9000
@@ -146,8 +146,8 @@ c
end if
bmat = 'I'
which = 'LM'
sigmar = 4.0E-1
sigmai = 6.0E-1
sigmar = 4.0E-1
sigmai = 6.0E-1
c
c %-----------------------------------------------------%
c | The work array WORKL is used in SNAUPD as |
@@ -161,7 +161,7 @@ c | generated in SNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -198,34 +198,34 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0E+0
m(idiag,j) = 4.0E+0
30 continue
c
a(idiag,j) = 4.0E+0
m(idiag,j) = 4.0E+0
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+kl+2
h = one / real (nx+1)
rho = 1.0E+2
rho = 1.0E+2
do 50 i = 1, nx
lo = (i-1)*nx
do 40 j = lo+1, lo+nx-1
a(isup,j+1) = -one+h*rho/two
a(isub,j) = -one-h*rho/two
40 continue
50 continue
40 continue
50 continue
c
do 60 j = 1, n-1
m(isup,j+1) = one
@@ -244,8 +244,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one
a(isub,j) = -one
70 continue
80 continue
70 continue
80 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -253,13 +253,13 @@ c | and eigenvectors. The real parts of the |
c | eigenvalues are returned in the first column |
c | of D, the imaginary parts are returned in the |
c | second column of D. Eigenvectors are returned |
c | in the first NCONV (=IPARAM(5)) columns of V. |
c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c
rvec = .true.
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -292,7 +292,7 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
first = .true.
do 90 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
@@ -301,8 +301,8 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
@@ -314,17 +314,17 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
call saxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call saxpy(n, -d(j,1), v(1,j+1), 1, ax, 1)
call saxpy(n, -d(j,2), v(1,j), 1, ax, 1)
@@ -336,11 +336,11 @@ c
first = .true.
end if
c
90 continue
90 continue
call smout(6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -351,8 +351,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+59 -59
View File
@@ -1,7 +1,7 @@
program snbdr6
c
c ... Construct matrices A and M in LAPACK-style band form.
c The matrix A is a block tridiagonal matrix. Each
c The matrix A is a block tridiagonal matrix. Each
c diagonal block is a tridiagonal matrix with
c 4 on the diagonal, 1-rho*h/2 on the subdiagonal and
c 1+rho*h/2 on the superdiagonal. Each subdiagonal block
@@ -53,13 +53,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -68,12 +68,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Real
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& workev(3*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv, 3), ax(maxn), mx(maxn)
Complex
Complex
& cfac(lda, maxn), workc(maxn)
c
c %---------------%
@@ -85,16 +85,16 @@ c
& n, nx, lo, idiag, isup, isub, mode, maxitr,
& nconv
logical rvec, first
Real
Real
& tol, rho, h, sigmar, sigmai
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
parameter (one = 1.0E+0 , zero = 0.0E+0 ,
& two = 2.0E+0 )
c
c %--------------------%
@@ -107,9 +107,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& slapy2, snrm2
external slapy2, snrm2, sgbmv, saxpy
external slapy2, snrm2, sgbmv, saxpy
c
c %-----------------------%
c | Executable Statements |
@@ -129,13 +129,13 @@ c | to get different parts the spectrum. However, the |
c | following rules must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %-----------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %-----------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR6: N is greater than MAXN '
go to 9000
@@ -148,8 +148,8 @@ c
end if
bmat = 'G'
which = 'LM'
sigmar = 4.0E-1
sigmai = 6.0E-1
sigmar = 4.0E-1
sigmai = 6.0E-1
c
c %-----------------------------------------------------%
c | The work array WORKL is used in SNAUPD as |
@@ -163,7 +163,7 @@ c | generated in SNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -178,7 +178,7 @@ c
maxitr = 300
mode = 4
c
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %--------------------------------------------%
@@ -200,34 +200,34 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0E+0
m(idiag,j) = 4.0E+0
30 continue
c
a(idiag,j) = 4.0E+0
m(idiag,j) = 4.0E+0
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
h = one / real (nx+1)
rho = 1.0E+2
rho = 1.0E+2
do 50 i = 1, nx
lo = (i-1)*nx
do 40 j = lo+1, lo+nx-1
a(isub,j+1) = -one+h*rho/two
a(isup,j) = -one-h*rho/two
40 continue
50 continue
40 continue
50 continue
c
do 60 j = 1, n-1
m(isub,j+1) = one
@@ -246,8 +246,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one
a(isub,j) = -one
70 continue
80 continue
70 continue
80 continue
c
c %------------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -259,9 +259,9 @@ c | in the first NCONV (=IPARAM(5)) columns of V. |
c %------------------------------------------------%
c
rvec = .true.
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
call snband(rvec, 'A', select, d, d(1,2), v, ldv, sigmar,
& sigmai, workev, n, a, m, lda, rfac, cfac, ku, kl,
& which, bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, workc, iwork, info)
c
if ( info .eq. 0) then
@@ -294,7 +294,7 @@ c | Compute the residual norm. |
c | || A*x - lambda*x || |
c %----------------------------%
c
first = .true.
first = .true.
do 90 j = 1, nconv
c
if ( d(j,2) .eq. zero ) then
@@ -303,11 +303,11 @@ c %--------------------%
c | Ritz value is real |
c %--------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
@@ -319,30 +319,30 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call saxpy(n, d(j,2), mx, 1, ax, 1)
d(j,3) = snrm2(n, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j+1), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j+1), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,2), mx, 1, ax, 1)
d(j,3) = slapy2( d(j,3), snrm2(n, ax, 1) )
@@ -353,11 +353,11 @@ c
first = .true.
end if
c
90 continue
90 continue
call smout(6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -368,8 +368,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+152 -152
View File
@@ -17,19 +17,19 @@ c
c Matrices A and B are stored in LAPACK-style band form.
c
c There is negligible additional cost to obtain eigenvectors. An orthonormal
c (Lanczos) basis is always computed. There is an additional storage cost
c of n*nev if both are requested (in this case a separate array Z must be
c (Lanczos) basis is always computed. There is an additional storage cost
c of n*nev if both are requested (in this case a separate array Z must be
c supplied).
c
c The approximate eigenvalues and eigenvectors of A*z = lambda*B*z
c are called Ritz values and Ritz vectors respectively. They are referred
c to as such in the comments that follow. The computed orthonormal basis
c for the invariant subspace corresponding to these Ritz values is referred
c are called Ritz values and Ritz vectors respectively. They are referred
c to as such in the comments that follow. The computed orthonormal basis
c for the invariant subspace corresponding to these Ritz values is referred
c to as a Lanczos basis.
c
c ssband can be called with one of the following modes:
c
c Mode 1: A*x = lambda*x, A symmetric
c Mode 1: A*x = lambda*x, A symmetric
c ===> OP = A and B = I.
c
c Mode 2: A*x = lambda*M*x, A symmetric, M symmetric positive definite
@@ -37,10 +37,10 @@ c ===> OP = inv[M]*A and B = M.
c ===> (If M can be factored see remark 3 in SSAUPD)
c
c Mode 3: K*x = lambda*M*x, K symmetric, M symmetric positive semi-definite
c ===> OP = (inv[K - sigma*M])*M and B = M.
c ===> OP = (inv[K - sigma*M])*M and B = M.
c ===> Shift-and-Invert mode
c
c Mode 4: K*x = lambda*KG*x, K symmetric positive semi-definite,
c Mode 4: K*x = lambda*KG*x, K symmetric positive semi-definite,
c KG symmetric indefinite
c ===> OP = (inv[K - sigma*KG])*K and B = K.
c ===> Buckling mode
@@ -53,21 +53,21 @@ c The choice of mode must be specified in IPARAM(7) defined below.
c
c \Usage
c call ssband
c ( RVEC, HOWMNY, SELECT, D, Z, LDZ, SIGMA, N, AB, MB, LDA,
c RFAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV, V,
c ( RVEC, HOWMNY, SELECT, D, Z, LDZ, SIGMA, N, AB, MB, LDA,
c RFAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV, V,
c LDV, IPARAM, WORKD, WORKL, LWORKL, IWORK, INFO )
c
c \Arguments
c
c RVEC Logical (INPUT)
c Specifies whether Ritz vectors corresponding to the Ritz value
c Specifies whether Ritz vectors corresponding to the Ritz value
c approximations to the eigenproblem A*z = lambda*B*z are computed.
c
c RVEC = .FALSE. Compute Ritz values only.
c
c RVEC = .TRUE. Compute the associated Ritz vectors.
c RVEC = .TRUE. Compute the associated Ritz vectors.
c
c HOWMNY Character*1 (INPUT)
c HOWMNY Character*1 (INPUT)
c Specifies how many Ritz vectors are wanted and the form of Z
c the matrix of Ritz vectors. See remark 1 below.
c = 'A': compute all Ritz vectors;
@@ -77,7 +77,7 @@ c
c SELECT Logical array of dimension NCV. (INPUT)
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
c computed. To select the Ritz vector corresponding to a
c Ritz value D(j), SELECT(j) must be set to .TRUE..
c Ritz value D(j), SELECT(j) must be set to .TRUE..
c If HOWMNY = 'A' , SELECT is not referenced.
c
c D Real array of dimension NEV. (OUTPUT)
@@ -85,8 +85,8 @@ c On exit, D contains the Ritz value approximations to the
c eigenvalues of A*z = lambda*B*z. The values are returned
c in ascending order. If IPARAM(7) = 3,4,5 then D represents
c the Ritz values of OP computed by ssaupd transformed to
c those of the original eigensystem A*z = lambda*B*z. If
c IPARAM(7) = 1,2 then the Ritz values of OP are the same
c those of the original eigensystem A*z = lambda*B*z. If
c IPARAM(7) = 1,2 then the Ritz values of OP are the same
c as the those of A*z = lambda*B*z.
c
c Z Real N by NEV array if HOWMNY = 'A'. (OUTPUT)
@@ -95,20 +95,20 @@ c eigensystem A*z = lambda*B*z corresponding to the Ritz
c value approximations.
c
c If RVEC = .FALSE. then Z is not referenced.
c NOTE: The array Z may be set equal to first NEV columns of the
c NOTE: The array Z may be set equal to first NEV columns of the
c Lanczos basis array V computed by SSAUPD.
c
c LDZ Integer. (INPUT)
c LDZ Integer. (INPUT)
c The leading dimension of the array Z. If Ritz vectors are
c desired, then LDZ .ge. max( 1, N ). In any case, LDZ .ge. 1.
c
c SIGMA Real (INPUT)
c If IPARAM(7) = 3,4,5 represents the shift. Not referenced if
c IPARAM(7) = 1 or 2.
c
c N Integer. (INPUT)
c Dimension of the eigenproblem.
c
c
c N Integer. (INPUT)
c Dimension of the eigenproblem.
c
c AB Real array of dimension LDA by N. (INPUT)
c The matrix A in band storage, in rows KL+1 to
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
@@ -118,7 +118,7 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
c
c MB Real array of dimension LDA by N. (INPUT)
c The matrix M in band storage, in rows KL+1 to
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c The j-th column of M is stored in the j-th column of the
c array AB as follows:
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
@@ -128,7 +128,7 @@ c LDA Integer. (INPUT)
c Leading dimension of AB, MB, RFAC.
c
c RFAC Real array of LDA by N. (WORKSPACE/OUTPUT)
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
c RFAC is used to store the LU factors of MB when IPARAM(7) = 2
c is invoked. It is used to store the LU factors of
c (A-sigma*M) when IPARAM(7) = 3,4,5 is invoked.
c It is not referenced when IPARAM(7) = 1.
@@ -142,17 +142,17 @@ c
c WHICH Character*2. (INPUT)
c When IPARAM(7)= 1 or 2, WHICH can be set to any one of
c the following.
c
c
c 'LM' -> want the NEV eigenvalues of largest magnitude.
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
c 'LA' -> want the NEV eigenvalues of largest REAL part.
c 'SA' -> want the NEV eigenvalues of smallest REAL part.
c 'BE' -> Compute NEV eigenvalues, half from each end of the
c spectrum. When NEV is odd, compute one more from
c the high end than from the low end.
c 'BE' -> Compute NEV eigenvalues, half from each end of the
c spectrum. When NEV is odd, compute one more from
c the high end than from the low end.
c
c When IPARAM(7) = 3, 4, or 5, WHICH should be set to 'LM' only.
c
c When IPARAM(7) = 3, 4, or 5, WHICH should be set to 'LM' only.
c
c BMAT Character*1. (INPUT)
c BMAT specifies the type of the matrix B that defines the
c semi-inner product for the operator OP.
@@ -161,9 +161,9 @@ c BMAT = 'G' -> generalized eigenvalue problem A*x = lambda*M*x
c NEV Integer. (INPUT)
c Number of eigenvalues of OP to be computed.
c
c
c TOL Real scalar. (INPUT)
c Stopping criterion: the relative accuracy of the Ritz value
c Stopping criterion: the relative accuracy of the Ritz value
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I)).
c If TOL .LE. 0. is passed a default is set:
c DEFAULT = SLAMCH('EPS') (machine precision as computed
@@ -183,35 +183,35 @@ c Represents the dimension of the Lanczos basis constructed
c by ssaupd for OP.
c
c V Real array N by NCV. (OUTPUT)
c Upon INPUT: the NCV columns of V contain the Lanczos basis
c Upon INPUT: the NCV columns of V contain the Lanczos basis
c vectors as constructed by ssaupd for OP.
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
c represent the Ritz vectors that span the desired
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
c represent the Ritz vectors that span the desired
c invariant subspace.
c NOTE: The array Z may be set equal to first NEV columns of the
c NOTE: The array Z may be set equal to first NEV columns of the
c Lanczos basis vector array V computed by ssaupd. In this case
c if RVEC=.TRUE., the first NCONV=IPARAM(5) columns of V contain
c the desired Ritz vectors.
c the desired Ritz vectors.
c
c LDV Integer. (INPUT)
c Leading dimension of V exactly as declared in the calling
c program.
c
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
c IPARAM(1) = ISHIFT:
c IPARAM(1) = ISHIFT:
c The shifts selected at each iteration are used to restart
c the Arnoldi iteration in an implicit fashion.
c It is set to 1 in this subroutine. The user do not need
c to set this parameter.
c ------------------------------------------------------------
c ISHIFT = 1: exact shifts with respect to the reduced
c tridiagonal matrix T. This is equivalent to
c restarting the iteration with a starting vector
c that is a linear combination of Ritz vectors
c ISHIFT = 1: exact shifts with respect to the reduced
c tridiagonal matrix T. This is equivalent to
c restarting the iteration with a starting vector
c that is a linear combination of Ritz vectors
c associated with the "wanted" Ritz values.
c -------------------------------------------------------------
c
c IPARAM(2) = No longer referenced.
c IPARAM(2) = No longer referenced.
c
c IPARAM(3) = MXITER
c On INPUT: max number of Arnoldi update iterations allowed.
@@ -225,11 +225,11 @@ c This represents the number of Ritz values that satisfy
c the convergence criterion.
c
c IPARAM(6) = IUPD
c No longer referenced. Implicit restarting is ALWAYS used.
c No longer referenced. Implicit restarting is ALWAYS used.
c
c IPARAM(7) = MODE
c On INPUT determines what type of eigenproblem is being solved.
c Must be 1,2,3,4,5; See under \Description of ssband for the
c Must be 1,2,3,4,5; See under \Description of ssband for the
c five modes available.
c
c IPARAM(8) = NP
@@ -248,18 +248,18 @@ c LWORKL Integer. (INPUT)
c LWORKL must be at least NCV**2 + 8*NCV.
c
c IWORK Integer array of dimension at least N. (WORKSPACE)
c Used when IPARAM(7)=2,3,4,5 to store the pivot information in the
c Used when IPARAM(7)=2,3,4,5 to store the pivot information in the
c factorization of M or (A-SIGMA*M).
c
c
c INFO Integer. (INPUT/OUTPUT)
c Error flag on output.
c = 0: Normal exit.
c = 1: Maximum number of iterations taken.
c All possible eigenvalues of OP has been found. IPARAM(5)
c All possible eigenvalues of OP has been found. IPARAM(5)
c returns the number of wanted converged Ritz values.
c = 3: No shifts could be applied during a cycle of the
c Implicitly restarted Arnoldi iteration. One possibility
c is to increase the size of NCV relative to NEV.
c = 3: No shifts could be applied during a cycle of the
c Implicitly restarted Arnoldi iteration. One possibility
c is to increase the size of NCV relative to NEV.
c See remark 4 in SSAUPD.
c
c = -1: N must be positive.
@@ -292,7 +292,7 @@ c 1. D.C. Sorensen, "Implicit Application of Polynomial Filters in
c a k-Step Arnoldi Method", SIAM J. Matr. Anal. Apps., 13 (1992),
c pp 357-385.
c
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
c 2. R.B. Lehoucq, "Analysis and Implementation of an Implicitly
c Restarted Arnoldi Iteration", Ph.D thesis, TR95-13, Rice Univ,
c May 1995.
c
@@ -301,7 +301,7 @@ c ssaupd ARPACK reverse communication interface routine.
c sseupd ARPACK routine that returns Ritz values and (optionally)
c Ritz vectors.
c sgbtrf LAPACK band matrix factorization routine.
c sgbtrs LAPACK band linear system solve routine.
c sgbtrs LAPACK band linear system solve routine.
c slacpy LAPACK matrix copy routine.
c slapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
c scopy Level 1 BLAS that copies one vector to another.
@@ -310,13 +310,13 @@ c snrm2 Level 1 BLAS that computes the norm of a vector.
c sgbmv Level 2 BLAS that computes the band matrix vector product.
c
c\Remarks
c 1. The converged Ritz values are always returned in increasing
c 1. The converged Ritz values are always returned in increasing
c (algebraic) order.
c
c 2. Currently only HOWMNY = 'A' is implemented. It is included at this
c stage for the user who wants to incorporate it.
c
c\Author
c\Author
c Danny Sorensen
c Richard Lehoucq
c Chao Yang
@@ -332,18 +332,18 @@ c\EndLib
c
c---------------------------------------------------------------------
c
subroutine ssband( rvec, howmny, select, d, z, ldz, sigma,
& n, ab, mb, lda, rfac, kl, ku, which, bmat, nev,
& tol, resid, ncv, v, ldv, iparam, workd, workl,
subroutine ssband( rvec, howmny, select, d, z, ldz, sigma,
& n, ab, mb, lda, rfac, kl, ku, which, bmat, nev,
& tol, resid, ncv, v, ldv, iparam, workd, workl,
& lworkl, iwork, info)
c
c %------------------%
c | Scalar Arguments |
c %------------------%
c
c
character which*2, bmat, howmny
integer n, lda, kl, ku, nev, ncv, ldv,
& ldz, lworkl, info
& ldz, lworkl, info
Real
& tol, sigma
logical rvec
@@ -356,7 +356,7 @@ c
logical select(*)
Real
& d(*), resid(*), v(ldv,*), z(ldz,*),
& ab(lda,*), mb(lda,*), rfac(lda,*),
& ab(lda,*), mb(lda,*), rfac(lda,*),
& workd(*), workl(*)
c
c %--------------%
@@ -386,22 +386,22 @@ c %-----------------------------%
c
Real
& sdot, snrm2, slapy2
external sdot, scopy, sgbmv, sgbtrf,
external sdot, scopy, sgbmv, sgbtrf,
& sgbtrs, snrm2, slapy2, slacpy
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
c
c
c %----------------------------------------------------------------%
c | Set type of the problem to be solved. Check consistency |
c | between BMAT and IPARAM(7). |
c | type = 1 --> Solving standard problem in regular mode. |
c | type = 2 --> Solving standard problem in shift-invert mode. |
c | type = 2 --> Solving standard problem in shift-invert mode. |
c | type = 3 --> Solving generalized problem in regular mode. |
c | type = 4 --> Solving generalized problem in shift-invert mode. |
c | type = 5 --> Solving generalized problem in Buckling mode. |
c | type = 6 --> Solving generalized problem in Cayley mode. |
c | type = 6 --> Solving generalized problem in Cayley mode. |
c %----------------------------------------------------------------%
c
if ( iparam(7) .eq. 1 ) then
@@ -411,15 +411,15 @@ c
else if ( iparam(7) .eq. 2 ) then
type = 3
else if ( iparam(7) .eq. 3 .and. bmat .eq. 'G') then
type = 4
type = 4
else if ( iparam(7) .eq. 4 ) then
type = 5
else if ( iparam(7) .eq. 5 ) then
else if ( iparam(7) .eq. 5 ) then
type = 6
else
print*, ' '
print*, 'BMAT is inconsistent with IPARAM(7).'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -432,9 +432,9 @@ c
c
c %----------------%
c | Exact shift is |
c | used. |
c | used. |
c %----------------%
c
c
iparam(1) = 1
c
c %-----------------------------------%
@@ -462,7 +462,7 @@ c
10 continue
call sgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr )
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*, ' _SBAND: Error with _gbtrf. '
print*, ' '
go to 9000
@@ -477,28 +477,28 @@ c | routine sgbtrf to factor M. |
c %----------------------------------------------%
c
call slacpy ('A', ibot, n, mb, lda, rfac, lda )
call sgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
if (ierr .ne. 0) then
call sgbtrf(n, n, kl, ku, rfac, lda, iwork, ierr)
if (ierr .ne. 0) then
print*, ' '
print*,'_SBAND: Error with _gbtrf.'
print*, ' '
go to 9000
print*,'_SBAND: Error with _gbtrf.'
print*, ' '
go to 9000
end if
c
else if ( type .eq. 4 .or. type .eq. 5 .or. type .eq. 6
else if ( type .eq. 4 .or. type .eq. 5 .or. type .eq. 6
& .and. bmat .eq. 'G' ) then
c
c %-------------------------------------------%
c | Solving generalized eigenvalue problem in |
c | shift-invert, Buckling, or Cayley mode. |
c %-------------------------------------------%
c
c
c %-------------------------------------%
c | Construct and factor (A - sigma*M). |
c %-------------------------------------%
c
do 60 j = 1,n
do 50 i = itop, ibot
do 50 i = itop, ibot
rfac(i,j) = ab(i,j) - sigma*mb(i,j)
50 continue
60 continue
@@ -510,14 +510,14 @@ c
print*, ' '
go to 9000
end if
c
end if
c
end if
c
c %--------------------------------------------%
c | M A I N L O O P (reverse communication) |
c %--------------------------------------------%
c
90 continue
90 continue
c
call ssaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
@@ -531,8 +531,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( type .eq. 2 ) then
@@ -548,7 +548,7 @@ c
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' '
print*, ' _SBAND: Error with _bgtrs. '
print*, ' '
go to 9000
@@ -558,15 +558,15 @@ c
c
c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c | to force the starting vector into |
c | to force the starting vector into |
c | the range of OP. |
c %-----------------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
call scopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
@@ -579,36 +579,36 @@ c
c
c %-----------------------------------------%
c | Perform y <-- OP*x |
c | = inv[A-SIGMA*M]*M |
c | = inv[A-SIGMA*M]*M |
c | to force the starting vector into the |
c | range of OP. |
c %-----------------------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*, '_SBAND: Error with _gbtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
else if ( type .eq. 5) then
c
c %---------------------------------------%
c %---------------------------------------%
c | Perform y <-- OP*x |
c | = inv[A-SIGMA*M]*A |
c | to force the starting vector into the |
c | range of OP. |
c %---------------------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
c
if ( ierr .ne. 0 ) then
@@ -622,31 +622,31 @@ c
c
c %---------------------------------------%
c | Perform y <-- OP*x |
c | = (inv[A-SIGMA*M])*(A+SIGMA*M)*x |
c | = (inv[A-SIGMA*M])*(A+SIGMA*M)*x |
c | to force the starting vector into the |
c | range of OP. |
c | range of OP. |
c %---------------------------------------%
c
if ( bmat .eq. 'G' ) then
call sgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
call sgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
& zero, workd(ipntr(2)), 1)
call sgbmv('Notranspose', n, n, kl, ku, sigma,
& mb(itop,1), lda, workd(ipntr(1)), 1,
call sgbmv('Notranspose', n, n, kl, ku, sigma,
& mb(itop,1), lda, workd(ipntr(1)), 1,
& one, workd(ipntr(2)), 1)
else
else
call scopy(n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, sigma,
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, sigma,
& workd(ipntr(2)), 1)
end if
end if
c
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
c
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_SBAND: Error with _gbtrs.'
print*, '_SBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
@@ -661,8 +661,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( type .eq. 2) then
@@ -677,7 +677,7 @@ c
& iwork, workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, '_SBAND: Error with _gbtrs.'
print*, '_SBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
@@ -688,16 +688,16 @@ c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c %-----------------------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
call scopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call scopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, '_SBAND: error with _bgtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -706,22 +706,22 @@ c
c %-------------------------------------%
c | Perform y <-- inv(A-sigma*M)*(M*x). |
c | (M*x) has been computed and stored |
c | in workd(ipntr(3)). |
c | in workd(ipntr(3)). |
c %-------------------------------------%
c
call scopy(n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
call sgbtrs ('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_SBAND: Error with _gbtrs.'
print*, '_SBAND: Error with _gbtrs.'
print*, ' '
go to 9000
end if
c
c
else if ( type .eq. 5 ) then
c
c %-------------------------------%
c %-------------------------------%
c | Perform y <-- OP*x |
c | = inv[A-SIGMA*M]*A*x |
c | B*x = A*x has been computed |
@@ -729,7 +729,7 @@ c | and saved in workd(ipntr(3)). |
c %-------------------------------%
c
call scopy (n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -742,24 +742,24 @@ c
c
c %---------------------------------%
c | Perform y <-- OP*x |
c | = inv[A-SIGMA*M]*(A+SIGMA*M)*x. |
c | = inv[A-SIGMA*M]*(A+SIGMA*M)*x. |
c | (M*x) has been saved in |
c | workd(ipntr(3)). |
c %---------------------------------%
c
if ( bmat .eq. 'G' ) then
call sgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
call sgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
& zero, workd(ipntr(2)), 1)
call saxpy( n, sigma, workd(ipntr(3)), 1,
call saxpy( n, sigma, workd(ipntr(3)), 1,
& workd(ipntr(2)), 1 )
else
else
call scopy (n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, sigma,
call sgbmv('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, sigma,
& workd(ipntr(2)), 1)
end if
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
call sgbtrs('Notranspose', n, kl, ku, 1, rfac, lda,
& iwork, workd(ipntr(2)), n, ierr)
c
end if
@@ -767,9 +767,9 @@ c
else if (ido .eq. 2) then
c
c %----------------------------------%
c | Perform y <-- B*x |
c | Perform y <-- B*x |
c | Note when Buckling mode is used, |
c | B = A, otherwise B=M. |
c | B = A, otherwise B=M. |
c %----------------------------------%
c
if (type .eq. 5) then
@@ -778,20 +778,20 @@ c %---------------------%
c | Buckling Mode, B=A. |
c %---------------------%
c
call sgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
call sgbmv('Notranspose', n, n, kl, ku, one,
& ab(itop,1), lda, workd(ipntr(1)), 1,
& zero, workd(ipntr(2)), 1)
else
call sgbmv('Notranspose', n, n, kl, ku, one,
& mb(itop,1), lda, workd(ipntr(1)), 1,
call sgbmv('Notranspose', n, n, kl, ku, one,
& mb(itop,1), lda, workd(ipntr(1)), 1,
& zero, workd(ipntr(2)), 1)
end if
c
else
else
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
c | Either we have convergence, or there is |
c | error. |
c %-----------------------------------------%
c
@@ -808,7 +808,7 @@ c
print *, ' '
go to 9000
c
else
else
c
if ( info .eq. 1) then
print *, ' '
@@ -823,22 +823,22 @@ c
c
if (iparam(5) .gt. 0) then
c
call sseupd ( rvec, 'A', select, d, z, ldz, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, info )
call sseupd ( rvec, 'A', select, d, z, ldz, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, info )
c
if ( info .ne. 0) then
c
c
c %------------------------------------%
c | Check the documentation of sneupd. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd = ', info
print *, ' Check the documentation of _neupd '
print *, ' '
print *, ' '
go to 9000
c
c
end if
c
end if
@@ -853,7 +853,7 @@ c %----------------------------------------%
c | L O O P B A C K to call SSAUPD again. |
c %----------------------------------------%
c
go to 90
go to 90
c
9000 continue
c
+40 -40
View File
@@ -2,13 +2,13 @@
c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is derived from the discretization of
c the 2-dimensional Laplacian on the unit square with
c zero Dirichlet boundary condition using standard
c the 2-dimensional Laplacian on the unit square with
c zero Dirichlet boundary condition using standard
c central difference.
c
c ... Call SSBAND to find eigenvalues LAMBDA such that
c A*x = x*LAMBDA.
c
c
c ... Use mode 1 of SSAUPD.
c
c\BeginLib
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -62,9 +62,9 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Real
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn)
c
@@ -76,15 +76,15 @@ c
integer nev, ncv, ku, kl, info, i, j, ido,
& n, nx, lo, isub, isup, idiag, maxitr, mode,
& nconv
Real
Real
& tol, sigma, h2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 )
c
@@ -92,9 +92,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& slapy2, snrm2
external slapy2, snrm2, sgbmv, saxpy
external slapy2, snrm2, sgbmv, saxpy
c
c %--------------------%
c | Intrinsic function |
@@ -121,13 +121,13 @@ c | However, the following conditions must be |
c | satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR1: N is greater than MAXN '
go to 9000
@@ -153,7 +153,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv**2+8*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -169,7 +169,7 @@ c
mode = 1
c
iparam(3) = maxitr
iparam(7) = mode
iparam(7) = mode
c
c %----------------------------------------%
c | Construct the matrix A in LAPACK-style |
@@ -190,10 +190,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -201,12 +201,12 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0E+0 / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
do 50 i = 1, nx
@@ -214,8 +214,8 @@ c
do 40 j = lo+1, lo+nx-1
a(isup,j+1) = -one / h2
a(isub,j) = -one / h2
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -229,8 +229,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %-------------------------------------%
c | Call SSBAND to find eigenvalues and |
@@ -239,18 +239,18 @@ c | returned in the first column of D. |
c | Eigenvectors are returned in the |
c | first NCONV (=IPARAM(5)) columns of |
c | V. |
c %-------------------------------------%
c %-------------------------------------%
c
rvec = .true.
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
c
nconv = iparam(5)
c
c
c %-----------------------------------%
c | Print out convergence information |
c %-----------------------------------%
@@ -278,18 +278,18 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
d(j,2) = snrm2(n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call smout(6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -300,8 +300,8 @@ c
print *, ' '
print *, ' Error with _sband, info= ', info
print *, ' Check the documentation of _sband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+39 -39
View File
@@ -2,11 +2,11 @@
c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is derived from the discretization of
c the 2-dimensional Laplacian on the unit square
c the 2-dimensional Laplacian on the unit square
c with zero Dirichlet boundary condition using standard
c central difference.
c
c ... Call SSBAND to find eigenvalues LAMBDA closest to
c ... Call SSBAND to find eigenvalues LAMBDA closest to
c SIGMA such that
c A*x = x*LAMBDA.
c
@@ -48,13 +48,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -63,10 +63,10 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Real
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& workl(3*maxncv*maxncv+6*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn)
c
c %---------------%
@@ -77,15 +77,15 @@ c
integer nev, ncv, ku, kl, info, i, j, ido,
& n, nx, lo, isub, isup, idiag, maxitr, mode,
& nconv
Real
Real
& tol, sigma, h2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 )
c
@@ -93,9 +93,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& slapy2, snrm2
external slapy2, snrm2, saxpy, sgbmv
external slapy2, snrm2, saxpy, sgbmv
c
c %-----------------------%
c | Executable Statements |
@@ -118,13 +118,13 @@ c | However, the following conditions must be |
c | satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR2: N is greater than MAXN '
go to 9000
@@ -151,7 +151,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -167,7 +167,7 @@ c
mode = 3
c
iparam(3) = maxitr
iparam(7) = mode
iparam(7) = mode
c
c %----------------------------------------%
c | Construct the matrix A in LAPACK-style |
@@ -188,10 +188,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -199,12 +199,12 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = 4.0E+0 / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
do 50 i = 1, nx
@@ -212,8 +212,8 @@ c
do 40 j = lo+1, lo+nx-1
a(isup,j+1) = -one / h2
a(isub,j) = -one / h2
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -227,8 +227,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %-------------------------------------%
c | Call SSBAND to find eigenvalues and |
@@ -239,10 +239,10 @@ c | first NCONV (=IPARAM(5)) columns of |
c | V. |
c %-------------------------------------%
c
rvec = .true.
call ssband( rvec,'A', select, d, v, ldv, sigma, n, a, m,
& lda, rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
rvec = .true.
call ssband( rvec,'A', select, d, v, ldv, sigma, n, a, m,
& lda, rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
@@ -276,18 +276,18 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
d(j,2) = snrm2(n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call smout(6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -298,8 +298,8 @@ c
print *, ' '
print *, ' Error with _sband, info= ', info
print *, ' Check the documentation of _sband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+33 -33
View File
@@ -5,7 +5,7 @@ c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
c with zero Dirichlet boundary condition, M is the mass
c formed by using piecewise linear elements on [0,1].
c
c ... Call SSBAND with regular mode to find eigenvalues LAMBDA
c ... Call SSBAND with regular mode to find eigenvalues LAMBDA
c such that
c A*x = LAMBDA*M*x.
c
@@ -46,13 +46,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -61,9 +61,9 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Real
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn), mx(maxn)
c
@@ -74,15 +74,15 @@ c
character which*2, bmat
integer nev, ncv, ku, kl, info, j, ido,
& n, isub, isup, idiag, maxitr, mode, nconv
Real
Real
& tol, h, sigma, r1, r2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two, four, six
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 ,
& four = 4.0E+0 , six = 6.0E+0 )
@@ -91,9 +91,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& slapy2, snrm2
external slapy2, snrm2, saxpy, sgbmv
external slapy2, snrm2, saxpy, sgbmv
c
c %--------------------%
c | Intrinsic function |
@@ -116,12 +116,12 @@ c | However, the following conditions must be |
c | satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
n = 100
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR3: N is greater than MAXN '
go to 9000
@@ -147,7 +147,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv**2+8*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -184,10 +184,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -197,12 +197,12 @@ c
do 30 j = 1, n
a(idiag,j) = two / h
m(idiag,j) = r1 * h
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
r2 = one / six
isup = kl+ku
isub = kl+ku+2
@@ -223,9 +223,9 @@ c | V. |
c %-------------------------------------%
c
rvec = .true.
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
@@ -259,21 +259,21 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
d(j,2) = snrm2(n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call smout(6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -284,8 +284,8 @@ c
print *, ' '
print *, ' Error with _sband, info= ', info
print *, ' Check the documentation of _sband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+34 -34
View File
@@ -5,7 +5,7 @@ c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
c with zero Dirichlet boundary condition, M is the mass
c formed by using piecewise linear elements on [0,1].
c
c ... Call SSBAND with shift-invert mode to find eigenvalues LAMBDA
c ... Call SSBAND with shift-invert mode to find eigenvalues LAMBDA
c closest to SIGMA such that
c A*x = LAMBDA*M*x.
c
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -62,9 +62,9 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Real
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn), mx(maxn)
c
@@ -75,15 +75,15 @@ c
character which*2, bmat
integer nev, ncv, ku, kl, info, j, ido,
& n, isub, isup, idiag, maxitr, mode, nconv
Real
Real
& tol, h, sigma, r1, r2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two, four, six
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 ,
& four = 4.0E+0 , six = 6.0E+0 )
@@ -92,9 +92,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& slapy2, snrm2
external slapy2, snrm2, saxpy, sgbmv
external slapy2, snrm2, saxpy, sgbmv
c
c %-----------------------%
c | Executable Statements |
@@ -113,12 +113,12 @@ c | However, the following conditions must be |
c | satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR4: N is greater than MAXN '
go to 9000
@@ -145,7 +145,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv**2+8*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -182,10 +182,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -195,19 +195,19 @@ c
do 30 j = 1, n
a(idiag,j) = two / h
m(idiag,j) = r1 * h
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
r2 = one / six
isup = kl+ku
isub = kl+ku+2
do 60 j = 1, n-1
a(isup,j+1) = -one / h
a(isub,j) = -one / h
m(isup,j+1) = r2 * h
m(isup,j+1) = r2 * h
m(isub,j) = r2 * h
60 continue
c
@@ -221,9 +221,9 @@ c | V. |
c %-------------------------------------%
c
rvec = .true.
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m,
& lda, rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m,
& lda, rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
@@ -243,7 +243,7 @@ c
print *, ' The number of Lanczos vectors generated',
& ' (NCV) is ', ncv
print *, ' The number of converged Ritz values is ',
& nconv
& nconv
print *, ' What portion of the spectrum ', which
print *, ' The number of Implicit Arnoldi',
& ' update taken is ', iparam(3)
@@ -257,21 +257,21 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
d(j,2) = snrm2(n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call smout(6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -282,8 +282,8 @@ c
print *, ' '
print *, ' Error with _sband, info= ', info
print *, ' Check the documentation of _sband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+33 -33
View File
@@ -3,9 +3,9 @@ c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
c with zero Dirichlet boundary condition, KG is the mass
c formed by using piecewise linear elements on [0,1].
c formed by using piecewise linear elements on [0,1].
c
c ... Call SSBAND with Buckling mode to find eigenvalues LAMBDA
c ... Call SSBAND with Buckling mode to find eigenvalues LAMBDA
c such that
c A*x = M*x*LAMBDA.
c
@@ -47,13 +47,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -62,9 +62,9 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Real
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn), mx(maxn)
c
@@ -75,15 +75,15 @@ c
character which*2, bmat
integer nev, ncv, kl, ku, info, j, ido,
& n, isub, isup, idiag, maxitr, mode, nconv
Real
Real
& tol, h, sigma, r1, r2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two, four, six
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 ,
& four = 4.0E+0 , six = 6.0E+0 )
@@ -92,9 +92,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& slapy2, snrm2
external slapy2, snrm2, sgbmv, saxpy
external slapy2, snrm2, sgbmv, saxpy
c
c %--------------------%
c | Intrinsic function |
@@ -118,12 +118,12 @@ c | the spectrum. However, the following conditions |
c | must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR5: N is greater than MAXN '
go to 9000
@@ -150,7 +150,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv**2+8*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -187,10 +187,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -200,12 +200,12 @@ c
do 30 j = 1, n
a(idiag,j) = two / h
m(idiag,j) = r1 * h
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
r2 = one / six
isup = kl+ku
isub = kl+ku+2
@@ -226,9 +226,9 @@ c | V. |
c %-------------------------------------%
c
rvec = .true.
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
@@ -262,21 +262,21 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
d(j,2) = snrm2(n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call smout(6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -287,8 +287,8 @@ c
print *, ' '
print *, ' Error with _sband, info= ', info
print *, ' Check the documentation of _sband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+32 -32
View File
@@ -4,7 +4,7 @@ c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is the 1-dimensional discrete Laplacian on [0,1]
c with zero Dirichlet boundary condition, M is the mass
c formed by using piecewise linear elements on [0,1].
c
c
c ... Call SSBAND with Cayley mode to find eigenvalues LAMBDA such that
c A*x = LAMBDA*M*x.
c
@@ -46,13 +46,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -61,9 +61,9 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Real
Real
& a(lda,maxn), m(lda,maxn), rfac(lda,maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& workl(maxncv*maxncv+8*maxncv), workd(3*maxn),
& v(ldv, maxncv), resid(maxn), d(maxncv, 2),
& ax(maxn), mx(maxn)
c
@@ -74,15 +74,15 @@ c
character which*2, bmat
integer nev, ncv, ku, kl, info, j, ido,
& n, isub, isup, idiag, maxitr, mode, nconv
Real
Real
& tol, h, sigma, r1, r2
logical rvec
c
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& one, zero, two, four, six
parameter (one = 1.0E+0 , zero = 0.0E+0 , two = 2.0E+0 ,
& four = 4.0E+0 , six = 6.0E+0 )
@@ -91,9 +91,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& slapy2, snrm2
external slapy2, snrm2, saxpy, sgbmv
external slapy2, snrm2, saxpy, sgbmv
c
c %--------------------%
c | Intrinsic function |
@@ -117,12 +117,12 @@ c | the spectrum. However, the following conditions |
c | must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SBDR6: N is greater than MAXN '
go to 9000
@@ -149,7 +149,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv**2+8*ncv
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -186,10 +186,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = 1
ku = 1
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -199,12 +199,12 @@ c
do 30 j = 1, n
a(idiag,j) = two / h
m(idiag,j) = r1 * h
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
r2 = one / six
isup = kl+ku
isub = kl+ku+2
@@ -225,9 +225,9 @@ c | V. |
c %-------------------------------------%
c
rvec = .true.
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
call ssband( rvec, 'A', select, d, v, ldv, sigma, n, a, m, lda,
& rfac, kl, ku, which, bmat, nev, tol,
& resid, ncv, v, ldv, iparam, workd, workl, lworkl,
& iwork, info)
c
if ( info .eq. 0) then
@@ -261,21 +261,21 @@ c | || A*x - lambda*x || |
c %----------------------------%
c
do 90 j = 1, nconv
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& a(kl+1,1), lda, v(1,j), 1, zero,
& ax, 1)
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
call sgbmv('Notranspose', n, n, kl, ku, one,
& m(kl+1,1), lda, v(1,j), 1, zero,
& mx, 1)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
d(j,2) = snrm2(n, ax, 1)
d(j,2) = d(j,2) / abs(d(j,1))
c
90 continue
90 continue
call smout(6, nconv, 2, d, maxncv, -6,
& 'Ritz values and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -286,8 +286,8 @@ c
print *, ' '
print *, ' Error with _band, info= ', info
print *, ' Check the documentation of _band '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+101 -101
View File
@@ -1,29 +1,29 @@
c \BeginDoc
c
c \Name: znband
c \Name: znband
c
c \Description:
c This subroutine returns the converged approximations to eigenvalues
c of A*z = lambda*B*z and (optionally):
c
c (1) The corresponding approximate eigenvectors;
c
c (2) An orthonormal basis for the associated approximate
c invariant subspace;
c
c (3) Both.
c This subroutine returns the converged approximations to eigenvalues
c of A*z = lambda*B*z and (optionally):
c
c (1) The corresponding approximate eigenvectors;
c
c (2) An orthonormal basis for the associated approximate
c invariant subspace;
c
c (3) Both.
c
c Matrices A and B are stored in LAPACK-style banded form.
c
c There is negligible additional cost to obtain eigenvectors. An orthonormal
c There is negligible additional cost to obtain eigenvectors. An orthonormal
c basis is always computed. There is an additional storage cost of n*nev
c if both are requested (in this case a separate array Z must be supplied).
c if both are requested (in this case a separate array Z must be supplied).
c
c The approximate eigenvalues and eigenvectors of A*z = lambda*B*z
c are commonly called Ritz values and Ritz vectors respectively. They are
c referred to as such in the comments that follow. The computed orthonormal
c basis for the invariant subspace corresponding to these Ritz values is
c referred to as a Schur basis.
c are commonly called Ritz values and Ritz vectors respectively. They are
c referred to as such in the comments that follow. The computed orthonormal
c basis for the invariant subspace corresponding to these Ritz values is
c referred to as a Schur basis.
c
c znband can be called with one of the following modes:
c
@@ -40,15 +40,15 @@ c
c Choice of different modes can be specified in IPARAM(7) defined below.
c
c \Usage
c call znband
c ( RVEC, HOWMNY, SELECT, D , Z, LDZ, SIGMA, WORKEV, N, AB,
c MB, LDA, FAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV,
c call znband
c ( RVEC, HOWMNY, SELECT, D , Z, LDZ, SIGMA, WORKEV, N, AB,
c MB, LDA, FAC, KL, KU, WHICH, BMAT, NEV, TOL, RESID, NCV,
c V, LDV, IPARAM, WORKD, WORKL, LWORKL, RWORK, IWORK, INFO )
c
c \Arguments
c RVEC LOGICAL (INPUT)
c RVEC LOGICAL (INPUT)
c Specifies whether a basis for the invariant subspace corresponding
c to the converged Ritz value approximations for the eigenproblem
c to the converged Ritz value approximations for the eigenproblem
c A*z = lambda*B*z is computed.
c
c RVEC = .FALSE. Compute Ritz values only.
@@ -56,8 +56,8 @@ c
c RVEC = .TRUE. Compute Ritz vectors or Schur vectors.
c See Remarks below.
c
c HOWMNY Character*1 (INPUT)
c Specifies the form of the invariant subspace to be computed
c HOWMNY Character*1 (INPUT)
c Specifies the form of the invariant subspace to be computed
c corresponding to the converged Ritz values.
c = 'A': Compute NEV Ritz vectors;
c = 'P': Compute NEV Schur vectors;
@@ -67,7 +67,7 @@ c
c SELECT Logical array of dimension NCV. (INPUT)
c If HOWMNY = 'S', SELECT specifies the Ritz vectors to be
c computed. To select the real Ritz vector corresponding to a
c Ritz value D(j), SELECT(j) must be set to .TRUE..
c Ritz value D(j), SELECT(j) must be set to .TRUE..
c If HOWMNY = 'A' or 'P', SELECT need not be initialized
c but it is used as internal workspace.
c
@@ -76,16 +76,16 @@ c On exit, D contains the Ritz approximations
c to the eigenvalues lambda for A*z = lambda*B*z.
c
c Z Complex*16 N by NEV array (OUTPUT)
c On exit, if RVEC = .TRUE. and HOWMNY = 'A', then the columns of
c Z represents approximate eigenvectors (Ritz vectors) corresponding
c On exit, if RVEC = .TRUE. and HOWMNY = 'A', then the columns of
c Z represents approximate eigenvectors (Ritz vectors) corresponding
c to the NCONV=IPARAM(5) Ritz values for eigensystem
c A*z = lambda*B*z.
c
c If RVEC = .FALSE. or HOWMNY = 'P', then Z is NOT REFERENCED.
c
c NOTE: If if RVEC = .TRUE. and a Schur basis is not required,
c the array Z may be set equal to first NEV columns of the
c array V.
c NOTE: If if RVEC = .TRUE. and a Schur basis is not required,
c the array Z may be set equal to first NEV columns of the
c array V.
c
c LDZ Integer. (INPUT)
c The leading dimension of the array Z. If Ritz vectors are
@@ -97,7 +97,7 @@ c If IPARAM(7) = 3 then SIGMA represents the shift.
c Not referenced if IPARAM(7) = 1 or 2.
c
c WORKEV Complex*16 work array of dimension NCV. (WORKSPACE)
c
c
c N Integer. (INPUT)
c Dimension of the eigenproblem.
c
@@ -110,7 +110,7 @@ c AB(kl+ku+1+i-j,j) = A(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
c
c MB Complex*16 array of dimension LDA by N. (INPUT)
c The matrix M in band storage, in rows KL+1 to
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c 2*KL+KU+1; rows 1 to KL of the array need not be set.
c The j-th column of M is stored in the j-th column of the
c array MB as follows:
c MB(kl+ku+1+i-j,j) = M(i,j) for max(1,j-ku)<=i<=min(m,j+kl)
@@ -134,7 +134,7 @@ c
c WHICH Character*2. (INPUT)
c When mode 1,2 are used, WHICH can be set to any one of
c the following.
c
c
c 'LM' -> want the NEV eigenvalues of largest magnitude.
c 'SM' -> want the NEV eigenvalues of smallest magnitude.
c 'LR' -> want the NEV eigenvalues of largest real part.
@@ -142,8 +142,8 @@ c 'SR' -> want the NEV eigenvalues of smallest real part.
c 'LI' -> want the NEV eigenvalues of largest imaginary part.
c 'SI' -> want the NEV eigenvalues of smallest imaginary part.
c
c When mode 3 is used, WHICH should be set to 'LM' only.
c
c When mode 3 is used, WHICH should be set to 'LM' only.
c
c BMAT Character*1. (INPUT)
c BMAT specifies the type of the matrix B that defines the
c semi-inner product for the operator OP.
@@ -152,13 +152,13 @@ c BMAT = 'G' -> generalized eigenvalue problem A*x = lambda*M*x
c NEV Integer. (INPUT)
c Number of eigenvalues of to be computed.
c
c
c TOL Double precision scalar. (INPUT)
c Stopping criteria: the relative accuracy of the Ritz value
c is considered acceptable if BOUNDS(I) .LE. TOL*ABS(RITZ(I))
c where ABS(RITZ(I)) is the magnitude when RITZ(I) is complex.
c DEFAULT = dlamch ('EPS') (machine precision as computed
c by the LAPACK auxilliary subroutine dlamch ).
c by the LAPACK auxiliary subroutine dlamch ).
c
c RESID Complex*16 array of length N. (INPUT/OUTPUT)
c On INPUT:
@@ -171,12 +171,12 @@ c
c NCV Integer. (INPUT)
c Number of columns of the matrix V. NCV must satisfy the two
c inequalities 2 <= NCV-NEV and NCV <= N.
c This will indicate how many Arnoldi vectors are generated
c at each iteration. After the startup phase in which NEV
c Arnoldi vectors are generated, the algorithm generates
c approximately NCV-NEV Arnoldi vectors at each subsequent update
c iteration. Most of the cost in generating each Arnoldi vector is
c in the matrix-vector operation OP*x.
c This will indicate how many Arnoldi vectors are generated
c at each iteration. After the startup phase in which NEV
c Arnoldi vectors are generated, the algorithm generates
c approximately NCV-NEV Arnoldi vectors at each subsequent update
c iteration. Most of the cost in generating each Arnoldi vector is
c in the matrix-vector operation OP*x.
c
c V Complex*16 array N by NCV. (OUTPUT)
c Upon OUTPUT: If RVEC = .TRUE. the first NCONV=IPARAM(5) columns
@@ -184,8 +184,8 @@ c contain approximate Schur vectors that span the
c desired invariant subspace.
c
c NOTE: If the array Z has been set equal to first NEV+1 columns
c of the array V and RVEC=.TRUE. and HOWMNY= 'A', then
c the first NCONV=IPARAM(5) columns of V will contain Ritz vectors
c of the array V and RVEC=.TRUE. and HOWMNY= 'A', then
c the first NCONV=IPARAM(5) columns of V will contain Ritz vectors
c of the eigensystem A*z = lambda*B*z.
c
c LDV Integer. (INPUT)
@@ -193,7 +193,7 @@ c Leading dimension of V exactly as declared in the calling
c program. LDV must be great than or equal to N.
c
c IPARAM Integer array of length 11. (INPUT/OUTPUT)
c IPARAM(1) = ISHIFT:
c IPARAM(1) = ISHIFT:
c The shifts selected at each iteration are used to restart
c the Arnoldi iteration in an implicit fashion.
c It is set to 1 in this subroutine. The user do not need
@@ -223,12 +223,12 @@ c Not referenced. Implicit restarting is ALWAYS used.
c
c IPARAM(7) = MODE
c On INPUT determines what type of eigenproblem is being solved.
c Must be 1,2 or 3; See under \Description of znband for the
c Must be 1,2 or 3; See under \Description of znband for the
c three modes available.
c
c WORKD Complex*16 work array of length at least 3*n. (WORKSPACE)
c
c WORKL Complex*16 work array of length LWORKL. (WORKSPACE)
c WORKL Complex*16 work array of length LWORKL. (WORKSPACE)
c
c LWORKL Integer. (INPUT)
c LWORKL must be at least 3*NCV**2 + 5*NCV.
@@ -237,9 +237,9 @@ c RWORK Double precision array of length N (WORKSPACE)
c Workspace used in znaupd .
c
c IWORK Integer array of dimension at least N. (WORKSPACE)
c Used to mode 2,3. Store the pivot information in the
c Used to mode 2,3. Store the pivot information in the
c factorization of M or (A-SIGMA*M).
c
c
c INFO Integer. (INPUT/OUTPUT)
c Error flag on output.
c = 0: Normal exit.
@@ -300,21 +300,21 @@ c
c-----------------------------------------------------------------------
c
subroutine znband (rvec, howmny, select, d , z, ldz, sigma,
& workev, n, ab, mb, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workev, n, ab, mb, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, rwork, iwork, info )
c
c %------------------%
c | Scalar Arguments |
c %------------------%
c
c
Character which*2, bmat, howmny
Logical rvec
Integer n, lda, kl, ku, nev, ncv, ldv,
& ldz, lworkl, info
Complex*16
& sigma
Double precision
& ldz, lworkl, info
Complex*16
& sigma
Double precision
& tol
c
c %-----------------%
@@ -323,11 +323,11 @@ c %-----------------%
c
Integer iparam(*), iwork(*)
Logical select(*)
Complex*16
Complex*16
& d(*), resid(*), v(ldv,*), z(ldz,*),
& ab(lda,*), mb(lda,*), fac(lda,*),
& ab(lda,*), mb(lda,*), fac(lda,*),
& workd(*), workl(*), workev(*)
Double precision
Double precision
& rwork(*)
c
c %--------------%
@@ -346,7 +346,7 @@ c %------------%
c | Parameters |
c %------------%
c
Complex*16
Complex*16
& one, zero
parameter (one = (1.0D+0, 0.0D+0) ,
& zero = (0.0D+0, 0.0D+0) )
@@ -355,14 +355,14 @@ c %-----------------------------%
c | LAPACK & BLAS routines used |
c %-----------------------------%
c
Double precision
& dznrm2
external zcopy , zgbmv , zgbtrf , zgbtrs , dznrm2 , zlacpy
Double precision
& dznrm2
external zcopy , zgbmv , zgbtrf , zgbtrs , dznrm2 , zlacpy
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
c
c
mode = iparam(7)
c
c %------------------------%
@@ -398,9 +398,9 @@ c | to factor M. |
c %-----------------------------------------------%
c
call zlacpy ('A', ibot, n, mb, lda, fac, lda )
call zgbtrf (n, n, kl, ku, fac, lda, iwork, ierr)
call zgbtrf (n, n, kl, ku, fac, lda, iwork, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*,'_band: error in _gbtrf'
print*, ' '
go to 9000
@@ -426,7 +426,7 @@ c | Construct (A - sigma*M) |
c %---------------------------%
c
do 30 j = 1,n
do 20 i = itop, ibot
do 20 i = itop, ibot
fac(i,j) = ab(i,j) - sigma*mb(i,j)
20 continue
30 continue
@@ -451,7 +451,7 @@ c %--------------------------------------------%
c | M A I N L O O P (reverse communication) |
c %--------------------------------------------%
c
40 continue
40 continue
c
call znaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
@@ -466,8 +466,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( mode .eq. 2 ) then
@@ -476,11 +476,11 @@ c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c %-----------------------------------%
c
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
@@ -493,21 +493,21 @@ c
c
c %-----------------------------------------%
c | Perform y <-- OP*x |
c | = inv[A-SIGMA*M]*M* x
c | = inv[A-SIGMA*M]*M* x
c | to force the starting vector into the |
c | range of OP. |
c %-----------------------------------------%
c
call zgbmv ('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call zgbmv ('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, ' '
print*, '_band: error in _gbtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -521,8 +521,8 @@ c %----------------------------%
c | Perform y <--- OP*x = A*x |
c %----------------------------%
c
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else if ( mode .eq. 2 ) then
@@ -531,16 +531,16 @@ c %-----------------------------------%
c | Perform y <--- OP*x = inv[M]*A*x |
c %-----------------------------------%
c
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call zgbmv ('Notranspose', n, n, kl, ku, one, ab(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
& iwork, workd(ipntr(2)), ldv, ierr)
if (ierr .ne. 0) then
print*, ' '
print*, '_band: error in sbgtrs.'
print*, ' '
print*, ' '
go to 9000
end if
c
@@ -563,19 +563,19 @@ c
end if
c
else
c
c
c %--------------------------------------%
c | Perform y <-- inv(A-sigma*M)*(M*x). |
c | (M*x) has been computed and stored |
c | in workd(ipntr(3)). |
c | in workd(ipntr(3)). |
c %--------------------------------------%
c
call zcopy (n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
call zgbtrs ('Notranspose', n, kl, ku, 1, fac, lda,
& iwork, workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print*, ' '
print*, '_band: error in _gbtrs.'
print*, '_band: error in _gbtrs.'
print*, ' '
go to 9000
end if
@@ -590,14 +590,14 @@ c %--------------------%
c | Perform y <-- M*x |
c %--------------------%
c
call zgbmv ('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
call zgbmv ('Notranspose', n, n, kl, ku, one, mb(itop,1),
& lda, workd(ipntr(1)), 1, zero,
& workd(ipntr(2)), 1)
c
else
else
c
c %-------------------------------------------%
c | Either we have convergence, or there is |
c | Either we have convergence, or there is |
c | error. |
c %-------------------------------------------%
c
@@ -613,7 +613,7 @@ c
print *, ' Check the documentation of _naupd '
print *, ' '
c
else
else
c
call zneupd (rvec, howmny , select, d, z, ldz, sigma,
& workev, bmat, n, which, nev, tol,
@@ -621,17 +621,17 @@ c
& workl, lworkl, rwork, info)
c
if ( info .ne. 0) then
c
c
c %------------------------------------%
c | Check the documentation of zneupd . |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd = ', info
print *, ' Check the documentation of _neupd '
print *, ' '
c
endif
print *, ' '
c
endif
c
end if
c
@@ -643,7 +643,7 @@ c %----------------------------------------%
c | L O O P B A C K to call znaupd again. |
c %----------------------------------------%
c
go to 40
go to 40
c
9000 continue
c
+41 -41
View File
@@ -1,4 +1,4 @@
program znbdr1
program znbdr1
c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is derived from the discretization of
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -64,12 +64,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Complex*16
Complex*16
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workev(2*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv), ax(maxn)
Double precision
Double precision
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -81,28 +81,28 @@ c
& n, nx, lo, isub, isup, idiag, maxitr, mode,
& nconv
logical rvec
Double precision
Double precision
& tol
Complex*16
Complex*16
& rho, h, h2, sigma
c
c
c %------------%
c | Parameters |
c %------------%
c
Complex*16
Complex*16
& one, zero, two
parameter ( one = (1.0D+0, 0.0D+0) ,
& zero = (0.0D+0, 0.0D+0) ,
parameter ( one = (1.0D+0, 0.0D+0) ,
& zero = (0.0D+0, 0.0D+0) ,
& two = (2.0D+0, 0.0D+0) )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dznrm2 , dlapy2
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
Double precision
& dznrm2 , dlapy2
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
c
c %-----------------------%
c | Executable Statements |
@@ -112,7 +112,7 @@ c %-------------------------------------------------%
c | The number NX is the number of interior points |
c | in the discretization of the 2-dimensional |
c | convection-diffusion operator on the unit |
c | square with zero Dirichlet boundary condition. |
c | square with zero Dirichlet boundary condition. |
c | The number N(=NX*NX) is the dimension of the |
c | matrix. A standard eigenvalue problem is |
c | solved (BMAT = 'I'). NEV is the number of |
@@ -123,13 +123,13 @@ c | the spectrum. However, the following |
c | conditions must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
nx = 10
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR1: N is greater than MAXN '
go to 9000
@@ -154,7 +154,7 @@ c | Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
tol = 0.0
info = 0
c
c %---------------------------------------------------%
@@ -168,7 +168,7 @@ c
maxitr = 300
mode = 1
c
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %----------------------------------------%
@@ -190,10 +190,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nx
ku = nx
kl = nx
ku = nx
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -203,13 +203,13 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = (4.0D+0, 0.0D+0) / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
rho = (1.0D+2, 0.0D+0)
c
rho = (1.0D+2, 0.0D+0)
isup = kl+ku
isub = kl+ku+2
do 50 i = 1, nx
@@ -217,8 +217,8 @@ c
do 40 j = lo+1, lo+nx-1
a(isup,j+1) = -one/h2 + rho/two/h
a(isub,j) = -one/h2 - rho/two/h
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -232,8 +232,8 @@ c
do 70 j = lo+1, lo+nx
a(isup,nx+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %-----------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -241,11 +241,11 @@ c | and eigenvectors. Eigenvalues are returned in |
c | the one dimensional array D. Eigenvectors |
c | are returned in the first NCONV (=IPARAM(5)) |
c | columns of V. |
c %-----------------------------------------------%
c %-----------------------------------------------%
c
rvec = .true.
rvec = .true.
call znband (rvec, 'A', select, d, v, ldv, sigma,
& workev, n, a, m, lda, fac, kl, ku, which,
& workev, n, a, m, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, rwork, iwork, info)
c
@@ -294,11 +294,11 @@ c
rd(j,2) = dimag (d(j))
rd(j,3) = dznrm2 (n, ax, 1)
rd(j,3) = rd(j,3) / dlapy2 (rd(j,1),rd(j,2))
90 continue
90 continue
call dmout (6, nconv, 3, rd, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -309,8 +309,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+40 -40
View File
@@ -1,4 +1,4 @@
program znbdr2
program znbdr2
c
c ... Construct the matrix A in LAPACK-style band form.
c The matrix A is derived from the discretization of
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn )
c
c %--------------%
@@ -64,12 +64,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Complex*16
Complex*16
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workev(2*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv), ax(maxn)
Double precision
Double precision
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -81,18 +81,18 @@ c
& n, nxi, lo, isub, isup, idiag, maxitr, mode,
& nconv
logical rvec
Double precision
Double precision
& tol
Complex*16
Complex*16
& rho, h, h2, sigma
c
c
c %------------%
c | Parameters |
c %------------%
c
Complex*16
Complex*16
& one, zero, two
parameter (one = (1.0D+0, 0.0D+0) ,
parameter (one = (1.0D+0, 0.0D+0) ,
& zero = (0.0D+0, 0.0D+0) ,
& two = (2.0D+0, 0.0D+0) )
c
@@ -100,9 +100,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dznrm2 , dlapy2
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
Double precision
& dznrm2 , dlapy2
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
c
c %-----------------------%
c | Executable Statements |
@@ -112,7 +112,7 @@ c %-------------------------------------------------%
c | The number NX is the number of interior points |
c | in the discretization of the 2-dimensional |
c | convection-diffusion operator on the unit |
c | square with zero Dirichlet boundary condition. |
c | square with zero Dirichlet boundary condition. |
c | The number N(=NX*NX) is the dimension of the |
c | matrix. A standard eigenvalue problem is |
c | solved (BMAT = 'I'). NEV is the number of |
@@ -122,16 +122,16 @@ c | is used, WHICH is set to 'LM'. The user can |
c | modify NX, NEV and NCV to solve problems of |
c | different sizes, and to get different parts the |
c | spectrum. However, the following conditions |
c | must be satisfied: |
c | must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
nxi = 10
nxi = 10
n = nxi*nxi
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR2: N is greater than MAXN '
go to 9000
@@ -157,7 +157,7 @@ c | Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
tol = 0.0
info = 0
c
c %---------------------------------------------------%
@@ -193,10 +193,10 @@ c | and subdiagonals within the band of |
c | matrices A and M. |
c %-------------------------------------%
c
kl = nxi
ku = nxi
kl = nxi
ku = nxi
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -206,13 +206,13 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = (4.0D+0, 0.0D+0) / h2
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
rho = (1.0D+2, 0.0D+0)
c
rho = (1.0D+2, 0.0D+0)
isup = kl+ku
isub = kl+ku+2
do 50 i = 1, nxi
@@ -220,8 +220,8 @@ c
do 40 j = lo+1, lo+nxi-1
a(isup,j+1) = -one/h2 + rho/two/h
a(isub,j) = -one/h2 - rho/two/h
40 continue
50 continue
40 continue
50 continue
c
c %------------------------------------%
c | KL-th subdiagonal and KU-th super- |
@@ -235,8 +235,8 @@ c
do 70 j = lo+1, lo+nxi
a(isup,nxi+j) = -one / h2
a(isub,j) = -one / h2
70 continue
80 continue
70 continue
80 continue
c
c %-----------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -244,11 +244,11 @@ c | and eigenvectors. Eigenvalues are returned in |
c | the one dimensional array D. Eigenvectors |
c | are returned in the first NCONV (=IPARAM(5)) |
c | columns of V. |
c %-----------------------------------------------%
c %-----------------------------------------------%
c
rvec = .true.
rvec = .true.
call znband (rvec, 'A', select, d, v, ldv, sigma,
& workev, n, a, m, lda, fac, kl, ku, which,
& workev, n, a, m, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
& workd, workl, lworkl, rwork, iwork, info)
c
@@ -297,11 +297,11 @@ c
rd(j,2) = dimag (d(j))
rd(j,3) = dznrm2 (n, ax, 1)
rd(j,3) = rd(j,3) / dlapy2 (rd(j,1),rd(j,2))
90 continue
90 continue
call dmout (6, nconv, 3, rd, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -312,8 +312,8 @@ c
print *, ' '
print *, ' Error with _nband, info= ', info
print *, ' Check the documentation of _nband '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+35 -35
View File
@@ -1,9 +1,9 @@
program znbdr3
program znbdr3
c
c ... Construct matrices A and M in LAPACK-style band form.
c Matrices A and M are derived from the finite
c element discretization of the 1-dimensional
c convection-diffusion operator
c Matrices A and M are derived from the finite
c element discretization of the 1-dimensional
c convection-diffusion operator
c (d^2u/dx^2) + rho*(du/dx)
c on the interval [0,1] with zero boundary condition using
c piecewise linear elements.
@@ -51,13 +51,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn)
c
c %--------------%
@@ -66,12 +66,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Complex*16
Complex*16
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workev(2*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv), ax(maxn), mx(maxn)
Double precision
Double precision
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -83,16 +83,16 @@ c
& n, idiag, isup, isub, maxitr,
& mode, nconv
logical rvec
Double precision
Double precision
& tol
Complex*16
Complex*16
& rho, h, sigma
c
c
c %------------%
c | Parameters |
c %------------%
c
Complex*16
Complex*16
& one, zero, two
parameter (one = (1.0D+0, 0.0D+0) ,
& zero = (0.0D+0, 0.0D+0) ,
@@ -102,9 +102,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dznrm2 , dlapy2
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
Double precision
& dznrm2 , dlapy2
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
c
c %-----------------------%
c | Executable Statements |
@@ -129,8 +129,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR3: N is greater than MAXN '
go to 9000
@@ -146,13 +146,13 @@ c
sigma = zero
c
c %----------------------------------------------------%
c | The work array WORKL is used in ZNAUPD as |
c | The work array WORKL is used in ZNAUPD as |
c | workspace. Its dimension LWORKL has to be set as |
c | illustrated below. The parameter TOL determines |
c | the stopping criterion. If TOL<=0, machine machine |
c | precision is used. Setting INFO=0 indicates that |
c | using a randomly generated vector to start the |
c | the ARNOLDI process. |
c | the ARNOLDI process. |
c %----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
@@ -195,7 +195,7 @@ c
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
@@ -203,23 +203,23 @@ c
c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = (2.0D+0, 0.0D+0) / h
m(idiag,j) = (4.0D+0, 0.0D+0) * h
30 continue
c
a(idiag,j) = (2.0D+0, 0.0D+0) / h
m(idiag,j) = (4.0D+0, 0.0D+0) * h
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
rho = (1.0D+1, 0.0D+0)
rho = (1.0D+1, 0.0D+0)
do 40 j = 1, n-1
a(isup,j+1) = -one/h + rho/two
a(isub,j) = -one/h - rho/two
m(isup,j+1) = one*h
m(isub,j) = one*h
40 continue
40 continue
c
c %-----------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -229,7 +229,7 @@ c | are returned in the first NCONV (=IPARAM(5)) |
c | columns of V. |
c %-----------------------------------------------%
c
rvec = .true.
rvec = .true.
call znband (rvec, 'A', select, d, v, ldv, sigma,
& workev, n, a, m, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
@@ -277,24 +277,24 @@ c
rd(j,1) = dble (d(j))
rd(j,2) = dimag (d(j))
rd(j,3) = dznrm2 (n, ax, 1)
rd(j,3) = rd(j,3) / dlapy2 (rd(j,1), rd(j,2))
50 continue
rd(j,3) = rd(j,3) / dlapy2 (rd(j,1), rd(j,2))
50 continue
call dmout (6, nconv, 3, rd, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
c | is error. Check the documentation |
c | for znband . |
c | for znband . |
c %-------------------------------------%
c
print *, ' '
print *, ' Error with _band, info= ', info
print *, ' Check the documentation of _band '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+31 -31
View File
@@ -1,4 +1,4 @@
program zndrv4
program zndrv4
c
c ... Construct matrices A and M in LAPACK-style band form.
c Matries A and M are derived from the finite
@@ -49,13 +49,13 @@ c | MAXN - Maximum size of the matrix |
c | MAXNEV - Maximum number of |
c | eigenvalues to be computed |
c | MAXNCV - Maximum number of Arnoldi |
c | vectors stored |
c | vectors stored |
c | MAXBDW - Maximum bandwidth |
c %-------------------------------------%
c
integer maxn, maxnev, maxncv, maxbdw, lda,
& lworkl, ldv
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
parameter ( maxn = 1000, maxnev = 25, maxncv=50,
& maxbdw=50, lda = maxbdw, ldv = maxn)
c
c %--------------%
@@ -64,12 +64,12 @@ c %--------------%
c
integer iparam(11), iwork(maxn)
logical select(maxncv)
Complex*16
Complex*16
& a(lda,maxn), m(lda,maxn), fac(lda,maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workl(3*maxncv*maxncv+5*maxncv), workd(3*maxn),
& workev(2*maxncv), v(ldv, maxncv),
& resid(maxn), d(maxncv), ax(maxn), mx(maxn)
Double precision
Double precision
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -81,16 +81,16 @@ c
& n, idiag, isup, isub, maxitr, mode,
& nconv
logical rvec
Double precision
Double precision
& tol
Complex*16
Complex*16
& rho, h, sigma
c
c
c %------------%
c | Parameters |
c %------------%
c
Complex*16
Complex*16
& one, zero, two, four, six
parameter (one = (1.0D+0, 0.0D+0) ,
& zero = (0.0D+0, 0.0D+0) ,
@@ -102,9 +102,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dznrm2 , dlapy2
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
Double precision
& dznrm2 , dlapy2
external dznrm2 , zgbmv , zaxpy , dlapy2 , zlaset
c
c %-----------------------%
c | Executable Statements |
@@ -121,7 +121,7 @@ c | solved (BMAT = 'G'). NEV is the number of |
c | eigenvalues (closest to the shift SIGMA) to be |
c | approximated. Since the shift and invert mode |
c | is used, WHICH is set to 'LM'. The user can |
c | modify NX, NEV and NCV to solve problems of |
c | modify NX, NEV and NCV to solve problems of |
c | different sizes, and to get different parts the |
c | spectrum. However, the following conditions |
c | must be satisfied: |
@@ -131,8 +131,8 @@ c | NEV + 2 <= NCV <= MAXNCV |
c %-------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NBDR4: N is greater than MAXN '
go to 9000
@@ -145,16 +145,16 @@ c
end if
bmat = 'G'
which = 'LM'
sigma = (1.0D+1, 0.0D+0)
sigma = (1.0D+1, 0.0D+0)
c
c %----------------------------------------------------%
c | The work array WORKL is used in ZNAUPD as |
c | The work array WORKL is used in ZNAUPD as |
c | workspace. Its dimension LWORKL has to be set as |
c | illustrated below. The parameter TOL determines |
c | the stopping criterion. If TOL<=0, machine machine |
c | precision is used. Setting INFO=0 indicates that |
c | we using a randomly generated vector to start the |
c | the ARNOLDI process. |
c | the ARNOLDI process. |
c %----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
@@ -197,30 +197,30 @@ c
kl = 1
ku = 1
c
c %---------------%
c %---------------%
c | Main diagonal |
c %---------------%
c
h = one / dcmplx (n+1)
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = two / h
a(idiag,j) = two / h
m(idiag,j) = four * h / six
30 continue
c
30 continue
c
c %-------------------------------------%
c | First subdiagonal and superdiagonal |
c %-------------------------------------%
c
c
isup = kl+ku
isub = kl+ku+2
rho = (1.0D+1, 0.0D+0)
rho = (1.0D+1, 0.0D+0)
do 40 j = 1, n-1
a(isup,j+1) = -one/h + rho/two
a(isub,j) = -one/h - rho/two
m(isup,j+1) = one*h / six
m(isub,j) = one*h / six
40 continue
40 continue
c
c %-----------------------------------------------%
c | Call ARPACK banded solver to find eigenvalues |
@@ -230,7 +230,7 @@ c | are returned in the first NCONV (=IPARAM(5)) |
c | columns of V. |
c %-----------------------------------------------%
c
rvec = .true.
rvec = .true.
call znband (rvec, 'A', select, d, v, ldv, sigma,
& workev, n, a, m, lda, fac, kl, ku, which,
& bmat, nev, tol, resid, ncv, v, ldv, iparam,
@@ -279,11 +279,11 @@ c
rd(j,2) = dimag (d(j))
rd(j,3) = dznrm2 (n, ax, 1)
rd(j,3) = rd(j,3) / dlapy2 (rd(j,1), rd(j,2))
90 continue
90 continue
call dmout (6, nconv, 3, rd, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
else
else
c
c %-------------------------------------%
c | Either convergence failed, or there |
@@ -294,8 +294,8 @@ c
print *, ' '
print *, ' Error with _band, info= ', info
print *, ' Check the documentation of _band '
print *, ' '
print *, ' '
c
end if
c
9000 end
9000 end
+22
View File
@@ -0,0 +1,22 @@
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
CNDRV = cndrv1 cndrv2 cndrv3 cndrv4
ZNDRV = zndrv1 zndrv2 zndrv3 zndrv4
COMPLEX = $(CNDRV) $(ZNDRV)
check_PROGRAMS = $(COMPLEX)
TESTS = $(check_PROGRAMS)
EXTRA_DIST = README
# Complex problem using single complex
cndrv1_SOURCES = cndrv1.f
cndrv2_SOURCES = cndrv2.f
cndrv3_SOURCES = cndrv3.f
cndrv4_SOURCES = cndrv4.f
# Complex problem using double complex
zndrv1_SOURCES = zndrv1.f
zndrv2_SOURCES = zndrv2.f
zndrv3_SOURCES = zndrv3.f
zndrv4_SOURCES = zndrv4.f
+53 -53
View File
@@ -1,14 +1,14 @@
program cndrv1
program cndrv1
c
c Example program to illustrate the idea of reverse communication
c for a standard complex nonsymmetric eigenvalue problem.
c for a standard complex nonsymmetric eigenvalue problem.
c
c We implement example one of ex-complex.doc in DOCUMENTS directory
c
c\Example-1
c ... Suppose we want to solve A*x = lambda*x in regular mode,
c where A is obtained from the standard central difference
c discretization of the convection-diffusion operator
c discretization of the convection-diffusion operator
c (Laplacian u) + rho*(du / dx)
c on the unit squre [0,1]x[0,1] with zero Dirichlet boundary
c condition.
@@ -69,12 +69,12 @@ c %--------------%
c
integer iparam(11), ipntr(14)
logical select(maxncv)
Complex
& ax(maxn), d(maxncv),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv), resid(maxn),
Complex
& ax(maxn), d(maxncv),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv), resid(maxn),
& workl(3*maxncv*maxncv+5*maxncv)
Real
Real
& rwork(maxncv), rd(maxncv,3)
c
c %---------------%
@@ -84,9 +84,9 @@ c
character bmat*1, which*2
integer ido, n, nx, nev, ncv, lworkl, info, j,
& ierr, nconv, maxitr, ishfts, mode
Complex
Complex
& sigma
Real
Real
& tol
logical rvec
c
@@ -94,19 +94,19 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& scnrm2, slapy2
external scnrm2, caxpy, slapy2
external scnrm2, caxpy, slapy2
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
c
c
c %--------------------------------------------------%
c | The number NX is the number of interior points |
c | in the discretization of the 2-dimensional |
c | convection-diffusion operator on the unit |
c | square with zero Dirichlet boundary condition. |
c | square with zero Dirichlet boundary condition. |
c | The number N(=NX*NX) is the dimension of the |
c | matrix. A standard eigenvalue problem is |
c | solved (BMAT = 'I'). NEV is the number of |
@@ -117,13 +117,13 @@ c | the spectrum. However, The following |
c | conditions must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
nx = 10
n = nx*nx
nx = 10
n = nx*nx
nev = 4
ncv = 20
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV1: N is greater than MAXN '
go to 9000
@@ -138,18 +138,18 @@ c
which = 'LM'
c
c %---------------------------------------------------%
c | The work array WORKL is used in CNAUPD as |
c | The work array WORKL is used in CNAUPD as |
c | workspace. Its dimension LWORKL is set as |
c | illustrated below. The parameter TOL determines |
c | the stopping criterion. If TOL<=0, machine |
c | precision is used. The variable IDO is used for |
c | reverse communication, and is initially set to 0. |
c | Setting INFO=0 indicates that a random vector is |
c | generated to start the ARNOLDI iteration. |
c | generated to start the ARNOLDI iteration. |
c %---------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
lworkl = 3*ncv**2+5*ncv
tol = 0.0
ido = 0
info = 0
c
@@ -168,11 +168,11 @@ c
mode = 1
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
c | M A I N L O O P (Reverse communication) |
c %-------------------------------------------%
c
10 continue
@@ -197,7 +197,7 @@ c | The user should supply his/her own |
c | matrix vector multiplication routine here |
c | that takes workd(ipntr(1)) as the input |
c | vector, and return the matrix vector |
c | product to workd(ipntr(2)). |
c | product to workd(ipntr(2)). |
c %-------------------------------------------%
c
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
@@ -209,7 +209,7 @@ c
go to 10
end if
c
c
c %----------------------------------------%
c | Either we have convergence or there is |
c | an error. |
@@ -227,7 +227,7 @@ c
print *, ' Check the documentation of _naupd'
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -241,16 +241,16 @@ c %-------------------------------------------%
c
rvec = .true.
c
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
& rwork, ierr)
c
c %----------------------------------------------%
c | Eigenvalues are returned in the one |
c | dimensional array D. The corresponding |
c | eigenvectors are returned in the first NCONV |
c | (=IPARAM(5)) columns of the two dimensional |
c | (=IPARAM(5)) columns of the two dimensional |
c | array V if requested. Otherwise, an |
c | orthogonal basis for the invariant subspace |
c | corresponding to the eigenvalues in D is |
@@ -258,7 +258,7 @@ c | returned in V. |
c %----------------------------------------------%
c
if ( ierr .ne. 0) then
c
c
c %------------------------------------%
c | Error condition: |
c | Check the documentation of CNEUPD. |
@@ -312,11 +312,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, '_NDRV1'
@@ -327,8 +327,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -344,7 +344,7 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector subroutine
@@ -354,21 +354,21 @@ c discretized using centered difference.
c
subroutine av (nx, v, w)
integer nx, j, lo
Complex
Complex
& v(nx*nx), w(nx*nx), one, h2
parameter (one = (1.0E+0, 0.0E+0) )
external caxpy, tv
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
c | -I T|
c
c derived from the standard central difference discretization
c derived from the standard central difference discretization
c of the convection-diffusion operator (Laplacian u) + rho*(du/dx)
c with zero boundary condition.
c
@@ -385,7 +385,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call caxpy(nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
call caxpy(nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -396,29 +396,29 @@ c
c=========================================================================
subroutine tv (nx, x, y)
c
integer nx, j
Complex
integer nx, j
Complex
& x(nx), y(nx), h, h2, dd, dl, du
c
Complex
Complex
& one, rho
parameter (one = (1.0E+0, 0.0E+0) ,
& rho = (1.0E+2, 0.0E+0) )
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal
c
c
h = one / cmplx(nx+1)
h2 = h*h
dd = (4.0E+0, 0.0E+0) / h2
dl = -one/h2 - (5.0E-1, 0.0E+0) *rho/h
du = -one/h2 + (5.0E-1, 0.0E+0) *rho/h
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
+41 -41
View File
@@ -1,7 +1,7 @@
program cndrv2
c
c Simple program to illustrate the idea of reverse communication
c in shift-invert mode for a standard complex nonsymmetric eigenvalue
c in shift-invert mode for a standard complex nonsymmetric eigenvalue
c problem.
c
c We implement example two of ex-complex.doc in DOCUMENTS directory
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -69,14 +69,14 @@ c %--------------%
c
integer iparam(11), ipntr(14), ipiv(maxn)
logical select(maxncv)
Complex
Complex
& ax(maxn), d(maxncv), resid(maxn),
& v(ldv, maxncv), workd(3*maxn),
& workev(2*maxncv),
& workl(3*maxncv*maxncv+5*maxncv),
& dd(maxn), dl(maxn), du(maxn),
& du2(maxn)
Real
Real
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -86,11 +86,11 @@ c
character bmat*1, which*2
integer ido, n, nev, ncv, lworkl, info, j, ierr,
& nconv, maxitr, ishfts, mode
Complex
Complex
& h, h2, s, sigma, s1, s2, s3, rho
common /convct/ rho
c
Real
Real
& tol
logical rvec
c
@@ -98,9 +98,9 @@ c %------------%
c | Parameters |
c %------------%
c
Complex
& one, zero, two
parameter (one = (1.0E+0, 0.0E+0) ,
Complex
& one, zero, two
parameter (one = (1.0E+0, 0.0E+0) ,
& zero = (0.0E+0, 0.0E+0) ,
& two = (2.0E+0, 0.0E+0) )
c
@@ -108,7 +108,7 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& scnrm2, slapy2
external cgttrf, cgttrs, caxpy, ccopy, scnrm2,
& slapy2
@@ -160,22 +160,22 @@ c | the interval [0, 1] with zero Dirichlet boundary |
c | condition. |
c %----------------------------------------------------%
c
rho = (1.0E+1, 0.0E+0)
rho = (1.0E+1, 0.0E+0)
h = one / cmplx(n+1)
h2 = h*h
s = rho / two
c
s1 = -one/h2 - s/h
s1 = -one/h2 - s/h
s2 = two/h2 - sigma
s3 = -one/h2 + s/h
s3 = -one/h2 + s/h
c
do 10 j = 1, n-1
dl(j) = s1
dl(j) = s1
dd(j) = s2
du(j) = s3
10 continue
dd(n) = s2
c
10 continue
dd(n) = s2
c
call cgttrf(n, dl, dd, du, du2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -195,8 +195,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in CNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
lworkl = 3*ncv**2+5*ncv
tol = 0.0
ido = 0
info = 0
c
@@ -214,18 +214,18 @@ c
maxitr = 300
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
c | M A I N L O O P (Reverse communication) |
c %-------------------------------------------%
c
20 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine CNAUPD and take |
c | Repeatedly call the routine CNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
@@ -247,8 +247,8 @@ c %-------------------------------------------%
c
call ccopy( n, workd(ipntr(1)),1, workd(ipntr(2)), 1)
c
call cgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
call cgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV2.'
@@ -279,23 +279,23 @@ c
print *, ' '
print *, ' Error with _naupd, info = ',info
print *, ' Check the documentation in _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using CNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
c
rvec = .true.
c
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, rwork, ierr)
@@ -312,19 +312,19 @@ c | returned in V. |
c %----------------------------------------------%
c
if ( ierr .ne. 0) then
c
c
c %------------------------------------%
c | Error condition: |
c | Error condition: |
c | Check the documentation of CNEUPD. |
c %------------------------------------%
c
c
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd. '
print *, ' '
else
c
nconv = iparam(5)
nconv = iparam(5)
do 60 j=1, nconv
c
c %---------------------------%
@@ -366,11 +366,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, '_NDRV2 '
@@ -381,8 +381,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -405,7 +405,7 @@ c matrix vector multiplication subroutine
c
subroutine av (n, v, w)
integer n, j
Complex
Complex
& v(n), w(n), rho, two, one, dd, dl, du, s, h,
& h2
parameter (one = (1.0E+0, 0.0E+0) ,
+57 -57
View File
@@ -1,7 +1,7 @@
program cndrv3
c
c Simple program to illustrate the idea of reverse communication
c in inverse mode for a generalized complex nonsymmetric eigenvalue
c in inverse mode for a generalized complex nonsymmetric eigenvalue
c problem.
c
c We implement example three of ex-complex.doc in DOCUMENTS directory
@@ -11,8 +11,8 @@ c ... Suppose we want to solve A*x = lambda*B*x in regular mode,
c where A and B are derived from the finite element discretization
c of the 1-dimensional convection-diffusion operator
c (d^2u/dx^2) + rho*(du/dx)
c on the interval [0,1] with zero boundary condition using
c piecewise linear elements.
c on the interval [0,1] with zero boundary condition using
c piecewise linear elements.
c
c ... OP = inv[M]*A and B = M.
c
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -69,13 +69,13 @@ c %--------------%
c
integer iparam(11), ipntr(14), ipiv(maxn)
logical select(maxncv)
Complex
Complex
& ax(maxn), mx(maxn), d(maxncv), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(2*maxncv),
& workl(3*maxncv*maxncv+5*maxncv),
& dd(maxn), dl(maxn), du(maxn), du2(maxn)
Real
Real
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -85,9 +85,9 @@ c
character bmat*1, which*2
integer ido, n, nev, ncv, lworkl, info, ierr, j,
& nconv, maxitr, ishfts, mode
Complex
Complex
& sigma, h
Real
Real
& tol
logical rvec
c
@@ -95,7 +95,7 @@ c %------------%
c | Parameters |
c %------------%
c
Complex
Complex
& zero, one
parameter (zero = (0.0E+0, 0.0E+0) ,
& one = (1.0E+0, 0.0E+0) )
@@ -104,7 +104,7 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& scnrm2, slapy2
external caxpy, ccopy, scnrm2, cgttrf, cgttrs,
& slapy2
@@ -126,9 +126,9 @@ c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
ncv = 20
n = 100
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV3: N is greater than MAXN '
go to 9000
@@ -154,15 +154,15 @@ c
do 20 j = 1, n-1
dl(j) = one*h
dd(j) = (4.0E+0, 0.0E+0) *h
du(j) = one*h
20 continue
dd(n) = (4.0E+0, 0.0E+0) *h
du(j) = one*h
20 continue
dd(n) = (4.0E+0, 0.0E+0) *h
c
call cgttrf(n, dl, dd, du, du2, ipiv, ierr)
call cgttrf(n, dl, dd, du, du2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrf. '
print*, ' '
print*, ' ERROR with _gttrf. '
print*, ' '
go to 9000
end if
c
@@ -177,8 +177,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in CNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
lworkl = 3*ncv**2+5*ncv
tol = 0.0
ido = 0
info = 0
c
@@ -197,8 +197,8 @@ c
mode = 2
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
@@ -207,14 +207,14 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine CNAUPD and take |
c | Repeatedly call the routine CNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call cnaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
call cnaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
& rwork, info )
c
if (ido .eq. -1 .or. ido .eq. 1) then
@@ -233,8 +233,8 @@ c
call cgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs. '
print*, ' '
print*, ' ERROR with _gttrs. '
print*, ' '
go to 9000
end if
@@ -268,7 +268,7 @@ c
c %-----------------------------------------%
c | Either we have convergence, or there is |
c | an error. |
c %-----------------------------------------%
c %-----------------------------------------%
c
if ( info .lt. 0 ) then
c
@@ -280,24 +280,24 @@ c
print *, ' '
print *, ' Error with _naupd, info = ',info
print *, ' Check the documentation of _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using CNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
rvec = .true.
c
call cneupd ( rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv, v,
call cneupd ( rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv, v,
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
& ierr )
c
@@ -318,8 +318,8 @@ c %------------------------------------%
c | Error condition: |
c | Check the documentation of CNEUPD. |
c %------------------------------------%
c
print *, ' '
c
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd'
print *, ' '
@@ -327,7 +327,7 @@ c
else
c
nconv = iparam(5)
do 80 j=1, nconv
do 80 j=1, nconv
c
c %---------------------------%
c | Compute the residual norm |
@@ -369,11 +369,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, '_NDRV3 '
@@ -384,8 +384,8 @@ c
print *, ' The number of Arnoldi vectors generated ',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -397,21 +397,21 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
c
subroutine av (n, v, w)
integer n, j
Complex
& v(n), w(n), one, two, dd, dl, du, s, h, rho
Complex
& v(n), w(n), one, two, dd, dl, du, s, h, rho
parameter (one = (1.0E+0, 0.0E+0) ,
& two = (2.0E+0, 0.0E+0) ,
& rho = (1.0E+1, 0.0E+0) )
c
c Compute the matrix vector multiplication y<---A*x
c where A is the stiffness matrix formed by using piecewise linear
c where A is the stiffness matrix formed by using piecewise linear
c elements on [0,1].
c
h = one / cmplx(n+1)
@@ -422,28 +422,28 @@ c
c
w(1) = dd*v(1) + du*v(2)
do 10 j = 2,n-1
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
10 continue
w(n) = dl*v(n-1) + dd*v(n)
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
10 continue
w(n) = dl*v(n-1) + dd*v(n)
return
end
c------------------------------------------------------------------------
subroutine mv (n, v, w)
integer n, j
Complex
Complex
& v(n), w(n), one, four, h
parameter (one = (1.0E+0, 0.0E+0) ,
parameter (one = (1.0E+0, 0.0E+0) ,
& four = (4.0E+0, 0.0E+0) )
c
c Compute the matrix vector multiplication y<---M*x
c where M is the mass matrix formed by using piecewise linear elements
c where M is the mass matrix formed by using piecewise linear elements
c on [0,1].
c
c
w(1) = four*v(1) + one*v(2)
do 10 j = 2,n-1
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
c
h = one / cmplx(n+1)
call cscal(n, h, w, 1)
+53 -53
View File
@@ -1,7 +1,7 @@
program cndrv4
c
c Simple program to illustrate the idea of reverse communication
c in shift and invert mode for a generalized complex nonsymmetric
c in shift and invert mode for a generalized complex nonsymmetric
c eigenvalue problem.
c
c We implement example four of ex-complex.doc in DOCUMENTS directory
@@ -11,7 +11,7 @@ c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode,
c where A and B are derived from a finite element discretization
c of a 1-dimensional convection-diffusion operator
c (d^2u/dx^2) + rho*(du/dx)
c on the interval [0,1] with zero boundary condition using
c on the interval [0,1] with zero boundary condition using
c piecewise linear elements.
c
c ... where the shift sigma is a complex number.
@@ -36,15 +36,15 @@ c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
c\Author
c Danny Sorensen
c Richard Lehoucq
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c Danny Sorensen
c Richard Lehoucq
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
c\SCCS Information: @(#)
c FILE: ndrv4.F SID: 2.4 DATE OF SID: 10/18/00 RELEASE: 2
c
c\Remarks
@@ -63,7 +63,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -72,14 +72,14 @@ c %--------------%
c
integer iparam(11), ipntr(14), ipiv(maxn)
logical select(maxncv)
Complex
& ax(maxn), mx(maxn), d(maxncv),
Complex
& ax(maxn), mx(maxn), d(maxncv),
& v(ldv,maxncv), workd(3*maxn), resid(maxn),
& workev(2*maxncv),
& workl(3*maxncv*maxncv+5*maxncv),
& dd(maxn), dl(maxn), du(maxn),
& du2(maxn)
Real
Real
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -89,20 +89,20 @@ c
character bmat*1, which*2
integer ido, n, nev, ncv, lworkl, info, j, ierr,
& nconv, maxitr, ishfts, mode
Complex
Complex
& rho, h, s,
& sigma, s1, s2, s3
common /convct/ rho
c
Real
Real
& tol
logical rvec
c
logical rvec
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& scnrm2, slapy2
external scnrm2, caxpy, ccopy, cgttrf, cgttrs,
& slapy2
@@ -111,10 +111,10 @@ c %------------%
c | Parameters |
c %------------%
c
Complex
Complex
& one, zero, two, four, six
parameter (one = (1.0E+0, 0.0E+0) ,
& zero = (0.0E+0, 0.0E+0) ,
& zero = (0.0E+0, 0.0E+0) ,
& two = (2.0E+0, 0.0E+0) ,
& four = (4.0E+0, 0.0E+0) ,
& six = (6.0E+0, 0.0E+0) )
@@ -138,7 +138,7 @@ c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
n = 100
nev = 4
ncv = 20
if ( n .gt. maxn ) then
@@ -153,7 +153,7 @@ c
end if
bmat = 'G'
which = 'LM'
sigma = one
sigma = one
c
c %--------------------------------------------------%
c | Construct C = A - SIGMA*M in COMPLEX arithmetic. |
@@ -164,11 +164,11 @@ c | central difference discretization of the 1-d |
c | convection-diffusion operator u``+ rho*u` on the |
c | interval [0, 1] with zero Dirichlet boundary |
c | condition. The matrix M is chosen to be the |
c | symmetric tridiagonal matrix with 4.0 on the |
c | diagonal and 1.0 on the off-diagonals. |
c | symmetric tridiagonal matrix with 4.0 on the |
c | diagonal and 1.0 on the off-diagonals. |
c %--------------------------------------------------%
c
rho = (1.0E+1, 0.0E+0)
rho = (1.0E+1, 0.0E+0)
h = one / cmplx(n+1)
s = rho / two
c
@@ -177,12 +177,12 @@ c
s3 = -one/h + s - sigma*h/six
c
do 10 j = 1, n-1
dl(j) = s1
dl(j) = s1
dd(j) = s2
du(j) = s3
10 continue
dd(n) = s2
c
10 continue
dd(n) = s2
c
call cgttrf(n, dl, dd, du, du2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -202,7 +202,7 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in CNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
lworkl = 3*ncv**2+5*ncv
tol = 0.0
ido = 0
info = 0
@@ -222,11 +222,11 @@ c
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------%
c | M A I N L O O P(Reverse communication) |
c | M A I N L O O P(Reverse communication) |
c %------------------------------------------%
c
20 continue
@@ -258,14 +258,14 @@ c | workd(ipntr(2)). |
c %-------------------------------------------%
c
call mv (n, workd(ipntr(1)), workd(ipntr(2)))
call cgttrs('N', n, 1, dl, dd, du, du2, ipiv,
call cgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV4.'
print*, ' '
go to 9000
end if
end if
c
c %-----------------------------------------%
c | L O O P B A C K to call CNAUPD again. |
@@ -285,7 +285,7 @@ c | workd(ipntr(2)). |
c %-----------------------------------------%
c
call ccopy( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call cgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
call cgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -317,8 +317,8 @@ c %-----------------------------------------%
c
go to 20
c
end if
c
end if
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
c | an error. |
@@ -334,9 +334,9 @@ c
print *, ' '
print *, ' Error with _naupd, info = ', info
print *, ' Check the documentation of _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -350,9 +350,9 @@ c %-------------------------------------------%
c
rvec = .true.
c
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv, v,
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
call cneupd (rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv, v,
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
& ierr)
c
c %----------------------------------------------%
@@ -367,7 +367,7 @@ c | returned in V. |
c %----------------------------------------------%
c
if ( ierr .ne. 0) then
c
c
c %------------------------------------%
c | Error condition: |
c | Check the documentation of CNEUPD. |
@@ -438,27 +438,27 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
c
subroutine mv (n, v, w)
integer n, j
Complex
Complex
& v(n), w(n), one, four, six, h
parameter (one = (1.0E+0, 0.0E+0) ,
& four = (4.0E+0, 0.0E+0) ,
& six = (6.0E+0, 0.0E+0) )
c
c Compute the matrix vector multiplication y<---M*x
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c diagonal, 1 on the subdiagonal and superdiagonal.
c
c
w(1) = ( four*v(1) + one*v(2) ) / six
do 40 j = 2,n-1
w(j) = ( one*v(j-1) + four*v(j) + one*v(j+1) ) / six
40 continue
40 continue
w(n) = ( one*v(n-1) + four*v(n) ) / six
c
h = one / cmplx(n+1)
@@ -468,9 +468,9 @@ c
c------------------------------------------------------------------
subroutine av (n, v, w)
integer n, j
Complex
& v(n), w(n), one, two, dd, dl, du, s, h, rho
parameter (one = (1.0E+0, 0.0E+0) ,
Complex
& v(n), w(n), one, two, dd, dl, du, s, h, rho
parameter (one = (1.0E+0, 0.0E+0) ,
& two = (2.0E+0, 0.0E+0) )
common /convct/ rho
c
-60
View File
@@ -1,60 +0,0 @@
#
# makefile to run simple examples of the reverse communication
# protocol.
#
# Modify if ALIBS library was built somewhere else.
#
# If ALIBS (defined in ../../ARmake.inc) contains the BLAS and LAPACK
# libraries installed on your system, you DO NOT need to change this
# makefile. OTHERWISE, you may need to modify the Makefile in the top level
# ARPACK directory tree to include cdrv and/or zdrv in the
# definition of the PRECISION variable, and issue 'make lib' from there.
# For example:
#
# PRECISION = single double sdrv ddrv
#
#\SCCS Information: @(#)
# FILE: makefile SID: 2.2 DATE OF SID: 9/24/96 RELEASE: 2
#
include ../../ARmake.inc
#
# Issue "complex" to make all 8 complex drivers.
# Issue "cndrv" to make 4 single precision complex drivers.
# Issue "zndrv" to make 4 double precision complex drivers.
#
complex: cndrv zndrv
#-----------------------------------------------------------------------
# Complex problem using single complex
#
cndrv: cndrv1 cndrv2 cndrv3 cndrv4
cndrv1: cndrv1.o
$(FC) $(FFLAGS) cndrv1.o $(ALIBS) -o cndrv1
#
cndrv2: cndrv2.o
$(FC) $(FFLAGS) cndrv2.o $(ALIBS) -o cndrv2
#
cndrv3: cndrv3.o
$(FC) $(FFLAGS) cndrv3.o $(ALIBS) -o cndrv3
#
cndrv4: cndrv4.o
$(FC) $(FFLAGS) cndrv4.o $(ALIBS) -o cndrv4
#
#----------------------------------------------------------------------
# Complex problem using double complex
#
zndrv: zndrv1 zndrv2 zndrv3 zndrv4
zndrv1: zndrv1.o
$(FC) $(FFLAGS) zndrv1.o $(ALIBS) -o zndrv1
#
zndrv2: zndrv2.o
$(FC) $(FFLAGS) zndrv2.o $(ALIBS) -o zndrv2
#
zndrv3: zndrv3.o
$(FC) $(FFLAGS) zndrv3.o $(ALIBS) -o zndrv3
#
zndrv4: zndrv4.o
$(FC) $(FFLAGS) zndrv4.o $(ALIBS) -o zndrv4
+54 -54
View File
@@ -1,14 +1,14 @@
program zndrv1
program zndrv1
c
c Example program to illustrate the idea of reverse communication
c for a standard complex nonsymmetric eigenvalue problem.
c for a standard complex nonsymmetric eigenvalue problem.
c
c We implement example one of ex-complex.doc in DOCUMENTS directory
c
c\Example-1
c ... Suppose we want to solve A*x = lambda*x in regular mode,
c where A is obtained from the standard central difference
c discretization of the convection-diffusion operator
c discretization of the convection-diffusion operator
c (Laplacian u) + rho*(du / dx)
c on the unit squre [0,1]x[0,1] with zero Dirichlet boundary
c condition.
@@ -69,12 +69,12 @@ c %--------------%
c
integer iparam(11), ipntr(14)
logical select(maxncv)
Complex*16
& ax(maxn), d(maxncv),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv), resid(maxn),
Complex*16
& ax(maxn), d(maxncv),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv), resid(maxn),
& workl(3*maxncv*maxncv+5*maxncv)
Double precision
Double precision
& rwork(maxncv), rd(maxncv,3)
c
c %---------------%
@@ -84,9 +84,9 @@ c
character bmat*1, which*2
integer ido, n, nx, nev, ncv, lworkl, info, j,
& ierr, nconv, maxitr, ishfts, mode
Complex*16
Complex*16
& sigma
Double precision
Double precision
& tol
logical rvec
c
@@ -94,19 +94,19 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dznrm2 , dlapy2
external dznrm2 , zaxpy , dlapy2
Double precision
& dznrm2 , dlapy2
external dznrm2 , zaxpy , dlapy2
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
c
c
c %--------------------------------------------------%
c | The number NX is the number of interior points |
c | in the discretization of the 2-dimensional |
c | convection-diffusion operator on the unit |
c | square with zero Dirichlet boundary condition. |
c | square with zero Dirichlet boundary condition. |
c | The number N(=NX*NX) is the dimension of the |
c | matrix. A standard eigenvalue problem is |
c | solved (BMAT = 'I'). NEV is the number of |
@@ -117,13 +117,13 @@ c | the spectrum. However, The following |
c | conditions must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
nx = 10
n = nx*nx
nx = 10
n = nx*nx
nev = 4
ncv = 20
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV1: N is greater than MAXN '
go to 9000
@@ -138,18 +138,18 @@ c
which = 'LM'
c
c %---------------------------------------------------%
c | The work array WORKL is used in ZNAUPD as |
c | The work array WORKL is used in ZNAUPD as |
c | workspace. Its dimension LWORKL is set as |
c | illustrated below. The parameter TOL determines |
c | the stopping criterion. If TOL<=0, machine |
c | precision is used. The variable IDO is used for |
c | reverse communication, and is initially set to 0. |
c | Setting INFO=0 indicates that a random vector is |
c | generated to start the ARNOLDI iteration. |
c | generated to start the ARNOLDI iteration. |
c %---------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
lworkl = 3*ncv**2+5*ncv
tol = 0.0
ido = 0
info = 0
c
@@ -168,11 +168,11 @@ c
mode = 1
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
c | M A I N L O O P (Reverse communication) |
c %-------------------------------------------%
c
10 continue
@@ -197,7 +197,7 @@ c | The user should supply his/her own |
c | matrix vector multiplication routine here |
c | that takes workd(ipntr(1)) as the input |
c | vector, and return the matrix vector |
c | product to workd(ipntr(2)). |
c | product to workd(ipntr(2)). |
c %-------------------------------------------%
c
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
@@ -209,7 +209,7 @@ c
go to 10
end if
c
c
c %----------------------------------------%
c | Either we have convergence or there is |
c | an error. |
@@ -227,7 +227,7 @@ c
print *, ' Check the documentation of _naupd'
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -241,16 +241,16 @@ c %-------------------------------------------%
c
rvec = .true.
c
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
& rwork, ierr)
c
c %----------------------------------------------%
c | Eigenvalues are returned in the one |
c | dimensional array D. The corresponding |
c | eigenvectors are returned in the first NCONV |
c | (=IPARAM(5)) columns of the two dimensional |
c | (=IPARAM(5)) columns of the two dimensional |
c | array V if requested. Otherwise, an |
c | orthogonal basis for the invariant subspace |
c | corresponding to the eigenvalues in D is |
@@ -258,7 +258,7 @@ c | returned in V. |
c %----------------------------------------------%
c
if ( ierr .ne. 0) then
c
c
c %------------------------------------%
c | Error condition: |
c | Check the documentation of ZNEUPD . |
@@ -312,11 +312,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, '_NDRV1'
@@ -327,8 +327,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -344,7 +344,7 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector subroutine
@@ -354,21 +354,21 @@ c discretized using centered difference.
c
subroutine av (nx, v, w)
integer nx, j, lo
Complex*16
Complex*16
& v(nx*nx), w(nx*nx), one, h2
parameter (one = (1.0D+0, 0.0D+0) )
external zaxpy , tv
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
c | -I T|
c
c derived from the standard central difference discretization
c derived from the standard central difference discretization
c of the convection-diffusion operator (Laplacian u) + rho*(du/dx)
c with zero boundary condition.
c
@@ -385,7 +385,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call zaxpy (nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
call zaxpy (nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -396,29 +396,29 @@ c
c=========================================================================
subroutine tv (nx, x, y)
c
integer nx, j
Complex*16
integer nx, j
Complex*16
& x(nx), y(nx), h, h2, dd, dl, du
c
Complex*16
Complex*16
& one, rho
parameter (one = (1.0D+0, 0.0D+0) ,
& rho = (1.0D+2, 0.0D+0) )
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal
c
c
h = one / dcmplx (nx+1)
h2 = h*h
dd = (4.0D+0, 0.0D+0) / h2
dl = -one/h2 - (5.0D-1, 0.0D+0) *rho/h
du = -one/h2 + (5.0D-1, 0.0D+0) *rho/h
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
+44 -44
View File
@@ -1,7 +1,7 @@
program zndrv2
program zndrv2
c
c Simple program to illustrate the idea of reverse communication
c in shift-invert mode for a standard complex nonsymmetric eigenvalue
c in shift-invert mode for a standard complex nonsymmetric eigenvalue
c problem.
c
c We implement example two of ex-complex.doc in DOCUMENTS directory
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -69,14 +69,14 @@ c %--------------%
c
integer iparam(11), ipntr(14), ipiv(maxn)
logical select(maxncv)
Complex*16
Complex*16
& ax(maxn), d(maxncv), resid(maxn),
& v(ldv, maxncv), workd(3*maxn),
& workev(2*maxncv),
& workl(3*maxncv*maxncv+5*maxncv),
& dd(maxn), dl(maxn), du(maxn),
& du2(maxn)
Double precision
Double precision
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -86,11 +86,11 @@ c
character bmat*1, which*2
integer ido, n, nev, ncv, lworkl, info, j, ierr,
& nconv, maxitr, ishfts, mode
Complex*16
Complex*16
& h, h2, s, sigma, s1, s2, s3, rho
common /convct/ rho
c
Double precision
Double precision
& tol
logical rvec
c
@@ -98,9 +98,9 @@ c %------------%
c | Parameters |
c %------------%
c
Complex*16
& one, zero, two
parameter (one = (1.0D+0, 0.0D+0) ,
Complex*16
& one, zero, two
parameter (one = (1.0D+0, 0.0D+0) ,
& zero = (0.0D+0, 0.0D+0) ,
& two = (2.0D+0, 0.0D+0) )
c
@@ -108,10 +108,10 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dznrm2 , dlapy2
Double precision
& dznrm2 , dlapy2
external zgttrf , zgttrs , zaxpy , zcopy , dznrm2 ,
& dlapy2
& dlapy2
c
c %-----------------------%
c | Executable statements |
@@ -160,22 +160,22 @@ c | the interval [0, 1] with zero Dirichlet boundary |
c | condition. |
c %----------------------------------------------------%
c
rho = (1.0D+1, 0.0D+0)
rho = (1.0D+1, 0.0D+0)
h = one / dcmplx (n+1)
h2 = h*h
s = rho / two
c
s1 = -one/h2 - s/h
s1 = -one/h2 - s/h
s2 = two/h2 - sigma
s3 = -one/h2 + s/h
s3 = -one/h2 + s/h
c
do 10 j = 1, n-1
dl(j) = s1
dl(j) = s1
dd(j) = s2
du(j) = s3
10 continue
dd(n) = s2
c
10 continue
dd(n) = s2
c
call zgttrf (n, dl, dd, du, du2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -195,8 +195,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in ZNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
lworkl = 3*ncv**2+5*ncv
tol = 0.0
ido = 0
info = 0
c
@@ -214,18 +214,18 @@ c
maxitr = 300
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
c | M A I N L O O P (Reverse communication) |
c %-------------------------------------------%
c
20 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine ZNAUPD and take |
c | Repeatedly call the routine ZNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
@@ -247,8 +247,8 @@ c %-------------------------------------------%
c
call zcopy ( n, workd(ipntr(1)),1, workd(ipntr(2)), 1)
c
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV2.'
@@ -279,23 +279,23 @@ c
print *, ' '
print *, ' Error with _naupd, info = ',info
print *, ' Check the documentation in _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using ZNEUPD . |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
c
rvec = .true.
c
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, rwork, ierr)
@@ -312,19 +312,19 @@ c | returned in V. |
c %----------------------------------------------%
c
if ( ierr .ne. 0) then
c
c
c %------------------------------------%
c | Error condition: |
c | Error condition: |
c | Check the documentation of ZNEUPD . |
c %------------------------------------%
c
c
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd. '
print *, ' '
else
c
nconv = iparam(5)
nconv = iparam(5)
do 60 j=1, nconv
c
c %---------------------------%
@@ -366,11 +366,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, '_NDRV2 '
@@ -381,8 +381,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -405,7 +405,7 @@ c matrix vector multiplication subroutine
c
subroutine av (n, v, w)
integer n, j
Complex*16
Complex*16
& v(n), w(n), rho, two, one, dd, dl, du, s, h,
& h2
parameter (one = (1.0D+0, 0.0D+0) ,
+60 -60
View File
@@ -1,7 +1,7 @@
program zndrv3
program zndrv3
c
c Simple program to illustrate the idea of reverse communication
c in inverse mode for a generalized complex nonsymmetric eigenvalue
c in inverse mode for a generalized complex nonsymmetric eigenvalue
c problem.
c
c We implement example three of ex-complex.doc in DOCUMENTS directory
@@ -11,8 +11,8 @@ c ... Suppose we want to solve A*x = lambda*B*x in regular mode,
c where A and B are derived from the finite element discretization
c of the 1-dimensional convection-diffusion operator
c (d^2u/dx^2) + rho*(du/dx)
c on the interval [0,1] with zero boundary condition using
c piecewise linear elements.
c on the interval [0,1] with zero boundary condition using
c piecewise linear elements.
c
c ... OP = inv[M]*A and B = M.
c
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -69,13 +69,13 @@ c %--------------%
c
integer iparam(11), ipntr(14), ipiv(maxn)
logical select(maxncv)
Complex*16
Complex*16
& ax(maxn), mx(maxn), d(maxncv), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(2*maxncv),
& workl(3*maxncv*maxncv+5*maxncv),
& dd(maxn), dl(maxn), du(maxn), du2(maxn)
Double precision
Double precision
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -85,9 +85,9 @@ c
character bmat*1, which*2
integer ido, n, nev, ncv, lworkl, info, ierr, j,
& nconv, maxitr, ishfts, mode
Complex*16
Complex*16
& sigma, h
Double precision
Double precision
& tol
logical rvec
c
@@ -95,7 +95,7 @@ c %------------%
c | Parameters |
c %------------%
c
Complex*16
Complex*16
& zero, one
parameter (zero = (0.0D+0, 0.0D+0) ,
& one = (1.0D+0, 0.0D+0) )
@@ -104,10 +104,10 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dznrm2 , dlapy2
Double precision
& dznrm2 , dlapy2
external zaxpy , zcopy , dznrm2 , zgttrf , zgttrs ,
& dlapy2
& dlapy2
c
c %-----------------------%
c | Executable Statements |
@@ -126,9 +126,9 @@ c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
ncv = 20
n = 100
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV3: N is greater than MAXN '
go to 9000
@@ -154,15 +154,15 @@ c
do 20 j = 1, n-1
dl(j) = one*h
dd(j) = (4.0D+0, 0.0D+0) *h
du(j) = one*h
20 continue
dd(n) = (4.0D+0, 0.0D+0) *h
du(j) = one*h
20 continue
dd(n) = (4.0D+0, 0.0D+0) *h
c
call zgttrf (n, dl, dd, du, du2, ipiv, ierr)
call zgttrf (n, dl, dd, du, du2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrf. '
print*, ' '
print*, ' ERROR with _gttrf. '
print*, ' '
go to 9000
end if
c
@@ -177,8 +177,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in ZNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
lworkl = 3*ncv**2+5*ncv
tol = 0.0
ido = 0
info = 0
c
@@ -197,8 +197,8 @@ c
mode = 2
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
@@ -207,14 +207,14 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine ZNAUPD and take |
c | Repeatedly call the routine ZNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call znaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
call znaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
& rwork, info )
c
if (ido .eq. -1 .or. ido .eq. 1) then
@@ -233,8 +233,8 @@ c
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs. '
print*, ' '
print*, ' ERROR with _gttrs. '
print*, ' '
go to 9000
end if
@@ -268,7 +268,7 @@ c
c %-----------------------------------------%
c | Either we have convergence, or there is |
c | an error. |
c %-----------------------------------------%
c %-----------------------------------------%
c
if ( info .lt. 0 ) then
c
@@ -280,24 +280,24 @@ c
print *, ' '
print *, ' Error with _naupd, info = ',info
print *, ' Check the documentation of _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using ZNEUPD . |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
rvec = .true.
c
call zneupd ( rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv, v,
call zneupd ( rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv, v,
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
& ierr )
c
@@ -318,8 +318,8 @@ c %------------------------------------%
c | Error condition: |
c | Check the documentation of ZNEUPD . |
c %------------------------------------%
c
print *, ' '
c
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd'
print *, ' '
@@ -327,7 +327,7 @@ c
else
c
nconv = iparam(5)
do 80 j=1, nconv
do 80 j=1, nconv
c
c %---------------------------%
c | Compute the residual norm |
@@ -369,11 +369,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, '_NDRV3 '
@@ -384,8 +384,8 @@ c
print *, ' The number of Arnoldi vectors generated ',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -397,21 +397,21 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
c
subroutine av (n, v, w)
integer n, j
Complex*16
& v(n), w(n), one, two, dd, dl, du, s, h, rho
Complex*16
& v(n), w(n), one, two, dd, dl, du, s, h, rho
parameter (one = (1.0D+0, 0.0D+0) ,
& two = (2.0D+0, 0.0D+0) ,
& rho = (1.0D+1, 0.0D+0) )
c
c Compute the matrix vector multiplication y<---A*x
c where A is the stiffness matrix formed by using piecewise linear
c where A is the stiffness matrix formed by using piecewise linear
c elements on [0,1].
c
h = one / dcmplx (n+1)
@@ -422,28 +422,28 @@ c
c
w(1) = dd*v(1) + du*v(2)
do 10 j = 2,n-1
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
10 continue
w(n) = dl*v(n-1) + dd*v(n)
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
10 continue
w(n) = dl*v(n-1) + dd*v(n)
return
end
c------------------------------------------------------------------------
subroutine mv (n, v, w)
integer n, j
Complex*16
Complex*16
& v(n), w(n), one, four, h
parameter (one = (1.0D+0, 0.0D+0) ,
parameter (one = (1.0D+0, 0.0D+0) ,
& four = (4.0D+0, 0.0D+0) )
c
c Compute the matrix vector multiplication y<---M*x
c where M is the mass matrix formed by using piecewise linear elements
c where M is the mass matrix formed by using piecewise linear elements
c on [0,1].
c
c
w(1) = four*v(1) + one*v(2)
do 10 j = 2,n-1
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
c
h = one / dcmplx (n+1)
call zscal (n, h, w, 1)
+56 -56
View File
@@ -1,7 +1,7 @@
program zndrv4
program zndrv4
c
c Simple program to illustrate the idea of reverse communication
c in shift and invert mode for a generalized complex nonsymmetric
c in shift and invert mode for a generalized complex nonsymmetric
c eigenvalue problem.
c
c We implement example four of ex-complex.doc in DOCUMENTS directory
@@ -11,7 +11,7 @@ c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode,
c where A and B are derived from a finite element discretization
c of a 1-dimensional convection-diffusion operator
c (d^2u/dx^2) + rho*(du/dx)
c on the interval [0,1] with zero boundary condition using
c on the interval [0,1] with zero boundary condition using
c piecewise linear elements.
c
c ... where the shift sigma is a complex number.
@@ -36,15 +36,15 @@ c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
c\Author
c Danny Sorensen
c Richard Lehoucq
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c Danny Sorensen
c Richard Lehoucq
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
c\SCCS Information: @(#)
c FILE: ndrv4.F SID: 2.4 DATE OF SID: 10/18/00 RELEASE: 2
c
c\Remarks
@@ -63,7 +63,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -72,14 +72,14 @@ c %--------------%
c
integer iparam(11), ipntr(14), ipiv(maxn)
logical select(maxncv)
Complex*16
& ax(maxn), mx(maxn), d(maxncv),
Complex*16
& ax(maxn), mx(maxn), d(maxncv),
& v(ldv,maxncv), workd(3*maxn), resid(maxn),
& workev(2*maxncv),
& workl(3*maxncv*maxncv+5*maxncv),
& dd(maxn), dl(maxn), du(maxn),
& du2(maxn)
Double precision
Double precision
& rwork(maxn), rd(maxncv,3)
c
c %---------------%
@@ -89,32 +89,32 @@ c
character bmat*1, which*2
integer ido, n, nev, ncv, lworkl, info, j, ierr,
& nconv, maxitr, ishfts, mode
Complex*16
Complex*16
& rho, h, s,
& sigma, s1, s2, s3
common /convct/ rho
c
Double precision
Double precision
& tol
logical rvec
c
logical rvec
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dznrm2 , dlapy2
Double precision
& dznrm2 , dlapy2
external dznrm2 , zaxpy , zcopy , zgttrf , zgttrs ,
& dlapy2
& dlapy2
c
c %------------%
c | Parameters |
c %------------%
c
Complex*16
Complex*16
& one, zero, two, four, six
parameter (one = (1.0D+0, 0.0D+0) ,
& zero = (0.0D+0, 0.0D+0) ,
& zero = (0.0D+0, 0.0D+0) ,
& two = (2.0D+0, 0.0D+0) ,
& four = (4.0D+0, 0.0D+0) ,
& six = (6.0D+0, 0.0D+0) )
@@ -138,7 +138,7 @@ c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
n = 100
nev = 4
ncv = 20
if ( n .gt. maxn ) then
@@ -153,7 +153,7 @@ c
end if
bmat = 'G'
which = 'LM'
sigma = one
sigma = one
c
c %--------------------------------------------------%
c | Construct C = A - SIGMA*M in COMPLEX arithmetic. |
@@ -164,11 +164,11 @@ c | central difference discretization of the 1-d |
c | convection-diffusion operator u``+ rho*u` on the |
c | interval [0, 1] with zero Dirichlet boundary |
c | condition. The matrix M is chosen to be the |
c | symmetric tridiagonal matrix with 4.0 on the |
c | diagonal and 1.0 on the off-diagonals. |
c | symmetric tridiagonal matrix with 4.0 on the |
c | diagonal and 1.0 on the off-diagonals. |
c %--------------------------------------------------%
c
rho = (1.0D+1, 0.0D+0)
rho = (1.0D+1, 0.0D+0)
h = one / dcmplx (n+1)
s = rho / two
c
@@ -177,12 +177,12 @@ c
s3 = -one/h + s - sigma*h/six
c
do 10 j = 1, n-1
dl(j) = s1
dl(j) = s1
dd(j) = s2
du(j) = s3
10 continue
dd(n) = s2
c
10 continue
dd(n) = s2
c
call zgttrf (n, dl, dd, du, du2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -202,7 +202,7 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in ZNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
lworkl = 3*ncv**2+5*ncv
tol = 0.0
ido = 0
info = 0
@@ -222,11 +222,11 @@ c
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------%
c | M A I N L O O P(Reverse communication) |
c | M A I N L O O P(Reverse communication) |
c %------------------------------------------%
c
20 continue
@@ -258,14 +258,14 @@ c | workd(ipntr(2)). |
c %-------------------------------------------%
c
call mv (n, workd(ipntr(1)), workd(ipntr(2)))
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV4.'
print*, ' '
go to 9000
end if
end if
c
c %-----------------------------------------%
c | L O O P B A C K to call ZNAUPD again. |
@@ -285,7 +285,7 @@ c | workd(ipntr(2)). |
c %-----------------------------------------%
c
call zcopy ( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
call zgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -317,8 +317,8 @@ c %-----------------------------------------%
c
go to 20
c
end if
c
end if
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
c | an error. |
@@ -334,9 +334,9 @@ c
print *, ' '
print *, ' Error with _naupd, info = ', info
print *, ' Check the documentation of _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -350,9 +350,9 @@ c %-------------------------------------------%
c
rvec = .true.
c
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv, v,
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
call zneupd (rvec, 'A', select, d, v, ldv, sigma,
& workev, bmat, n, which, nev, tol, resid, ncv, v,
& ldv, iparam, ipntr, workd, workl, lworkl, rwork,
& ierr)
c
c %----------------------------------------------%
@@ -367,7 +367,7 @@ c | returned in V. |
c %----------------------------------------------%
c
if ( ierr .ne. 0) then
c
c
c %------------------------------------%
c | Error condition: |
c | Check the documentation of ZNEUPD . |
@@ -438,27 +438,27 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
c
subroutine mv (n, v, w)
integer n, j
Complex*16
Complex*16
& v(n), w(n), one, four, six, h
parameter (one = (1.0D+0, 0.0D+0) ,
& four = (4.0D+0, 0.0D+0) ,
& six = (6.0D+0, 0.0D+0) )
c
c Compute the matrix vector multiplication y<---M*x
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c diagonal, 1 on the subdiagonal and superdiagonal.
c
c
w(1) = ( four*v(1) + one*v(2) ) / six
do 40 j = 2,n-1
w(j) = ( one*v(j-1) + four*v(j) + one*v(j+1) ) / six
40 continue
40 continue
w(n) = ( one*v(n-1) + four*v(n) ) / six
c
h = one / dcmplx (n+1)
@@ -468,9 +468,9 @@ c
c------------------------------------------------------------------
subroutine av (n, v, w)
integer n, j
Complex*16
& v(n), w(n), one, two, dd, dl, du, s, h, rho
parameter (one = (1.0D+0, 0.0D+0) ,
Complex*16
& v(n), w(n), one, two, dd, dl, du, s, h, rho
parameter (one = (1.0D+0, 0.0D+0) ,
& two = (2.0D+0, 0.0D+0) )
common /convct/ rho
c
+2
View File
@@ -0,0 +1,2 @@
SUBDIRS = BAND COMPLEX NONSYM SIMPLE SVD SYM
EXTRA_DIST = README
+26
View File
@@ -0,0 +1,26 @@
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
SNDRV = sndrv1 sndrv2 sndrv3 sndrv4 sndrv5 sndrv6
DNDRV = dndrv1 dndrv2 dndrv3 dndrv4 dndrv5 dndrv6
NONSYM = $(SNDRV) $(DNDRV)
check_PROGRAMS = $(NONSYM)
TESTS = $(check_PROGRAMS)
EXTRA_DIST = README
# Simple nonsymmetric problem using single precision
sndrv1_SOURCES = sndrv1.f
sndrv2_SOURCES = sndrv2.f
sndrv3_SOURCES = sndrv3.f
sndrv4_SOURCES = sndrv4.f
sndrv5_SOURCES = sndrv5.f
sndrv6_SOURCES = sndrv6.f
# Simple nonsymmetric problem using double precision
dndrv1_SOURCES = dndrv1.f
dndrv2_SOURCES = dndrv2.f
dndrv3_SOURCES = dndrv3.f
dndrv4_SOURCES = dndrv4.f
dndrv5_SOURCES = dndrv5.f
dndrv6_SOURCES = dndrv6.f
+56 -56
View File
@@ -1,4 +1,4 @@
program dndrv1
program dndrv1
c
c
c Example program to illustrate the idea of reverse communication
@@ -9,9 +9,9 @@ c
c\Example-1
c ... Suppose we want to solve A*x = lambda*x in regular mode,
c where A is obtained from the standard central difference
c discretization of the convection-diffusion operator
c discretization of the convection-diffusion operator
c (Laplacian u) + rho*(du / dx)
c on the unit square [0,1]x[0,1] with zero Dirichlet boundary
c on the unit square [0,1]x[0,1] with zero Dirichlet boundary
c condition.
c
c ... OP = A and B = I.
@@ -30,7 +30,7 @@ c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
c daxpy Level 1 BLAS that computes y <- alpha*x+y.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c tv Matrix vector multiplication routine that computes T*x,
c tv Matrix vector multiplication routine that computes T*x,
c where T is a tridiagonal matrix. It is used in routine
c av.
c
@@ -71,9 +71,9 @@ c
integer iparam(11), ipntr(14)
logical select(maxncv)
Double precision
& ax(maxn), d(maxncv,3), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& ax(maxn), d(maxncv,3), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& workl(3*maxncv*maxncv+6*maxncv)
c
c %---------------%
@@ -112,12 +112,12 @@ c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
c
c
c %--------------------------------------------------%
c | The number NX is the number of interior points |
c | in the discretization of the 2-dimensional |
c | convection-diffusion operator on the unit |
c | square with zero Dirichlet boundary condition. |
c | square with zero Dirichlet boundary condition. |
c | The number N(=NX*NX) is the dimension of the |
c | matrix. A standard eigenvalue problem is |
c | solved (BMAT = 'I'). NEV is the number of |
@@ -128,13 +128,13 @@ c | the spectrum. However, The following |
c | conditions must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
nx = 10
n = nx*nx
nx = 10
n = nx*nx
nev = 4
ncv = 20
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV1: N is greater than MAXN '
go to 9000
@@ -149,18 +149,18 @@ c
which = 'SM'
c
c %-----------------------------------------------------%
c | The work array WORKL is used in DNAUPD as |
c | The work array WORKL is used in DNAUPD as |
c | workspace. Its dimension LWORKL is set as |
c | illustrated below. The parameter TOL determines |
c | the stopping criterion. If TOL<=0, machine |
c | precision is used. The variable IDO is used for |
c | reverse communication, and is initially set to 0. |
c | Setting INFO=0 indicates that a random vector is |
c | generated in DNAUPD to start the Arnoldi iteration. |
c | generated in DNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
c
@@ -179,11 +179,11 @@ c
mode = 1
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
c | M A I N L O O P (Reverse communication) |
c %-------------------------------------------%
c
10 continue
@@ -195,8 +195,8 @@ c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
& info )
c
if (ido .eq. -1 .or. ido .eq. 1) then
@@ -208,7 +208,7 @@ c | The user should supply his/her own |
c | matrix vector multiplication routine here |
c | that takes workd(ipntr(1)) as the input |
c | vector, and return the matrix vector |
c | product to workd(ipntr(2)). |
c | product to workd(ipntr(2)). |
c %-------------------------------------------%
c
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
@@ -219,8 +219,8 @@ c %-----------------------------------------%
c
go to 10
c
end if
c
end if
c
c %----------------------------------------%
c | Either we have convergence or there is |
c | an error. |
@@ -238,7 +238,7 @@ c
print *, ' Check the documentation of _naupd'
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -252,8 +252,8 @@ c %-------------------------------------------%
c
rvec = .true.
c
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, ierr )
c
@@ -281,7 +281,7 @@ c
print *, ' Check the documentation of _neupd. '
print *, ' '
c
else
else
c
first = .true.
nconv = iparam(5)
@@ -317,9 +317,9 @@ c %------------------------%
c | Ritz value is complex. |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
c
call av(nx, v(1,j), ax)
call daxpy(n, -d(j,1), v(1,j), 1, ax, 1)
call daxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
@@ -354,23 +354,23 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV1 '
print *, ' ====== '
print *, ' '
print *, ' '
print *, ' Size of the matrix is ', n
print *, ' The number of Ritz values requested is ', nev
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -386,37 +386,37 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector subroutine
c
c The matrix used is the 2 dimensional convection-diffusion
c The matrix used is the 2 dimensional convection-diffusion
c operator discretized using central difference.
c
subroutine av (nx, v, w)
integer nx, j, lo
Double precision
Double precision
& v(nx*nx), w(nx*nx), one, h2
parameter (one = 1.0D+0)
external daxpy
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
c | -I T|
c
c derived from the standard central difference discretization
c of the 2 dimensional convection-diffusion operator
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
c derived from the standard central difference discretization
c of the 2 dimensional convection-diffusion operator
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
c condition.
c
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
c eigenvalues.
c
c The subroutine TV is called to compute y<---T*x.
@@ -432,7 +432,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call daxpy(nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
call daxpy(nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -443,21 +443,21 @@ c
c=========================================================================
subroutine tv (nx, x, y)
c
integer nx, j
integer nx, j
Double precision
& x(nx), y(nx), h, h2, dd, dl, du
c
Double precision
& one, zero, rho
parameter (one = 1.0D+0, zero = 0.0D+0,
parameter (one = 1.0D+0, zero = 0.0D+0,
& rho = 0.0D+0)
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal.
c
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
c eigenvalues.
c
h = one / dble(nx+1)
@@ -465,11 +465,11 @@ c
dd = 4.0D+0 / h2
dl = -one / h2 - 5.0D-1*rho / h
du = -one / h2 + 5.0D-1*rho / h
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
+49 -49
View File
@@ -9,7 +9,7 @@ c\Example-2
c ... Suppose we want to solve A*x = lambda*x in shift-invert mode,
c where A is derived from the centered difference discretization
c of the 1-dimensional convection-diffusion operator
c (d^2u / dx^2) + rho*(du/dx)
c (d^2u / dx^2) + rho*(du/dx)
c on the interval [0,1] with zero Dirichlet boundary condition.
c
c ... The shift sigma is a real number.
@@ -61,7 +61,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -97,7 +97,7 @@ c
Double precision
& one, zero, two, rho
common /convct/ rho
parameter (one = 1.0D+0, zero = 0.0D+0,
parameter (one = 1.0D+0, zero = 0.0D+0,
& two = 2.0D+0)
c
c %-----------------------------%
@@ -128,14 +128,14 @@ c | 'LM'. The user can modify NEV, NCV, SIGMAR to |
c | solve problems of different sizes, and to get |
c | different parts of the spectrum. However, The |
c | following conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c | NEV + 2 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
n = 100
nev = 4
ncv = 20
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV2: N is greater than MAXN '
go to 9000
@@ -148,8 +148,8 @@ c
end if
bmat = 'I'
which = 'LM'
sigmar = 1.0D+0
sigmai = 0.0D+0
sigmar = 1.0D+0
sigmai = 0.0D+0
c
c %----------------------------------------------------%
c | Construct C = A - SIGMA*I in real arithmetic, and |
@@ -157,7 +157,7 @@ c | factor C in real arithmetic using LAPACK |
c | subroutine dgttrf. The matrix A is chosen to be |
c | the tridiagonal matrix derived from standard |
c | central difference of the 1-d convection diffusion |
c | operator u" + rho*u' on the interval [0, 1] with |
c | operator u" + rho*u' on the interval [0, 1] with |
c | zero Dirichlet boundary condition. |
c %----------------------------------------------------%
c
@@ -165,25 +165,25 @@ c
h = one / dble(n+1)
s = rho*h / two
c
s1 = -one-s
s1 = -one-s
s2 = two - sigmar
s3 = -one+s
s3 = -one+s
c
do 10 j = 1, n-1
dl(j) = s1
dl(j) = s1
dd(j) = s2
du(j) = s3
10 continue
dd(n) = s2
c
10 continue
dd(n) = s2
c
call dgttrf(n, dl, dd, du, du2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' '
print*, ' ERROR with _gttrf in _NDRV2.'
print*, ' '
go to 9000
end if
c
c
c %-----------------------------------------------------%
c | The work array WORKL is used in DNAUPD as |
c | workspace. Its dimension LWORKL is set as |
@@ -195,8 +195,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in DNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
c
@@ -213,26 +213,26 @@ c
ishfts = 1
maxitr = 300
mode = 3
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
c | M A I N L O O P (Reverse communication) |
c %-------------------------------------------%
c
20 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine DNAUPD and take |
c | Repeatedly call the routine DNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
& info )
c
if ( ido .eq. -1 .or. ido .eq. 1) then
@@ -247,10 +247,10 @@ c %-------------------------------------------%
c
call dcopy( n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
c
call dgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
call dgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' '
print*, ' ERROR with _gttrs in _NDRV2.'
print*, ' '
go to 9000
@@ -279,26 +279,26 @@ c
print *, ' '
print *, ' Error with _naupd, info = ', info
print *, ' Check the documentation in _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using DNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
c
rvec = .true.
c
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
c
c %-----------------------------------------------%
c | The real part of the eigenvalue is returned |
@@ -319,11 +319,11 @@ c | Error condition: |
c | Check the documentation of DNEUPD. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd. '
print *, ' '
c
print *, ' '
c
else
c
first = .true.
@@ -360,9 +360,9 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
c
call av(n, v(1,j), ax)
call daxpy(n, -d(j,1), v(1,j), 1, ax, 1)
call daxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
@@ -397,11 +397,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV2 '
@@ -412,8 +412,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
+51 -51
View File
@@ -15,7 +15,7 @@ c using linear elements.
c
c ... So OP = inv[M]*A and B = M.
c
c ... Use mode 2 of DNAUPD.
c ... Use mode 2 of DNAUPD.
c
c\BeginLib
c
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -71,7 +71,7 @@ c
logical select(maxncv)
Double precision
& ax(maxn), mx(maxn), d(maxncv, 3), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& workl(3*maxncv*maxncv+6*maxncv),
& md(maxn), me(maxn-1)
@@ -83,7 +83,7 @@ c
character bmat*1, which*2
integer ido, n, nev, ncv, lworkl, info, ierr, j,
& nconv, maxitr, ishfts, mode
Double precision
Double precision
& tol, sigmar, sigmai, h
logical first, rvec
c
@@ -91,14 +91,14 @@ c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& zero, one
parameter (zero = 0.0D+0, one = 1.0D+0)
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
Double precision
Double precision
& dnrm2, dlapy2
external daxpy, dnrm2, dpttrf, dpttrs, dlapy2
c
@@ -125,9 +125,9 @@ c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
ncv = 20
n = 100
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV3: N is greater than MAXN '
go to 9000
@@ -148,16 +148,16 @@ c %------------------------------------------------%
c
h = one / dble(n+1)
do 20 j = 1, n-1
md(j) = 4.0D+0*h
me(j) = one*h
20 continue
md(j) = 4.0D+0*h
me(j) = one*h
20 continue
md(n) = 4.0D+0*h
c
c
call dpttrf(n, md, me, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _pttrf. '
print*, ' '
print*, ' ERROR with _pttrf. '
print*, ' '
go to 9000
end if
c
@@ -172,8 +172,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in DNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = 0.0
lworkl = 3*ncv**2+6*ncv
tol = 0.0
ido = 0
info = 0
c
@@ -191,9 +191,9 @@ c
maxitr = 300
mode = 2
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
@@ -202,14 +202,14 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine DNAUPD and take |
c | Repeatedly call the routine DNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, info )
c
if (ido .eq. -1 .or. ido .eq. 1) then
@@ -228,8 +228,8 @@ c
call dpttrs(n, 1, md, me, workd(ipntr(2)), n,
& ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _pttrs. '
print*, ' '
print*, ' ERROR with _pttrs. '
print*, ' '
go to 9000
end if
@@ -264,7 +264,7 @@ c
c %-----------------------------------------%
c | Either we have convergence, or there is |
c | an error. |
c %-----------------------------------------%
c %-----------------------------------------%
c
if ( info .lt. 0 ) then
c
@@ -276,22 +276,22 @@ c
print *, ' '
print *, ' Error with _naupd, info = ', info
print *, ' Check the documentation of _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using DNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
rvec = .true.
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
@@ -314,13 +314,13 @@ c %------------------------------------%
c | Error condition: |
c | Check the documentation of DNEUPD. |
c %------------------------------------%
c
print *, ' '
c
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd'
print *, ' '
c
else
else
c
first = .true.
nconv = iparam(5)
@@ -399,11 +399,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV3 '
@@ -414,8 +414,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -431,16 +431,16 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
c
subroutine av (n, v, w)
integer n, j
Double precision
& v(n), w(n), one, two, dd, dl, du, s, h, rho
parameter ( rho = 1.0D+1, one = 1.0D+0,
Double precision
& v(n), w(n), one, two, dd, dl, du, s, h, rho
parameter ( rho = 1.0D+1, one = 1.0D+0,
& two = 2.0D+0)
c
c Compute the matrix vector multiplication y<---A*x
@@ -458,27 +458,27 @@ c
c
w(1) = dd*v(1) + du*v(2)
do 10 j = 2,n-1
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
10 continue
w(n) = dl*v(n-1) + dd*v(n)
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
10 continue
w(n) = dl*v(n-1) + dd*v(n)
return
end
c------------------------------------------------------------------------
subroutine mv (n, v, w)
integer n, j
Double precision
Double precision
& v(n), w(n), one, four, h
parameter ( one = 1.0D+0, four = 4.0D+0)
c
c Compute the matrix vector multiplication y<---M*x
c where M is the mass matrix formed by using piecewise linear
c where M is the mass matrix formed by using piecewise linear
c elements on [0,1].
c
c
w(1) = four*v(1) + one*v(2)
do 10 j = 2,n-1
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
c
h = one / dble(n+1)
call dscal(n, h, w, 1)
+58 -58
View File
@@ -1,7 +1,7 @@
program dndrv4
c
c Simple program to illustrate the idea of reverse communication
c in shift-invert mode for a generalized nonsymmetric eigenvalue
c in shift-invert mode for a generalized nonsymmetric eigenvalue
c problem.
c
c We implement example four of ex-nonsym.doc in DOCUMENTS directory
@@ -25,7 +25,7 @@ c
c\Routines called:
c dnaupd ARPACK reverse communication interface routine.
c dneupd ARPACK routine that returns Ritz values and (optionally)
c Ritz vectors.
c Ritz vectors.
c dgttrf LAPACK tridiagonal factorization routine.
c dgttrs LAPACK tridiagonal linear system solve routine.
c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
@@ -37,15 +37,15 @@ c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
c\Author
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
c\SCCS Information: @(#)
c FILE: ndrv4.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
c
c\Remarks
@@ -64,7 +64,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -90,13 +90,13 @@ c
Double precision
& tol, h, s,
& sigmar, sigmai, s1, s2, s3
logical first, rvec
c
logical first, rvec
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
Double precision
& ddot, dnrm2, dlapy2
external ddot, dnrm2, dlapy2, dgttrf, dgttrs
c
@@ -113,7 +113,7 @@ c
Double precision
& one, zero, two, six, rho
common /convct/ rho
parameter (one = 1.0D+0, zero = 0.0D+0,
parameter (one = 1.0D+0, zero = 0.0D+0,
& two = 2.0D+0, six = 6.0D+0)
c
c %-----------------------%
@@ -130,14 +130,14 @@ c | The user can modify NEV, NCV, SIGMAR to solve |
c | problems of different sizes, and to get different |
c | parts of the spectrum. However, The following |
c | conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
n = 100
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV4: N is greater than MAXN '
go to 9000
@@ -150,7 +150,7 @@ c
end if
bmat = 'G'
which = 'LM'
sigmar = one
sigmar = one
sigmai = zero
c
c %--------------------------------------------------%
@@ -175,12 +175,12 @@ c
s3 = -one/h + s - sigmar*h/six
c
do 10 j = 1, n-1
dl(j) = s1
dl(j) = s1
dd(j) = s2
du(j) = s3
10 continue
dd(n) = s2
c
10 continue
dd(n) = s2
c
call dgttrf(n, dl, dd, du, du2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -200,7 +200,7 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in DNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
@@ -224,20 +224,20 @@ c
iparam(7) = mode
c
c %------------------------------------------%
c | M A I N L O O P(Reverse communication) |
c | M A I N L O O P(Reverse communication) |
c %------------------------------------------%
c
20 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine DNAUPD and take |
c | Repeatedly call the routine DNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, info )
c
if (ido .eq. -1) then
@@ -255,8 +255,8 @@ c | workd(ipntr(2)). |
c %-------------------------------------------%
c
call mv (n, workd(ipntr(1)), workd(ipntr(2)))
call dgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
call dgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV4.'
@@ -282,7 +282,7 @@ c | workd(ipntr(2)). |
c %-----------------------------------------%
c
call dcopy( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call dgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
call dgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -314,8 +314,8 @@ c %-----------------------------------------%
c
go to 20
c
end if
c
end if
c
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
@@ -334,23 +334,23 @@ c
print *, ' Check the documentation in _naupd.'
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using DNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
rvec = .true.
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
c
c %-----------------------------------------------%
c | The real part of the eigenvalue is returned |
@@ -365,16 +365,16 @@ c | the eigenvalues in D is returned in V. |
c %-----------------------------------------------%
c
if ( ierr .ne. 0) then
c
c
c %------------------------------------%
c | Error condition: |
c | Check the documentation of DNEUPD. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd. '
print *, ' '
print *, ' '
c
else
c
@@ -413,9 +413,9 @@ c %------------------------%
c | Ritz value is complex. |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
c
call av(n, v(1,j), ax)
call mv(n, v(1,j), mx)
call daxpy(n, -d(j,1), mx, 1, ax, 1)
@@ -455,11 +455,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV4 '
@@ -470,8 +470,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -487,7 +487,7 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
@@ -495,17 +495,17 @@ c
subroutine mv (n, v, w)
integer n, j
Double precision
& v(n), w(n), one, four, six, h
& v(n), w(n), one, four, six, h
parameter (one = 1.0D+0, four = 4.0D+0, six = 6.0D+0)
c
c Compute the matrix vector multiplication y<---M*x
c where M is mass matrix formed by using piecewise linear elements
c where M is mass matrix formed by using piecewise linear elements
c on [0,1].
c
c
w(1) = ( four*v(1) + one*v(2) ) / six
do 10 j = 2,n-1
w(j) = ( one*v(j-1) + four*v(j) + one*v(j+1) ) / six
10 continue
10 continue
w(n) = ( one*v(n-1) + four*v(n) ) / six
c
h = one / dble(n+1)
@@ -516,7 +516,7 @@ c------------------------------------------------------------------
subroutine av (n, v, w)
integer n, j
Double precision
& v(n), w(n), one, two, dd, dl, du, s, h, rho
& v(n), w(n), one, two, dd, dl, du, s, h, rho
common /convct/ rho
parameter (one = 1.0D+0, two = 2.0D+0)
c
@@ -530,7 +530,7 @@ c This routine is only used in residual calculation.
c
h = one / dble(n+1)
s = rho / two
dd = two / h
dd = two / h
dl = -one/h - s
du = -one/h + s
c
+74 -74
View File
@@ -8,9 +8,9 @@ c
c\Example-5
c
c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
c off-diagonals.
c ... The shift sigma is a complex number (sigmar, sigmai).
c ... OP = Real_Part{inv[A-(SIGMAR,SIGMAI)*M]*M and B = M.
@@ -32,15 +32,15 @@ c av Matrix vector subroutine that computes A*x.
c mv Matrix vector subroutine that computes M*x.
c
c\Author
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
c\SCCS Information: @(#)
c FILE: ndrv5.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
c
c\Remarks
@@ -59,7 +59,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -73,7 +73,7 @@ c
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& workl(3*maxncv*maxncv+6*maxncv)
Complex*16
Complex*16
& cdd(maxn), cdl(maxn), cdu(maxn),
& cdu2(maxn), ctemp(maxn)
c
@@ -86,16 +86,16 @@ c
& nconv, maxitr, ishfts, mode
Double precision
& tol, numr, numi, denr, deni, sigmar, sigmai
Complex*16
Complex*16
& c1, c2, c3
logical first, rvec
c
logical first, rvec
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
external zgttrf, zgttrs
Double precision
Double precision
& ddot, dnrm2, dlapy2
external ddot, dnrm2, dlapy2
c
@@ -128,14 +128,14 @@ c | to 'LM'. The user can modify NEV, NCV, SIGMAR, |
c | SIGMAI to solve problems of different sizes, and |
c | to get different parts of the spectrum. However, |
c | The following conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
ncv = 20
n = 100
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV5: N is greater than MAXN '
go to 9000
@@ -167,12 +167,12 @@ c
c3 = dcmplx( 3.0D+0-sigmar, -sigmai)
c
do 10 j = 1, n-1
cdl(j) = c1
cdl(j) = c1
cdd(j) = c2
cdu(j) = c3
10 continue
cdd(n) = c2
c
10 continue
cdd(n) = c2
c
call zgttrf(n, cdl, cdd, cdu, cdu2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -192,8 +192,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in DNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
c
@@ -212,30 +212,30 @@ c
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------%
c | M A I N L O O P(Reverse communication) |
c | M A I N L O O P(Reverse communication) |
c %------------------------------------------%
c
20 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine DNAUPD and take |
c | Repeatedly call the routine DNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, info )
c
if (ido .eq. -1) then
c
c %-------------------------------------------------------%
c | Perform |
c | Perform |
c | y <--- OP*x = Real_Part{inv[A-(SIGMAR,SIGMAI)*M]*M*x} |
c | to force starting vector into the range of OP. The |
c | user should supply his/her own matrix vector |
@@ -251,14 +251,14 @@ c
ctemp(j) = dcmplx(workd(ipntr(2)+j-1))
30 continue
c
call zgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
call zgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
& ctemp, n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV5.'
print*, ' '
go to 9000
end if
end if
do 40 j = 1, n
workd(ipntr(2)+j-1) = dble(ctemp(j))
40 continue
@@ -283,14 +283,14 @@ c
do 50 j = 1,n
ctemp(j) = dcmplx(workd(ipntr(3)+j-1))
50 continue
call zgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
call zgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
& ctemp, n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV5.'
print*, ' '
go to 9000
end if
end if
do 60 j = 1, n
workd(ipntr(2)+j-1) = dble(ctemp(j))
60 continue
@@ -320,7 +320,7 @@ c
c
end if
c
c
c
c %------------------------------------------%
c | Either we have convergence, or there is |
c | an error. |
@@ -336,25 +336,25 @@ c
print *, ' '
print *, ' Error with _naupd info = ',info
print *, ' Check the documentation of _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using DNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
rvec = .true.
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
c
c %-----------------------------------------------%
c | The real part of the eigenvalue is returned |
@@ -375,14 +375,14 @@ c | Error condition: |
c | Check the documentation of DNEUPD. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd = ', ierr
print *, ' Check the documentation of _neupd. '
print *, ' '
print *, ' '
c
else
else
c
first = .true.
first = .true.
nconv = iparam(5)
do 70 j=1,nconv
c
@@ -394,7 +394,7 @@ c
if ( d(j,2) .eq. zero ) then
c
c %---------------------------%
c | Eigenvalue is real. |
c | Eigenvalue is real. |
c | Compute d = x'(Ax)/x'(Mx).|
c %---------------------------%
c
@@ -402,7 +402,7 @@ c
numr = ddot(n, v(1,j), 1, ax, 1)
call mv(n, v(1,j), ax )
denr = ddot(n, v(1,j), 1, ax, 1)
d(j,1) = numr / denr
d(j,1) = numr / denr
c
else if (first) then
c
@@ -420,7 +420,7 @@ c %----------------%
numr = ddot(n, v(1,j), 1, ax, 1)
numi = ddot(n, v(1,j+1), 1, ax, 1)
call av(n, v(1,j+1), ax)
numr = numr + ddot(n,v(1,j+1),1,ax,1)
numr = numr + ddot(n,v(1,j+1),1,ax,1)
numi = -numi + ddot(n,v(1,j),1,ax,1)
c
c %----------------%
@@ -431,7 +431,7 @@ c
denr = ddot(n, v(1,j), 1, ax, 1)
deni = ddot(n, v(1,j+1), 1, ax, 1)
call mv(n, v(1,j+1), ax)
denr = denr + ddot(n,v(1,j+1),1,ax,1)
denr = denr + ddot(n,v(1,j+1),1,ax,1)
deni = -deni + ddot(n,v(1,j),1, ax,1)
c
c %----------------%
@@ -452,7 +452,7 @@ c | the conjugate pair by taking |
c | the conjugate of the last |
c | eigenvalue computed. |
c %------------------------------%
c
c
d(j,1) = d(j-1,1)
d(j,2) = -d(j-1,2)
first = .true.
@@ -475,7 +475,7 @@ c | tolerance) |
c %---------------------------%
c
first = .true.
do 80 j=1, nconv
do 80 j=1, nconv
c
if (d(j,2) .eq. zero) then
c
@@ -495,9 +495,9 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
c
call av(n, v(1,j), ax)
call mv(n, v(1,j), mx)
call daxpy(n, -d(j,1), mx, 1, ax, 1)
@@ -527,7 +527,7 @@ c
call dmout(6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
c
end if
end if
c
c %-------------------------------------------%
c | Print additional convergence information. |
@@ -538,11 +538,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV5 '
@@ -553,8 +553,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -570,7 +570,7 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
@@ -578,25 +578,25 @@ c
subroutine mv (n, v, w)
integer n, j
Double precision
& v(n), w(n), one, four
& v(n), w(n), one, four
parameter (one = 1.0D+0, four = 4.0D+0)
c
c Compute the matrix vector multiplication y<---M*x
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c diagonal, 1 on the subdiagonal and superdiagonal.
c
c
w(1) = four*v(1) + one*v(2)
do 10 j = 2,n-1
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
return
end
c------------------------------------------------------------------
subroutine av (n, v, w)
integer n, j
Double precision
& v(n), w(n), three, two
Double precision
& v(n), w(n), three, two
parameter (three = 3.0D+0, two = 2.0D+0)
c
c Compute the matrix vector multiplication y<---A*x
+71 -71
View File
@@ -8,9 +8,9 @@ c
c\Example-6
c
c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
c off-diagonals.
c ... The shift sigma is a complex number (sigmar, sigmai).
c ... OP = Imaginary_Part{inv[A-(SIGMAR,SIGMAI)*M]*M and B = M.
@@ -32,15 +32,15 @@ c av Matrix vector subroutine that computes A*x.
c mv Matrix vector subroutine that computes M*x.
c
c\Author
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
c\SCCS Information: @(#)
c FILE: ndrv6.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
c
c\Remarks
@@ -59,7 +59,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -73,7 +73,7 @@ c
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& workl(3*maxncv*maxncv+6*maxncv)
Complex*16
Complex*16
& cdd(maxn), cdl(maxn), cdu(maxn),
& cdu2(maxn), ctemp(maxn)
c
@@ -86,16 +86,16 @@ c
& nconv, maxitr, ishfts, mode
Double precision
& tol, numr, numi, denr, deni, sigmar, sigmai
Complex*16
Complex*16
& c1, c2, c3
logical first, rvec
c
logical first, rvec
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
external zgttrf, zgttrs
Double precision
Double precision
& ddot, dnrm2, dlapy2
external ddot, dnrm2, dlapy2
c
@@ -127,14 +127,14 @@ c | to 'LM'. The user can modify NEV, NCV, SIGMA to |
c | solve problems of different sizes, and to get |
c | different parts of the spectrum. However, The |
c | following conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
ncv = 20
n = 100
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV6: N is greater than MAXN '
go to 9000
@@ -148,7 +148,7 @@ c
bmat = 'G'
which = 'LM'
sigmar = 4.0D-1
sigmai = 6.0D-1
sigmai = 6.0D-1
c
c %----------------------------------------------------%
c | Construct C = A - (SIGMAR,SIGMAI)*M in complex |
@@ -166,12 +166,12 @@ c
c3 = dcmplx( 3.0D+0-sigmar, -sigmai)
c
do 10 j = 1, n-1
cdl(j) = c1
cdl(j) = c1
cdd(j) = c2
cdu(j) = c3
10 continue
cdd(n) = c2
c
10 continue
cdd(n) = c2
c
call zgttrf(n, cdl, cdd, cdu, cdu2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -191,8 +191,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in DNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
c
@@ -211,31 +211,31 @@ c
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------%
c | M A I N L O O P(Reverse communication) |
c | M A I N L O O P(Reverse communication) |
c %------------------------------------------%
c
20 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine DNAUPD and take |
c | Repeatedly call the routine DNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
call dnaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, info )
c
if (ido .eq. -1) then
c
c %------------------------------------------------------------%
c | Perform |
c | Perform |
c | y <--- OP*x = Imaginary_Part{inv[A-(SIGMAR,SIGMAI)*M]*M*x} |
c | to force starting vector into the range of OP. The user |
c | should supply his/her own matrix vector multiplication |
@@ -250,14 +250,14 @@ c
ctemp(j) = dcmplx(workd(ipntr(2)+j-1))
30 continue
c
call zgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
call zgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
& ctemp, maxn, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV6.'
print*, ' '
go to 9000
end if
end if
do 40 j = 1, n
workd(ipntr(2)+j-1) = dimag(ctemp(j))
40 continue
@@ -282,14 +282,14 @@ c
do 50 j = 1,n
ctemp(j) = dcmplx(workd(ipntr(3)+j-1))
50 continue
call zgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
call zgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
& ctemp, maxn, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV6.'
print*, ' '
go to 9000
end if
end if
do 60 j = 1, n
workd(ipntr(2)+j-1) = dimag(ctemp(j))
60 continue
@@ -335,24 +335,24 @@ c
print *, ' '
print *, ' Error with _naupd, info = ',info
print *, ' Check the documentation of _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using DNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
rvec = .true.
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
c
c %-----------------------------------------------%
@@ -368,16 +368,16 @@ c | the eigenvalues in D is returned in V. |
c %-----------------------------------------------%
c
if ( ierr .ne. 0) then
c
c
c %------------------------------------%
c | Error condition: |
c | Check the documentation of DNEUPD. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd. '
print *, ' '
print *, ' '
c
else
c
@@ -393,7 +393,7 @@ c
if ( d(j,2) .eq. zero) then
c
c %----------------------------%
c | Eigenvalue is real. |
c | Eigenvalue is real. |
c | Compute d = x'(Ax)/x'(Mx). |
c %----------------------------%
c
@@ -401,7 +401,7 @@ c
numr = ddot(n, v(1,j), 1, ax, 1)
call mv(n, v(1,j), ax )
denr = ddot(n, v(1,j), 1, ax, 1)
d(j,1) = numr / denr
d(j,1) = numr / denr
c
else if (first) then
c
@@ -419,7 +419,7 @@ c
numr = ddot(n, v(1,j), 1, ax, 1)
numi = ddot(n, v(1,j+1), 1, ax, 1)
call av(n, v(1,j+1), ax)
numr = numr + ddot(n,v(1,j+1),1,ax,1)
numr = numr + ddot(n,v(1,j+1),1,ax,1)
numi = -numi + ddot(n,v(1,j),1,ax,1)
c
c %----------------%
@@ -430,7 +430,7 @@ c
denr = ddot(n, v(1,j), 1, ax, 1)
deni = ddot(n, v(1,j+1), 1, ax, 1)
call mv(n, v(1,j+1), ax)
denr = denr + ddot(n,v(1,j+1),1,ax,1)
denr = denr + ddot(n,v(1,j+1),1,ax,1)
deni = -deni + ddot(n,v(1,j),1, ax,1)
c
c %----------------%
@@ -451,7 +451,7 @@ c | the conjugate pair by taking |
c | the conjugate of the last |
c | eigenvalue computed. |
c %------------------------------%
c
c
d(j,1) = d(j-1,1)
d(j,2) = -d(j-1,2)
first = .true.
@@ -475,7 +475,7 @@ c %---------------------------%
c
first = .true.
nconv = iparam(5)
do 80 j=1, nconv
do 80 j=1, nconv
c
if (d(j,2) .eq. zero) then
c
@@ -495,9 +495,9 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
c
call av(n, v(1,j), ax)
call mv(n, v(1,j), mx)
call daxpy(n, -d(j,1), mx, 1, ax, 1)
@@ -510,7 +510,7 @@ c
call mv(n, v(1,j), mx)
call daxpy(n, -d(j,2), mx, 1, ax, 1)
d(j,3) = dlapy2( d(j,3), dnrm2(n, ax, 1) )
d(j,3) = d(j,3) / dlapy2(d(j,1),d(j,2))
d(j,3) = d(j,3) / dlapy2(d(j,1),d(j,2))
d(j+1,3) = d(j,3)
first = .false.
else
@@ -537,11 +537,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV6 '
@@ -552,8 +552,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -569,7 +569,7 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
@@ -577,25 +577,25 @@ c
subroutine mv (n, v, w)
integer n, j
Double precision
& v(n), w(n), one, four
& v(n), w(n), one, four
parameter (one = 1.0D+0, four = 4.0D+0)
c
c Compute the matrix vector multiplication y<---M*x
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c diagonal, 1 on the subdiagonal and superdiagonal.
c
c
w(1) = four*v(1) + one*v(2)
do 10 j = 2,n-1
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
return
end
c------------------------------------------------------------------
subroutine av (n, v, w)
integer n, j
Double precision
& v(n), w(n), three, two
Double precision
& v(n), w(n), three, two
parameter (three = 3.0D+0, two = 2.0D+0)
c
c Compute the matrix vector multiplication y<---A*x
-71
View File
@@ -1,71 +0,0 @@
#
# makefile to run simple examples of the reverse communication
# protocol.
#
# Modify if ARPACK library was built somewhere else.
#
# If ALIBS (defined in ../../ARmake.inc) contains the BLAS and LAPACK
# libraries installed on your system, you DO NOT need to change this
# makefile. OTHERWISE, you may need to modify the Makefile in the top level
# ARPACK directory tree to include sdrv and/or ddrv in the
# definition of the PRECISION variable, and issue 'make lib' from there.
# For example:
#
# PRECISION = single double sdrv ddrv
#
#\SCCS Information: @(#)
# FILE: makefile SID: 2.2 DATE OF SID: 9/24/96 RELEASE: 2
#
include ../../ARmake.inc
#
# Issue "make nonsym" to make all 12 nonsymmetric drivers.
# Issue "make sndrv" to make 6 single precision nonsymmetric drivers.
# Issue "make dndrv" to make 6 double precision nonsymmetric drivers.
#
nonsym: sndrv dndrv
#
#-----------------------------------------------------------------------
# Simple nonsymmetric problem using single precision
#
sndrv: sndrv1 sndrv2 sndrv3 sndrv4 sndrv5 sndrv6
sndrv1: sndrv1.o
$(FC) $(FFLAGS) sndrv1.o $(ALIBS) -o sndrv1
#
sndrv2: sndrv2.o
$(FC) $(FFLAGS) sndrv2.o $(ALIBS) -o sndrv2
#
sndrv3: sndrv3.o
$(FC) $(FFLAGS) sndrv3.o $(ALIBS) -o sndrv3
#
sndrv4: sndrv4.o
$(FC) $(FFLAGS) sndrv4.o $(ALIBS) -o sndrv4
#
sndrv5: sndrv5.o
$(FC) $(FFLAGS) sndrv5.o $(ALIBS) -o sndrv5
#
sndrv6: sndrv6.o
$(FC) $(FFLAGS) sndrv6.o $(ALIBS) -o sndrv6
#
#------------------------------------------------------
# Simple nonsymmetric problem using double precision
#
dndrv: dndrv1 dndrv2 dndrv3 dndrv4 dndrv5 dndrv6
dndrv1: dndrv1.o
$(FC) $(FFLAGS) dndrv1.o $(ALIBS) -o dndrv1
#
dndrv2: dndrv2.o
$(FC) $(FFLAGS) dndrv2.o $(ALIBS) -o dndrv2
#
dndrv3: dndrv3.o
$(FC) $(FFLAGS) dndrv3.o $(ALIBS) -o dndrv3
#
dndrv4: dndrv4.o
$(FC) $(FFLAGS) dndrv4.o $(ALIBS) -o dndrv4
#
dndrv5: dndrv5.o
$(FC) $(FFLAGS) dndrv5.o $(ALIBS) -o dndrv5
#
dndrv6: dndrv6.o
$(FC) $(FFLAGS) dndrv6.o $(ALIBS) -o dndrv6
+56 -56
View File
@@ -1,4 +1,4 @@
program sndrv1
program sndrv1
c
c
c Example program to illustrate the idea of reverse communication
@@ -9,9 +9,9 @@ c
c\Example-1
c ... Suppose we want to solve A*x = lambda*x in regular mode,
c where A is obtained from the standard central difference
c discretization of the convection-diffusion operator
c discretization of the convection-diffusion operator
c (Laplacian u) + rho*(du / dx)
c on the unit square [0,1]x[0,1] with zero Dirichlet boundary
c on the unit square [0,1]x[0,1] with zero Dirichlet boundary
c condition.
c
c ... OP = A and B = I.
@@ -30,7 +30,7 @@ c slapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
c saxpy Level 1 BLAS that computes y <- alpha*x+y.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c tv Matrix vector multiplication routine that computes T*x,
c tv Matrix vector multiplication routine that computes T*x,
c where T is a tridiagonal matrix. It is used in routine
c av.
c
@@ -71,9 +71,9 @@ c
integer iparam(11), ipntr(14)
logical select(maxncv)
Real
& ax(maxn), d(maxncv,3), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& ax(maxn), d(maxncv,3), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& workl(3*maxncv*maxncv+6*maxncv)
c
c %---------------%
@@ -112,12 +112,12 @@ c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
c
c
c %--------------------------------------------------%
c | The number NX is the number of interior points |
c | in the discretization of the 2-dimensional |
c | convection-diffusion operator on the unit |
c | square with zero Dirichlet boundary condition. |
c | square with zero Dirichlet boundary condition. |
c | The number N(=NX*NX) is the dimension of the |
c | matrix. A standard eigenvalue problem is |
c | solved (BMAT = 'I'). NEV is the number of |
@@ -128,13 +128,13 @@ c | the spectrum. However, The following |
c | conditions must be satisfied: |
c | N <= MAXN |
c | NEV <= MAXNEV |
c | NEV + 2 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c | NEV + 2 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
nx = 10
n = nx*nx
nx = 10
n = nx*nx
nev = 4
ncv = 20
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV1: N is greater than MAXN '
go to 9000
@@ -149,18 +149,18 @@ c
which = 'SM'
c
c %-----------------------------------------------------%
c | The work array WORKL is used in SNAUPD as |
c | The work array WORKL is used in SNAUPD as |
c | workspace. Its dimension LWORKL is set as |
c | illustrated below. The parameter TOL determines |
c | the stopping criterion. If TOL<=0, machine |
c | precision is used. The variable IDO is used for |
c | reverse communication, and is initially set to 0. |
c | Setting INFO=0 indicates that a random vector is |
c | generated in SNAUPD to start the Arnoldi iteration. |
c | generated in SNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
c
@@ -179,11 +179,11 @@ c
mode = 1
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
c | M A I N L O O P (Reverse communication) |
c %-------------------------------------------%
c
10 continue
@@ -195,8 +195,8 @@ c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
& info )
c
if (ido .eq. -1 .or. ido .eq. 1) then
@@ -208,7 +208,7 @@ c | The user should supply his/her own |
c | matrix vector multiplication routine here |
c | that takes workd(ipntr(1)) as the input |
c | vector, and return the matrix vector |
c | product to workd(ipntr(2)). |
c | product to workd(ipntr(2)). |
c %-------------------------------------------%
c
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
@@ -219,8 +219,8 @@ c %-----------------------------------------%
c
go to 10
c
end if
c
end if
c
c %----------------------------------------%
c | Either we have convergence or there is |
c | an error. |
@@ -238,7 +238,7 @@ c
print *, ' Check the documentation of _naupd'
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -252,8 +252,8 @@ c %-------------------------------------------%
c
rvec = .true.
c
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, ierr )
c
@@ -281,7 +281,7 @@ c
print *, ' Check the documentation of _neupd. '
print *, ' '
c
else
else
c
first = .true.
nconv = iparam(5)
@@ -317,9 +317,9 @@ c %------------------------%
c | Ritz value is complex. |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
c
call av(nx, v(1,j), ax)
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
call saxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
@@ -354,23 +354,23 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV1 '
print *, ' ====== '
print *, ' '
print *, ' '
print *, ' Size of the matrix is ', n
print *, ' The number of Ritz values requested is ', nev
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -386,37 +386,37 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector subroutine
c
c The matrix used is the 2 dimensional convection-diffusion
c The matrix used is the 2 dimensional convection-diffusion
c operator discretized using central difference.
c
subroutine av (nx, v, w)
integer nx, j, lo
Real
Real
& v(nx*nx), w(nx*nx), one, h2
parameter (one = 1.0E+0)
external saxpy
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
c | -I T|
c
c derived from the standard central difference discretization
c of the 2 dimensional convection-diffusion operator
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
c derived from the standard central difference discretization
c of the 2 dimensional convection-diffusion operator
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
c condition.
c
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
c eigenvalues.
c
c The subroutine TV is called to compute y<---T*x.
@@ -432,7 +432,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call saxpy(nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
call saxpy(nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -443,21 +443,21 @@ c
c=========================================================================
subroutine tv (nx, x, y)
c
integer nx, j
integer nx, j
Real
& x(nx), y(nx), h, h2, dd, dl, du
c
Real
& one, zero, rho
parameter (one = 1.0E+0, zero = 0.0E+0,
parameter (one = 1.0E+0, zero = 0.0E+0,
& rho = 0.0E+0)
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal.
c
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has COMPLEX
c eigenvalues.
c
h = one / real(nx+1)
@@ -465,11 +465,11 @@ c
dd = 4.0E+0 / h2
dl = -one / h2 - 5.0E-1*rho / h
du = -one / h2 + 5.0E-1*rho / h
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
+49 -49
View File
@@ -9,7 +9,7 @@ c\Example-2
c ... Suppose we want to solve A*x = lambda*x in shift-invert mode,
c where A is derived from the centered difference discretization
c of the 1-dimensional convection-diffusion operator
c (d^2u / dx^2) + rho*(du/dx)
c (d^2u / dx^2) + rho*(du/dx)
c on the interval [0,1] with zero Dirichlet boundary condition.
c
c ... The shift sigma is a real number.
@@ -61,7 +61,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -97,7 +97,7 @@ c
Real
& one, zero, two, rho
common /convct/ rho
parameter (one = 1.0E+0, zero = 0.0E+0,
parameter (one = 1.0E+0, zero = 0.0E+0,
& two = 2.0E+0)
c
c %-----------------------------%
@@ -128,14 +128,14 @@ c | 'LM'. The user can modify NEV, NCV, SIGMAR to |
c | solve problems of different sizes, and to get |
c | different parts of the spectrum. However, The |
c | following conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c | NEV + 2 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
n = 100
nev = 4
ncv = 20
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV2: N is greater than MAXN '
go to 9000
@@ -148,8 +148,8 @@ c
end if
bmat = 'I'
which = 'LM'
sigmar = 1.0E+0
sigmai = 0.0E+0
sigmar = 1.0E+0
sigmai = 0.0E+0
c
c %----------------------------------------------------%
c | Construct C = A - SIGMA*I in real arithmetic, and |
@@ -157,7 +157,7 @@ c | factor C in real arithmetic using LAPACK |
c | subroutine sgttrf. The matrix A is chosen to be |
c | the tridiagonal matrix derived from standard |
c | central difference of the 1-d convection diffusion |
c | operator u" + rho*u' on the interval [0, 1] with |
c | operator u" + rho*u' on the interval [0, 1] with |
c | zero Dirichlet boundary condition. |
c %----------------------------------------------------%
c
@@ -165,25 +165,25 @@ c
h = one / real(n+1)
s = rho*h / two
c
s1 = -one-s
s1 = -one-s
s2 = two - sigmar
s3 = -one+s
s3 = -one+s
c
do 10 j = 1, n-1
dl(j) = s1
dl(j) = s1
dd(j) = s2
du(j) = s3
10 continue
dd(n) = s2
c
10 continue
dd(n) = s2
c
call sgttrf(n, dl, dd, du, du2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' '
print*, ' ERROR with _gttrf in _NDRV2.'
print*, ' '
go to 9000
end if
c
c
c %-----------------------------------------------------%
c | The work array WORKL is used in SNAUPD as |
c | workspace. Its dimension LWORKL is set as |
@@ -195,8 +195,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in SNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
c
@@ -213,26 +213,26 @@ c
ishfts = 1
maxitr = 300
mode = 3
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
c | M A I N L O O P (Reverse communication) |
c %-------------------------------------------%
c
20 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine SNAUPD and take |
c | Repeatedly call the routine SNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
& info )
c
if ( ido .eq. -1 .or. ido .eq. 1) then
@@ -247,10 +247,10 @@ c %-------------------------------------------%
c
call scopy( n, workd(ipntr(1)), 1, workd(ipntr(2)), 1)
c
call sgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
call sgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' '
print*, ' ERROR with _gttrs in _NDRV2.'
print*, ' '
go to 9000
@@ -279,26 +279,26 @@ c
print *, ' '
print *, ' Error with _naupd, info = ', info
print *, ' Check the documentation in _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using SNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
c
rvec = .true.
c
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
c
c %-----------------------------------------------%
c | The real part of the eigenvalue is returned |
@@ -319,11 +319,11 @@ c | Error condition: |
c | Check the documentation of SNEUPD. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd. '
print *, ' '
c
print *, ' '
c
else
c
first = .true.
@@ -360,9 +360,9 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
c
call av(n, v(1,j), ax)
call saxpy(n, -d(j,1), v(1,j), 1, ax, 1)
call saxpy(n, d(j,2), v(1,j+1), 1, ax, 1)
@@ -397,11 +397,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV2 '
@@ -412,8 +412,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
+51 -51
View File
@@ -15,7 +15,7 @@ c using linear elements.
c
c ... So OP = inv[M]*A and B = M.
c
c ... Use mode 2 of SNAUPD.
c ... Use mode 2 of SNAUPD.
c
c\BeginLib
c
@@ -60,7 +60,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -71,7 +71,7 @@ c
logical select(maxncv)
Real
& ax(maxn), mx(maxn), d(maxncv, 3), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& workl(3*maxncv*maxncv+6*maxncv),
& md(maxn), me(maxn-1)
@@ -83,7 +83,7 @@ c
character bmat*1, which*2
integer ido, n, nev, ncv, lworkl, info, ierr, j,
& nconv, maxitr, ishfts, mode
Real
Real
& tol, sigmar, sigmai, h
logical first, rvec
c
@@ -91,14 +91,14 @@ c %------------%
c | Parameters |
c %------------%
c
Real
Real
& zero, one
parameter (zero = 0.0E+0, one = 1.0E+0)
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
Real
Real
& snrm2, slapy2
external saxpy, snrm2, spttrf, spttrs, slapy2
c
@@ -125,9 +125,9 @@ c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
ncv = 20
n = 100
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV3: N is greater than MAXN '
go to 9000
@@ -148,16 +148,16 @@ c %------------------------------------------------%
c
h = one / real(n+1)
do 20 j = 1, n-1
md(j) = 4.0E+0*h
me(j) = one*h
20 continue
md(j) = 4.0E+0*h
me(j) = one*h
20 continue
md(n) = 4.0E+0*h
c
c
call spttrf(n, md, me, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _pttrf. '
print*, ' '
print*, ' ERROR with _pttrf. '
print*, ' '
go to 9000
end if
c
@@ -172,8 +172,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in SNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = 0.0
lworkl = 3*ncv**2+6*ncv
tol = 0.0
ido = 0
info = 0
c
@@ -191,9 +191,9 @@ c
maxitr = 300
mode = 2
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
@@ -202,14 +202,14 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine SNAUPD and take |
c | Repeatedly call the routine SNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, info )
c
if (ido .eq. -1 .or. ido .eq. 1) then
@@ -228,8 +228,8 @@ c
call spttrs(n, 1, md, me, workd(ipntr(2)), n,
& ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _pttrs. '
print*, ' '
print*, ' ERROR with _pttrs. '
print*, ' '
go to 9000
end if
@@ -264,7 +264,7 @@ c
c %-----------------------------------------%
c | Either we have convergence, or there is |
c | an error. |
c %-----------------------------------------%
c %-----------------------------------------%
c
if ( info .lt. 0 ) then
c
@@ -276,22 +276,22 @@ c
print *, ' '
print *, ' Error with _naupd, info = ', info
print *, ' Check the documentation of _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using SNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
rvec = .true.
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
@@ -314,13 +314,13 @@ c %------------------------------------%
c | Error condition: |
c | Check the documentation of SNEUPD. |
c %------------------------------------%
c
print *, ' '
c
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd'
print *, ' '
c
else
else
c
first = .true.
nconv = iparam(5)
@@ -399,11 +399,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV3 '
@@ -414,8 +414,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -431,16 +431,16 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
c
subroutine av (n, v, w)
integer n, j
Real
& v(n), w(n), one, two, dd, dl, du, s, h, rho
parameter ( rho = 1.0E+1, one = 1.0E+0,
Real
& v(n), w(n), one, two, dd, dl, du, s, h, rho
parameter ( rho = 1.0E+1, one = 1.0E+0,
& two = 2.0E+0)
c
c Compute the matrix vector multiplication y<---A*x
@@ -458,27 +458,27 @@ c
c
w(1) = dd*v(1) + du*v(2)
do 10 j = 2,n-1
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
10 continue
w(n) = dl*v(n-1) + dd*v(n)
w(j) = dl*v(j-1) + dd*v(j) + du*v(j+1)
10 continue
w(n) = dl*v(n-1) + dd*v(n)
return
end
c------------------------------------------------------------------------
subroutine mv (n, v, w)
integer n, j
Real
Real
& v(n), w(n), one, four, h
parameter ( one = 1.0E+0, four = 4.0E+0)
c
c Compute the matrix vector multiplication y<---M*x
c where M is the mass matrix formed by using piecewise linear
c where M is the mass matrix formed by using piecewise linear
c elements on [0,1].
c
c
w(1) = four*v(1) + one*v(2)
do 10 j = 2,n-1
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
c
h = one / real(n+1)
call sscal(n, h, w, 1)
+58 -58
View File
@@ -1,7 +1,7 @@
program sndrv4
c
c Simple program to illustrate the idea of reverse communication
c in shift-invert mode for a generalized nonsymmetric eigenvalue
c in shift-invert mode for a generalized nonsymmetric eigenvalue
c problem.
c
c We implement example four of ex-nonsym.doc in DOCUMENTS directory
@@ -25,7 +25,7 @@ c
c\Routines called:
c snaupd ARPACK reverse communication interface routine.
c sneupd ARPACK routine that returns Ritz values and (optionally)
c Ritz vectors.
c Ritz vectors.
c sgttrf LAPACK tridiagonal factorization routine.
c sgttrs LAPACK tridiagonal linear system solve routine.
c slapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
@@ -37,15 +37,15 @@ c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
c\Author
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
c\SCCS Information: @(#)
c FILE: ndrv4.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
c
c\Remarks
@@ -64,7 +64,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -90,13 +90,13 @@ c
Real
& tol, h, s,
& sigmar, sigmai, s1, s2, s3
logical first, rvec
c
logical first, rvec
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& sdot, snrm2, slapy2
external sdot, snrm2, slapy2, sgttrf, sgttrs
c
@@ -113,7 +113,7 @@ c
Real
& one, zero, two, six, rho
common /convct/ rho
parameter (one = 1.0E+0, zero = 0.0E+0,
parameter (one = 1.0E+0, zero = 0.0E+0,
& two = 2.0E+0, six = 6.0E+0)
c
c %-----------------------%
@@ -130,14 +130,14 @@ c | The user can modify NEV, NCV, SIGMAR to solve |
c | problems of different sizes, and to get different |
c | parts of the spectrum. However, The following |
c | conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
ncv = 10
n = 100
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV4: N is greater than MAXN '
go to 9000
@@ -150,7 +150,7 @@ c
end if
bmat = 'G'
which = 'LM'
sigmar = one
sigmar = one
sigmai = zero
c
c %--------------------------------------------------%
@@ -175,12 +175,12 @@ c
s3 = -one/h + s - sigmar*h/six
c
do 10 j = 1, n-1
dl(j) = s1
dl(j) = s1
dd(j) = s2
du(j) = s3
10 continue
dd(n) = s2
c
10 continue
dd(n) = s2
c
call sgttrf(n, dl, dd, du, du2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -200,7 +200,7 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in SNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
@@ -224,20 +224,20 @@ c
iparam(7) = mode
c
c %------------------------------------------%
c | M A I N L O O P(Reverse communication) |
c | M A I N L O O P(Reverse communication) |
c %------------------------------------------%
c
20 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine SNAUPD and take |
c | Repeatedly call the routine SNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, info )
c
if (ido .eq. -1) then
@@ -255,8 +255,8 @@ c | workd(ipntr(2)). |
c %-------------------------------------------%
c
call mv (n, workd(ipntr(1)), workd(ipntr(2)))
call sgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
call sgttrs('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV4.'
@@ -282,7 +282,7 @@ c | workd(ipntr(2)). |
c %-----------------------------------------%
c
call scopy( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call sgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
call sgttrs ('N', n, 1, dl, dd, du, du2, ipiv,
& workd(ipntr(2)), n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -314,8 +314,8 @@ c %-----------------------------------------%
c
go to 20
c
end if
c
end if
c
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
@@ -334,23 +334,23 @@ c
print *, ' Check the documentation in _naupd.'
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using SNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
rvec = .true.
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
c
c %-----------------------------------------------%
c | The real part of the eigenvalue is returned |
@@ -365,16 +365,16 @@ c | the eigenvalues in D is returned in V. |
c %-----------------------------------------------%
c
if ( ierr .ne. 0) then
c
c
c %------------------------------------%
c | Error condition: |
c | Check the documentation of SNEUPD. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd. '
print *, ' '
print *, ' '
c
else
c
@@ -413,9 +413,9 @@ c %------------------------%
c | Ritz value is complex. |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
c
call av(n, v(1,j), ax)
call mv(n, v(1,j), mx)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
@@ -455,11 +455,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV4 '
@@ -470,8 +470,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -487,7 +487,7 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
@@ -495,17 +495,17 @@ c
subroutine mv (n, v, w)
integer n, j
Real
& v(n), w(n), one, four, six, h
& v(n), w(n), one, four, six, h
parameter (one = 1.0E+0, four = 4.0E+0, six = 6.0E+0)
c
c Compute the matrix vector multiplication y<---M*x
c where M is mass matrix formed by using piecewise linear elements
c where M is mass matrix formed by using piecewise linear elements
c on [0,1].
c
c
w(1) = ( four*v(1) + one*v(2) ) / six
do 10 j = 2,n-1
w(j) = ( one*v(j-1) + four*v(j) + one*v(j+1) ) / six
10 continue
10 continue
w(n) = ( one*v(n-1) + four*v(n) ) / six
c
h = one / real(n+1)
@@ -516,7 +516,7 @@ c------------------------------------------------------------------
subroutine av (n, v, w)
integer n, j
Real
& v(n), w(n), one, two, dd, dl, du, s, h, rho
& v(n), w(n), one, two, dd, dl, du, s, h, rho
common /convct/ rho
parameter (one = 1.0E+0, two = 2.0E+0)
c
@@ -530,7 +530,7 @@ c This routine is only used in residual calculation.
c
h = one / real(n+1)
s = rho / two
dd = two / h
dd = two / h
dl = -one/h - s
du = -one/h + s
c
+74 -74
View File
@@ -8,9 +8,9 @@ c
c\Example-5
c
c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
c off-diagonals.
c ... The shift sigma is a complex number (sigmar, sigmai).
c ... OP = Real_Part{inv[A-(SIGMAR,SIGMAI)*M]*M and B = M.
@@ -32,15 +32,15 @@ c av Matrix vector subroutine that computes A*x.
c mv Matrix vector subroutine that computes M*x.
c
c\Author
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
c\SCCS Information: @(#)
c FILE: ndrv5.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
c
c\Remarks
@@ -59,7 +59,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -73,7 +73,7 @@ c
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& workl(3*maxncv*maxncv+6*maxncv)
Complex
Complex
& cdd(maxn), cdl(maxn), cdu(maxn),
& cdu2(maxn), ctemp(maxn)
c
@@ -86,16 +86,16 @@ c
& nconv, maxitr, ishfts, mode
Real
& tol, numr, numi, denr, deni, sigmar, sigmai
Complex
Complex
& c1, c2, c3
logical first, rvec
c
logical first, rvec
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
external cgttrf, cgttrs
Real
Real
& sdot, snrm2, slapy2
external sdot, snrm2, slapy2
c
@@ -128,14 +128,14 @@ c | to 'LM'. The user can modify NEV, NCV, SIGMAR, |
c | SIGMAI to solve problems of different sizes, and |
c | to get different parts of the spectrum. However, |
c | The following conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
ncv = 20
n = 100
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV5: N is greater than MAXN '
go to 9000
@@ -167,12 +167,12 @@ c
c3 = cmplx( 3.0E+0-sigmar, -sigmai)
c
do 10 j = 1, n-1
cdl(j) = c1
cdl(j) = c1
cdd(j) = c2
cdu(j) = c3
10 continue
cdd(n) = c2
c
10 continue
cdd(n) = c2
c
call cgttrf(n, cdl, cdd, cdu, cdu2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -192,8 +192,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in SNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
c
@@ -212,30 +212,30 @@ c
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------%
c | M A I N L O O P(Reverse communication) |
c | M A I N L O O P(Reverse communication) |
c %------------------------------------------%
c
20 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine SNAUPD and take |
c | Repeatedly call the routine SNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, info )
c
if (ido .eq. -1) then
c
c %-------------------------------------------------------%
c | Perform |
c | Perform |
c | y <--- OP*x = Real_Part{inv[A-(SIGMAR,SIGMAI)*M]*M*x} |
c | to force starting vector into the range of OP. The |
c | user should supply his/her own matrix vector |
@@ -251,14 +251,14 @@ c
ctemp(j) = cmplx(workd(ipntr(2)+j-1))
30 continue
c
call cgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
call cgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
& ctemp, n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV5.'
print*, ' '
go to 9000
end if
end if
do 40 j = 1, n
workd(ipntr(2)+j-1) = real(ctemp(j))
40 continue
@@ -283,14 +283,14 @@ c
do 50 j = 1,n
ctemp(j) = cmplx(workd(ipntr(3)+j-1))
50 continue
call cgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
call cgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
& ctemp, n, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV5.'
print*, ' '
go to 9000
end if
end if
do 60 j = 1, n
workd(ipntr(2)+j-1) = real(ctemp(j))
60 continue
@@ -320,7 +320,7 @@ c
c
end if
c
c
c
c %------------------------------------------%
c | Either we have convergence, or there is |
c | an error. |
@@ -336,25 +336,25 @@ c
print *, ' '
print *, ' Error with _naupd info = ',info
print *, ' Check the documentation of _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using SNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
rvec = .true.
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
c
c %-----------------------------------------------%
c | The real part of the eigenvalue is returned |
@@ -375,14 +375,14 @@ c | Error condition: |
c | Check the documentation of SNEUPD. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd = ', ierr
print *, ' Check the documentation of _neupd. '
print *, ' '
print *, ' '
c
else
else
c
first = .true.
first = .true.
nconv = iparam(5)
do 70 j=1,nconv
c
@@ -394,7 +394,7 @@ c
if ( d(j,2) .eq. zero ) then
c
c %---------------------------%
c | Eigenvalue is real. |
c | Eigenvalue is real. |
c | Compute d = x'(Ax)/x'(Mx).|
c %---------------------------%
c
@@ -402,7 +402,7 @@ c
numr = sdot(n, v(1,j), 1, ax, 1)
call mv(n, v(1,j), ax )
denr = sdot(n, v(1,j), 1, ax, 1)
d(j,1) = numr / denr
d(j,1) = numr / denr
c
else if (first) then
c
@@ -420,7 +420,7 @@ c %----------------%
numr = sdot(n, v(1,j), 1, ax, 1)
numi = sdot(n, v(1,j+1), 1, ax, 1)
call av(n, v(1,j+1), ax)
numr = numr + sdot(n,v(1,j+1),1,ax,1)
numr = numr + sdot(n,v(1,j+1),1,ax,1)
numi = -numi + sdot(n,v(1,j),1,ax,1)
c
c %----------------%
@@ -431,7 +431,7 @@ c
denr = sdot(n, v(1,j), 1, ax, 1)
deni = sdot(n, v(1,j+1), 1, ax, 1)
call mv(n, v(1,j+1), ax)
denr = denr + sdot(n,v(1,j+1),1,ax,1)
denr = denr + sdot(n,v(1,j+1),1,ax,1)
deni = -deni + sdot(n,v(1,j),1, ax,1)
c
c %----------------%
@@ -452,7 +452,7 @@ c | the conjugate pair by taking |
c | the conjugate of the last |
c | eigenvalue computed. |
c %------------------------------%
c
c
d(j,1) = d(j-1,1)
d(j,2) = -d(j-1,2)
first = .true.
@@ -475,7 +475,7 @@ c | tolerance) |
c %---------------------------%
c
first = .true.
do 80 j=1, nconv
do 80 j=1, nconv
c
if (d(j,2) .eq. zero) then
c
@@ -495,9 +495,9 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
c
call av(n, v(1,j), ax)
call mv(n, v(1,j), mx)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
@@ -527,7 +527,7 @@ c
call smout(6, nconv, 3, d, maxncv, -6,
& 'Ritz values (Real,Imag) and relative residuals')
c
end if
end if
c
c %-------------------------------------------%
c | Print additional convergence information. |
@@ -538,11 +538,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV5 '
@@ -553,8 +553,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -570,7 +570,7 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
@@ -578,25 +578,25 @@ c
subroutine mv (n, v, w)
integer n, j
Real
& v(n), w(n), one, four
& v(n), w(n), one, four
parameter (one = 1.0E+0, four = 4.0E+0)
c
c Compute the matrix vector multiplication y<---M*x
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c diagonal, 1 on the subdiagonal and superdiagonal.
c
c
w(1) = four*v(1) + one*v(2)
do 10 j = 2,n-1
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
return
end
c------------------------------------------------------------------
subroutine av (n, v, w)
integer n, j
Real
& v(n), w(n), three, two
Real
& v(n), w(n), three, two
parameter (three = 3.0E+0, two = 2.0E+0)
c
c Compute the matrix vector multiplication y<---A*x
+71 -71
View File
@@ -8,9 +8,9 @@ c
c\Example-6
c
c ... Suppose we want to solve A*x = lambda*B*x in shift-invert mode
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
c The matrix A is the tridiagonal matrix with 2 on the diagonal,
c -2 on the subdiagonal and 3 on the superdiagonal. The matrix M
c is the tridiagonal matrix with 4 on the diagonal and 1 on the
c off-diagonals.
c ... The shift sigma is a complex number (sigmar, sigmai).
c ... OP = Imaginary_Part{inv[A-(SIGMAR,SIGMAI)*M]*M and B = M.
@@ -32,15 +32,15 @@ c av Matrix vector subroutine that computes A*x.
c mv Matrix vector subroutine that computes M*x.
c
c\Author
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
c\SCCS Information: @(#)
c FILE: ndrv6.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
c
c\Remarks
@@ -59,7 +59,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -73,7 +73,7 @@ c
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& workl(3*maxncv*maxncv+6*maxncv)
Complex
Complex
& cdd(maxn), cdl(maxn), cdu(maxn),
& cdu2(maxn), ctemp(maxn)
c
@@ -86,16 +86,16 @@ c
& nconv, maxitr, ishfts, mode
Real
& tol, numr, numi, denr, deni, sigmar, sigmai
Complex
Complex
& c1, c2, c3
logical first, rvec
c
logical first, rvec
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
external cgttrf, cgttrs
Real
Real
& sdot, snrm2, slapy2
external sdot, snrm2, slapy2
c
@@ -127,14 +127,14 @@ c | to 'LM'. The user can modify NEV, NCV, SIGMA to |
c | solve problems of different sizes, and to get |
c | different parts of the spectrum. However, The |
c | following conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 2 <= NCV <= MAXNCV |
c | NEV + 2 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
ncv = 20
n = 100
nev = 4
ncv = 20
if ( n .gt. maxn ) then
print *, ' ERROR with _NDRV6: N is greater than MAXN '
go to 9000
@@ -148,7 +148,7 @@ c
bmat = 'G'
which = 'LM'
sigmar = 4.0E-1
sigmai = 6.0E-1
sigmai = 6.0E-1
c
c %----------------------------------------------------%
c | Construct C = A - (SIGMAR,SIGMAI)*M in complex |
@@ -166,12 +166,12 @@ c
c3 = cmplx( 3.0E+0-sigmar, -sigmai)
c
do 10 j = 1, n-1
cdl(j) = c1
cdl(j) = c1
cdd(j) = c2
cdu(j) = c3
10 continue
cdd(n) = c2
c
10 continue
cdd(n) = c2
c
call cgttrf(n, cdl, cdd, cdu, cdu2, ipiv, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
@@ -191,8 +191,8 @@ c | Setting INFO=0 indicates that a random vector is |
c | generated in SNAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
c
@@ -211,31 +211,31 @@ c
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------%
c | M A I N L O O P(Reverse communication) |
c | M A I N L O O P(Reverse communication) |
c %------------------------------------------%
c
20 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine SNAUPD and take |
c | Repeatedly call the routine SNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
call snaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, info )
c
if (ido .eq. -1) then
c
c %------------------------------------------------------------%
c | Perform |
c | Perform |
c | y <--- OP*x = Imaginary_Part{inv[A-(SIGMAR,SIGMAI)*M]*M*x} |
c | to force starting vector into the range of OP. The user |
c | should supply his/her own matrix vector multiplication |
@@ -250,14 +250,14 @@ c
ctemp(j) = cmplx(workd(ipntr(2)+j-1))
30 continue
c
call cgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
call cgttrs('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
& ctemp, maxn, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV6.'
print*, ' '
go to 9000
end if
end if
do 40 j = 1, n
workd(ipntr(2)+j-1) = aimag(ctemp(j))
40 continue
@@ -282,14 +282,14 @@ c
do 50 j = 1,n
ctemp(j) = cmplx(workd(ipntr(3)+j-1))
50 continue
call cgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
call cgttrs ('N', n, 1, cdl, cdd, cdu, cdu2, ipiv,
& ctemp, maxn, ierr)
if ( ierr .ne. 0 ) then
print*, ' '
print*, ' ERROR with _gttrs in _NDRV6.'
print*, ' '
go to 9000
end if
end if
do 60 j = 1, n
workd(ipntr(2)+j-1) = aimag(ctemp(j))
60 continue
@@ -335,24 +335,24 @@ c
print *, ' '
print *, ' Error with _naupd, info = ',info
print *, ' Check the documentation of _naupd.'
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using SNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
rvec = .true.
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd,
& workl, lworkl, ierr )
c
c %-----------------------------------------------%
@@ -368,16 +368,16 @@ c | the eigenvalues in D is returned in V. |
c %-----------------------------------------------%
c
if ( ierr .ne. 0) then
c
c
c %------------------------------------%
c | Error condition: |
c | Check the documentation of SNEUPD. |
c %------------------------------------%
c
print *, ' '
print *, ' '
print *, ' Error with _neupd, info = ', ierr
print *, ' Check the documentation of _neupd. '
print *, ' '
print *, ' '
c
else
c
@@ -393,7 +393,7 @@ c
if ( d(j,2) .eq. zero) then
c
c %----------------------------%
c | Eigenvalue is real. |
c | Eigenvalue is real. |
c | Compute d = x'(Ax)/x'(Mx). |
c %----------------------------%
c
@@ -401,7 +401,7 @@ c
numr = sdot(n, v(1,j), 1, ax, 1)
call mv(n, v(1,j), ax )
denr = sdot(n, v(1,j), 1, ax, 1)
d(j,1) = numr / denr
d(j,1) = numr / denr
c
else if (first) then
c
@@ -419,7 +419,7 @@ c
numr = sdot(n, v(1,j), 1, ax, 1)
numi = sdot(n, v(1,j+1), 1, ax, 1)
call av(n, v(1,j+1), ax)
numr = numr + sdot(n,v(1,j+1),1,ax,1)
numr = numr + sdot(n,v(1,j+1),1,ax,1)
numi = -numi + sdot(n,v(1,j),1,ax,1)
c
c %----------------%
@@ -430,7 +430,7 @@ c
denr = sdot(n, v(1,j), 1, ax, 1)
deni = sdot(n, v(1,j+1), 1, ax, 1)
call mv(n, v(1,j+1), ax)
denr = denr + sdot(n,v(1,j+1),1,ax,1)
denr = denr + sdot(n,v(1,j+1),1,ax,1)
deni = -deni + sdot(n,v(1,j),1, ax,1)
c
c %----------------%
@@ -451,7 +451,7 @@ c | the conjugate pair by taking |
c | the conjugate of the last |
c | eigenvalue computed. |
c %------------------------------%
c
c
d(j,1) = d(j-1,1)
d(j,2) = -d(j-1,2)
first = .true.
@@ -475,7 +475,7 @@ c %---------------------------%
c
first = .true.
nconv = iparam(5)
do 80 j=1, nconv
do 80 j=1, nconv
c
if (d(j,2) .eq. zero) then
c
@@ -495,9 +495,9 @@ c %------------------------%
c | Ritz value is complex |
c | Residual of one Ritz |
c | value of the conjugate |
c | pair is computed. |
c | pair is computed. |
c %------------------------%
c
c
call av(n, v(1,j), ax)
call mv(n, v(1,j), mx)
call saxpy(n, -d(j,1), mx, 1, ax, 1)
@@ -510,7 +510,7 @@ c
call mv(n, v(1,j), mx)
call saxpy(n, -d(j,2), mx, 1, ax, 1)
d(j,3) = slapy2( d(j,3), snrm2(n, ax, 1) )
d(j,3) = d(j,3) / slapy2(d(j,1),d(j,2))
d(j,3) = d(j,3) / slapy2(d(j,1),d(j,2))
d(j+1,3) = d(j,3)
first = .false.
else
@@ -537,11 +537,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NDRV6 '
@@ -552,8 +552,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -569,7 +569,7 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector multiplication subroutine
@@ -577,25 +577,25 @@ c
subroutine mv (n, v, w)
integer n, j
Real
& v(n), w(n), one, four
& v(n), w(n), one, four
parameter (one = 1.0E+0, four = 4.0E+0)
c
c Compute the matrix vector multiplication y<---M*x
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c where M is a n by n symmetric tridiagonal matrix with 4 on the
c diagonal, 1 on the subdiagonal and superdiagonal.
c
c
w(1) = four*v(1) + one*v(2)
do 10 j = 2,n-1
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
w(j) = one*v(j-1) + four*v(j) + one*v(j+1)
10 continue
w(n) = one*v(n-1) + four*v(n)
return
end
c------------------------------------------------------------------
subroutine av (n, v, w)
integer n, j
Real
& v(n), w(n), three, two
Real
& v(n), w(n), three, two
parameter (three = 3.0E+0, two = 2.0E+0)
c
c Compute the matrix vector multiplication y<---A*x
@@ -0,0 +1,2 @@
In ../TESTS, the file icb_arpack_c.c is an example of how to call arpack from C.
In ../TESTS, the file icb_arpack_cpp.cpp is an example of how to call arpack from C++.
+15
View File
@@ -0,0 +1,15 @@
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
SIMPLE = sssimp dssimp snsimp dnsimp cnsimp znsimp
check_PROGRAMS = $(SIMPLE)
TESTS = $(check_PROGRAMS)
EXTRA_DIST = README debug.h
sssimp_SOURCES = sssimp.f
dssimp_SOURCES = dssimp.f
snsimp_SOURCES = snsimp.f
dnsimp_SOURCES = dnsimp.f
cnsimp_SOURCES = cnsimp.f
znsimp_SOURCES = znsimp.f
+78 -78
View File
@@ -1,26 +1,26 @@
program cnsimp
program cnsimp
c
c This example program is intended to illustrate the
c simplest case of using ARPACK in considerable detail.
c This example program is intended to illustrate the
c simplest case of using ARPACK in considerable detail.
c This code may be used to understand basic usage of ARPACK
c and as a template for creating an interface to ARPACK.
c
c This code shows how to use ARPACK to find a few eigenvalues
c (lambda) and corresponding eigenvectors (x) for the standard
c and as a template for creating an interface to ARPACK.
c
c This code shows how to use ARPACK to find a few eigenvalues
c (lambda) and corresponding eigenvectors (x) for the standard
c eigenvalue problem:
c
c
c A*x = lambda*x
c
c
c where A is a general n by n complex matrix.
c
c The main points illustrated here are
c The main points illustrated here are
c
c 1) How to declare sufficient memory to find NEV
c 1) How to declare sufficient memory to find NEV
c eigenvalues of largest magnitude. Other options
c are available.
c
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine CNAUPD
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine CNAUPD
c that computes the quantities needed to construct
c the desired eigenvalues and eigenvectors(if requested).
c
@@ -28,8 +28,8 @@ c 3) How to extract the desired eigenvalues and eigenvectors
c using the ARPACK routine CNEUPD.
c
c The only thing that must be supplied in order to use this
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH eigenvalues you want to compute
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH eigenvalues you want to compute
c and to supply a matrix-vector product
c
c w <- Av
@@ -40,7 +40,7 @@ c
c Once usage of this routine is understood, you may wish to explore
c the other available options to improve convergence, to solve generalized
c problems, etc. Look at the file ex-complex.doc in DOCUMENTS directory.
c This codes implements
c This codes implements
c
c
c\Example-1
@@ -65,11 +65,11 @@ c av.
c
c\Author
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
@@ -112,12 +112,12 @@ c %--------------%
c
integer iparam(11), ipntr(14)
logical select(maxncv)
Complex
& ax(maxn), d(maxncv),
& v(ldv,maxncv), workd(3*maxn),
& workev(2*maxncv), resid(maxn),
Complex
& ax(maxn), d(maxncv),
& v(ldv,maxncv), workd(3*maxn),
& workev(2*maxncv), resid(maxn),
& workl(3*maxncv*maxncv+5*maxncv)
Real
Real
& rwork(maxncv), rd(maxncv,3)
c
c %---------------%
@@ -127,9 +127,9 @@ c
character bmat*1, which*2
integer ido, n, nx, nev, ncv, lworkl, info, ierr,
& j, ishfts, maxitr, mode1, nconv
Complex
Complex
& sigma
Real
Real
& tol
logical rvec
c
@@ -137,9 +137,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& scnrm2, slapy2
external scnrm2, caxpy, slapy2
external scnrm2, caxpy, slapy2
c
c %-----------------------%
c | Executable Statements |
@@ -158,7 +158,7 @@ c
include 'debug.h'
ndigit = -3
logfil = 6
mcaitr = 0
mcaitr = 0
mcapps = 0
mcaupd = 1
mcaup2 = 0
@@ -169,16 +169,16 @@ c %-------------------------------------------------%
c | The following sets dimensions for this problem. |
c %-------------------------------------------------%
c
nx = 10
n = nx*nx
nx = 10
n = nx*nx
c
c %-----------------------------------------------%
c | |
c | Specifications for ARPACK usage are set |
c | |
c | Specifications for ARPACK usage are set |
c | below: |
c | |
c | 1) NEV = 4 asks for 4 eigenvalues to be |
c | computed. |
c | 1) NEV = 4 asks for 4 eigenvalues to be |
c | computed. |
c | |
c | 2) NCV = 20 sets the length of the Arnoldi |
c | factorization |
@@ -190,7 +190,7 @@ c | 4) Ask for the NEV eigenvalues of |
c | largest magnitude |
c | (indicated by which = 'LM') |
c | See documentation in CNAUPD for the |
c | other options SM, LR, SR, LI, SI. |
c | other options SM, LR, SR, LI, SI. |
c | |
c | Note: NEV and NCV must satisfy the following |
c | conditions: |
@@ -200,7 +200,7 @@ c | |
c %-----------------------------------------------%
c
nev = 4
ncv = 20
ncv = 20
bmat = 'I'
which = 'LM'
c
@@ -234,26 +234,26 @@ c | used to specify actions to be taken on return |
c | from CNAUPD. (see usage below) |
c | |
c | It MUST initially be set to 0 before the first |
c | call to CNAUPD. |
c | call to CNAUPD. |
c | |
c | INFO on entry specifies starting vector information |
c | and on return indicates error codes |
c | |
c | Initially, setting INFO=0 indicates that a |
c | Initially, setting INFO=0 indicates that a |
c | random starting vector is requested to |
c | start the ARNOLDI iteration. Setting INFO to |
c | a nonzero value on the initial call is used |
c | if you want to specify your own starting |
c | vector (This vector must be placed in RESID). |
c | vector (This vector must be placed in RESID). |
c | |
c | The work array WORKL is used in CNAUPD as |
c | The work array WORKL is used in CNAUPD as |
c | workspace. Its dimension LWORKL is set as |
c | illustrated below. |
c | |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
lworkl = 3*ncv**2+5*ncv
tol = 0.0
ido = 0
info = 0
c
@@ -274,19 +274,19 @@ c
mode1 = 1
c
iparam(1) = ishfts
c
c
iparam(3) = maxitr
c
c
iparam(7) = mode1
c
c %------------------------------------------------%
c | M A I N L O O P (Reverse Communication Loop) |
c | M A I N L O O P (Reverse Communication Loop) |
c %------------------------------------------------%
c
10 continue
c
c
c %---------------------------------------------%
c | Repeatedly call the routine CNAUPD and take |
c | Repeatedly call the routine CNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
@@ -308,11 +308,11 @@ c | matrix vector multiplication routine here |
c | that takes workd(ipntr(1)) as the input |
c | vector x , and returns the resulting |
c | matrix-vector product y = A*x in the |
c | array workd(ipntr(2)). |
c | array workd(ipntr(2)). |
c %-------------------------------------------%
c
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
c
c
c %-----------------------------------------%
c | L O O P B A C K to call CNAUPD again. |
c %-----------------------------------------%
@@ -320,7 +320,7 @@ c
go to 10
c
endif
c
c
c %----------------------------------------%
c | Either we have convergence or there is |
c | an error. |
@@ -338,16 +338,16 @@ c
print *, ' Check the documentation of _naupd'
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using CNEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may be also computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c | |
c | The routine CNEUPD now called to do this |
c | post processing (Other modes may require |
@@ -355,7 +355,7 @@ c | more complicated post processing than |
c | mode1.) |
c | |
c %-------------------------------------------%
c
c
rvec = .true.
c
call cneupd (rvec, 'A', select, D, V, ldv, sigma,
@@ -429,11 +429,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, '_NSIMP '
@@ -444,8 +444,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -461,7 +461,7 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector subroutine
@@ -471,22 +471,22 @@ c discretized using centered difference.
c
subroutine av (nx, v, w)
integer nx, j, lo
Complex
Complex
& v(nx*nx), w(nx*nx), one, h2
parameter (one = (1.0E+0, 0.0E+0) )
external caxpy
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
c | -I T|
c
c derived from the standard central difference discretization
c of the 2-dimensional convection-diffusion operator
c derived from the standard central difference discretization
c of the 2-dimensional convection-diffusion operator
c (Laplacian u) + rho*(du/dx)
c on the unit squqre with zero boundary condition.
c
@@ -503,7 +503,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call caxpy(nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
call caxpy(nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -514,29 +514,29 @@ c
c=========================================================================
subroutine tv (nx, x, y)
c
integer nx, j
Complex
integer nx, j
Complex
& x(nx), y(nx), h, h2, dd, dl, du
c
Complex
Complex
& one, rho
parameter (one = (1.0E+0, 0.0E+0) ,
parameter (one = (1.0E+0, 0.0E+0) ,
& rho = (1.0E+2, 0.0E+0) )
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal
c
c
h = one / cmplx(nx+1)
h2 = h*h
dd = (4.0E+0, 0.0E+0) / h2
dl = -one/h2 - (5.0E-1, 0.0E+0) *rho/h
du = -one/h2 + (5.0E-1, 0.0E+0) *rho/h
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
+41 -41
View File
@@ -45,7 +45,7 @@ c
c\Example-1
c ... Suppose we want to solve A*x = lambda*x in regular mode,
c where A is obtained from the standard central difference
c discretization of the convection-diffusion operator
c discretization of the convection-diffusion operator
c (Laplacian u) + rho*(du / dx)
c on the unit square, with zero Dirichlet boundary condition.
c
@@ -63,7 +63,7 @@ c dlapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
c daxpy Level 1 BLAS that computes y <- alpha*x+y.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c tv Matrix vector multiplication routine that computes T*x,
c tv Matrix vector multiplication routine that computes T*x,
c where T is a tridiagonal matrix. It is used in routine
c av.
c
@@ -117,9 +117,9 @@ c
integer iparam(11), ipntr(14)
logical select(maxncv)
Double precision
& ax(maxn), d(maxncv,3), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& ax(maxn), d(maxncv,3), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& workl(3*maxncv*maxncv+6*maxncv)
c
c %---------------%
@@ -147,7 +147,7 @@ c %-----------------------------%
c
Double precision
& dlapy2, dnrm2
external dlapy2, dnrm2, daxpy
external dlapy2, dnrm2, daxpy
c
c %--------------------%
c | Intrinsic function |
@@ -183,8 +183,8 @@ c %-------------------------------------------------%
c | The following sets dimensions for this problem. |
c %-------------------------------------------------%
c
nx = 10
n = nx*nx
nx = 10
n = nx*nx
c
c %-----------------------------------------------%
c | |
@@ -266,8 +266,8 @@ c | illustrated below. |
c | |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
c
@@ -294,7 +294,7 @@ c
iparam(7) = mode1
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
c | M A I N L O O P (Reverse communication) |
c %-------------------------------------------%
c
10 continue
@@ -306,8 +306,8 @@ c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dnaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
call dnaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
& info )
c
if (ido .eq. -1 .or. ido .eq. 1) then
@@ -319,7 +319,7 @@ c | The user should supply his/her own |
c | matrix vector multiplication routine here |
c | that takes workd(ipntr(1)) as the input |
c | vector, and return the matrix vector |
c | product to workd(ipntr(2)). |
c | product to workd(ipntr(2)). |
c %-------------------------------------------%
c
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
@@ -349,7 +349,7 @@ c
print *, ' Check the documentation of _naupd'
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -369,8 +369,8 @@ c %-------------------------------------------%
c
rvec = .true.
c
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
call dneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, ierr )
c
@@ -472,11 +472,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NSIMP '
@@ -487,8 +487,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -504,37 +504,37 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector subroutine
c
c The matrix used is the 2 dimensional convection-diffusion
c The matrix used is the 2 dimensional convection-diffusion
c operator discretized using central difference.
c
subroutine av (nx, v, w)
integer nx, j, lo
Double precision
Double precision
& v(nx*nx), w(nx*nx), one, h2
parameter (one = 1.0D+0)
external daxpy, tv
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
c | -I T|
c
c derived from the standard central difference discretization
c of the 2 dimensional convection-diffusion operator
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
c derived from the standard central difference discretization
c of the 2 dimensional convection-diffusion operator
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
c condition.
c
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has complex
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has complex
c eigenvalues.
c
c The subroutine TV is called to computed y<---T*x.
@@ -550,7 +550,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call daxpy(nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
call daxpy(nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -561,7 +561,7 @@ c
c=========================================================================
subroutine tv (nx, x, y)
c
integer nx, j
integer nx, j
Double precision
& x(nx), y(nx), h, dd, dl, du, h2
c
@@ -570,23 +570,23 @@ c
parameter (one = 1.0D+0, rho = 1.0D+2)
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal.
c
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has complex
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has complex
c eigenvalues.
c
h = one / dble(nx+1)
h2 = h*h
dd = 4.0D+0 / h2
dd = 4.0D+0 / h2
dl = -one/h2 - 5.0D-1*rho/h
du = -one/h2 + 5.0D-1*rho/h
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
+62 -62
View File
@@ -1,26 +1,26 @@
program dssimp
c
c This example program is intended to illustrate the
c simplest case of using ARPACK in considerable detail.
c This example program is intended to illustrate the
c simplest case of using ARPACK in considerable detail.
c This code may be used to understand basic usage of ARPACK
c and as a template for creating an interface to ARPACK.
c
c This code shows how to use ARPACK to find a few eigenvalues
c (lambda) and corresponding eigenvectors (x) for the standard
c and as a template for creating an interface to ARPACK.
c
c This code shows how to use ARPACK to find a few eigenvalues
c (lambda) and corresponding eigenvectors (x) for the standard
c eigenvalue problem:
c
c
c A*x = lambda*x
c
c
c where A is an n by n real symmetric matrix.
c
c The main points illustrated here are
c The main points illustrated here are
c
c 1) How to declare sufficient memory to find NEV
c 1) How to declare sufficient memory to find NEV
c eigenvalues of largest magnitude. Other options
c are available.
c
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine DSAUPD
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine DSAUPD
c that computes the quantities needed to construct
c the desired eigenvalues and eigenvectors(if requested).
c
@@ -28,8 +28,8 @@ c 3) How to extract the desired eigenvalues and eigenvectors
c using the ARPACK routine DSEUPD.
c
c The only thing that must be supplied in order to use this
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH eigenvalues you want to compute
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH eigenvalues you want to compute
c and to supply a matrix-vector product
c
c w <- Av
@@ -39,7 +39,7 @@ c
c Once usage of this routine is understood, you may wish to explore
c the other available options to improve convergence, to solve generalized
c problems, etc. Look at the file ex-sym.doc in DOCUMENTS directory.
c This codes implements
c This codes implements
c
c\Example-1
c ... Suppose we want to solve A*x = lambda*x in regular mode,
@@ -101,7 +101,7 @@ c | MAXNCV: Maximum NCV allowed. |
c %------------------------------------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
$ ldv=maxn )
c
c %--------------%
@@ -123,7 +123,7 @@ c
integer ido, n, nev, ncv, lworkl, info, ierr,
& j, nx, ishfts, maxitr, mode1, nconv
logical rvec
Double precision
Double precision
& tol, sigma
c
c %------------%
@@ -133,12 +133,12 @@ c
Double precision
& zero
parameter (zero = 0.0D+0)
c
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
Double precision
& dnrm2
external dnrm2, daxpy
c
@@ -166,13 +166,13 @@ c
ndigit = -3
logfil = 6
msgets = 0
msaitr = 0
msaitr = 0
msapps = 0
msaupd = 1
msaup2 = 0
mseigt = 0
mseupd = 0
c
c
c %-------------------------------------------------%
c | The following sets dimensions for this problem. |
c %-------------------------------------------------%
@@ -181,12 +181,12 @@ c
n = nx*nx
c
c %-----------------------------------------------%
c | |
c | Specifications for ARPACK usage are set |
c | |
c | Specifications for ARPACK usage are set |
c | below: |
c | |
c | 1) NEV = 4 asks for 4 eigenvalues to be |
c | computed. |
c | 1) NEV = 4 asks for 4 eigenvalues to be |
c | computed. |
c | |
c | 2) NCV = 20 sets the length of the Arnoldi |
c | factorization |
@@ -198,7 +198,7 @@ c | 4) Ask for the NEV eigenvalues of |
c | largest magnitude |
c | (indicated by which = 'LM') |
c | See documentation in DSAUPD for the |
c | other options SM, LA, SA, LI, SI. |
c | other options SM, LA, SA, LI, SI. |
c | |
c | Note: NEV and NCV must satisfy the following |
c | conditions: |
@@ -207,7 +207,7 @@ c | NEV + 1 <= NCV <= MAXNCV |
c %-----------------------------------------------%
c
nev = 4
ncv = 20
ncv = 20
bmat = 'I'
which = 'LM'
c
@@ -241,26 +241,26 @@ c | used to specify actions to be taken on return |
c | from DSAUPD. (See usage below.) |
c | |
c | It MUST initially be set to 0 before the first |
c | call to DSAUPD. |
c | call to DSAUPD. |
c | |
c | INFO on entry specifies starting vector information |
c | and on return indicates error codes |
c | |
c | Initially, setting INFO=0 indicates that a |
c | Initially, setting INFO=0 indicates that a |
c | random starting vector is requested to |
c | start the ARNOLDI iteration. Setting INFO to |
c | a nonzero value on the initial call is used |
c | if you want to specify your own starting |
c | vector (This vector must be placed in RESID.) |
c | vector (This vector must be placed in RESID.) |
c | |
c | The work array WORKL is used in DSAUPD as |
c | The work array WORKL is used in DSAUPD as |
c | workspace. Its dimension LWORKL is set as |
c | illustrated below. |
c | |
c %-----------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
info = 0
ido = 0
c
@@ -277,13 +277,13 @@ c | DSAUPD. |
c %---------------------------------------------------%
c
ishfts = 1
maxitr = 300
maxitr = 300
mode1 = 1
c
iparam(1) = ishfts
c
c
iparam(3) = maxitr
c
c
iparam(7) = mode1
c
c %------------------------------------------------%
@@ -293,13 +293,13 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine DSAUPD and take |
c | Repeatedly call the routine DSAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dsaupd ( ido, bmat, n, which, nev, tol, resid,
call dsaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, info )
c
@@ -323,7 +323,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %----------------------------------------%
c | Either we have convergence or there is |
@@ -342,16 +342,16 @@ c
print *, ' Check documentation in _saupd '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using DSEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may be also computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c | |
c | The routine DSEUPD now called to do this |
c | post processing (Other modes may require |
@@ -359,11 +359,11 @@ c | more complicated post processing than |
c | mode1.) |
c | |
c %-------------------------------------------%
c
c
rvec = .true.
c
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
c %----------------------------------------------%
@@ -431,11 +431,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _SSIMP '
@@ -446,8 +446,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -463,17 +463,17 @@ c
9000 continue
c
end
c
c
c ------------------------------------------------------------------
c matrix vector subroutine
c
c The matrix used is the 2 dimensional discrete Laplacian on unit
c square with zero Dirichlet boundary condition.
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
@@ -485,7 +485,7 @@ c
integer nx, j, lo, n2
Double precision
& v(nx*nx), w(nx*nx), one, h2
parameter ( one = 1.0D+0 )
parameter ( one = 1.0D+0 )
c
call tv(nx,v(1),w(1))
call daxpy(nx, -one, v(nx+1), 1, w(1), 1)
@@ -495,7 +495,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call daxpy(nx, -one, v(lo-nx+1), 1, w(lo+1), 1)
call daxpy(nx, -one, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -512,7 +512,7 @@ c
c-------------------------------------------------------------------
subroutine tv (nx, x, y)
c
integer nx, j
integer nx, j
Double precision
& x(nx), y(nx), dd, dl, du
c
@@ -521,19 +521,19 @@ c
parameter (one = 1.0D+0, four = 4.0D+0)
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal.
c
c
dd = four
dl = -one
c
dd = four
dl = -one
du = -one
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
-27
View File
@@ -1,27 +0,0 @@
#
# makefile to run simple examples of the reverse communication
# protocol.
#
# Modify if ARPACK library was built somewhere else.
#
#\SCCS Information: @(#)
# FILE: makefile SID: 2.2 DATE OF SID: 9/24/96 RELEASE: 2
#
include ../../ARmake.inc
#
# simple drivers
#
simple: sssimp dssimp snsimp dnsimp cnsimp znsimp
#
sssimp: sssimp.o
$(FC) $(FFLAGS) sssimp.o $(ALIBS) -o sssimp
dssimp: dssimp.o
$(FC) $(FFLAGS) dssimp.o $(ALIBS) -o dssimp
snsimp: snsimp.o
$(FC) $(FFLAGS) snsimp.o $(ALIBS) -o snsimp
dnsimp: dnsimp.o
$(FC) $(FFLAGS) dnsimp.o $(ALIBS) -o dnsimp
cnsimp: cnsimp.o
$(FC) $(FFLAGS) cnsimp.o $(ALIBS) -o cnsimp
znsimp: znsimp.o
$(FC) $(FFLAGS) znsimp.o $(ALIBS) -o znsimp
+41 -41
View File
@@ -45,7 +45,7 @@ c
c\Example-1
c ... Suppose we want to solve A*x = lambda*x in regular mode,
c where A is obtained from the standard central difference
c discretization of the convection-diffusion operator
c discretization of the convection-diffusion operator
c (Laplacian u) + rho*(du / dx)
c on the unit square, with zero Dirichlet boundary condition.
c
@@ -63,7 +63,7 @@ c slapy2 LAPACK routine to compute sqrt(x**2+y**2) carefully.
c saxpy Level 1 BLAS that computes y <- alpha*x+y.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c tv Matrix vector multiplication routine that computes T*x,
c tv Matrix vector multiplication routine that computes T*x,
c where T is a tridiagonal matrix. It is used in routine
c av.
c
@@ -117,9 +117,9 @@ c
integer iparam(11), ipntr(14)
logical select(maxncv)
Real
& ax(maxn), d(maxncv,3), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& ax(maxn), d(maxncv,3), resid(maxn),
& v(ldv,maxncv), workd(3*maxn),
& workev(3*maxncv),
& workl(3*maxncv*maxncv+6*maxncv)
c
c %---------------%
@@ -147,7 +147,7 @@ c %-----------------------------%
c
Real
& slapy2, snrm2
external slapy2, snrm2, saxpy
external slapy2, snrm2, saxpy
c
c %--------------------%
c | Intrinsic function |
@@ -183,8 +183,8 @@ c %-------------------------------------------------%
c | The following sets dimensions for this problem. |
c %-------------------------------------------------%
c
nx = 10
n = nx*nx
nx = 10
n = nx*nx
c
c %-----------------------------------------------%
c | |
@@ -266,8 +266,8 @@ c | illustrated below. |
c | |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+6*ncv
tol = zero
lworkl = 3*ncv**2+6*ncv
tol = zero
ido = 0
info = 0
c
@@ -294,7 +294,7 @@ c
iparam(7) = mode1
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
c | M A I N L O O P (Reverse communication) |
c %-------------------------------------------%
c
10 continue
@@ -306,8 +306,8 @@ c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call snaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
call snaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
& info )
c
if (ido .eq. -1 .or. ido .eq. 1) then
@@ -319,7 +319,7 @@ c | The user should supply his/her own |
c | matrix vector multiplication routine here |
c | that takes workd(ipntr(1)) as the input |
c | vector, and return the matrix vector |
c | product to workd(ipntr(2)). |
c | product to workd(ipntr(2)). |
c %-------------------------------------------%
c
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
@@ -349,7 +349,7 @@ c
print *, ' Check the documentation of _naupd'
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -369,8 +369,8 @@ c %-------------------------------------------%
c
rvec = .true.
c
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
call sneupd ( rvec, 'A', select, d, d(1,2), v, ldv,
& sigmar, sigmai, workev, bmat, n, which, nev, tol,
& resid, ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, ierr )
c
@@ -472,11 +472,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _NSIMP '
@@ -487,8 +487,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -504,37 +504,37 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector subroutine
c
c The matrix used is the 2 dimensional convection-diffusion
c The matrix used is the 2 dimensional convection-diffusion
c operator discretized using central difference.
c
subroutine av (nx, v, w)
integer nx, j, lo
Real
Real
& v(nx*nx), w(nx*nx), one, h2
parameter (one = 1.0E+0)
external saxpy, tv
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
c | -I T|
c
c derived from the standard central difference discretization
c of the 2 dimensional convection-diffusion operator
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
c derived from the standard central difference discretization
c of the 2 dimensional convection-diffusion operator
c (Laplacian u) + rho*(du/dx) on a unit square with zero boundary
c condition.
c
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has complex
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has complex
c eigenvalues.
c
c The subroutine TV is called to computed y<---T*x.
@@ -550,7 +550,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call saxpy(nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
call saxpy(nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -561,7 +561,7 @@ c
c=========================================================================
subroutine tv (nx, x, y)
c
integer nx, j
integer nx, j
Real
& x(nx), y(nx), h, dd, dl, du, h2
c
@@ -570,23 +570,23 @@ c
parameter (one = 1.0E+0, rho = 1.0E+2)
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal.
c
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has complex
c When rho*h/2 <= 1, the discrete convection-diffusion operator
c has real eigenvalues. When rho*h/2 > 1, it has complex
c eigenvalues.
c
h = one / real(nx+1)
h2 = h*h
dd = 4.0E+0 / h2
dd = 4.0E+0 / h2
dl = -one/h2 - 5.0E-1*rho/h
du = -one/h2 + 5.0E-1*rho/h
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
+62 -62
View File
@@ -1,26 +1,26 @@
program sssimp
c
c This example program is intended to illustrate the
c simplest case of using ARPACK in considerable detail.
c This example program is intended to illustrate the
c simplest case of using ARPACK in considerable detail.
c This code may be used to understand basic usage of ARPACK
c and as a template for creating an interface to ARPACK.
c
c This code shows how to use ARPACK to find a few eigenvalues
c (lambda) and corresponding eigenvectors (x) for the standard
c and as a template for creating an interface to ARPACK.
c
c This code shows how to use ARPACK to find a few eigenvalues
c (lambda) and corresponding eigenvectors (x) for the standard
c eigenvalue problem:
c
c
c A*x = lambda*x
c
c
c where A is an n by n real symmetric matrix.
c
c The main points illustrated here are
c The main points illustrated here are
c
c 1) How to declare sufficient memory to find NEV
c 1) How to declare sufficient memory to find NEV
c eigenvalues of largest magnitude. Other options
c are available.
c
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine SSAUPD
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine SSAUPD
c that computes the quantities needed to construct
c the desired eigenvalues and eigenvectors(if requested).
c
@@ -28,8 +28,8 @@ c 3) How to extract the desired eigenvalues and eigenvectors
c using the ARPACK routine SSEUPD.
c
c The only thing that must be supplied in order to use this
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH eigenvalues you want to compute
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH eigenvalues you want to compute
c and to supply a matrix-vector product
c
c w <- Av
@@ -39,7 +39,7 @@ c
c Once usage of this routine is understood, you may wish to explore
c the other available options to improve convergence, to solve generalized
c problems, etc. Look at the file ex-sym.doc in DOCUMENTS directory.
c This codes implements
c This codes implements
c
c\Example-1
c ... Suppose we want to solve A*x = lambda*x in regular mode,
@@ -101,7 +101,7 @@ c | MAXNCV: Maximum NCV allowed. |
c %------------------------------------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
$ ldv=maxn )
c
c %--------------%
@@ -123,7 +123,7 @@ c
integer ido, n, nev, ncv, lworkl, info, ierr,
& j, nx, ishfts, maxitr, mode1, nconv
logical rvec
Real
Real
& tol, sigma
c
c %------------%
@@ -133,12 +133,12 @@ c
Real
& zero
parameter (zero = 0.0E+0)
c
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& snrm2
external snrm2, saxpy
c
@@ -166,13 +166,13 @@ c
ndigit = -3
logfil = 6
msgets = 0
msaitr = 0
msaitr = 0
msapps = 0
msaupd = 1
msaup2 = 0
mseigt = 0
mseupd = 0
c
c
c %-------------------------------------------------%
c | The following sets dimensions for this problem. |
c %-------------------------------------------------%
@@ -181,12 +181,12 @@ c
n = nx*nx
c
c %-----------------------------------------------%
c | |
c | Specifications for ARPACK usage are set |
c | |
c | Specifications for ARPACK usage are set |
c | below: |
c | |
c | 1) NEV = 4 asks for 4 eigenvalues to be |
c | computed. |
c | 1) NEV = 4 asks for 4 eigenvalues to be |
c | computed. |
c | |
c | 2) NCV = 20 sets the length of the Arnoldi |
c | factorization |
@@ -198,7 +198,7 @@ c | 4) Ask for the NEV eigenvalues of |
c | largest magnitude |
c | (indicated by which = 'LM') |
c | See documentation in SSAUPD for the |
c | other options SM, LA, SA, LI, SI. |
c | other options SM, LA, SA, LI, SI. |
c | |
c | Note: NEV and NCV must satisfy the following |
c | conditions: |
@@ -207,7 +207,7 @@ c | NEV + 1 <= NCV <= MAXNCV |
c %-----------------------------------------------%
c
nev = 4
ncv = 20
ncv = 20
bmat = 'I'
which = 'LM'
c
@@ -241,26 +241,26 @@ c | used to specify actions to be taken on return |
c | from SSAUPD. (See usage below.) |
c | |
c | It MUST initially be set to 0 before the first |
c | call to SSAUPD. |
c | call to SSAUPD. |
c | |
c | INFO on entry specifies starting vector information |
c | and on return indicates error codes |
c | |
c | Initially, setting INFO=0 indicates that a |
c | Initially, setting INFO=0 indicates that a |
c | random starting vector is requested to |
c | start the ARNOLDI iteration. Setting INFO to |
c | a nonzero value on the initial call is used |
c | if you want to specify your own starting |
c | vector (This vector must be placed in RESID.) |
c | vector (This vector must be placed in RESID.) |
c | |
c | The work array WORKL is used in SSAUPD as |
c | The work array WORKL is used in SSAUPD as |
c | workspace. Its dimension LWORKL is set as |
c | illustrated below. |
c | |
c %-----------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
info = 0
ido = 0
c
@@ -277,13 +277,13 @@ c | SSAUPD. |
c %---------------------------------------------------%
c
ishfts = 1
maxitr = 300
maxitr = 300
mode1 = 1
c
iparam(1) = ishfts
c
c
iparam(3) = maxitr
c
c
iparam(7) = mode1
c
c %------------------------------------------------%
@@ -293,13 +293,13 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine SSAUPD and take |
c | Repeatedly call the routine SSAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call ssaupd ( ido, bmat, n, which, nev, tol, resid,
call ssaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, info )
c
@@ -323,7 +323,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %----------------------------------------%
c | Either we have convergence or there is |
@@ -342,16 +342,16 @@ c
print *, ' Check documentation in _saupd '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using SSEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may be also computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c | |
c | The routine SSEUPD now called to do this |
c | post processing (Other modes may require |
@@ -359,11 +359,11 @@ c | more complicated post processing than |
c | mode1.) |
c | |
c %-------------------------------------------%
c
c
rvec = .true.
c
call sseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call sseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
c %----------------------------------------------%
@@ -431,11 +431,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _SSIMP '
@@ -446,8 +446,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -463,17 +463,17 @@ c
9000 continue
c
end
c
c
c ------------------------------------------------------------------
c matrix vector subroutine
c
c The matrix used is the 2 dimensional discrete Laplacian on unit
c square with zero Dirichlet boundary condition.
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
@@ -485,7 +485,7 @@ c
integer nx, j, lo, n2
Real
& v(nx*nx), w(nx*nx), one, h2
parameter ( one = 1.0E+0 )
parameter ( one = 1.0E+0 )
c
call tv(nx,v(1),w(1))
call saxpy(nx, -one, v(nx+1), 1, w(1), 1)
@@ -495,7 +495,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call saxpy(nx, -one, v(lo-nx+1), 1, w(lo+1), 1)
call saxpy(nx, -one, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -512,7 +512,7 @@ c
c-------------------------------------------------------------------
subroutine tv (nx, x, y)
c
integer nx, j
integer nx, j
Real
& x(nx), y(nx), dd, dl, du
c
@@ -521,19 +521,19 @@ c
parameter (one = 1.0E+0, four = 4.0E+0)
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal.
c
c
dd = four
dl = -one
c
dd = four
dl = -one
du = -one
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
+80 -80
View File
@@ -1,26 +1,26 @@
program znsimp
program znsimp
c
c This example program is intended to illustrate the
c simplest case of using ARPACK in considerable detail.
c This example program is intended to illustrate the
c simplest case of using ARPACK in considerable detail.
c This code may be used to understand basic usage of ARPACK
c and as a template for creating an interface to ARPACK.
c
c This code shows how to use ARPACK to find a few eigenvalues
c (lambda) and corresponding eigenvectors (x) for the standard
c and as a template for creating an interface to ARPACK.
c
c This code shows how to use ARPACK to find a few eigenvalues
c (lambda) and corresponding eigenvectors (x) for the standard
c eigenvalue problem:
c
c
c A*x = lambda*x
c
c
c where A is a general n by n complex matrix.
c
c The main points illustrated here are
c The main points illustrated here are
c
c 1) How to declare sufficient memory to find NEV
c 1) How to declare sufficient memory to find NEV
c eigenvalues of largest magnitude. Other options
c are available.
c
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine ZNAUPD
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine ZNAUPD
c that computes the quantities needed to construct
c the desired eigenvalues and eigenvectors(if requested).
c
@@ -28,8 +28,8 @@ c 3) How to extract the desired eigenvalues and eigenvectors
c using the ARPACK routine ZNEUPD .
c
c The only thing that must be supplied in order to use this
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH eigenvalues you want to compute
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH eigenvalues you want to compute
c and to supply a matrix-vector product
c
c w <- Av
@@ -40,7 +40,7 @@ c
c Once usage of this routine is understood, you may wish to explore
c the other available options to improve convergence, to solve generalized
c problems, etc. Look at the file ex-complex.doc in DOCUMENTS directory.
c This codes implements
c This codes implements
c
c
c\Example-1
@@ -65,11 +65,11 @@ c av.
c
c\Author
c Richard Lehoucq
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Danny Sorensen
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
@@ -112,12 +112,12 @@ c %--------------%
c
integer iparam(11), ipntr(14)
logical select(maxncv)
Complex*16
& ax(maxn), d(maxncv),
& v(ldv,maxncv), workd(3*maxn),
& workev(2*maxncv), resid(maxn),
Complex*16
& ax(maxn), d(maxncv),
& v(ldv,maxncv), workd(3*maxn),
& workev(2*maxncv), resid(maxn),
& workl(3*maxncv*maxncv+5*maxncv)
Double precision
Double precision
& rwork(maxncv), rd(maxncv,3)
c
c %---------------%
@@ -127,9 +127,9 @@ c
character bmat*1, which*2
integer ido, n, nx, nev, ncv, lworkl, info, ierr,
& j, ishfts, maxitr, mode1, nconv
Complex*16
Complex*16
& sigma
Double precision
Double precision
& tol
logical rvec
c
@@ -137,9 +137,9 @@ c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dznrm2 , dlapy2
external dznrm2 , zaxpy , dlapy2
Double precision
& dznrm2 , dlapy2
external dznrm2 , zaxpy , dlapy2
c
c %-----------------------%
c | Executable Statements |
@@ -158,7 +158,7 @@ c
include 'debug.h'
ndigit = -3
logfil = 6
mcaitr = 0
mcaitr = 0
mcapps = 0
mcaupd = 1
mcaup2 = 0
@@ -169,16 +169,16 @@ c %-------------------------------------------------%
c | The following sets dimensions for this problem. |
c %-------------------------------------------------%
c
nx = 10
n = nx*nx
nx = 10
n = nx*nx
c
c %-----------------------------------------------%
c | |
c | Specifications for ARPACK usage are set |
c | |
c | Specifications for ARPACK usage are set |
c | below: |
c | |
c | 1) NEV = 4 asks for 4 eigenvalues to be |
c | computed. |
c | 1) NEV = 4 asks for 4 eigenvalues to be |
c | computed. |
c | |
c | 2) NCV = 20 sets the length of the Arnoldi |
c | factorization |
@@ -190,7 +190,7 @@ c | 4) Ask for the NEV eigenvalues of |
c | largest magnitude |
c | (indicated by which = 'LM') |
c | See documentation in ZNAUPD for the |
c | other options SM, LR, SR, LI, SI. |
c | other options SM, LR, SR, LI, SI. |
c | |
c | Note: NEV and NCV must satisfy the following |
c | conditions: |
@@ -200,7 +200,7 @@ c | |
c %-----------------------------------------------%
c
nev = 4
ncv = 20
ncv = 20
bmat = 'I'
which = 'LM'
c
@@ -234,26 +234,26 @@ c | used to specify actions to be taken on return |
c | from ZNAUPD . (see usage below) |
c | |
c | It MUST initially be set to 0 before the first |
c | call to ZNAUPD . |
c | call to ZNAUPD . |
c | |
c | INFO on entry specifies starting vector information |
c | and on return indicates error codes |
c | |
c | Initially, setting INFO=0 indicates that a |
c | Initially, setting INFO=0 indicates that a |
c | random starting vector is requested to |
c | start the ARNOLDI iteration. Setting INFO to |
c | a nonzero value on the initial call is used |
c | if you want to specify your own starting |
c | vector (This vector must be placed in RESID). |
c | vector (This vector must be placed in RESID). |
c | |
c | The work array WORKL is used in ZNAUPD as |
c | The work array WORKL is used in ZNAUPD as |
c | workspace. Its dimension LWORKL is set as |
c | illustrated below. |
c | |
c %-----------------------------------------------------%
c
lworkl = 3*ncv**2+5*ncv
tol = 0.0
lworkl = 3*ncv**2+5*ncv
tol = 0.0
ido = 0
info = 0
c
@@ -274,19 +274,19 @@ c
mode1 = 1
c
iparam(1) = ishfts
c
c
iparam(3) = maxitr
c
c
iparam(7) = mode1
c
c %------------------------------------------------%
c | M A I N L O O P (Reverse Communication Loop) |
c | M A I N L O O P (Reverse Communication Loop) |
c %------------------------------------------------%
c
10 continue
c
c
c %---------------------------------------------%
c | Repeatedly call the routine ZNAUPD and take |
c | Repeatedly call the routine ZNAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
@@ -308,11 +308,11 @@ c | matrix vector multiplication routine here |
c | that takes workd(ipntr(1)) as the input |
c | vector x , and returns the resulting |
c | matrix-vector product y = A*x in the |
c | array workd(ipntr(2)). |
c | array workd(ipntr(2)). |
c %-------------------------------------------%
c
call av (nx, workd(ipntr(1)), workd(ipntr(2)))
c
c
c %-----------------------------------------%
c | L O O P B A C K to call ZNAUPD again. |
c %-----------------------------------------%
@@ -320,7 +320,7 @@ c
go to 10
c
endif
c
c
c %----------------------------------------%
c | Either we have convergence or there is |
c | an error. |
@@ -338,16 +338,16 @@ c
print *, ' Check the documentation of _naupd'
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using ZNEUPD . |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may be also computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c | |
c | The routine ZNEUPD now called to do this |
c | post processing (Other modes may require |
@@ -355,7 +355,7 @@ c | more complicated post processing than |
c | mode1.) |
c | |
c %-------------------------------------------%
c
c
rvec = .true.
c
call zneupd (rvec, 'A', select, D, V, ldv, sigma,
@@ -429,11 +429,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, '_NSIMP '
@@ -444,8 +444,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -461,7 +461,7 @@ c
9000 continue
c
end
c
c
c==========================================================================
c
c matrix vector subroutine
@@ -471,22 +471,22 @@ c discretized using centered difference.
c
subroutine av (nx, v, w)
integer nx, j, lo
Complex*16
Complex*16
& v(nx*nx), w(nx*nx), one, h2
parameter (one = (1.0D+0, 0.0D+0) )
external zaxpy
external zaxpy
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
c | -I T|
c
c derived from the standard central difference discretization
c of the 2-dimensional convection-diffusion operator
c derived from the standard central difference discretization
c of the 2-dimensional convection-diffusion operator
c (Laplacian u) + rho*(du/dx)
c on the unit squqre with zero boundary condition.
c
@@ -503,7 +503,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call zaxpy (nx, -one/h2, v(lo-nx+1), 1, w(lo+1), 1)
call zaxpy (nx, -one/h2, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -514,29 +514,29 @@ c
c=========================================================================
subroutine tv (nx, x, y)
c
integer nx, j
Complex*16
integer nx, j
Complex*16
& x(nx), y(nx), h, h2, dd, dl, du
c
Complex*16
Complex*16
& one, rho
parameter (one = (1.0D+0, 0.0D+0) ,
parameter (one = (1.0D+0, 0.0D+0) ,
& rho = (1.0D+2, 0.0D+0) )
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal
c
c
h = one / dcmplx (nx+1)
h2 = h*h
dd = (4.0D+0, 0.0D+0) / h2
dl = -one/h2 - (5.0D-1, 0.0D+0) *rho/h
du = -one/h2 + (5.0D-1, 0.0D+0) *rho/h
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
+11
View File
@@ -0,0 +1,11 @@
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
SVD = ssvd dsvd
check_PROGRAMS = $(SVD)
TESTS = $(check_PROGRAMS)
EXTRA_DIST = README debug.h
ssvd_SOURCES = ssvd.f
dsvd_SOURCES = dsvd.f
+64 -64
View File
@@ -1,14 +1,14 @@
program dsvd
c
c This example program is intended to illustrate the
c This example program is intended to illustrate the
c the use of ARPACK to compute the Singular Value Decomposition.
c
c
c This code shows how to use ARPACK to find a few of the
c largest singular values(sigma) and corresponding right singular
c largest singular values(sigma) and corresponding right singular
c vectors (v) for the the matrix A by solving the symmetric problem:
c
c
c (A'*A)*v = sigma*v
c
c
c where A is an m by n real matrix.
c
c This code may be easily modified to estimate the 2-norm
@@ -21,20 +21,20 @@ c
c This formulation is appropriate when m .ge. n.
c Reverse the roles of A and A' in the case that m .le. n.
c
c The main points illustrated here are
c The main points illustrated here are
c
c 1) How to declare sufficient memory to find NEV
c largest singular values of A .
c 1) How to declare sufficient memory to find NEV
c largest singular values of A .
c
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine DSAUPD
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine DSAUPD
c that computes the quantities needed to construct
c the desired singular values and vectors(if requested).
c
c 3) How to extract the desired singular values and vectors
c using the ARPACK routine DSEUPD.
c
c 4) How to construct the left singular vectors U from the
c 4) How to construct the left singular vectors U from the
c right singular vectors V to obtain the decomposition
c
c A*V = U*S
@@ -42,14 +42,14 @@ c
c where S = diag(sigma_1, sigma_2, ..., sigma_k).
c
c The only thing that must be supplied in order to use this
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH singular values you want to
c compute and to supply a the matrix-vector products
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH singular values you want to
c compute and to supply a the matrix-vector products
c
c w <- Ax
c y <- A'w
c
c in place of the calls to AV( ) and ATV( ) respectively below.
c in place of the calls to AV( ) and ATV( ) respectively below.
c
c Further documentation is available in the header of DSAUPD
c which may be found in the SRC directory.
@@ -58,11 +58,11 @@ c This codes implements
c
c\Example-1
c ... Suppose we want to solve A'A*v = sigma*v in regular mode,
c where A is derived from the simplest finite difference
c where A is derived from the simplest finite difference
c discretization of the 2-dimensional kernel K(s,t)dt where
c
c K(s,t) = s(t-1) if 0 .le. s .le. t .le. 1,
c t(s-1) if 0 .le. t .lt. s .le. 1.
c t(s-1) if 0 .le. t .lt. s .le. 1.
c
c See subroutines AV and ATV for details.
c ... OP = A'*A and B = I.
@@ -133,7 +133,7 @@ c | MAXNCV: Maximum NCV allowed |
c %------------------------------------------------------%
c
integer maxm, maxn, maxnev, maxncv, ldv, ldu
parameter (maxm = 500, maxn=250, maxnev=10, maxncv=25,
parameter (maxm = 500, maxn=250, maxnev=10, maxncv=25,
& ldu = maxm, ldv=maxn )
c
c %--------------%
@@ -141,8 +141,8 @@ c | Local Arrays |
c %--------------%
c
Double precision
& v(ldv,maxncv), u(ldu, maxnev),
& workl(maxncv*(maxncv+8)), workd(3*maxn),
& v(ldv,maxncv), u(ldu, maxnev),
& workl(maxncv*(maxncv+8)), workd(3*maxn),
& s(maxncv,2), resid(maxn), ax(maxm)
logical select(maxncv)
integer iparam(11), ipntr(11)
@@ -155,7 +155,7 @@ c
integer ido, m, n, nev, ncv, lworkl, info, ierr,
& j, ishfts, maxitr, mode1, nconv
logical rvec
Double precision
Double precision
& tol, sigma, temp
c
c %------------%
@@ -165,12 +165,12 @@ c
Double precision
& one, zero
parameter (one = 1.0D+0, zero = 0.0D+0)
c
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
Double precision
& dnrm2
external dnrm2, daxpy, dcopy, dscal
c
@@ -192,7 +192,7 @@ c
ndigit = -3
logfil = 6
msgets = 0
msaitr = 0
msaitr = 0
msapps = 0
msaupd = 1
msaup2 = 0
@@ -207,11 +207,11 @@ c
n = 100
c
c %------------------------------------------------%
c | Specifications for ARPACK usage are set |
c | Specifications for ARPACK usage are set |
c | below: |
c | |
c | 1) NEV = 4 asks for 4 singular values to be |
c | computed. |
c | 1) NEV = 4 asks for 4 singular values to be |
c | computed. |
c | |
c | 2) NCV = 20 sets the length of the Arnoldi |
c | factorization |
@@ -223,7 +223,7 @@ c | 4) Ask for the NEV singular values of |
c | largest magnitude |
c | (indicated by which = 'LM') |
c | See documentation in DSAUPD for the |
c | other options SM, BE. |
c | other options SM, BE. |
c | |
c | Note: NEV and NCV must satisfy the following |
c | conditions: |
@@ -232,7 +232,7 @@ c | NEV + 1 <= NCV <= MAXNCV |
c %------------------------------------------------%
c
nev = 4
ncv = 10
ncv = 10
bmat = 'I'
which = 'LM'
c
@@ -265,25 +265,25 @@ c | used to specify actions to be taken on return |
c | from DSAUPD. (See usage below.) |
c | |
c | It MUST initially be set to 0 before the first |
c | call to DSAUPD. |
c | call to DSAUPD. |
c | |
c | INFO on entry specifies starting vector information |
c | and on return indicates error codes |
c | |
c | Initially, setting INFO=0 indicates that a |
c | Initially, setting INFO=0 indicates that a |
c | random starting vector is requested to |
c | start the ARNOLDI iteration. Setting INFO to |
c | a nonzero value on the initial call is used |
c | if you want to specify your own starting |
c | vector (This vector must be placed in RESID.) |
c | vector (This vector must be placed in RESID.) |
c | |
c | The work array WORKL is used in DSAUPD as |
c | The work array WORKL is used in DSAUPD as |
c | workspace. Its dimension LWORKL is set as |
c | illustrated below. |
c %-----------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
info = 0
ido = 0
c
@@ -304,9 +304,9 @@ c
mode1 = 1
c
iparam(1) = ishfts
c
c
iparam(3) = maxitr
c
c
iparam(7) = mode1
c
c %------------------------------------------------%
@@ -316,13 +316,13 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine DSAUPD and take |
c | Repeatedly call the routine DSAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dsaupd ( ido, bmat, n, which, nev, tol, resid,
call dsaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, info )
c
@@ -339,7 +339,7 @@ c | the input, and returns the result in |
c | workd(ipntr(2)). |
c %---------------------------------------%
c
call av (m, n, workd(ipntr(1)), ax)
call av (m, n, workd(ipntr(1)), ax)
call atv (m, n, ax, workd(ipntr(2)))
c
c %-----------------------------------------%
@@ -348,7 +348,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %----------------------------------------%
c | Either we have convergence or there is |
@@ -367,31 +367,31 @@ c
print *, ' Check documentation in _saupd '
print *, ' '
c
else
else
c
c %--------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using DSEUPD. |
c | |
c | Computed singular values may be extracted. |
c | Computed singular values may be extracted. |
c | |
c | Singular vectors may also be computed now |
c | if desired. (indicated by rvec = .true.) |
c | if desired. (indicated by rvec = .true.) |
c | |
c | The routine DSEUPD now called to do this |
c | post processing |
c | post processing |
c %--------------------------------------------%
c
c
rvec = .true.
c
call dseupd ( rvec, 'All', select, s, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call dseupd ( rvec, 'All', select, s, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
c %-----------------------------------------------%
c | Singular values are returned in the first |
c | column of the two dimensional array S |
c | and the corresponding right singular vectors |
c | and the corresponding right singular vectors |
c | are returned in the first NEV columns of the |
c | two dimensional array V as requested here. |
c %-----------------------------------------------%
@@ -468,11 +468,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _SVD '
@@ -483,8 +483,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -500,16 +500,16 @@ c
9000 continue
c
end
c
c
c ------------------------------------------------------------------
c matrix vector subroutines
c
c The matrix A is derived from the simplest finite difference
c discretization of the integral operator
c The matrix A is derived from the simplest finite difference
c discretization of the integral operator
c
c f(s) = integral(K(s,t)x(t)dt).
c
c Thus, the matrix A is a discretization of the 2-dimensional kernel
c
c Thus, the matrix A is a discretization of the 2-dimensional kernel
c K(s,t)dt, where
c
c K(s,t) = s(t-1) if 0 .le. s .le. t .le. 1,
@@ -521,7 +521,7 @@ c A(i,j) = k*(si)*(tj - 1) if i .le. j,
c k*(tj)*(si - 1) if i .gt. j
c
c where si = i/(m+1) and tj = j/(n+1) and k = 1/(n+1).
c
c
c-------------------------------------------------------------------
c
subroutine av (m, n, x, w)
@@ -531,7 +531,7 @@ c
integer m, n, i, j
Double precision
& x(n), w(m), one, zero, h, k, s, t
parameter ( one = 1.0D+0, zero = 0.0D+0 )
parameter ( one = 1.0D+0, zero = 0.0D+0 )
c
h = one / dble(m+1)
k = one / dble(n+1)
@@ -539,19 +539,19 @@ c
w(i) = zero
5 continue
t = zero
c
c
do 30 j = 1,n
t = t+k
s = zero
do 10 i = 1,j
s = s+h
w(i) = w(i) + k*s*(t-one)*x(j)
10 continue
10 continue
do 20 i = j+1,m
s = s+h
w(i) = w(i) + k*t*(s-one)*x(j)
w(i) = w(i) + k*t*(s-one)*x(j)
20 continue
30 continue
30 continue
c
return
end
@@ -588,7 +588,7 @@ c
30 continue
c
return
end
end
c
-15
View File
@@ -1,15 +0,0 @@
#
# makefile to run simple examples of the reverse communication
# protocol.
#
# Modify if ARPACK library was built somewhere else.
#
#\SCCS Information: @(#)
# FILE: makefile SID: 2.2 DATE OF SID: 9/24/96 RELEASE: 2
#
include ../../ARmake.inc
ssvd: ssvd.o
$(FC) $(FFLAGS) ssvd.o $(ALIBS) -o ssvd
dsvd: dsvd.o
$(FC) $(FFLAGS) dsvd.o $(ALIBS) -o dsvd
+64 -64
View File
@@ -1,14 +1,14 @@
program ssvd
c
c This example program is intended to illustrate the
c This example program is intended to illustrate the
c the use of ARPACK to compute the Singular Value Decomposition.
c
c
c This code shows how to use ARPACK to find a few of the
c largest singular values(sigma) and corresponding right singular
c largest singular values(sigma) and corresponding right singular
c vectors (v) for the the matrix A by solving the symmetric problem:
c
c
c (A'*A)*v = sigma*v
c
c
c where A is an m by n real matrix.
c
c This code may be easily modified to estimate the 2-norm
@@ -21,20 +21,20 @@ c
c This formulation is appropriate when m .ge. n.
c Reverse the roles of A and A' in the case that m .le. n.
c
c The main points illustrated here are
c The main points illustrated here are
c
c 1) How to declare sufficient memory to find NEV
c largest singular values of A .
c 1) How to declare sufficient memory to find NEV
c largest singular values of A .
c
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine SSAUPD
c 2) Illustration of the reverse communication interface
c needed to utilize the top level ARPACK routine SSAUPD
c that computes the quantities needed to construct
c the desired singular values and vectors(if requested).
c
c 3) How to extract the desired singular values and vectors
c using the ARPACK routine SSEUPD.
c
c 4) How to construct the left singular vectors U from the
c 4) How to construct the left singular vectors U from the
c right singular vectors V to obtain the decomposition
c
c A*V = U*S
@@ -42,14 +42,14 @@ c
c where S = diag(sigma_1, sigma_2, ..., sigma_k).
c
c The only thing that must be supplied in order to use this
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH singular values you want to
c compute and to supply a the matrix-vector products
c routine on your problem is to change the array dimensions
c appropriately, to specify WHICH singular values you want to
c compute and to supply a the matrix-vector products
c
c w <- Ax
c y <- A'w
c
c in place of the calls to AV( ) and ATV( ) respectively below.
c in place of the calls to AV( ) and ATV( ) respectively below.
c
c Further documentation is available in the header of DSAUPD
c which may be found in the SRC directory.
@@ -58,11 +58,11 @@ c This codes implements
c
c\Example-1
c ... Suppose we want to solve A'A*v = sigma*v in regular mode,
c where A is derived from the simplest finite difference
c where A is derived from the simplest finite difference
c discretization of the 2-dimensional kernel K(s,t)dt where
c
c K(s,t) = s(t-1) if 0 .le. s .le. t .le. 1,
c t(s-1) if 0 .le. t .lt. s .le. 1.
c t(s-1) if 0 .le. t .lt. s .le. 1.
c
c See subroutines AV and ATV for details.
c ... OP = A'*A and B = I.
@@ -133,7 +133,7 @@ c | MAXNCV: Maximum NCV allowed |
c %------------------------------------------------------%
c
integer maxm, maxn, maxnev, maxncv, ldv, ldu
parameter (maxm = 500, maxn=250, maxnev=10, maxncv=25,
parameter (maxm = 500, maxn=250, maxnev=10, maxncv=25,
& ldu = maxm, ldv=maxn )
c
c %--------------%
@@ -141,8 +141,8 @@ c | Local Arrays |
c %--------------%
c
Real
& v(ldv,maxncv), u(ldu, maxnev),
& workl(maxncv*(maxncv+8)), workd(3*maxn),
& v(ldv,maxncv), u(ldu, maxnev),
& workl(maxncv*(maxncv+8)), workd(3*maxn),
& s(maxncv,2), resid(maxn), ax(maxm)
logical select(maxncv)
integer iparam(11), ipntr(11)
@@ -155,7 +155,7 @@ c
integer ido, m, n, nev, ncv, lworkl, info, ierr,
& j, ishfts, maxitr, mode1, nconv
logical rvec
Real
Real
& tol, sigma, temp
c
c %------------%
@@ -165,12 +165,12 @@ c
Real
& one, zero
parameter (one = 1.0E+0, zero = 0.0E+0)
c
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& snrm2
external snrm2, saxpy, scopy, sscal
c
@@ -192,7 +192,7 @@ c
ndigit = -3
logfil = 6
msgets = 0
msaitr = 0
msaitr = 0
msapps = 0
msaupd = 1
msaup2 = 0
@@ -207,11 +207,11 @@ c
n = 100
c
c %------------------------------------------------%
c | Specifications for ARPACK usage are set |
c | Specifications for ARPACK usage are set |
c | below: |
c | |
c | 1) NEV = 4 asks for 4 singular values to be |
c | computed. |
c | 1) NEV = 4 asks for 4 singular values to be |
c | computed. |
c | |
c | 2) NCV = 20 sets the length of the Arnoldi |
c | factorization |
@@ -223,7 +223,7 @@ c | 4) Ask for the NEV singular values of |
c | largest magnitude |
c | (indicated by which = 'LM') |
c | See documentation in SSAUPD for the |
c | other options SM, BE. |
c | other options SM, BE. |
c | |
c | Note: NEV and NCV must satisfy the following |
c | conditions: |
@@ -232,7 +232,7 @@ c | NEV + 1 <= NCV <= MAXNCV |
c %------------------------------------------------%
c
nev = 4
ncv = 10
ncv = 10
bmat = 'I'
which = 'LM'
c
@@ -265,25 +265,25 @@ c | used to specify actions to be taken on return |
c | from SSAUPD. (See usage below.) |
c | |
c | It MUST initially be set to 0 before the first |
c | call to SSAUPD. |
c | call to SSAUPD. |
c | |
c | INFO on entry specifies starting vector information |
c | and on return indicates error codes |
c | |
c | Initially, setting INFO=0 indicates that a |
c | Initially, setting INFO=0 indicates that a |
c | random starting vector is requested to |
c | start the ARNOLDI iteration. Setting INFO to |
c | a nonzero value on the initial call is used |
c | if you want to specify your own starting |
c | vector (This vector must be placed in RESID.) |
c | vector (This vector must be placed in RESID.) |
c | |
c | The work array WORKL is used in SSAUPD as |
c | The work array WORKL is used in SSAUPD as |
c | workspace. Its dimension LWORKL is set as |
c | illustrated below. |
c %-----------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
info = 0
ido = 0
c
@@ -304,9 +304,9 @@ c
mode1 = 1
c
iparam(1) = ishfts
c
c
iparam(3) = maxitr
c
c
iparam(7) = mode1
c
c %------------------------------------------------%
@@ -316,13 +316,13 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine SSAUPD and take |
c | Repeatedly call the routine SSAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call ssaupd ( ido, bmat, n, which, nev, tol, resid,
call ssaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, info )
c
@@ -339,7 +339,7 @@ c | the input, and returns the result in |
c | workd(ipntr(2)). |
c %---------------------------------------%
c
call av (m, n, workd(ipntr(1)), ax)
call av (m, n, workd(ipntr(1)), ax)
call atv (m, n, ax, workd(ipntr(2)))
c
c %-----------------------------------------%
@@ -348,7 +348,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %----------------------------------------%
c | Either we have convergence or there is |
@@ -367,31 +367,31 @@ c
print *, ' Check documentation in _saupd '
print *, ' '
c
else
else
c
c %--------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using SSEUPD. |
c | |
c | Computed singular values may be extracted. |
c | Computed singular values may be extracted. |
c | |
c | Singular vectors may also be computed now |
c | if desired. (indicated by rvec = .true.) |
c | if desired. (indicated by rvec = .true.) |
c | |
c | The routine SSEUPD now called to do this |
c | post processing |
c | post processing |
c %--------------------------------------------%
c
c
rvec = .true.
c
call sseupd ( rvec, 'All', select, s, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call sseupd ( rvec, 'All', select, s, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
c %-----------------------------------------------%
c | Singular values are returned in the first |
c | column of the two dimensional array S |
c | and the corresponding right singular vectors |
c | and the corresponding right singular vectors |
c | are returned in the first NEV columns of the |
c | two dimensional array V as requested here. |
c %-----------------------------------------------%
@@ -468,11 +468,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _SVD '
@@ -483,8 +483,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -500,16 +500,16 @@ c
9000 continue
c
end
c
c
c ------------------------------------------------------------------
c matrix vector subroutines
c
c The matrix A is derived from the simplest finite difference
c discretization of the integral operator
c The matrix A is derived from the simplest finite difference
c discretization of the integral operator
c
c f(s) = integral(K(s,t)x(t)dt).
c
c Thus, the matrix A is a discretization of the 2-dimensional kernel
c
c Thus, the matrix A is a discretization of the 2-dimensional kernel
c K(s,t)dt, where
c
c K(s,t) = s(t-1) if 0 .le. s .le. t .le. 1,
@@ -521,7 +521,7 @@ c A(i,j) = k*(si)*(tj - 1) if i .le. j,
c k*(tj)*(si - 1) if i .gt. j
c
c where si = i/(m+1) and tj = j/(n+1) and k = 1/(n+1).
c
c
c-------------------------------------------------------------------
c
subroutine av (m, n, x, w)
@@ -531,7 +531,7 @@ c
integer m, n, i, j
Real
& x(n), w(m), one, zero, h, k, s, t
parameter ( one = 1.0E+0, zero = 0.0E+0 )
parameter ( one = 1.0E+0, zero = 0.0E+0 )
c
h = one / real(m+1)
k = one / real(n+1)
@@ -539,19 +539,19 @@ c
w(i) = zero
5 continue
t = zero
c
c
do 30 j = 1,n
t = t+k
s = zero
do 10 i = 1,j
s = s+h
w(i) = w(i) + k*s*(t-one)*x(j)
10 continue
10 continue
do 20 i = j+1,m
s = s+h
w(i) = w(i) + k*t*(s-one)*x(j)
w(i) = w(i) + k*t*(s-one)*x(j)
20 continue
30 continue
30 continue
c
return
end
@@ -588,7 +588,7 @@ c
30 continue
c
return
end
end
c
+26
View File
@@ -0,0 +1,26 @@
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
SSDRV = ssdrv1 ssdrv2 ssdrv3 ssdrv4 ssdrv5 ssdrv6
DSDRV = dsdrv1 dsdrv2 dsdrv3 dsdrv4 dsdrv5 dsdrv6
SYM = $(SSDRV) $(DSDRV)
check_PROGRAMS = $(SYM)
TESTS = $(check_PROGRAMS)
EXTRA_DIST = README
# simple symmetric problem using single precision
ssdrv1_SOURCES = ssdrv1.f
ssdrv2_SOURCES = ssdrv2.f
ssdrv3_SOURCES = ssdrv3.f
ssdrv4_SOURCES = ssdrv4.f
ssdrv5_SOURCES = ssdrv5.f
ssdrv6_SOURCES = ssdrv6.f
# simple symmetric problem using double precision
dsdrv1_SOURCES = dsdrv1.f
dsdrv2_SOURCES = dsdrv2.f
dsdrv3_SOURCES = dsdrv3.f
dsdrv4_SOURCES = dsdrv4.f
dsdrv5_SOURCES = dsdrv5.f
dsdrv6_SOURCES = dsdrv6.f
+44 -44
View File
@@ -1,4 +1,4 @@
program dsdrv1
program dsdrv1
c
c Simple program to illustrate the idea of reverse communication
c in regular mode for a standard symmetric eigenvalue problem.
@@ -26,7 +26,7 @@ c Ritz vectors.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c daxpy Level 1 BLAS that computes y <- alpha*x+y.
c av Matrix vector multiplication routine that computes A*x.
c tv Matrix vector multiplication routine that computes T*x,
c tv Matrix vector multiplication routine that computes T*x,
c where T is a tridiagonal matrix. It is used in routine
c av.
c
@@ -59,7 +59,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
$ ldv=maxn )
c
c %--------------%
@@ -78,10 +78,10 @@ c | Local Scalars |
c %---------------%
c
character bmat*1, which*2
integer ido, n, nev, ncv, lworkl, info, ierr, j,
integer ido, n, nev, ncv, lworkl, info, ierr, j,
& nx, nconv, maxitr, mode, ishfts
logical rvec
Double precision
Double precision
& tol, sigma
c
c %------------%
@@ -91,12 +91,12 @@ c
Double precision
& zero
parameter (zero = 0.0D+0)
c
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
Double precision
& dnrm2
external dnrm2, daxpy
c
@@ -122,15 +122,15 @@ c | modify NEV, NCV, WHICH to solve problems of |
c | different sizes, and to get different parts of the |
c | spectrum. However, The following conditions must |
c | be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SDRV1: N is greater than MAXN '
go to 9000
@@ -157,7 +157,7 @@ c | iteration. |
c %--------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
info = 0
ido = 0
c
@@ -174,10 +174,10 @@ c
ishfts = 1
maxitr = 300
mode = 1
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
@@ -186,13 +186,13 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine DSAUPD and take |
c | Repeatedly call the routine DSAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dsaupd ( ido, bmat, n, which, nev, tol, resid,
call dsaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, info )
c
@@ -216,7 +216,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %----------------------------------------%
c | Either we have convergence or there is |
@@ -235,22 +235,22 @@ c
print *, ' Check documentation in _saupd '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using DSEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
c
rvec = .true.
c
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c %----------------------------------------------%
@@ -318,11 +318,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _SDRV1 '
@@ -333,8 +333,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -350,17 +350,17 @@ c
9000 continue
c
end
c
c
c ------------------------------------------------------------------
c matrix vector subroutine
c
c The matrix used is the 2 dimensional discrete Laplacian on unit
c square with zero Dirichlet boundary condition.
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
@@ -372,7 +372,7 @@ c
integer nx, j, lo, n2
Double precision
& v(nx*nx), w(nx*nx), one, h2
parameter ( one = 1.0D+0 )
parameter ( one = 1.0D+0 )
c
call tv(nx,v(1),w(1))
call daxpy(nx, -one, v(nx+1), 1, w(1), 1)
@@ -382,7 +382,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call daxpy(nx, -one, v(lo-nx+1), 1, w(lo+1), 1)
call daxpy(nx, -one, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -392,14 +392,14 @@ c Scale the vector w by (1/h^2), where h is the mesh size
c
n2 = nx*nx
h2 = one / dble((nx+1)*(nx+1))
call dscal(n2, one/h2, w, 1)
call dscal(n2, one/h2, w, 1)
return
end
c
c-------------------------------------------------------------------
subroutine tv (nx, x, y)
c
integer nx, j
integer nx, j
Double precision
& x(nx), y(nx), dd, dl, du
c
@@ -408,19 +408,19 @@ c
parameter (one = 1.0D+0 )
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal.
c
c
c
dd = 4.0D+0
dl = -one
dl = -one
du = -one
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
+32 -32
View File
@@ -1,9 +1,9 @@
program dsdrv2
program dsdrv2
c
c Program to illustrate the idea of reverse communication
c in shift and invert mode for a standard symmetric eigenvalue
c problem. The following program uses the two LAPACK subroutines
c dgttrf.f and dgttrs.f to factor and solve a tridiagonal system of
c problem. The following program uses the two LAPACK subroutines
c dgttrf.f and dgttrs.f to factor and solve a tridiagonal system of
c equations.
c
c We implement example two of ex-sym.doc in DOCUMENTS directory
@@ -25,7 +25,7 @@ c Ritz vectors.
c dgttrf LAPACK tridiagonal factorization routine.
c dgttrs LAPACK tridiagonal solve routine.
c daxpy daxpy Level 1 BLAS that computes y <- alpha*x+y.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c
c\Author
@@ -56,7 +56,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -65,7 +65,7 @@ c %--------------%
c
Double precision
& v(ldv,maxncv), workl(maxncv*(maxncv+8)),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& ad(maxn), adl(maxn), adu(maxn), adu2(maxn),
& ax(maxn)
logical select(maxncv)
@@ -86,9 +86,9 @@ c %------------%
c | Parameters |
c %------------%
c
Double precision
& zero, one, two
parameter (zero = 0.0D+0, one = 1.0D+0,
Double precision
& zero, one, two
parameter (zero = 0.0D+0, one = 1.0D+0,
& two = 2.0D+0)
c
c %-----------------------------%
@@ -115,14 +115,14 @@ c | standard eigenvalue problem is solved (BMAT = 'I'. |
c | NEV is the number of eigenvalues (closest to |
c | SIGMA) to be approximated. Since the shift-invert |
c | mode is used, WHICH is set to 'LM'. The user can |
c | modify NEV, NCV, SIGMA to solve problems of |
c | modify NEV, NCV, SIGMA to solve problems of |
c | different sizes, and to get different parts of the |
c | spectrum. However, The following conditions must |
c | be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
@@ -140,7 +140,7 @@ c
c
bmat = 'I'
which = 'LM'
sigma = zero
sigma = zero
c
c %--------------------------------------------------%
c | The work array WORKL is used in DSAUPD as |
@@ -155,7 +155,7 @@ c | iteration. |
c %--------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -173,24 +173,24 @@ c
maxitr = 300
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
c %-----------------------------------------------------%
c | Call LAPACK routine to factor (A-SIGMA*I), where A |
c | is the 1-d Laplacian. |
c | is the 1-d Laplacian. |
c %-----------------------------------------------------%
c
h2 = one / dble((n+1)*(n+1))
do 20 j=1,n
ad(j) = two / h2 - sigma
adl(j) = -one / h2
20 continue
20 continue
call dcopy (n, adl, 1, adu, 1)
call dgttrf (n, adl, ad, adu, adu2, ipiv, ierr)
if (ierr .ne. 0) then
print *, ' '
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrf in SDRV2.'
print *, ' '
go to 9000
@@ -230,7 +230,7 @@ c
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV2. '
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -240,7 +240,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %----------------------------------------%
c | Either we have convergence or there is |
@@ -257,9 +257,9 @@ c
print *, ' '
print *, ' Error with _saupd, info = ',info
print *, ' Check documentation of _saupd '
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -288,7 +288,7 @@ c | corresponding to the eigenvalues in D is |
c | returned in V. |
c %----------------------------------------------%
if ( ierr .ne. 0 ) then
if ( ierr .ne. 0 ) then
c
c %------------------------------------%
c | Error condition: |
@@ -300,7 +300,7 @@ c
print *, ' Check the documentation of _seupd '
print *, ' '
c
else
else
c
nconv = iparam(5)
do 30 j=1, nconv
@@ -351,14 +351,14 @@ c
print *, ' '
print *, ' _SDRV2 '
print *, ' ====== '
print *, ' '
print *, ' '
print *, ' Size of the matrix is ', n
print *, ' The number of Ritz values requested is ', nev
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -389,10 +389,10 @@ c
c
w(1) = two*v(1) - v(2)
do 100 j = 2,n-1
w(j) = - v(j-1) + two*v(j) - v(j+1)
w(j) = - v(j-1) + two*v(j) - v(j+1)
100 continue
j = n
w(j) = - v(j-1) + two*v(j)
w(j) = - v(j-1) + two*v(j)
c
c Scale the vector w by (1 / h^2).
c
+53 -53
View File
@@ -1,15 +1,15 @@
program dsdrv3
program dsdrv3
c
c Program to illustrate the idea of reverse communication in
c inverse mode for a generalized symmetric eigenvalue problem.
c The following program uses the two LAPACK subroutines dgttrf .f
c The following program uses the two LAPACK subroutines dgttrf .f
c and dgttrs .f to factor and solve a tridiagonal system of equations.
c
c We implement example three of ex-sym.doc in DOCUMENTS directory
c
c\Example-3
c ... Suppose we want to solve A*x = lambda*M*x in inverse mode,
c where A and M are obtained by the finite element of the
c where A and M are obtained by the finite element of the
c 1-dimensional discrete Laplacian
c d^2u / dx^2
c on the interval [0,1] with zero Dirichlet boundary condition
@@ -17,7 +17,7 @@ c using piecewise linear elements.
c
c ... OP = inv[M]*A and B = M.
c
c ... Use mode 2 of DSAUPD .
c ... Use mode 2 of DSAUPD .
c
c\BeginLib
c
@@ -30,7 +30,7 @@ c dgttrs LAPACK tridiagonal solve routine.
c daxpy Level 1 BLAS that computes y <- alpha*x+y.
c dscal Level 1 BLAS that scales a vector by a scalar.
c dcopy Level 1 BLAS that copies one vector to another.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
@@ -62,16 +62,16 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
c | Local Arrays |
c %--------------%
c
Double precision
Double precision
& v(ldv,maxncv), workl(maxncv*(maxncv+8)),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& ad(maxn), adl(maxn), adu(maxn), adu2(maxn),
& ax(maxn), mx(maxn)
logical select(maxncv)
@@ -85,25 +85,25 @@ c
integer ido, n, nev, ncv, lworkl, info, j, ierr,
& nconv, maxitr, ishfts, mode
logical rvec
Double precision
Double precision
& sigma, r1, r2, tol, h
c
c %------------%
c | Parameters |
c %------------%
c
Double precision
Double precision
& zero, one, four, six
parameter ( zero = 0.0D+0 , one = 1.0D+0 ,
parameter ( zero = 0.0D+0 , one = 1.0D+0 ,
& four = 4.0D+0 , six = 6.0D+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Double precision
& dnrm2
external daxpy , dcopy , dscal , dnrm2 , dgttrf , dgttrs
Double precision
& dnrm2
external daxpy , dcopy , dscal , dnrm2 , dgttrf , dgttrs
c
c %--------------------%
c | Intrinsic function |
@@ -123,9 +123,9 @@ c | approximated. The user can modify NEV, NCV, WHICH |
c | to solve problems of different sizes, and to get |
c | different parts of the spectrum. However, The |
c | following conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
@@ -157,7 +157,7 @@ c | iteration. |
c %--------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -176,7 +176,7 @@ c
mode = 2
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------------%
@@ -188,18 +188,18 @@ c %------------------------------------------------%
c
h = one / dble (n+1)
c
r1 = (four / six) * h
r1 = (four / six) * h
r2 = (one / six) * h
do 20 j=1,n
ad(j) = r1
adl(j) = r2
20 continue
20 continue
call dcopy (n, adl, 1, adu, 1)
call dgttrf (n, adl, ad, adu, adu2, ipiv, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrf in _SDRV3. '
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -210,13 +210,13 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine DSAUPD and take |
c | Repeatedly call the routine DSAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dsaupd ( ido, bmat, n, which, nev, tol, resid,
call dsaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, info )
c
@@ -229,7 +229,7 @@ c | matrix vector multiplication (A*x) |
c | routine and a linear system solver |
c | here. The matrix vector |
c | multiplication routine takes |
c | workd(ipntr(1)) as the input vector. |
c | workd(ipntr(1)) as the input vector. |
c | The final result is returned to |
c | workd(ipntr(2)). The result of A*x |
c | overwrites workd(ipntr(1)). |
@@ -237,12 +237,12 @@ c %--------------------------------------%
c
call av (n, workd(ipntr(1)), workd(ipntr(2)))
call dcopy (n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV3.'
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -271,7 +271,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c
c
@@ -290,24 +290,24 @@ c
print *, ' '
print *, ' Error with _saupd, info = ',info
print *, ' Check the documentation of _saupd '
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using DSEUPD . |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
c
rvec = .true.
c
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
c %----------------------------------------------%
@@ -321,19 +321,19 @@ c | corresponding to the eigenvalues in D is |
c | returned in V. |
c %----------------------------------------------%
c
if (ierr .ne. 0) then
if (ierr .ne. 0) then
c
c %------------------------------------%
c | Error condition: |
c | Check the documentation of DSEUPD . |
c %------------------------------------%
c
print *, ' '
c
print *, ' '
print *, ' Error with _seupd, info = ', ierr
print *, ' Check the documentation of _seupd'
print *, ' '
c
else
else
c
nconv = iparam(5)
do 30 j=1, nconv
@@ -376,23 +376,23 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _SDRV3 '
print *, ' ====== '
print *, ' '
print *, ' '
print *, ' Size of the matrix is ', n
print *, ' The number of Ritz values requested is ', nev
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -416,17 +416,17 @@ c on the interval [0,1].
c
subroutine mv (n, v, w)
integer n, j
Double precision
Double precision
& v(n),w(n), one, four, six, h
parameter (one = 1.0D+0 , four = 4.0D+0 ,
parameter (one = 1.0D+0 , four = 4.0D+0 ,
& six = 6.0D+0 )
c
w(1) = four*v(1) + v(2)
do 100 j = 2,n-1
w(j) = v(j-1) + four*v(j) + v(j+1)
w(j) = v(j-1) + four*v(j) + v(j+1)
100 continue
j = n
w(j) = v(j-1) + four*v(j)
w(j) = v(j-1) + four*v(j)
c
c Scale the vector w by h.
c
@@ -438,23 +438,23 @@ c
c--------------------------------------------------------------------
c matrix vector subroutine
c
c The matrix used is the stiffness matrix obtained from the finite
c The matrix used is the stiffness matrix obtained from the finite
c element discretization of the 1-dimensional discrete Laplacian
c on the interval [0,1] with zero Dirichlet boundary condition using
c piecewise linear elements.
c
subroutine av (n, v, w)
integer n, j
Double precision
Double precision
& v(n),w(n), two, one, h
parameter ( one = 1.0D+0 , two = 2.0D+0 )
c
w(1) = two*v(1) - v(2)
do 100 j = 2,n-1
w(j) = - v(j-1) + two*v(j) - v(j+1)
w(j) = - v(j-1) + two*v(j) - v(j+1)
100 continue
j = n
w(j) = - v(j-1) + two*v(j)
w(j) = - v(j-1) + two*v(j)
c
c Scale the vector w by (1 / h).
c
+40 -40
View File
@@ -1,9 +1,9 @@
program dsdrv4
program dsdrv4
c
c Program to illustrate the idea of reverse communication
c in shift and invert mode for a generalized symmetric eigenvalue
c problem. The following program uses the two LAPACK subroutines
c dgttrf.f and dgttrs to factor and solve a tridiagonal system of
c problem. The following program uses the two LAPACK subroutines
c dgttrf.f and dgttrs to factor and solve a tridiagonal system of
c equations.
c
c We implement example four of ex-sym.doc in DOCUMENTS directory
@@ -34,7 +34,7 @@ c dscal Level 1 BLAS that scales a vector by a scalar.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
c
c\Author
c Richard Lehoucq
c Danny Sorensen
@@ -51,7 +51,7 @@ c\Remarks
c 1. None
c
c\EndLib
c----------------------------------------------------------------------
c----------------------------------------------------------------------
c
c %-----------------------------%
c | Define leading dimensions |
@@ -63,7 +63,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn)
c
c %--------------%
@@ -72,7 +72,7 @@ c %--------------%
c
Double precision
& v(ldv,maxncv), workl(maxncv*(maxncv+8)),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& ad(maxn), adl(maxn), adu(maxn), adu2(maxn)
logical select(maxncv)
integer iparam(11), ipntr(11), ipiv(maxn)
@@ -85,7 +85,7 @@ c
integer ido, n, nev, ncv, lworkl, info, j, ierr,
& nconv, maxitr, ishfts, mode
logical rvec
Double precision
Double precision
& sigma, r1, r2, tol, h
c
c %------------%
@@ -126,10 +126,10 @@ c | The user can modify NEV, NCV, SIGMA to solve |
c | problems of different sizes, and to get different |
c | parts of the spectrum. However, The following |
c | conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
@@ -146,7 +146,7 @@ c
end if
bmat = 'G'
which = 'LM'
sigma = zero
sigma = zero
c
c %--------------------------------------------------%
c | The work array WORKL is used in DSAUPD as |
@@ -161,7 +161,7 @@ c | iteration. |
c %--------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -180,8 +180,8 @@ c
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------------------%
c | Call LAPACK routine to factor the tridiagonal matrix |
@@ -197,10 +197,10 @@ c
do 20 j=1,n
ad(j) = two/h - sigma * r1
adl(j) = -one/h - sigma * r2
20 continue
20 continue
call dcopy (n, adl, 1, adu, 1)
call dgttrf (n, adl, ad, adu, adu2, ipiv, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' Error with _gttrf in _SDRV4.'
go to 9000
end if
@@ -238,12 +238,12 @@ c %--------------------------------------------%
c
call mv (n, workd(ipntr(1)), workd(ipntr(2)))
c
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV4. '
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -261,16 +261,16 @@ c | M*x has been saved in workd(ipntr(3)). |
c | the user only needs the linear system |
c | solver here that takes workd(ipntr(3) |
c | as input, and returns the result to |
c | workd(ipntr(2)). |
c | workd(ipntr(2)). |
c %-----------------------------------------%
c
call dcopy ( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV4.'
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -298,7 +298,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
@@ -315,9 +315,9 @@ c
print *, ' '
print *, ' Error with _saupd, info = ',info
print *, ' Check the documentation of _saupd '
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -332,7 +332,7 @@ c
rvec = .true.
c
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
c %----------------------------------------------%
@@ -346,7 +346,7 @@ c | corresponding to the eigenvalues in D is |
c | returned in V. |
c %----------------------------------------------%
c
if ( ierr .ne. 0 ) then
if ( ierr .ne. 0 ) then
c
c %------------------------------------%
c | Error condition: |
@@ -358,7 +358,7 @@ c
print *, ' Check the documentation of _seupd '
print *, ' '
c
else
else
c
nconv = iparam(5)
do 30 j=1, nconv
@@ -375,7 +375,7 @@ c | indicates how many are |
c | accurate to the requested |
c | tolerance) |
c %---------------------------%
c
c
call av(n, v(1,j), workd)
call mv(n, v(1,j), workd(n+1))
call daxpy (n, -d(j,1), workd(n+1), 1, workd, 1)
@@ -414,7 +414,7 @@ c
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -440,15 +440,15 @@ c
integer n, j
Double precision
& v(n),w(n), one, four, six, h
parameter (one = 1.0D+0, four = 4.0D+0,
parameter (one = 1.0D+0, four = 4.0D+0,
& six = 6.0D+0)
c
w(1) = four*v(1) + v(2)
do 100 j = 2,n-1
w(j) = v(j-1) + four*v(j) + v(j+1)
w(j) = v(j-1) + four*v(j) + v(j+1)
100 continue
j = n
w(j) = v(j-1) + four*v(j)
w(j) = v(j-1) + four*v(j)
c
c Scale the vector w by h.
c
@@ -458,8 +458,8 @@ c
end
c------------------------------------------------------------------------
c matrix vector subroutine
c where the matrix is the finite element discretization of the
c 1 dimensional discrete Laplacian on [0,1] with zero Dirichlet
c where the matrix is the finite element discretization of the
c 1 dimensional discrete Laplacian on [0,1] with zero Dirichlet
c boundary condition using piecewise linear elements.
c
subroutine av (n, v, w)
@@ -470,10 +470,10 @@ c
c
w(1) = two*v(1) - v(2)
do 100 j = 2,n-1
w(j) = - v(j-1) + two*v(j) - v(j+1)
w(j) = - v(j-1) + two*v(j) - v(j+1)
100 continue
j = n
w(j) = - v(j-1) + two*v(j)
w(j) = - v(j-1) + two*v(j)
c
c Scale the vector w by (1/h)
c
+39 -39
View File
@@ -1,9 +1,9 @@
program dsdrv5
program dsdrv5
c
c Program to illustrate the idea of reverse communication
c in Buckling mode for a generalized symmetric eigenvalue
c problem. The following program uses the two LAPACK subroutines
c dgttrf.f and dgttrs.f to factor and solve a tridiagonal system of
c problem. The following program uses the two LAPACK subroutines
c dgttrf.f and dgttrs.f to factor and solve a tridiagonal system of
c equations.
c
c We implement example five of ex-sym.doc in DOCUMENTS directory
@@ -21,8 +21,8 @@ c
c\BeginLib
c
c\References:
c 1. R.G. Grimes, J.G. Lewis and H.D. Simon, "A Shifted Block Lanczos
c Algorithm for Solving Sparse Symmetric Generalized Eigenproblems",
c 1. R.G. Grimes, J.G. Lewis and H.D. Simon, "A Shifted Block Lanczos
c Algorithm for Solving Sparse Symmetric Generalized Eigenproblems",
c SIAM J. Matr. Anal. Apps., January (1993).
c
c\Routines called:
@@ -34,7 +34,7 @@ c dgttrs LAPACK tridiagonal solve routine.
c daxpy Level 1 BLAS that computes y <- alpha*x+y.
c dcopy Level 1 BLAS that copies one vector to another.
c dscal Level 1 BLAS that scales a vector by a scalar.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
@@ -54,7 +54,7 @@ c\Remarks
c 1. None
c
c\EndLib
c----------------------------------------------------------------------
c----------------------------------------------------------------------
c
c %-----------------------------%
c | Define leading dimensions |
@@ -66,7 +66,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn)
c
c %--------------%
@@ -75,7 +75,7 @@ c %--------------%
c
Double precision
& v(ldv,maxncv), workl(maxncv*(maxncv+8)),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& ad(maxn), adl(maxn), adu(maxn), adu2(maxn),
& ax(maxn), mx(maxn)
logical select(maxncv)
@@ -89,7 +89,7 @@ c
integer ido, n, nev, ncv, lworkl, info, j, ierr,
& nconv, maxitr, ishfts, mode
logical rvec
Double precision
Double precision
& h, sigma, r1, r2, tol
c
c %------------%
@@ -130,12 +130,12 @@ c | NCV, SIGMA to solve problems of different sizes, |
c | and to get different parts of the spectrum. |
c | However, The following conditions must be |
c | satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c | |
c | |
c | The shift SIGMA cannot be zero!!! |
c %--------------------------------------------------%
c %--------------------------------------------------%
c
n = 100
nev = 4
@@ -152,7 +152,7 @@ c
end if
bmat = 'G'
which = 'LM'
sigma = one
sigma = one
c
c %-----------------------------------------------------%
c | The work array WORKL is used in DSAUPD as |
@@ -166,7 +166,7 @@ c | generated in DSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -185,8 +185,8 @@ c
mode = 4
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------------------%
c | Call LAPACK routine to factor the tridiagonal matrix |
@@ -203,10 +203,10 @@ c
do 20 j=1,n
ad(j) = two / h - sigma * r1
adl(j) = -one / h- sigma * r2
20 continue
20 continue
call dcopy (n, adl, 1, adu, 1)
call dgttrf (n, adl, ad, adu, adu2, ipiv, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrf in _SDRV5.'
print *, ' '
@@ -226,8 +226,8 @@ c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dsaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
call dsaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
& info )
c
if (ido .eq. -1) then
@@ -246,10 +246,10 @@ c %-------------------------------------------%
c
call av (n, workd(ipntr(1)), workd(ipntr(2)))
c
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print *, ' '
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in SDRV5.'
print *, ' '
go to 9000
@@ -273,9 +273,9 @@ c | workd(ipntr(2)). |
c %------------------------------------------%
c
call dcopy ( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV5.'
print *, ' '
@@ -306,7 +306,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
@@ -323,9 +323,9 @@ c
print *, ' '
print *, ' Error with _saupd, info = ',info
print *, ' Check the documentation of _saupd '
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -339,11 +339,11 @@ c %-------------------------------------------%
c
rvec = .true.
c
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
if (ierr .ne. 0) then
if (ierr .ne. 0) then
c
c %------------------------------------%
c | Error condition: |
@@ -357,7 +357,7 @@ c
c
else
c
nconv = iparam(5)
nconv = iparam(5)
do 30 j=1, nconv
c
c %---------------------------%
@@ -412,7 +412,7 @@ c
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -432,7 +432,7 @@ c
c------------------------------------------------------------------------
c Matrix vector subroutine
c where the matrix is the 1-dimensional mass matrix
c arising from using piecewise linear finite elements on the
c arising from using piecewise linear finite elements on the
c interval [0,1].
c
subroutine mv (n, v, w)
@@ -444,10 +444,10 @@ c
c
w(1) = four*v(1) + v(2)
do 100 j = 2,n-1
w(j) = v(j-1) + four*v(j) + v(j+1)
w(j) = v(j-1) + four*v(j) + v(j+1)
100 continue
j = n
w(j) = v(j-1) + four*v(j)
w(j) = v(j-1) + four*v(j)
c
c Scale the vector w by h.
c
@@ -470,10 +470,10 @@ c
c
w(1) = two*v(1) - v(2)
do 100 j = 2,n-1
w(j) = - v(j-1) + two*v(j) - v(j+1)
w(j) = - v(j-1) + two*v(j) - v(j+1)
100 continue
j = n
w(j) = - v(j-1) + two*v(j)
w(j) = - v(j-1) + two*v(j)
c
c Scale the vector w by (1/h)
c
+47 -47
View File
@@ -1,9 +1,9 @@
program dsdrv6
program dsdrv6
c
c Program to illustrate the idea of reverse communication
c in Cayley mode for a generalized symmetric eigenvalue
c problem. The following program uses the two LAPACK subroutines
c dgttrf.f and dgttrs.f to factor and solve a tridiagonal system of
c in Cayley mode for a generalized symmetric eigenvalue
c problem. The following program uses the two LAPACK subroutines
c dgttrf.f and dgttrs.f to factor and solve a tridiagonal system of
c equations.
c
c We implement example six of ex-sym.doc in DOCUMENTS directory
@@ -23,8 +23,8 @@ c
c\BeginLib
c
c\References:
c 1. R.G. Grimes, J.G. Lewis and H.D. Simon, "A Shifted Block Lanczos
c Algorithm for Solving Sparse Symmetric Generalized Eigenproblems",
c 1. R.G. Grimes, J.G. Lewis and H.D. Simon, "A Shifted Block Lanczos
c Algorithm for Solving Sparse Symmetric Generalized Eigenproblems",
c SIAM J. Matr. Anal. Apps., January (1993).
c
c\Routines called:
@@ -36,7 +36,7 @@ c dgttrs LAPACK tridiagonal solve routine.
c daxpy Level 1 BLAS that computes y <- alpha*x+y.
c dcopy Level 1 BLAS that copies one vector to another.
c dscal Level 1 BLAS that scales a vector by a scalar.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c dnrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
@@ -46,9 +46,9 @@ c Richard Lehoucq
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
c FILE: sdrv6.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
c
@@ -68,7 +68,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn)
c
c %--------------%
@@ -77,7 +77,7 @@ c %--------------%
c
Double precision
& v(ldv,maxncv), workl(maxncv*(maxncv+8)),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& ad(maxn), adl(maxn), adu(maxn), adu2(maxn),
& temp(maxn), ax(maxn), mx(maxn)
logical select(maxncv)
@@ -100,9 +100,9 @@ c %------------%
c
Double precision
& zero, one, two, four, six
parameter (zero = 0.0D+0, one = 1.0D+0,
parameter (zero = 0.0D+0, one = 1.0D+0,
& four = 4.0D+0, six = 6.0D+0,
& two = 2.0D+0 )
& two = 2.0D+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
@@ -132,9 +132,9 @@ c | NCV, SIGMA to solve problems of different sizes, |
c | and to get different parts of the spectrum. |
c | However, The following conditions must be |
c | satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
n = 100
@@ -186,8 +186,8 @@ c
mode = 5
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------------------%
c | Call LAPACK routine to factor (A-sigma*M). The |
@@ -203,10 +203,10 @@ c
do 20 j=1,n
ad(j) = two / h - sigma * r1
adl(j) = -one / h - sigma * r2
20 continue
20 continue
call dcopy (n, adl, 1, adu, 1)
call dgttrf (n, adl, ad, adu, adu2, ipiv, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrf in _SDRV6.'
print *, ' '
@@ -226,8 +226,8 @@ c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call dsaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
call dsaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
& info )
c
if (ido .eq. -1) then
@@ -239,19 +239,19 @@ c | user should provide his/her matrix vector (A*x, M*x) |
c | multiplication routines and a linear system solver |
c | here. The matrix vector multiplication routine takes |
c | workd(ipntr(1)) as the input vector. The final |
c | result is returned to workd(ipntr(2)). |
c | result is returned to workd(ipntr(2)). |
c %-------------------------------------------------------%
c
call av (n, workd(ipntr(1)), workd(ipntr(2)))
call mv (n, workd(ipntr(1)), temp)
call daxpy(n, sigma, temp, 1, workd(ipntr(2)), 1)
call daxpy(n, sigma, temp, 1, workd(ipntr(2)), 1)
c
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV6.'
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -272,15 +272,15 @@ c | matrix vector multiplication routine takes |
c | workd(ipntr(1)) as the input, and the result is |
c | combined with workd(ipntr(3)) to form the input |
c | for the linear system solver. The final result is |
c | returned to workd(ipntr(2)). |
c | returned to workd(ipntr(2)). |
c %----------------------------------------------------%
c
call av (n, workd(ipntr(1)), workd(ipntr(2)))
call daxpy(n, sigma, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call dgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print *, ' '
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV6. '
print *, ' '
go to 9000
@@ -309,7 +309,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
@@ -328,7 +328,7 @@ c
print *, ' Check the documentation of _saupd. '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -342,8 +342,8 @@ c %-------------------------------------------%
c
rvec = .true.
c
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call dseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
c %----------------------------------------------%
@@ -357,7 +357,7 @@ c | corresponding to the eigenvalues in D is |
c | returned in V. |
c %----------------------------------------------%
c
if ( ierr .ne. 0 ) then
if ( ierr .ne. 0 ) then
c
c %------------------------------------%
c | Error condition: |
@@ -383,7 +383,7 @@ c | indicates how many are |
c | accurate to the requested |
c | tolerance) |
c %---------------------------%
c
c
nconv = iparam(5)
do 30 j=1, nconv
call av(n, v(1,j), ax)
@@ -423,7 +423,7 @@ c
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -448,17 +448,17 @@ c on the interval [0,1].
c
subroutine mv (n, v, w)
integer n, j
Double precision
Double precision
& v(n), w(n), one, four, six, h
parameter (one = 1.0D+0, four = 4.0D+0,
& six = 6.0D+0)
parameter (one = 1.0D+0, four = 4.0D+0,
& six = 6.0D+0)
c
w(1) = four*v(1) + v(2)
do 100 j = 2,n-1
w(j) = v(j-1) + four*v(j) + v(j+1)
w(j) = v(j-1) + four*v(j) + v(j+1)
100 continue
j = n
w(j) = v(j-1) + four*v(j)
w(j) = v(j-1) + four*v(j)
c
c Scale the vector w by h.
c
@@ -469,7 +469,7 @@ c
c
c------------------------------------------------------------------------
c Matrix vector subroutine
c where the matrix is the stiffness matrix obtained from the
c where the matrix is the stiffness matrix obtained from the
c finite element discretization of the 1-dimensional discrete Laplacian
c on the interval [0,1] with zero Dirichlet boundary condition
c using piecewise linear elements.
@@ -482,14 +482,14 @@ c
c
w(1) = two*v(1) - v(2)
do 100 j = 2,n-1
w(j) = - v(j-1) + two*v(j) - v(j+1)
w(j) = - v(j-1) + two*v(j) - v(j+1)
100 continue
j = n
w(j) = - v(j-1) + two*v(j)
c
c
c Scale the vector w by (1/h).
c
h = one / dble(n+1)
call dscal(n, one/h, w, 1)
call dscal(n, one/h, w, 1)
return
end
-64
View File
@@ -1,64 +0,0 @@
#
# makefile to run simple examples of the reverse communication
# protocol.
#
# Modify if ARPACK library was built somewhere else.
# We assume that the required BLAS and LAPACK routines
# are in the version of libarpack.a built. If not, you
# will need to modify the link step below and link to them.
#
#\SCCS Information: @(#)
# FILE: makefile SID: 2.1 DATE OF SID: 11/19/95 RELEASE: 2
#
include ../../ARmake.inc
#
# Issue "make sym" to make all 12 symmetric drivers
# Issue "make ssdrv" to make 6 single precision symmetric drivers
# Issue "make dsdrv" to make 6 double precision symmetric drivers
#
sym: ssdrv dsdrv
#
# simple symmetric problem using single precision
#
ssdrv: ssdrv1 ssdrv2 ssdrv3 ssdrv4 ssdrv5 ssdrv6
ssdrv1: ssdrv1.o
$(FC) $(FFLAGS) ssdrv1.o $(ALIBS) -o ssdrv1
#
ssdrv2: ssdrv2.o
$(FC) $(FFLAGS) ssdrv2.o $(ALIBS) -o ssdrv2
#
ssdrv3: ssdrv3.o
$(FC) $(FFLAGS) ssdrv3.o $(ALIBS) -o ssdrv3
#
ssdrv4: ssdrv4.o
$(FC) $(FFLAGS) ssdrv4.o $(ALIBS) -o ssdrv4
#
ssdrv5: ssdrv5.o
$(FC) $(FFLAGS) ssdrv5.o $(ALIBS) -o ssdrv5
#
ssdrv6: ssdrv6.o
$(FC) $(FFLAGS) ssdrv6.o $(ALIBS) -o ssdrv6
#
#-----------------------------------------------------------------------
# simple symmetric problem using double precision
#
dsdrv: dsdrv1 dsdrv2 dsdrv3 dsdrv4 dsdrv5 dsdrv6
dsdrv1: dsdrv1.o
$(FC) $(FFLAGS) dsdrv1.o $(ALIBS) -o dsdrv1
#
dsdrv2: dsdrv2.o
$(FC) $(FFLAGS) dsdrv2.o $(ALIBS) -o dsdrv2
#
dsdrv3: dsdrv3.o
$(FC) $(FFLAGS) dsdrv3.o $(ALIBS) -o dsdrv3
#
dsdrv4: dsdrv4.o
$(FC) $(FFLAGS) dsdrv4.o $(ALIBS) -o dsdrv4
#
dsdrv5: dsdrv5.o
$(FC) $(FFLAGS) dsdrv5.o $(ALIBS) -o dsdrv5
#
dsdrv6: dsdrv6.o
$(FC) $(FFLAGS) dsdrv6.o $(ALIBS) -o dsdrv6
+44 -44
View File
@@ -1,4 +1,4 @@
program ssdrv1
program ssdrv1
c
c Simple program to illustrate the idea of reverse communication
c in regular mode for a standard symmetric eigenvalue problem.
@@ -26,7 +26,7 @@ c Ritz vectors.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c saxpy Level 1 BLAS that computes y <- alpha*x+y.
c av Matrix vector multiplication routine that computes A*x.
c tv Matrix vector multiplication routine that computes T*x,
c tv Matrix vector multiplication routine that computes T*x,
c where T is a tridiagonal matrix. It is used in routine
c av.
c
@@ -59,7 +59,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
$ ldv=maxn )
c
c %--------------%
@@ -78,10 +78,10 @@ c | Local Scalars |
c %---------------%
c
character bmat*1, which*2
integer ido, n, nev, ncv, lworkl, info, ierr, j,
integer ido, n, nev, ncv, lworkl, info, ierr, j,
& nx, nconv, maxitr, mode, ishfts
logical rvec
Real
Real
& tol, sigma
c
c %------------%
@@ -91,12 +91,12 @@ c
Real
& zero
parameter (zero = 0.0E+0)
c
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& snrm2
external snrm2, saxpy
c
@@ -122,15 +122,15 @@ c | modify NEV, NCV, WHICH to solve problems of |
c | different sizes, and to get different parts of the |
c | spectrum. However, The following conditions must |
c | be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
nx = 10
n = nx*nx
nev = 4
ncv = 10
nev = 4
ncv = 10
if ( n .gt. maxn ) then
print *, ' ERROR with _SDRV1: N is greater than MAXN '
go to 9000
@@ -157,7 +157,7 @@ c | iteration. |
c %--------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
info = 0
ido = 0
c
@@ -174,10 +174,10 @@ c
ishfts = 1
maxitr = 300
mode = 1
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------%
c | M A I N L O O P (Reverse communication) |
@@ -186,13 +186,13 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine SSAUPD and take |
c | Repeatedly call the routine SSAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call ssaupd ( ido, bmat, n, which, nev, tol, resid,
call ssaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, info )
c
@@ -216,7 +216,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %----------------------------------------%
c | Either we have convergence or there is |
@@ -235,22 +235,22 @@ c
print *, ' Check documentation in _saupd '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using SSEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
c
rvec = .true.
c
call sseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call sseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c %----------------------------------------------%
@@ -318,11 +318,11 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _SDRV1 '
@@ -333,8 +333,8 @@ c
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -350,17 +350,17 @@ c
9000 continue
c
end
c
c
c ------------------------------------------------------------------
c matrix vector subroutine
c
c The matrix used is the 2 dimensional discrete Laplacian on unit
c square with zero Dirichlet boundary condition.
c
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c Computes w <--- OP*v, where OP is the nx*nx by nx*nx block
c tridiagonal matrix
c
c | T -I |
c | T -I |
c |-I T -I |
c OP = | -I T |
c | ... -I|
@@ -372,7 +372,7 @@ c
integer nx, j, lo, n2
Real
& v(nx*nx), w(nx*nx), one, h2
parameter ( one = 1.0E+0 )
parameter ( one = 1.0E+0 )
c
call tv(nx,v(1),w(1))
call saxpy(nx, -one, v(nx+1), 1, w(1), 1)
@@ -382,7 +382,7 @@ c
call tv(nx, v(lo+1), w(lo+1))
call saxpy(nx, -one, v(lo-nx+1), 1, w(lo+1), 1)
call saxpy(nx, -one, v(lo+nx+1), 1, w(lo+1), 1)
10 continue
10 continue
c
lo = (nx-1)*nx
call tv(nx, v(lo+1), w(lo+1))
@@ -392,14 +392,14 @@ c Scale the vector w by (1/h^2), where h is the mesh size
c
n2 = nx*nx
h2 = one / real((nx+1)*(nx+1))
call sscal(n2, one/h2, w, 1)
call sscal(n2, one/h2, w, 1)
return
end
c
c-------------------------------------------------------------------
subroutine tv (nx, x, y)
c
integer nx, j
integer nx, j
Real
& x(nx), y(nx), dd, dl, du
c
@@ -408,19 +408,19 @@ c
parameter (one = 1.0E+0 )
c
c Compute the matrix vector multiplication y<---T*x
c where T is a nx by nx tridiagonal matrix with DD on the
c where T is a nx by nx tridiagonal matrix with DD on the
c diagonal, DL on the subdiagonal, and DU on the superdiagonal.
c
c
c
dd = 4.0E+0
dl = -one
dl = -one
du = -one
c
c
y(1) = dd*x(1) + du*x(2)
do 10 j = 2,nx-1
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
y(j) = dl*x(j-1) + dd*x(j) + du*x(j+1)
10 continue
y(nx) = dl*x(nx-1) + dd*x(nx)
return
end
+32 -32
View File
@@ -1,9 +1,9 @@
program ssdrv2
program ssdrv2
c
c Program to illustrate the idea of reverse communication
c in shift and invert mode for a standard symmetric eigenvalue
c problem. The following program uses the two LAPACK subroutines
c sgttrf.f and sgttrs.f to factor and solve a tridiagonal system of
c problem. The following program uses the two LAPACK subroutines
c sgttrf.f and sgttrs.f to factor and solve a tridiagonal system of
c equations.
c
c We implement example two of ex-sym.doc in DOCUMENTS directory
@@ -25,7 +25,7 @@ c Ritz vectors.
c sgttrf LAPACK tridiagonal factorization routine.
c sgttrs LAPACK tridiagonal solve routine.
c saxpy saxpy Level 1 BLAS that computes y <- alpha*x+y.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c
c\Author
@@ -56,7 +56,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
@@ -65,7 +65,7 @@ c %--------------%
c
Real
& v(ldv,maxncv), workl(maxncv*(maxncv+8)),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& ad(maxn), adl(maxn), adu(maxn), adu2(maxn),
& ax(maxn)
logical select(maxncv)
@@ -86,9 +86,9 @@ c %------------%
c | Parameters |
c %------------%
c
Real
& zero, one, two
parameter (zero = 0.0E+0, one = 1.0E+0,
Real
& zero, one, two
parameter (zero = 0.0E+0, one = 1.0E+0,
& two = 2.0E+0)
c
c %-----------------------------%
@@ -115,14 +115,14 @@ c | standard eigenvalue problem is solved (BMAT = 'I'. |
c | NEV is the number of eigenvalues (closest to |
c | SIGMA) to be approximated. Since the shift-invert |
c | mode is used, WHICH is set to 'LM'. The user can |
c | modify NEV, NCV, SIGMA to solve problems of |
c | modify NEV, NCV, SIGMA to solve problems of |
c | different sizes, and to get different parts of the |
c | spectrum. However, The following conditions must |
c | be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
@@ -140,7 +140,7 @@ c
c
bmat = 'I'
which = 'LM'
sigma = zero
sigma = zero
c
c %--------------------------------------------------%
c | The work array WORKL is used in SSAUPD as |
@@ -155,7 +155,7 @@ c | iteration. |
c %--------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -173,24 +173,24 @@ c
maxitr = 300
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
c
c %-----------------------------------------------------%
c | Call LAPACK routine to factor (A-SIGMA*I), where A |
c | is the 1-d Laplacian. |
c | is the 1-d Laplacian. |
c %-----------------------------------------------------%
c
h2 = one / real((n+1)*(n+1))
do 20 j=1,n
ad(j) = two / h2 - sigma
adl(j) = -one / h2
20 continue
20 continue
call scopy (n, adl, 1, adu, 1)
call sgttrf (n, adl, ad, adu, adu2, ipiv, ierr)
if (ierr .ne. 0) then
print *, ' '
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrf in SDRV2.'
print *, ' '
go to 9000
@@ -230,7 +230,7 @@ c
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV2. '
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -240,7 +240,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %----------------------------------------%
c | Either we have convergence or there is |
@@ -257,9 +257,9 @@ c
print *, ' '
print *, ' Error with _saupd, info = ',info
print *, ' Check documentation of _saupd '
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -288,7 +288,7 @@ c | corresponding to the eigenvalues in D is |
c | returned in V. |
c %----------------------------------------------%
if ( ierr .ne. 0 ) then
if ( ierr .ne. 0 ) then
c
c %------------------------------------%
c | Error condition: |
@@ -300,7 +300,7 @@ c
print *, ' Check the documentation of _seupd '
print *, ' '
c
else
else
c
nconv = iparam(5)
do 30 j=1, nconv
@@ -351,14 +351,14 @@ c
print *, ' '
print *, ' _SDRV2 '
print *, ' ====== '
print *, ' '
print *, ' '
print *, ' Size of the matrix is ', n
print *, ' The number of Ritz values requested is ', nev
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -389,10 +389,10 @@ c
c
w(1) = two*v(1) - v(2)
do 100 j = 2,n-1
w(j) = - v(j-1) + two*v(j) - v(j+1)
w(j) = - v(j-1) + two*v(j) - v(j+1)
100 continue
j = n
w(j) = - v(j-1) + two*v(j)
w(j) = - v(j-1) + two*v(j)
c
c Scale the vector w by (1 / h^2).
c
+51 -51
View File
@@ -1,15 +1,15 @@
program ssdrv3
program ssdrv3
c
c Program to illustrate the idea of reverse communication in
c inverse mode for a generalized symmetric eigenvalue problem.
c The following program uses the two LAPACK subroutines sgttrf.f
c The following program uses the two LAPACK subroutines sgttrf.f
c and sgttrs.f to factor and solve a tridiagonal system of equations.
c
c We implement example three of ex-sym.doc in DOCUMENTS directory
c
c\Example-3
c ... Suppose we want to solve A*x = lambda*M*x in inverse mode,
c where A and M are obtained by the finite element of the
c where A and M are obtained by the finite element of the
c 1-dimensional discrete Laplacian
c d^2u / dx^2
c on the interval [0,1] with zero Dirichlet boundary condition
@@ -17,7 +17,7 @@ c using piecewise linear elements.
c
c ... OP = inv[M]*A and B = M.
c
c ... Use mode 2 of SSAUPD.
c ... Use mode 2 of SSAUPD.
c
c\BeginLib
c
@@ -30,7 +30,7 @@ c sgttrs LAPACK tridiagonal solve routine.
c saxpy Level 1 BLAS that computes y <- alpha*x+y.
c sscal Level 1 BLAS that scales a vector by a scalar.
c scopy Level 1 BLAS that copies one vector to another.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
@@ -62,16 +62,16 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn )
c
c %--------------%
c | Local Arrays |
c %--------------%
c
Real
Real
& v(ldv,maxncv), workl(maxncv*(maxncv+8)),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& ad(maxn), adl(maxn), adu(maxn), adu2(maxn),
& ax(maxn), mx(maxn)
logical select(maxncv)
@@ -85,23 +85,23 @@ c
integer ido, n, nev, ncv, lworkl, info, j, ierr,
& nconv, maxitr, ishfts, mode
logical rvec
Real
Real
& sigma, r1, r2, tol, h
c
c %------------%
c | Parameters |
c %------------%
c
Real
Real
& zero, one, four, six
parameter ( zero = 0.0E+0 , one = 1.0E+0 ,
parameter ( zero = 0.0E+0 , one = 1.0E+0 ,
& four = 4.0E+0 , six = 6.0E+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
c %-----------------------------%
c
Real
Real
& snrm2
external saxpy, scopy, sscal, snrm2, sgttrf, sgttrs
c
@@ -123,9 +123,9 @@ c | approximated. The user can modify NEV, NCV, WHICH |
c | to solve problems of different sizes, and to get |
c | different parts of the spectrum. However, The |
c | following conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
@@ -157,7 +157,7 @@ c | iteration. |
c %--------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -176,7 +176,7 @@ c
mode = 2
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------------%
@@ -188,18 +188,18 @@ c %------------------------------------------------%
c
h = one / real (n+1)
c
r1 = (four / six) * h
r1 = (four / six) * h
r2 = (one / six) * h
do 20 j=1,n
ad(j) = r1
adl(j) = r2
20 continue
20 continue
call scopy (n, adl, 1, adu, 1)
call sgttrf (n, adl, ad, adu, adu2, ipiv, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrf in _SDRV3. '
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -210,13 +210,13 @@ c
10 continue
c
c %---------------------------------------------%
c | Repeatedly call the routine SSAUPD and take |
c | Repeatedly call the routine SSAUPD and take |
c | actions indicated by parameter IDO until |
c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call ssaupd ( ido, bmat, n, which, nev, tol, resid,
call ssaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl,
& lworkl, info )
c
@@ -229,7 +229,7 @@ c | matrix vector multiplication (A*x) |
c | routine and a linear system solver |
c | here. The matrix vector |
c | multiplication routine takes |
c | workd(ipntr(1)) as the input vector. |
c | workd(ipntr(1)) as the input vector. |
c | The final result is returned to |
c | workd(ipntr(2)). The result of A*x |
c | overwrites workd(ipntr(1)). |
@@ -237,12 +237,12 @@ c %--------------------------------------%
c
call av (n, workd(ipntr(1)), workd(ipntr(2)))
call scopy(n, workd(ipntr(2)), 1, workd(ipntr(1)), 1)
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV3.'
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -271,7 +271,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c
c
@@ -290,24 +290,24 @@ c
print *, ' '
print *, ' Error with _saupd, info = ',info
print *, ' Check the documentation of _saupd '
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
c | Post-Process using SSEUPD. |
c | |
c | Computed eigenvalues may be extracted. |
c | Computed eigenvalues may be extracted. |
c | |
c | Eigenvectors may also be computed now if |
c | desired. (indicated by rvec = .true.) |
c | desired. (indicated by rvec = .true.) |
c %-------------------------------------------%
c
c
rvec = .true.
c
call sseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call sseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
c %----------------------------------------------%
@@ -321,19 +321,19 @@ c | corresponding to the eigenvalues in D is |
c | returned in V. |
c %----------------------------------------------%
c
if (ierr .ne. 0) then
if (ierr .ne. 0) then
c
c %------------------------------------%
c | Error condition: |
c | Check the documentation of SSEUPD. |
c %------------------------------------%
c
print *, ' '
c
print *, ' '
print *, ' Error with _seupd, info = ', ierr
print *, ' Check the documentation of _seupd'
print *, ' '
c
else
else
c
nconv = iparam(5)
do 30 j=1, nconv
@@ -376,23 +376,23 @@ c
print *, ' Maximum number of iterations reached.'
print *, ' '
else if ( info .eq. 3) then
print *, ' '
print *, ' '
print *, ' No shifts could be applied during implicit',
& ' Arnoldi update, try increasing NCV.'
print *, ' '
end if
end if
c
print *, ' '
print *, ' _SDRV3 '
print *, ' ====== '
print *, ' '
print *, ' '
print *, ' Size of the matrix is ', n
print *, ' The number of Ritz values requested is ', nev
print *, ' The number of Arnoldi vectors generated',
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of converged Ritz values is ',
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -416,17 +416,17 @@ c on the interval [0,1].
c
subroutine mv (n, v, w)
integer n, j
Real
Real
& v(n),w(n), one, four, six, h
parameter (one = 1.0E+0 , four = 4.0E+0 ,
parameter (one = 1.0E+0 , four = 4.0E+0 ,
& six = 6.0E+0 )
c
w(1) = four*v(1) + v(2)
do 100 j = 2,n-1
w(j) = v(j-1) + four*v(j) + v(j+1)
w(j) = v(j-1) + four*v(j) + v(j+1)
100 continue
j = n
w(j) = v(j-1) + four*v(j)
w(j) = v(j-1) + four*v(j)
c
c Scale the vector w by h.
c
@@ -438,23 +438,23 @@ c
c--------------------------------------------------------------------
c matrix vector subroutine
c
c The matrix used is the stiffness matrix obtained from the finite
c The matrix used is the stiffness matrix obtained from the finite
c element discretization of the 1-dimensional discrete Laplacian
c on the interval [0,1] with zero Dirichlet boundary condition using
c piecewise linear elements.
c
subroutine av (n, v, w)
integer n, j
Real
Real
& v(n),w(n), two, one, h
parameter ( one = 1.0E+0 , two = 2.0E+0 )
c
w(1) = two*v(1) - v(2)
do 100 j = 2,n-1
w(j) = - v(j-1) + two*v(j) - v(j+1)
w(j) = - v(j-1) + two*v(j) - v(j+1)
100 continue
j = n
w(j) = - v(j-1) + two*v(j)
w(j) = - v(j-1) + two*v(j)
c
c Scale the vector w by (1 / h).
c
+40 -40
View File
@@ -1,9 +1,9 @@
program ssdrv4
program ssdrv4
c
c Program to illustrate the idea of reverse communication
c in shift and invert mode for a generalized symmetric eigenvalue
c problem. The following program uses the two LAPACK subroutines
c sgttrf.f and sgttrs to factor and solve a tridiagonal system of
c problem. The following program uses the two LAPACK subroutines
c sgttrf.f and sgttrs to factor and solve a tridiagonal system of
c equations.
c
c We implement example four of ex-sym.doc in DOCUMENTS directory
@@ -34,7 +34,7 @@ c sscal Level 1 BLAS that scales a vector by a scalar.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
c
c\Author
c Richard Lehoucq
c Danny Sorensen
@@ -51,7 +51,7 @@ c\Remarks
c 1. None
c
c\EndLib
c----------------------------------------------------------------------
c----------------------------------------------------------------------
c
c %-----------------------------%
c | Define leading dimensions |
@@ -63,7 +63,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn)
c
c %--------------%
@@ -72,7 +72,7 @@ c %--------------%
c
Real
& v(ldv,maxncv), workl(maxncv*(maxncv+8)),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& ad(maxn), adl(maxn), adu(maxn), adu2(maxn)
logical select(maxncv)
integer iparam(11), ipntr(11), ipiv(maxn)
@@ -85,7 +85,7 @@ c
integer ido, n, nev, ncv, lworkl, info, j, ierr,
& nconv, maxitr, ishfts, mode
logical rvec
Real
Real
& sigma, r1, r2, tol, h
c
c %------------%
@@ -126,10 +126,10 @@ c | The user can modify NEV, NCV, SIGMA to solve |
c | problems of different sizes, and to get different |
c | parts of the spectrum. However, The following |
c | conditions must be satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c | NEV + 1 <= NCV <= MAXNCV |
c %----------------------------------------------------%
c
n = 100
nev = 4
@@ -146,7 +146,7 @@ c
end if
bmat = 'G'
which = 'LM'
sigma = zero
sigma = zero
c
c %--------------------------------------------------%
c | The work array WORKL is used in SSAUPD as |
@@ -161,7 +161,7 @@ c | iteration. |
c %--------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -180,8 +180,8 @@ c
mode = 3
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %-------------------------------------------------------%
c | Call LAPACK routine to factor the tridiagonal matrix |
@@ -197,10 +197,10 @@ c
do 20 j=1,n
ad(j) = two/h - sigma * r1
adl(j) = -one/h - sigma * r2
20 continue
20 continue
call scopy (n, adl, 1, adu, 1)
call sgttrf (n, adl, ad, adu, adu2, ipiv, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' Error with _gttrf in _SDRV4.'
go to 9000
end if
@@ -238,12 +238,12 @@ c %--------------------------------------------%
c
call mv (n, workd(ipntr(1)), workd(ipntr(2)))
c
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV4. '
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -261,16 +261,16 @@ c | M*x has been saved in workd(ipntr(3)). |
c | the user only needs the linear system |
c | solver here that takes workd(ipntr(3) |
c | as input, and returns the result to |
c | workd(ipntr(2)). |
c | workd(ipntr(2)). |
c %-----------------------------------------%
c
call scopy ( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV4.'
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -298,7 +298,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
@@ -315,9 +315,9 @@ c
print *, ' '
print *, ' Error with _saupd, info = ',info
print *, ' Check the documentation of _saupd '
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -332,7 +332,7 @@ c
rvec = .true.
c
call sseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
c %----------------------------------------------%
@@ -346,7 +346,7 @@ c | corresponding to the eigenvalues in D is |
c | returned in V. |
c %----------------------------------------------%
c
if ( ierr .ne. 0 ) then
if ( ierr .ne. 0 ) then
c
c %------------------------------------%
c | Error condition: |
@@ -358,7 +358,7 @@ c
print *, ' Check the documentation of _seupd '
print *, ' '
c
else
else
c
nconv = iparam(5)
do 30 j=1, nconv
@@ -375,7 +375,7 @@ c | indicates how many are |
c | accurate to the requested |
c | tolerance) |
c %---------------------------%
c
c
call av(n, v(1,j), workd)
call mv(n, v(1,j), workd(n+1))
call saxpy (n, -d(j,1), workd(n+1), 1, workd, 1)
@@ -414,7 +414,7 @@ c
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is ', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -440,15 +440,15 @@ c
integer n, j
Real
& v(n),w(n), one, four, six, h
parameter (one = 1.0E+0, four = 4.0E+0,
parameter (one = 1.0E+0, four = 4.0E+0,
& six = 6.0E+0)
c
w(1) = four*v(1) + v(2)
do 100 j = 2,n-1
w(j) = v(j-1) + four*v(j) + v(j+1)
w(j) = v(j-1) + four*v(j) + v(j+1)
100 continue
j = n
w(j) = v(j-1) + four*v(j)
w(j) = v(j-1) + four*v(j)
c
c Scale the vector w by h.
c
@@ -458,8 +458,8 @@ c
end
c------------------------------------------------------------------------
c matrix vector subroutine
c where the matrix is the finite element discretization of the
c 1 dimensional discrete Laplacian on [0,1] with zero Dirichlet
c where the matrix is the finite element discretization of the
c 1 dimensional discrete Laplacian on [0,1] with zero Dirichlet
c boundary condition using piecewise linear elements.
c
subroutine av (n, v, w)
@@ -470,10 +470,10 @@ c
c
w(1) = two*v(1) - v(2)
do 100 j = 2,n-1
w(j) = - v(j-1) + two*v(j) - v(j+1)
w(j) = - v(j-1) + two*v(j) - v(j+1)
100 continue
j = n
w(j) = - v(j-1) + two*v(j)
w(j) = - v(j-1) + two*v(j)
c
c Scale the vector w by (1/h)
c
+39 -39
View File
@@ -1,9 +1,9 @@
program ssdrv5
program ssdrv5
c
c Program to illustrate the idea of reverse communication
c in Buckling mode for a generalized symmetric eigenvalue
c problem. The following program uses the two LAPACK subroutines
c sgttrf.f and sgttrs.f to factor and solve a tridiagonal system of
c problem. The following program uses the two LAPACK subroutines
c sgttrf.f and sgttrs.f to factor and solve a tridiagonal system of
c equations.
c
c We implement example five of ex-sym.doc in DOCUMENTS directory
@@ -21,8 +21,8 @@ c
c\BeginLib
c
c\References:
c 1. R.G. Grimes, J.G. Lewis and H.D. Simon, "A Shifted Block Lanczos
c Algorithm for Solving Sparse Symmetric Generalized Eigenproblems",
c 1. R.G. Grimes, J.G. Lewis and H.D. Simon, "A Shifted Block Lanczos
c Algorithm for Solving Sparse Symmetric Generalized Eigenproblems",
c SIAM J. Matr. Anal. Apps., January (1993).
c
c\Routines called:
@@ -34,7 +34,7 @@ c sgttrs LAPACK tridiagonal solve routine.
c saxpy Level 1 BLAS that computes y <- alpha*x+y.
c scopy Level 1 BLAS that copies one vector to another.
c sscal Level 1 BLAS that scales a vector by a scalar.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
@@ -54,7 +54,7 @@ c\Remarks
c 1. None
c
c\EndLib
c----------------------------------------------------------------------
c----------------------------------------------------------------------
c
c %-----------------------------%
c | Define leading dimensions |
@@ -66,7 +66,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn)
c
c %--------------%
@@ -75,7 +75,7 @@ c %--------------%
c
Real
& v(ldv,maxncv), workl(maxncv*(maxncv+8)),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& ad(maxn), adl(maxn), adu(maxn), adu2(maxn),
& ax(maxn), mx(maxn)
logical select(maxncv)
@@ -89,7 +89,7 @@ c
integer ido, n, nev, ncv, lworkl, info, j, ierr,
& nconv, maxitr, ishfts, mode
logical rvec
Real
Real
& h, sigma, r1, r2, tol
c
c %------------%
@@ -130,12 +130,12 @@ c | NCV, SIGMA to solve problems of different sizes, |
c | and to get different parts of the spectrum. |
c | However, The following conditions must be |
c | satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c | |
c | |
c | The shift SIGMA cannot be zero!!! |
c %--------------------------------------------------%
c %--------------------------------------------------%
c
n = 100
nev = 4
@@ -152,7 +152,7 @@ c
end if
bmat = 'G'
which = 'LM'
sigma = one
sigma = one
c
c %-----------------------------------------------------%
c | The work array WORKL is used in SSAUPD as |
@@ -166,7 +166,7 @@ c | generated in SSAUPD to start the Arnoldi iteration. |
c %-----------------------------------------------------%
c
lworkl = ncv*(ncv+8)
tol = zero
tol = zero
ido = 0
info = 0
c
@@ -185,8 +185,8 @@ c
mode = 4
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------------------%
c | Call LAPACK routine to factor the tridiagonal matrix |
@@ -203,10 +203,10 @@ c
do 20 j=1,n
ad(j) = two / h - sigma * r1
adl(j) = -one / h- sigma * r2
20 continue
20 continue
call scopy (n, adl, 1, adu, 1)
call sgttrf (n, adl, ad, adu, adu2, ipiv, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrf in _SDRV5.'
print *, ' '
@@ -226,8 +226,8 @@ c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call ssaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
call ssaupd ( ido, bmat, n, which, nev, tol, resid,
& ncv, v, ldv, iparam, ipntr, workd, workl, lworkl,
& info )
c
if (ido .eq. -1) then
@@ -246,10 +246,10 @@ c %-------------------------------------------%
c
call av (n, workd(ipntr(1)), workd(ipntr(2)))
c
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print *, ' '
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in SDRV5.'
print *, ' '
go to 9000
@@ -273,9 +273,9 @@ c | workd(ipntr(2)). |
c %------------------------------------------%
c
call scopy ( n, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV5.'
print *, ' '
@@ -306,7 +306,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
@@ -323,9 +323,9 @@ c
print *, ' '
print *, ' Error with _saupd, info = ',info
print *, ' Check the documentation of _saupd '
print *, ' '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -339,11 +339,11 @@ c %-------------------------------------------%
c
rvec = .true.
c
call sseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call sseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
if (ierr .ne. 0) then
if (ierr .ne. 0) then
c
c %------------------------------------%
c | Error condition: |
@@ -357,7 +357,7 @@ c
c
else
c
nconv = iparam(5)
nconv = iparam(5)
do 30 j=1, nconv
c
c %---------------------------%
@@ -412,7 +412,7 @@ c
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -432,7 +432,7 @@ c
c------------------------------------------------------------------------
c Matrix vector subroutine
c where the matrix is the 1-dimensional mass matrix
c arising from using piecewise linear finite elements on the
c arising from using piecewise linear finite elements on the
c interval [0,1].
c
subroutine mv (n, v, w)
@@ -444,10 +444,10 @@ c
c
w(1) = four*v(1) + v(2)
do 100 j = 2,n-1
w(j) = v(j-1) + four*v(j) + v(j+1)
w(j) = v(j-1) + four*v(j) + v(j+1)
100 continue
j = n
w(j) = v(j-1) + four*v(j)
w(j) = v(j-1) + four*v(j)
c
c Scale the vector w by h.
c
@@ -470,10 +470,10 @@ c
c
w(1) = two*v(1) - v(2)
do 100 j = 2,n-1
w(j) = - v(j-1) + two*v(j) - v(j+1)
w(j) = - v(j-1) + two*v(j) - v(j+1)
100 continue
j = n
w(j) = - v(j-1) + two*v(j)
w(j) = - v(j-1) + two*v(j)
c
c Scale the vector w by (1/h)
c
+47 -47
View File
@@ -1,9 +1,9 @@
program ssdrv6
program ssdrv6
c
c Program to illustrate the idea of reverse communication
c in Cayley mode for a generalized symmetric eigenvalue
c problem. The following program uses the two LAPACK subroutines
c sgttrf.f and sgttrs.f to factor and solve a tridiagonal system of
c in Cayley mode for a generalized symmetric eigenvalue
c problem. The following program uses the two LAPACK subroutines
c sgttrf.f and sgttrs.f to factor and solve a tridiagonal system of
c equations.
c
c We implement example six of ex-sym.doc in DOCUMENTS directory
@@ -23,8 +23,8 @@ c
c\BeginLib
c
c\References:
c 1. R.G. Grimes, J.G. Lewis and H.D. Simon, "A Shifted Block Lanczos
c Algorithm for Solving Sparse Symmetric Generalized Eigenproblems",
c 1. R.G. Grimes, J.G. Lewis and H.D. Simon, "A Shifted Block Lanczos
c Algorithm for Solving Sparse Symmetric Generalized Eigenproblems",
c SIAM J. Matr. Anal. Apps., January (1993).
c
c\Routines called:
@@ -36,7 +36,7 @@ c sgttrs LAPACK tridiagonal solve routine.
c saxpy Level 1 BLAS that computes y <- alpha*x+y.
c scopy Level 1 BLAS that copies one vector to another.
c sscal Level 1 BLAS that scales a vector by a scalar.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c snrm2 Level 1 BLAS that computes the norm of a vector.
c av Matrix vector multiplication routine that computes A*x.
c mv Matrix vector multiplication routine that computes M*x.
c
@@ -46,9 +46,9 @@ c Richard Lehoucq
c Chao Yang
c Dept. of Computational &
c Applied Mathematics
c Rice University
c Houston, Texas
c
c Rice University
c Houston, Texas
c
c\SCCS Information: @(#)
c FILE: sdrv6.F SID: 2.5 DATE OF SID: 10/17/00 RELEASE: 2
c
@@ -68,7 +68,7 @@ c | MAXNCV: Maximum NCV allowed |
c %-----------------------------%
c
integer maxn, maxnev, maxncv, ldv
parameter (maxn=256, maxnev=10, maxncv=25,
parameter (maxn=256, maxnev=10, maxncv=25,
& ldv=maxn)
c
c %--------------%
@@ -77,7 +77,7 @@ c %--------------%
c
Real
& v(ldv,maxncv), workl(maxncv*(maxncv+8)),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& workd(3*maxn), d(maxncv,2), resid(maxn),
& ad(maxn), adl(maxn), adu(maxn), adu2(maxn),
& temp(maxn), ax(maxn), mx(maxn)
logical select(maxncv)
@@ -100,9 +100,9 @@ c %------------%
c
Real
& zero, one, two, four, six
parameter (zero = 0.0E+0, one = 1.0E+0,
parameter (zero = 0.0E+0, one = 1.0E+0,
& four = 4.0E+0, six = 6.0E+0,
& two = 2.0E+0 )
& two = 2.0E+0 )
c
c %-----------------------------%
c | BLAS & LAPACK routines used |
@@ -132,9 +132,9 @@ c | NCV, SIGMA to solve problems of different sizes, |
c | and to get different parts of the spectrum. |
c | However, The following conditions must be |
c | satisfied: |
c | N <= MAXN, |
c | N <= MAXN, |
c | NEV <= MAXNEV, |
c | NEV + 1 <= NCV <= MAXNCV |
c | NEV + 1 <= NCV <= MAXNCV |
c %--------------------------------------------------%
c
n = 100
@@ -186,8 +186,8 @@ c
mode = 5
c
iparam(1) = ishfts
iparam(3) = maxitr
iparam(7) = mode
iparam(3) = maxitr
iparam(7) = mode
c
c %------------------------------------------------------%
c | Call LAPACK routine to factor (A-sigma*M). The |
@@ -203,10 +203,10 @@ c
do 20 j=1,n
ad(j) = two / h - sigma * r1
adl(j) = -one / h - sigma * r2
20 continue
20 continue
call scopy (n, adl, 1, adu, 1)
call sgttrf (n, adl, ad, adu, adu2, ipiv, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrf in _SDRV6.'
print *, ' '
@@ -226,8 +226,8 @@ c | either convergence is indicated or maxitr |
c | has been exceeded. |
c %---------------------------------------------%
c
call ssaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
call ssaupd ( ido, bmat, n, which, nev, tol, resid, ncv,
& v, ldv, iparam, ipntr, workd, workl, lworkl,
& info )
c
if (ido .eq. -1) then
@@ -239,19 +239,19 @@ c | user should provide his/her matrix vector (A*x, M*x) |
c | multiplication routines and a linear system solver |
c | here. The matrix vector multiplication routine takes |
c | workd(ipntr(1)) as the input vector. The final |
c | result is returned to workd(ipntr(2)). |
c | result is returned to workd(ipntr(2)). |
c %-------------------------------------------------------%
c
call av (n, workd(ipntr(1)), workd(ipntr(2)))
call mv (n, workd(ipntr(1)), temp)
call saxpy(n, sigma, temp, 1, workd(ipntr(2)), 1)
call saxpy(n, sigma, temp, 1, workd(ipntr(2)), 1)
c
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV6.'
print *, ' '
print *, ' '
go to 9000
end if
c
@@ -272,15 +272,15 @@ c | matrix vector multiplication routine takes |
c | workd(ipntr(1)) as the input, and the result is |
c | combined with workd(ipntr(3)) to form the input |
c | for the linear system solver. The final result is |
c | returned to workd(ipntr(2)). |
c | returned to workd(ipntr(2)). |
c %----------------------------------------------------%
c
call av (n, workd(ipntr(1)), workd(ipntr(2)))
call saxpy(n, sigma, workd(ipntr(3)), 1, workd(ipntr(2)), 1)
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
call sgttrs ('Notranspose', n, 1, adl, ad, adu, adu2, ipiv,
& workd(ipntr(2)), n, ierr)
if (ierr .ne. 0) then
print *, ' '
if (ierr .ne. 0) then
print *, ' '
print *, ' Error with _gttrs in _SDRV6. '
print *, ' '
go to 9000
@@ -309,7 +309,7 @@ c %-----------------------------------------%
c
go to 10
c
end if
end if
c
c %-----------------------------------------%
c | Either we have convergence, or there is |
@@ -328,7 +328,7 @@ c
print *, ' Check the documentation of _saupd. '
print *, ' '
c
else
else
c
c %-------------------------------------------%
c | No fatal errors occurred. |
@@ -342,8 +342,8 @@ c %-------------------------------------------%
c
rvec = .true.
c
call sseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
call sseupd ( rvec, 'All', select, d, v, ldv, sigma,
& bmat, n, which, nev, tol, resid, ncv, v, ldv,
& iparam, ipntr, workd, workl, lworkl, ierr )
c
c %----------------------------------------------%
@@ -357,7 +357,7 @@ c | corresponding to the eigenvalues in D is |
c | returned in V. |
c %----------------------------------------------%
c
if ( ierr .ne. 0 ) then
if ( ierr .ne. 0 ) then
c
c %------------------------------------%
c | Error condition: |
@@ -383,7 +383,7 @@ c | indicates how many are |
c | accurate to the requested |
c | tolerance) |
c %---------------------------%
c
c
nconv = iparam(5)
do 30 j=1, nconv
call av(n, v(1,j), ax)
@@ -423,7 +423,7 @@ c
& ' (NCV) is ', ncv
print *, ' What portion of the spectrum: ', which
print *, ' The number of converged Ritz values is ',
& nconv
& nconv
print *, ' The number of Implicit Arnoldi update',
& ' iterations taken is', iparam(3)
print *, ' The number of OP*x is ', iparam(9)
@@ -448,17 +448,17 @@ c on the interval [0,1].
c
subroutine mv (n, v, w)
integer n, j
Real
Real
& v(n), w(n), one, four, six, h
parameter (one = 1.0E+0, four = 4.0E+0,
& six = 6.0E+0)
parameter (one = 1.0E+0, four = 4.0E+0,
& six = 6.0E+0)
c
w(1) = four*v(1) + v(2)
do 100 j = 2,n-1
w(j) = v(j-1) + four*v(j) + v(j+1)
w(j) = v(j-1) + four*v(j) + v(j+1)
100 continue
j = n
w(j) = v(j-1) + four*v(j)
w(j) = v(j-1) + four*v(j)
c
c Scale the vector w by h.
c
@@ -469,7 +469,7 @@ c
c
c------------------------------------------------------------------------
c Matrix vector subroutine
c where the matrix is the stiffness matrix obtained from the
c where the matrix is the stiffness matrix obtained from the
c finite element discretization of the 1-dimensional discrete Laplacian
c on the interval [0,1] with zero Dirichlet boundary condition
c using piecewise linear elements.
@@ -482,14 +482,14 @@ c
c
w(1) = two*v(1) - v(2)
do 100 j = 2,n-1
w(j) = - v(j-1) + two*v(j) - v(j+1)
w(j) = - v(j-1) + two*v(j) - v(j+1)
100 continue
j = n
w(j) = - v(j-1) + two*v(j)
c
c
c Scale the vector w by (1/h).
c
h = one / real(n+1)
call sscal(n, one/h, w, 1)
call sscal(n, one/h, w, 1)
return
end

Some files were not shown because too many files have changed in this diff Show More