558 Commits
Author SHA1 Message Date
Franck HOUSSEN 6c7a3240d8 New upstream release.
arpack-ng / ubuntu_latest_cmake (push) Waiting to run
arpack-ng / ubuntu_latest_cmake_install (push) Waiting to run
arpack-ng / ubuntu_latest_autotools (push) Waiting to run
arpack-ng / ubuntu_latest_autotools_install (push) Waiting to run
arpack-ng / ubuntu_latest_cmake_python (push) Waiting to run
arpack-ng / ubuntu_latest_autotools_ilp64 (push) Waiting to run
arpack-ng / macos_latest_cmake (push) Waiting to run
arpack-ng / macos_latest_cmake_python (push) Waiting to run
arpack-ng / macos_latest_autotools (push) Waiting to run
arpack-ng / windows_latest_cmake (push) Waiting to run
2023-02-11 13:56:54 +01:00
easifem 2a7244b8a3 Improve README. 2023-02-11 13:56:54 +01:00
Franck HOUSSEN b8ab7a72c4 [CI] Run full test suite (including eigen tests). (#396) 2023-02-07 23:09:56 +01:00
Fabien Péan 6be238e703 Avoid removing macro _CRT_USE_C_COMPLEX_H if pre-existing (#393) 2023-01-27 19:27:44 +01:00
Fabien Péan 12814dc6b1 Run all examples for job windows_latest_cmake in CI (#392)
* Enable examples on CI for `windows_latest_cmake`

* Enable MPI for CI job `windows_latest_cmake`
2023-01-26 21:20:32 +01:00
Fabien Péan f4d7302a49 Fix library consumption from C++17 on Windows (#391) 2023-01-19 20:02:59 +01:00
Fabien Péan 6f58bb1974 Link to LAPACK before BLAS (#384) 2023-01-15 19:54:09 +01:00
Sylvestre Ledru af09793e70 Merge pull request #385 from FabienPean/patch-2
Make building tests an option in CMake
2023-01-15 18:37:17 +01:00
Fabien Péan f4823d97e6 Make building tests an option 2023-01-15 17:35:45 +01:00
Fabien Péan 282bd42fde Make building tests an option 2023-01-15 17:35:45 +01:00
Sylvestre Ledru 1278cb1001 Merge pull request #389 from FabienPean/fix/macos
Fix CI macOS jobs
2023-01-15 17:35:29 +01:00
Fabien Péan 4002c2733c Replace deprecated np.complex by built-in complex 2023-01-14 21:45:23 +00:00
Fabien Péan 81ed8ef3ec Fix CI for macOS 2023-01-14 21:45:02 +00:00
Juan José García RipollandFranck HOUSSEN db55a7ff41 Propagate dependencies in CMake configuration file (#377)
* Propagate dependencies in CMake configuration file

* Test that CMake find_package(arpackng) finds arpack in standard locations

Co-authored-by: Franck HOUSSEN <fghoussen@users.noreply.github.com>
2022-10-27 21:51:41 +02:00
Zhentao Wang 8ecf1be713 Add Ritz options (largest/smallest in real/imaginary parts) for complex routines 2022-08-20 21:30:21 +02:00
Zhentao Wang 36eaaf0791 [CLEAN] Shuffle the order of the functions inside parpack.h to be
consistent with those in parpack.hpp. Remove a few trailing white spaces
in pc/znaupd.f
2022-08-20 21:30:21 +02:00
Sylvestre Ledru 5131f792f2 Merge pull request #372 from fghoussen/fix_issue_332
Fix issue 332
2022-08-14 23:36:10 +02:00
Franck HOUSSEN 04e1b3c9db parpack: no ILP64 support. 2022-08-14 23:10:17 +02:00
Franck HOUSSEN 5c81720203 [CI - W10] bug_1315_single: easy tolerance as we deal with float. 2022-08-14 23:10:17 +02:00
Franck HOUSSEN 98bf1f1ade [BUG FIX] Fixing issue 332: rewrite icb_parpack_c*. 2022-08-14 23:10:02 +02:00
Franck HOUSSEN 68b2840c63 [BUG FIX] Use MPI ICB types (mpi_f08) instead of integer(kind=i_int). 2022-08-14 23:06:47 +02:00
Franck HOUSSEN e0d67054f5 [BUG FIX] According to lapack doc of ?larnv, iseed(4) must be odd. 2022-08-14 23:06:47 +02:00
Franck HOUSSEN ce2e69a849 [BUG FIX] Make sure iseed is always initialized to values allowed by
lapack ?larnv.

This means killing inits variable:
  - Using MPI, inits (shared variable) may be set to false by one proc,
    and prevent other procs to initialize seeds (as inits is shared by
    use of the save fortran keyword).
  - Not using MPI, inits only prevents from re-initializing seeds which
    have already been initialized.

This commit is not-op. From a functional point of view, we are doing
the same thing. From an implementation point of view, we make sure
iseed is always (for all MPI procs) initialized to values allowed
by lapack (if not, lapack crashes).

This problem doesn't occur with sequential code. Changes have been
done in both sequential and MPI code to keep things symmetric.
2022-08-14 23:06:47 +02:00
Zhentao Wang f36eb6c75d [BUG FIX] parpack.h\hpp: rwork should be real instead of complex. 2022-08-14 23:06:47 +02:00
Sylvestre Ledru 17e6bba6b2 Merge pull request #370 from luzpaz/typos/SRC
Fix typos in SRC/
2022-08-03 20:34:55 +02:00
luz paz 90e04f3afa Fix typos in SRC/
Found via `codespell -q 3 -L canot,coo,inout,reord,workd`
2022-08-03 13:29:43 -04:00
Franck HOUSSEN 13bc40022c How to use arpack-ng with Intel MKL. (#369) 2022-07-30 10:47:43 +02:00
Sylvestre Ledru d280435c25 Merge pull request #367 from fghoussen/fix_error_msg
arpackSolver: fix error messages.
2022-07-09 14:10:44 +02:00
Franck HOUSSEN 0c655a68cd arpackSolver: fix error messages. 2022-07-09 12:36:27 +02:00
Franck HOUSSEN 872df83b9e [CI] Test pyarpack on macos. (#365)
* [CI] Test pyarpack on macos.
* Fix pyarpack compilation warning: seems like default is python3 now.
* Improve pyarpack doc.
* pyarpack: run with latest boost-python version and require Boost >= 1.78.
2022-06-25 19:16:31 +02:00
Juan José García Ripoll d3cec6d67e Support for Microsoft's non-standard complex types (#334)
Replaced _Complex types with a_fcomplex and a_dcomplex in all C/C++ files.
Replaced uses of I and _Complex_I with the CMPLXand CMPLXF constructors.
For MSVC, defined those constructors as macros that call MSVC's functions.
Updated the CHANGES file.
2022-06-18 21:13:32 +02:00
Franck HOUSSEN 51249ebcfc [DOC] Add notes in pyarpack documentation. (#364) 2022-06-18 21:12:57 +02:00
Franck HOUSSEN 5eafea4328 Create one .cmake file per arpack-ng flavor (32-bits, 64-bits, ILP64). (#362) 2022-06-04 10:54:05 +02:00
Markus Mützel 83e6205289 Simplify build rules for CI on Windows (#361) 2022-06-04 10:30:16 +02:00
Jose E. Roman 08e2368179 Avoid isnan(), which is GNU-specific (#357)
The proposed solution relies on IEEE-754 standard definition of NaN,
https://stackoverflow.com/questions/17389958/is-there-a-standard-way-to-check-for-infinite-and-nan-in-fortran-90-95
2022-05-28 19:48:55 +02:00
Franck HOUSSEN 2683ada680 README.md: fix style. (#359) 2022-05-21 19:23:28 +02:00
Markus Mützel b3f48b7cb7 CMake: don't override BLAS/LAPACK/MPI flags. (#355) 2022-05-21 19:21:28 +02:00
Franck HOUSSEN 7124d622ab Test install with ITF64 suffix. (#356) 2022-05-07 23:00:18 +02:00
Markus Mützel 5465aee30e cmake: handle libraries without "lib" prefix. 2022-05-01 13:45:16 +02:00
Franck HOUSSEN bf82f61b13 [BUG FIX] Test install.
CMake may change install directory structure (local/lib or
local/lib/arch). Use find to prevent tests from this.
2022-04-30 18:42:28 +02:00
Franck HOUSSEN e7abe8b42b Test install with suffix. (#352) 2022-04-24 22:14:28 +02:00
Franck HOUSSEN 9331036702 Test autotools pkg-config (*.pc files). (#351) 2022-04-23 23:08:08 +02:00
Franck HOUSSEN 3ba4dbfbe9 Test install cmake (#350)
Test CMake find_package (*.cmake files).
2022-04-23 22:44:06 +02:00
Tom Payerle 1f4c1e0a44 Change the continuation line format for stat.h, debug.h (#339)
Change the continuation line format for stat.h, debug.h

AOCC flang compiler is complaining about the continuation lines in these
two files.  It does not complain about similar continuation lines in
files (e.g. SRC/icbacn.F90), so I believe this is due to flang setting
the Fortran dialect to something like F77 for most of the compilations,
which cause problems with these *.h files.

I cannot find a way to force flang Fortran dialect to accept the & at
end of line continuation marker, so this patch changes the continuation
lines in these two files (stat.h, debug.h) to use continuation marker in
column 6.

This should fix #300
2022-04-23 18:42:25 +02:00
prj- a5155ee72b [c,z]dotc => [cc,zz]dotc (#346)
[c,z]dotc => [cc,zz]dotc
2022-04-17 21:56:24 +02:00
Franck HOUSSEN 7e85cb19ad CI: fix github-actions workflow.
c45094c broke the workflow: CI triggered on PR (modified code) was
actually testing master codebase (untouched code). Solution:
- Drop pull_request_target: use pull_request
- Drop all docker jobs (which need pull_request_target to be based
  on master to be able to access opencollab secrets)
- Remove opencollab secrets (docker login and password)
- Drop coverage jobs (OK with TravisCI but never worked with
  github-actions)
2022-04-10 20:00:13 +02:00
Dima Pasechnik 645db9e647 Fortran intrinsic: replace non standard (dimag) function with standard (aimag) one. (#318)
Fortran intrinsic: replace non standard (dimag) function with standard (aimag) one. Nagfor compiler fix.
2021-10-17 19:34:40 +02:00
Dima Pasechnik 9cd6c25cb9 Replace obsolete macro AC_TRY_COMPILE (#325)
* Replace obsolete macro AC_TRY_COMPILE

This is to pacify autoconf 2.70 and 2.71,
which otherwise print warnings, etc.

* Update CHANGES
2021-10-16 17:13:27 +02:00
Franck HOUSSEN c45094c758 Github Actions: enable access to opencollab secrets for docker jobs. 2021-10-07 19:26:00 +02:00
Franck HOUSSEN 3b5dab9c93 [BUG FIX] arpackmm: command line sanity checks. 2021-10-04 22:50:56 +02:00
Franck HOUSSEN e3a1f97f2a [BUG FIX] arpackmm: Cut-off in case previous run used different nbDim. 2021-10-04 22:50:56 +02:00
Franck HOUSSEN 5f9bd674b1 [BUG FIX] Compile C programs with ICB. 2021-10-04 22:50:16 +02:00
Franck HOUSSEN 38902e024c [BUG FIX] BLAS/LAPACK: allow suffixes in case BLAS/LAPACK can not provide ICB. 2021-10-04 22:50:16 +02:00
Franck HOUSSEN c7382178cf [BUG FIX] autotools: ICB must be checked first (MPI changes compilers). 2021-10-04 22:50:16 +02:00
Dima Pasechnik 5cc85ad6f6 Allow triggering GitHub Actions for PRs (#322) 2021-10-04 22:14:54 +02:00
Dima Pasechnik 5c28eac0b3 CI based on GitHub Actions only (#317) 2021-09-29 09:57:06 +02:00
Haoyang Liu 0a655d918d [TravisCI] Add support for centos:7 (#304)
* CI: add support for centos:7
* add wrapper for centos builds
2021-04-02 17:44:53 +02:00
Haoyang Liu 51b299cba0 CMake : add C99 standard, move to CMake3 (#298)
* update CMakeLists.txt:
- add C99 standard checking to `CMakeLists.txt`
  older compilers may not enable this by default.
- change minimum cmake version to 3.0
  cmake2 does not recognize `add_library(... INTERFACE ...)`

* update CHANGES
2021-03-28 14:15:33 +02:00
Robert Schütz 47fc83cb37 [BUG FIX] Use CMAKE_INSTALL_FULL_<dir> in arpack.pc (#301)
CMAKE_INSTALL_<dir> cannot be assumed to be relative to CMAKE_INSTALL_PREFIX.
See https://github.com/jtojnar/cmake-snips#assuming-cmake_install_dir-is-relative-path.
2021-03-27 09:29:22 +01:00
Haoyang Liu deb47b5682 Fix ci (#299)
[TravisCI] : Fixing CI.
2021-03-26 21:58:56 +01:00
Sylvestre Ledru e3bdd3b8db prepare future release 2020-12-07 11:41:40 +01:00
Sylvestre Ledru 7b7ce1a46e New upstream release 2020-12-07 11:40:45 +01:00
Sylvestre Ledru 896df0aa88 Merge pull request #259 from turboencabulator/buildfixes
Miscellaneous build fixes
2020-11-30 14:41:15 +01:00
Kyle Guinn 4345d4af51 Fix variable name typo 2020-11-23 22:46:29 -06:00
Kyle Guinn 1da025c2d3 Update arpack-ng-config.cmake to match pkgconfig files
Removes the manual search for library files (where the static lib was
preferred by default), instead passes the library name as a -l flag so
the system can search for it in the preferred manner.

MPI libraries and includes should not be part of PARPACK's interface,
instead they belong in the equivalent of Libs.private/Requires.private
in the pkgconfig files.  Remove them.

PARPACK has no header files of its own.  Remove them from the
target_include_directories stuff.
2020-11-23 22:38:41 -06:00
Kyle Guinn a583f7d6a5 Add arpackSolver.pc 2020-11-23 22:16:41 -06:00
Kyle Guinn 93a3016fc5 Clean a few more files 2020-11-23 22:16:41 -06:00
Kyle Guinn 068a40817b Add parpack.pc 2020-11-23 22:16:41 -06:00
Kyle Guinn c5e7b021dd Fix the cmake library directory 2020-11-23 22:16:41 -06:00
Kyle Guinn 1d84a81b8f Attempt to make cmake files identical when generated by autotools 2020-11-23 21:29:57 -06:00
Kyle Guinn d1a29c2947 Revert "[BUG FIX] fix cmake/pc files: enable linking from outside. (#216)"
See discussion in #221.

This reverts commit c43cb86854.
2020-11-23 01:58:21 -06:00
Kyle Guinn c06ad87196 Attempt to make arpack.pc identical when generated by CMake 2020-11-23 01:44:48 -06:00
Kyle Guinn fd1a146fbe Fix pkg-config fallback for Eigen3
Use QUIET to suppress warnings about missing FindEigen3.cmake.

pkg_check_modules defines EIGEN3_INCLUDE_DIRS, not EIGEN3_INCLUDE_DIR,
so define the latter as the former.
2020-11-23 01:28:23 -06:00
Kyle Guinn 3914dcbe3b Remove Eigen3 from arpack.pc
Eigen3 is only needed for arpackSolver.hpp, which is independent from
the library.  If desired, a separate pkg-config file should be created
for the solver itself, which should contain something like:

    Requires: arpack, eigen3 >= 3.3

Also remove Eigen3 from arpack-ng-config.cmake since it serves the same
purpose.
2020-11-23 01:19:32 -06:00
Kyle Guinn b42216cbb6 Install arpackSolver.hpp alongside other headers 2020-11-23 01:09:12 -06:00
Kyle Guinn fd2fc43dbc Don't build static libs by default
I believe many of the incorrect dependency problems are due to building
static libs, which don't contain any dependency info.

If needed, these can be enabled with --enable-static (for autotools) or
-DBUILD_SHARED_LIBS=OFF (for cmake).
2020-11-23 00:56:22 -06:00
Kyle Guinn f85e91fa99 Remove SH_LOG_COMPILER
SH_LOG_COMPILER has no effect since TEST_EXTENSIONS does not contain .sh

The test driver runs the script directly and therefore uses its #! line
to find the appropriate shell and its options.

This partially reverts commit 8fe4734da8.
2020-11-23 00:54:33 -06:00
Kyle Guinn 5fbe6161c2 Switch back to the default pkg-config error text
The original issue (#183) appears to be some sort of syntax error,
likely from not having pkg-config installed at the time of generating
the configure script.  Specifying our own error text won't improve that
problem.

This reverts commit ad9f74b962.
2020-11-23 00:54:05 -06:00
Kyle Guinn d513128421 Update to latest versions of ax_blas.m4 and ax_lapack.m4 2020-11-23 00:53:18 -06:00
badshah400andAtri Bhattacharya 4d5e71774e [BUG FIX] Compare difference to 0 for equality. (#272)
In bug_79_double_complex, the bitwise comparison `res1 .ne. res2`
returns true on some archs (i586) though `res1` and `res2` are equal
upto double precision. Instead compare the absolute value of their
difference to double precision 0 which works on all archs. Fixes #269.

Co-authored-by: Atri Bhattacharya <A.Bhattacharya@uliege.be>
2020-11-19 23:19:09 +01:00
Franck HOUSSEN 8a129088e1 [BUG FIX] TravisCI: openmpi not found on osx. (#285)
* [BUG FIX] TravisCI: openmpi not found on osx.

* [BUG FIX] TravisCI: docker does no more provide this linuxmint image.
2020-11-19 23:03:53 +01:00
Myron OikonomakisandMyron Ekonomakis 455a0d6966 Fix a typo in arpack.hpp + some issues in iso_c_binding (#258)
* Fix a typo in arpack.hpp + fome issues in iso_c_binding

* changes in iso_c_binding regarding scalar chars in PARPACK

* document changes in CHANGES file

Co-authored-by: Myron Ekonomakis <myr_oikon@hotmail.com>
2020-11-19 23:03:29 +01:00
Sylvestre Ledru 01297eee88 Merge pull request #282 from fghoussen/issue281
[CMake] Use targets following "modern CMake".
2020-09-04 22:10:31 +02:00
Franck HOUSSEN ff93cbc53b [CMake] Use targets following "modern CMake". 2020-08-14 23:01:04 +02:00
Sylvestre Ledru 2d097e4a6a Merge pull request #280 from fghoussen/osx
[TravisCI] OS X: running the whole test suite.
2020-08-09 17:49:33 +02:00
Sylvestre Ledru abc2fabc1c Merge branch 'master' into osx 2020-08-09 17:49:20 +02:00
Franck HOUSSEN a04cf112ea Update changelog. 2020-08-09 17:47:22 +02:00
Sylvestre Ledru 4f993fdfe9 Merge pull request #265 from fghoussen/centos
TravisCI: add centos build.
2020-08-09 13:35:34 +02:00
Sylvestre Ledru 44554d2094 Merge pull request #279 from fghoussen/cov
[BUG FIX] coverage.
2020-08-09 13:35:03 +02:00
Franck HOUSSEN e0c308841e [TravisCI] OS X: running the whole test suite. 2020-08-09 13:02:29 +02:00
Franck HOUSSEN e260d411ea [BUG FIX] coverage.
With newer versions of cmake, an unquoted 6th argument gives the
following error:

    STRING sub-command REGEX, mode REPLACE needs at least 6 arguments
    total to command.

Quoting this fixes the issue.
2020-07-27 22:14:03 +02:00
Franck HOUSSEN f475fd9bee [TravisCI] Add centos build. 2020-07-20 21:39:57 +02:00
Sylvestre Ledru b350513ddc Merge pull request #270 from fghoussen/opensuse
TravisCI: add opensuse build.
2020-07-20 13:58:26 +02:00
Sylvestre Ledru 2354e51961 Merge pull request #275 from fghoussen/osx
[TravisCI] Test osx formula.
2020-07-20 13:57:43 +02:00
Sylvestre Ledru e1a003d9ca Merge pull request #277 from fghoussen/mint
[TravisCI] Add linuxmint job.
2020-07-20 13:57:08 +02:00
Franck HOUSSEN 3db367d0ff [TravisCI] Add linuxmint job. 2020-07-19 20:04:51 +02:00
Franck HOUSSEN df811f8441 [TravisCI] Rename existing jobs. 2020-07-19 20:04:51 +02:00
Franck HOUSSEN a0db6e8593 [TravisCI] Make CI faster : kill old not-so-usefull jobs. 2020-07-19 17:25:24 +02:00
Franck HOUSSEN 34ab5be34f [TravisCI] : add eoan / focal build. 2020-07-19 17:24:27 +02:00
Franck HOUSSEN 6b752a10ae [TravisCI] Test osx formula. 2020-07-18 21:03:24 +02:00
Franck HOUSSEN ce58425a01 TravisCI: add opensuse build. 2020-06-17 19:48:11 +02:00
mergify[bot] e50818137a Merge pull request #263 from dschwoerer/fedora-travis
Fedora travis
2020-06-08 08:52:43 +00:00
David Schwörer bb9f75a637 Fix bad merge 2020-06-08 09:46:31 +02:00
dschwoerer 2aabeab53a Merge branch 'master' into fedora-travis 2020-06-08 08:27:45 +01:00
Sylvestre Ledru 82c193b909 Merge pull request #264 from fghoussen/changelog
Update changelog.
2020-06-05 19:56:17 +02:00
Franck HOUSSEN 0692c687cf Update changelog. 2020-06-05 18:51:04 +02:00
Sylvestre Ledru 63c1819252 Switch eigen version to latest one 2020-06-05 18:09:10 +02:00
Franck HOUSSEN 745114243c Revert "coverage: EXMM with -g1."
This reverts commit 6cd4d53934.
2020-06-04 09:50:05 +02:00
Franck HOUSSEN dfd801dbc6 Revert "coverage: gcc mem param."
This reverts commit 61b721932b.
2020-06-04 09:50:00 +02:00
Franck HOUSSEN 2803f701e6 Revert "debug ?"
This reverts commit be0c0b07b6.
2020-06-04 09:49:56 +02:00
Franck HOUSSEN 277e9e56ce Revert "param value."
This reverts commit 3b7aca7b26.
2020-06-04 09:49:52 +02:00
Franck HOUSSEN 3b7aca7b26 param value. 2020-06-03 21:49:21 +02:00
Franck HOUSSEN be0c0b07b6 debug ? 2020-06-03 20:13:49 +02:00
Franck HOUSSEN 61b721932b coverage: gcc mem param. 2020-06-03 11:22:55 +02:00
Franck HOUSSEN 6cd4d53934 coverage: EXMM with -g1. 2020-06-03 11:11:31 +02:00
Franck HOUSSEN face704209 suppress exmm (but keep icb) from coverage. 2020-06-02 22:56:13 +02:00
Franck HOUSSEN 6491e7774a Revert "debug ?"
This reverts commit 0c883893e8.
2020-06-02 22:54:44 +02:00
Franck HOUSSEN 0c883893e8 debug ? 2020-06-02 17:06:33 +02:00
Franck HOUSSEN b38933b98c Do test 'icb-exmm' on bionic which may have eigen 3.3 ! 2020-06-02 15:19:31 +02:00
Franck HOUSSEN 124c541c5f Do not test 'icb-exmm' on xenial whiach has not yet eigen 3.3 ! 2020-06-02 15:18:31 +02:00
David Schwörer d3e7f0dab8 Show names in travis 2020-06-02 13:26:55 +01:00
David Schwörer f1373935ad Reduced depencies in test 2020-06-02 13:26:55 +01:00
Franck HOUSSEN f2a747c98a Use latest version of eigen. 2020-06-02 09:05:25 +02:00
Franck HOUSSEN c89b848a20 Revert README. 2020-06-01 22:18:17 +02:00
Franck HOUSSEN aa20bc5b8e ILP64 : need to use docker. mkl can't be installed from bionic. 2020-06-01 22:11:39 +02:00
Franck HOUSSEN fa8a1634a0 update needed to get mkl ? 2020-06-01 20:49:45 +02:00
Franck HOUSSEN caaac63f3d cov build break : no idea why - return to xenial ?... 2020-06-01 18:50:17 +02:00
Franck HOUSSEN 6952afef4f cd $TRAVIS_BUILD_DIR 2020-06-01 13:11:28 +02:00
Franck HOUSSEN 1a1371a166 Testing if ilp build can be achieved easily now on bionic with cmake. 2020-06-01 11:47:52 +02:00
Franck HOUSSEN a38b411291 move fedora up as it's tested first. 2020-06-01 11:27:37 +02:00
Franck HOUSSEN 2ddb03cf46 add sudo. 2020-06-01 11:26:34 +02:00
Franck HOUSSEN a5b0573808 move specific install in 'before_install' section. 2020-05-31 23:23:10 +02:00
Franck HOUSSEN 4e02e69902 TravisCI: use bionic as it's now available ! Dropping docker. 2020-05-31 22:55:01 +02:00
Franck HOUSSEN 8a97c96134 Try to run interface64 job with ubuntu (more stable than debian/testing). 2020-05-31 22:12:32 +02:00
Franck HOUSSEN 984335a15a [BUG FIX - TravisCI]: fix Interface64 job. 2020-05-31 18:58:56 +02:00
Franck HOUSSEN 160b572315 [BUG FIX - Architecture]: arpackdef.h for C/C++, and, arpackicb.h for F77/F90. (#249) 2020-05-31 14:01:20 +02:00
Sylvestre Ledru 6dcecc8eef Update the coding style (#256)
* clang-format the C++ codebase

* clang-format the C code
2020-03-21 18:47:59 +01:00
mergify[bot] 4a12554877 Merge pull request #257 from fghoussen/doc
pyarpack: improve documentation.
2020-03-03 13:17:54 +00:00
Franck HOUSSEN 07739ac229 pyarpack: improve python module documentation. 2020-03-03 13:18:36 +01:00
Franck HOUSSEN 259a1596a5 pyarpack: improve README documentation. 2020-03-03 13:17:45 +01:00
Franck HOUSSEN 5c988b0f41 [BUG FIX - ICB] iparam/ipntr sizes may change depending on cases. (#247)
* [BUG FIX - ICB] iparam/ipntr sizes may change depending on cases.

>> git grep "integer[ ]*iparam" SRC/*[ae]upd*.f
SRC/cnaupd.f:      integer    iparam(11), ipntr(14)
SRC/cneupd.f:      integer    iparam(11), ipntr(14)
SRC/dnaupd.f:      integer    iparam(11), ipntr(14)
SRC/dneupd.f:      integer    iparam(11), ipntr(14)
SRC/dsaupd.f:      integer    iparam(11), ipntr(11)
SRC/dseupd.f:      integer    iparam(7), ipntr(11)
SRC/snaupd.f:      integer    iparam(11), ipntr(14)
SRC/sneupd.f:      integer    iparam(11), ipntr(14)
SRC/ssaupd.f:      integer    iparam(11), ipntr(11)
SRC/sseupd.f:      integer    iparam(7), ipntr(11)
SRC/znaupd.f:      integer    iparam(11), ipntr(14)
SRC/zneupd.f:      integer    iparam(11), ipntr(14)

>> git grep "integer[ ]*iparam" PARPACK/SRC/MPI/*[ae]upd*.f
PARPACK/SRC/MPI/pcnaupd.f:      integer    iparam(11), ipntr(14)
PARPACK/SRC/MPI/pcneupd.f:      integer    iparam(11), ipntr(14)
PARPACK/SRC/MPI/pdnaupd.f:      integer    iparam(11), ipntr(14)
PARPACK/SRC/MPI/pdneupd.f:      integer    iparam(11), ipntr(14)
PARPACK/SRC/MPI/pdsaupd.f:      integer    iparam(11), ipntr(11)
PARPACK/SRC/MPI/pdseupd.f:      integer    iparam(7), ipntr(11)
PARPACK/SRC/MPI/psnaupd.f:      integer    iparam(11), ipntr(14)
PARPACK/SRC/MPI/psneupd.f:      integer    iparam(11), ipntr(14)
PARPACK/SRC/MPI/pssaupd.f:      integer    iparam(11), ipntr(11)
PARPACK/SRC/MPI/psseupd.f:      integer    iparam(7), ipntr(11)
PARPACK/SRC/MPI/pznaupd.f:      integer    iparam(11), ipntr(14)
PARPACK/SRC/MPI/pzneupd.f:      integer    iparam(11), ipntr(14)

* Kill else.
2020-03-02 22:49:21 +01:00
Sylvestre Ledru addf1b0906 Revert "Rename the python files" - wasn't supposed to land now
This reverts commit d153dffb80.
2020-03-02 22:20:06 +01:00
Sylvestre Ledru d153dffb80 Rename the python files 2020-03-02 21:58:19 +01:00
mergify[bot] 03b65e5169 Merge pull request #253 from fghoussen/issue252
[BUG FIX] configure must be Bourne shell compatible.
2020-03-01 22:00:45 +00:00
Franck HOUSSEN 79204e9713 [BUG FIX] configure must be Bourne shell compatible. 2020-03-01 21:58:32 +01:00
turboencabulator 35bffac439 Don't hard-code installation paths (#250)
Move all installation commands after include(GNUInstallDirs) so that the
CMAKE_INSTALL_* variables have correct values at the time of use.

This reverts commit 6b04aa4bcc.
2020-02-29 18:49:16 +01:00
mergify[bot] 7438db1327 Merge pull request #251 from fghoussen/clean
[CLEAN] pyarpack: does not python2.
2020-02-29 13:36:21 +00:00
Franck HOUSSEN 6d5ded77f9 [CLEAN] pyarpack: does not python2. 2020-02-29 13:36:48 +01:00
Franck HOUSSEN cfdb5f680f pyarpack: python binding based on Boost.Python.Numpy exposing C++ API. (#238)
* pyarpack: python binding based on Boost.Python.Numpy exposing C++ API.

* py3.
2020-02-26 12:32:59 +01:00
dschwoererandSylvestre Ledru ad82dcbc0b gcc-10 (parpack) and mpich (#245)
* port PARPACK also to gcc 10

* Ensure that the output buffer is a rank-1 vector

The vector should also not be a temporary, so that we
can use the result.

* use valid address of binary

openmpi ignores this error, but mpich doesn't

* Add travis test with gcc 10 and mpich

* After pulling fedora:rawhide, use fedora:rawhide

* simplify travis tests for fedora

* run using bash -v (permissions issue otherwise)

* run using bash -v (permissions issue otherwise)

* fix permission of script

* Add she-bang to allow execution

* fix test for fedora

Co-authored-by: Sylvestre Ledru <sledru@mozilla.com>
2020-02-24 10:05:43 +01:00
mergify[bot] 3dd2d5fe97 Merge pull request #239 from dschwoerer/master
?vout expects a vector, so make sure to pass a vector
2020-02-19 23:35:30 +00:00
Sylvestre Ledru 2535b97caf Update CHANGES 2020-02-19 23:17:48 +01:00
David Schwörer 0c22019c6c Update changelog 2020-02-19 22:03:52 +00:00
Franck HOUSSEN 6b04aa4bcc [BUG FIX] pc and cmake files: accounting for lib64. (#235) 2020-02-19 22:34:42 +01:00
Franck HOUSSEN 5100a99c1a parpack.hpp: don't use complex.h C macros. (#236) 2020-02-19 22:33:59 +01:00
Franck HOUSSEN 1eff779f74 [TravisCI] Add osx job (#234)
* parpack.hpp: don't use complex.h C macros.

* [BUG FIX] fix autotools build on osx.

* [TravisCI] Add osx job.

Full build but only partial testing as some tests crash on osx.
2020-02-19 22:33:34 +01:00
Franck HOUSSEN 1cfa486a50 arpackSolver: cleaning, refactoring. (#237) 2020-02-19 22:32:19 +01:00
mergify[bot] 77b451835e Merge pull request #240 from dschwoerer/travis
Various minor improvements for fedora test
2020-02-19 21:31:49 +00:00
David Schwörer e7fac50201 Various minor improvements for fedora test:
* yum is deprecated and an alias for dnf
* update is a deprecated alias to upgrade, so only use upgrade
* install all packages in one go is faster
* prefer fedoraproject registry, which is generally more up-to-date
2020-02-19 20:48:51 +00:00
David Schwörer 9418632214 ?vout expects a vector, so make sure to pass a vector
gcc10 throws an error otherwise
2020-02-19 20:07:47 +00:00
mergify[bot] 3f7b86adde Merge pull request #229 from jschueller/complexi
arpack.hpp: Dont use complex.h C macros
2019-11-26 11:54:42 +00:00
Julien Schueller 4bc2349330 arpack.hpp: Dont use complex.h C macros
Fixes build with llvm on osx, as with libc++
including complex.h just gives you the c++ header.
2019-11-26 11:58:33 +01:00
Sylvestre Ledru 7098047b71 Improve mergify 2019-11-26 10:26:05 +01:00
Sylvestre Ledru 1ae541f4a1 Enable mergify.io 2019-11-26 10:25:43 +01:00
GillianGrayson 531d24c41f Removed unnecessary export (#228) 2019-11-17 16:52:33 +01:00
Franck HOUSSEN 6fa8b271c0 [API] arpackSolver: API change. (#222)
* [BUG FIX] ICB using rvec/select: rvec/select turned to integer.

bool should be, but, is not always supported (depend on compiler, options).

* [CLEAN] arpackSolver API: clean + more convenient.
2019-10-11 17:03:45 +02:00
Sylvestre Ledru 21db0cd83a fix some typos 2019-10-06 21:41:42 +02:00
Franck HOUSSEN 8a46621c64 [BUG FIX] Fix pc/cmake files. (#221) 2019-07-14 09:45:06 +02:00
Franck HOUSSEN 6e2893f17f Arpack solver (#217)
* TravisCI: fix ILP64 job. No need for security.debian.org.

* Extract arpackSolver.hpp from arpackmm.cpp.
arpackSolver.hpp is added in the install directory.
2019-07-08 13:11:25 +02:00
Franck HOUSSEN 6254162e2e TravisCI: fix ILP64 job. No need for security.debian.org. (#220) 2019-07-08 13:10:31 +02:00
Franck HOUSSEN c0725738d7 [BUG FIX] Install: generating crossed cmake/pc files. (#219)
* TravisCI: fix ILP64 job. No need for security.debian.org.

* [BUG FIX] Install: generating crossed cmake/pc files.
Add cmake/autotool variables in autotool/cmake to generate pc/cmake files.
2019-07-08 13:10:20 +02:00
Franck HOUSSEN c43cb86854 [BUG FIX] fix cmake/pc files: enable linking from outside. (#216) 2019-07-05 08:33:38 +02:00
Franck HOUSSEN 92787d9bcc Issue63 (#213)
* Generate arpack.pc when configuring with cmake

* Fix detection using pkg-config

* Use correct cmake variable names
2019-05-23 22:55:46 +02:00
Izaak "Zaak" Beekman dbe1582b5f Update CHANGES for #210/#211 (#212) 2019-05-14 16:34:20 +03:00
Izaak "Zaak" Beekman f40f5f92ff Fix CMake bug when enabling ISO_C_binding support (#211)
- Fixes #210
2019-05-14 11:04:58 +03:00
Franck HOUSSEN 10fb0c301c [BUG FIX] ILP64 support: using debug_c and stat_c. (#196) 2019-04-01 10:45:32 +02:00
Franck HOUSSEN f5aead95fd [BUG FIX] fix check precision which may fail with some ATLAS versions. (#198) 2019-04-01 10:44:02 +02:00
Franck HOUSSEN c34f762fcd CI: Add ubuntu:bionic using docker. (#209)
[BUG FIX]: fix 'eval: Syntax error: "(" unexpected' error at build time.
Note: for CI, pkg-config and libtool must be added when using autotools.
2019-03-15 08:21:50 +01:00
Franck HOUSSEN f670e731b7 CI: add fedora build via docker run. (#199) 2019-03-10 22:28:52 +01:00
Franck HOUSSEN a26b727bc4 Update changelog. (#208) 2019-03-02 22:58:58 +01:00
Franck HOUSSEN 1dab774991 autotools: provide *.cmake files (in addition to *.pc file). (#207)
note: cmake provides both *.pc and *.cmake files.
2019-03-02 18:55:55 +01:00
Franck HOUSSEN 6615574e37 arpackmm: add --dense option. (#194) 2019-03-02 18:54:50 +01:00
Franck HOUSSEN 8fe4734da8 arpackmm: run test script with bash. (#206) 2019-03-02 18:53:51 +01:00
Franck HOUSSEN dfc8abd708 [BUG FIX] arpack may succeed to compute more EV than expected. (#197) 2019-02-13 17:01:22 +01:00
Franck HOUSSEN a98f85544f CI: make docker-run builds aware of PR commits. (#200)
Note: `-` was missing in `-enable-icb-exmm`, replaced with `--enable-icb`.
2019-02-13 16:59:34 +01:00
Franck HOUSSEN 5fff9efa5c CMake: make build dir look like source dir. (#201)
* CMake: make build dir look like source dir.

* CMake: provide files for coverage.
2019-02-12 14:17:12 +01:00
Franck HOUSSEN 7ae47646d4 CI: reduce logs, fix precision problem, increase coverage. (#193) 2019-01-27 10:12:39 +01:00
Franck HOUSSEN e10f589232 arpackmm: refactorisation, documentation, help, add timers. (#191) 2019-01-24 20:17:51 +01:00
Franck HOUSSEN 9112422e3b arpackmm: add missing options in option summary. (#190) 2019-01-23 18:50:53 +01:00
Franck HOUSSEN 3596f02a3e Arpackmm: add --simplePrec option (to enable use of [sc]*upd). (#189)
* arpackmm: factorisation before adding new option.

* arpackmm: add --simplePrec option (to enable use of [sc]*upd).
2019-01-23 18:35:55 +01:00
Franck HOUSSEN bc5cb025c8 Arpackmm (#188)
* arpackmm: add --slv LLT/LDLT.

* arpackmm: get consistent direct solver cmd line (kill --slvDrtPvtThd).
2019-01-20 23:10:05 +01:00
Franck HOUSSEN 6657ca2cca arpackmm: add --slvItrPC option (PC: Jacobi, ILU). (#187) 2019-01-14 15:47:42 +01:00
Franck HOUSSEN fee44e613d Add parpack files in the coveralls report. (#184) 2019-01-13 20:34:04 +01:00
Franck HOUSSEN ad9f74b962 Add error message if eigen is not found at configure time (autotools). (#185)
* Add error message if eigen is not found at configure time (autotools).

* Update configure.ac

Co-Authored-By: fghoussen <fghoussen@users.noreply.github.com>
2019-01-13 20:33:43 +01:00
Sylvestre Ledru a580f6fc10 update of the release date 2019-01-12 16:24:12 +01:00
Sylvestre Ledru 2dc21c1af9 fix the path 2019-01-12 15:17:39 +01:00
Sylvestre Ledru a1a08e6eea add more files in the coverages analysis 2019-01-12 14:55:55 +01:00
Sylvestre Ledru 92828f62e1 revert the removal of the space 2019-01-12 14:23:51 +01:00
Sylvestre Ledru 661fcdac82 also build C/C++ using the coverage flags 2019-01-12 13:53:29 +01:00
Sylvestre Ledru e99054735d fix a typo 2019-01-12 13:50:09 +01:00
Franck HOUSSEN 7317371abd arpackmm: add --schur option. (#181) 2019-01-11 09:46:39 +01:00
Franck HOUSSEN c957f8c43e arpackmm: add --slvDrtPvtThd option. (#180) 2019-01-11 08:22:37 +01:00
Franck HOUSSEN 56c2791dc6 [CLEAN] add .dirstamp in .gitignore. (#177) 2019-01-11 08:21:49 +01:00
Kyle Guinn 1e0348423e Update CHANGES 2019-01-11 08:21:30 +01:00
Franck HOUSSEN 3d3bcd0c49 arpackmm: add --cpxPb option (run with zn[ae]upd). (#174) 2019-01-10 16:02:15 +01:00
Sylvestre Ledru e67badf1e2 Add back the coveralls push (#175) 2019-01-10 14:46:56 +01:00
turboencabulator 998b89840e Autotools cleanup (#172)
* Version numbers need to be kept up-to-date

* arpack.pc:  includedir should match the corresponding ./configure option

* Override pkgincludedir instead of creating a new directory variable

* Supplying arguments to AC_OUTPUT is obsolete behavior

* Distribute the entire source regardless of build options

Otherwise you won't be able to build ICB/MPI/etc. if the tarball wasn't
originally built with those options, because those files will be
missing.  Missing files leads to more breakage.

DIST_SUBDIRS is handled automatically.

* Clean up conditional recursion into subdirectories

Don't need to check for ICB inside a subdirectory if it won't be
descended into from the parent directory.

* Fix various include path problems

Should be using $(top_srcdir), not $(top_builddir).
-I flags go in CPPFLAGS, not CFLAGS nor FCFLAGS.

* Minor rearrangement of autoconf macros

Put all AC_CONFIG_*s together near the end.
Put all AM_CONDITIONALs together near the end.  These should never be
conditionally expanded.

* Run Fortran flag tests against the correct compiler

* Simplify --enable arguments

AC_HELP_STRING has been replaced by AS_HELP_STRING.
Setting enable_foo to $enableval is an unnecessary self-assignment.

* Fix missing files in the distribution

* Simplify creation of arpackdef.h

The ax_gen_arpack.m4 macro would add a bunch of extra garbage to
arpackdef.h, such as PACKAGE_NAME, VERSION, HAVE_BLAS, etc. that would
clash if any other project tried to #include it.  Shorten it to only the
one #define that we care about.

This file is placed in $(top_builddir) so add that path to CPPFLAGS.
-I$(top_builddir) should be first.  Note that autoheader would do this,
but now we don't need to use autoheader.

Move #include lines inside the include guards.

* Need PKG_PROG_PKG_CONFIG if first PKG_CHECK_MODULES is conditional

* Populate the version and URL fields of arpack.pc from CMake

Still not installing this yet because it doesn't contain full dependency
info for LAPACK/BLAS.

* Bump version to 3.7.0

* Update shared library version

Updating the minor number (libtool "age") due to the new dbgini/staini
symbols.  Note that CMake doesn't follow libtool's current:revision:age
numbering scheme, so care should be taken with any future changes to
make sure they generate files with the same numbers.

* Enable checks for eigen3 headers
2019-01-10 11:12:29 +01:00
Franck HOUSSEN 16e331abf3 arpackmm: add check. (#173) 2019-01-06 18:07:16 +01:00
Franck HOUSSEN 8a17cea5b7 [BUG FIX] changes needed after PR#165 (ILP64). (#169)
This was need to PR as the ilp64 branch didn't exist on opencollab/master.
2018-12-29 19:39:52 +01:00
Sylvestre Ledru 13716fe86e improve the presentation of the doc 2018-12-29 14:11:50 +01:00
Sylvestre Ledru fce1d44d96 update of the changelog 2018-12-29 13:56:48 +01:00
Franck HOUSSEN aa970cefa6 ILP64 support. (#165)
The idea is:
- cmake      generates arpackdef.h from arpackdef.cmake.h.in
- autoheader generates arpackdef.h from arpackdef.autotools.h[.in]
- arpack includes arpackdef.h when/where needed:
  - #define provide c_int/a_int according to architecture.
  - all f90 who need to include "arpackdef.h" must be moved to F90.
    Note: by convention, F90 are preprocessed (f90 are not).
- MPI does not support ILP64: integer*4 must be imposed in all
  calls involving MPI (f90 example/test code).

To enable ILP64 users to compile/link, arpackdef.h is added in
the arpack installation (make install).
2018-12-29 13:55:40 +01:00
Franck HOUSSEN 2c1f6ebb5b arpackmm: utility to test arpack with matrix market files. (#157) 2018-12-12 09:39:56 +01:00
Franck HOUSSEN 8840cfdf43 Add github templates when creating issue/PR. (#167) 2018-12-11 18:26:00 +01:00
Franck HOUSSEN aff1edc46a Add F77 and FFLAGS in autotools configuration summary. (#166) 2018-11-23 11:28:05 +01:00
Franck HOUSSEN f18f8fa322 TravisCI - move CI to xenial: get not-so outdated packages. (#164)
* Create root ICB directory.

* TravisCI: move to precise + trusty + xenial.

* [CLEAN] autotools: kill from EXTRA_DIST all what is already in
arpack_include_HEADERS.

* [BUG FIX] fix circular dependencies in "make distcheck".

- do not use AC_CONFIG_FILES to create files in builddir.
- refer files when needed with srcdir (*_*FLAGS).
2018-11-20 12:09:18 +01:00
Sylvestre Ledru 94dd13dc2c fix the changelog 2018-11-10 09:28:22 +01:00
Franck HOUSSEN 703fb580a4 [BUG FIX] ICB: missing workev for *[ds]neupd (real+not-sym). (#155)
Even with real matrices, eigen values can be complex if matrices
are not symmetric. In this case, you need workev.

ICB tests: should be OK as it turns out that they do NOT use
real+not-sym methods (they use real+sym and complex+non-sym).
2018-11-10 09:26:27 +01:00
Franck HOUSSEN 95360d81d6 [BUG FIX] TravisCI: show build error or test log to know what is wrong (#161)
if error occured (cmake bug, autotools OK, increase tail).
2018-10-11 16:21:31 +02:00
Franck HOUSSEN 8f95a7d772 TravisCI: show build error or test log to know what is wrong (#160)
if errors occured.
2018-10-11 15:12:30 +02:00
Sylvestre Ledru 60cea47bd6 Update the readme to reflect the reality 2018-09-19 18:12:15 +02:00
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
Sylvestre Ledru 9edcf7a494 Merge branch 'master' of git.forge.scilab.org:arpack-ng 2012-02-22 11:41:49 +01:00
Sylvestre Ledru 81ce8ecb6d Update of the gitignore 2012-02-22 11:40:45 +01:00
Sylvestre Ledru 2523fb7df5 Change the build order 2012-02-22 11:40:28 +01:00
Sylvestre Ledru 36aaa0570f Update of the date 2012-02-22 10:59:03 +01:00
Tim Mitchell 3c470ca5a2 Fix potential wrong eigenvalue return. (patch by Tim Mitchell at Courant)
"ARPACK can return the wrong eigenvalues if eigenvectors are
requested and the resulting number of converged eigenvalues is less than
the number requested."
2012-02-21 18:05:06 +01:00
Sylvestre Ledru 75fb014285 Revert "Fix potential wrong eigenvalue return. (patch by Tim Mitchell at Courant)"
This reverts commit 7625b2456e.
2012-02-21 18:04:35 +01:00
Tim Mitchell 7625b2456e Fix potential wrong eigenvalue return. (patch by Tim Mitchell at Courant)
"ARPACK can return the wrong eigenvalues if eigenvectors are
requested and the resulting number of converged eigenvalues is less than
the number requested."
2012-02-21 18:03:43 +01:00
Sylvestre Ledru b3d2f34a82 Revert " * Reorder bug fixed when eigenvectors are requested and the resulting"
This reverts commit f4e816d4d2.
2012-02-21 18:03:16 +01:00
Sylvestre Ledru bf945c1837 Prepare a working make dist 2012-02-21 18:00:12 +01:00
Sylvestre Ledru 933c31a183 Update the version of arpack-ng in the configure 2012-02-21 17:28:51 +01:00
Sylvestre Ledru e315ec7419 Update of the various changes 2012-02-21 17:23:15 +01:00
Sylvestre Ledru 9a1658d77d * TESTS/ directory added and built. 2012-02-21 17:23:02 +01:00
Tim Mitchell f4e816d4d2 * Reorder bug fixed when eigenvectors are requested and the resulting
number of converged eigenvalues is less than the number requested.
     Patches from Tim Mitchell. (Closes: #664)
2012-02-21 17:21:03 +01:00
Tim Mitchell db18628436 Cosmetic changes 2012-02-21 17:20:32 +01:00
Sylvestre Ledru 9b99af7e6b * Update of the doc about TOL in dnaupd. 2012-01-19 00:22:11 +01:00
Sylvestre Ledru 8a69318bb7 Update of the changelog 2012-01-19 00:10:51 +01:00
Pauli Virtanen a8b99df06d * ARPACK routines (at least dnaupd) modifieD its argument TOL, which
is listed in the documentation as input-only. Thanks to Pauli Virtanen
     for the patch (Closes: #632)
2012-01-19 00:10:38 +01:00
Sylvestre Ledru cd7c6b4379 * 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.
2012-01-14 14:58:11 +01:00
Sylvestre Ledru beaad2654c * Provide a M4 macro (detect_arpack_bug.m4) to check if the underlying
arpack is buggy (ie not arpack-ng). This allows developper applications
     to perform the check in their autotools build system (configure).
2012-01-13 11:16:22 +01:00
Sylvestre Ledru 4ade42ebd7 * Change the bug report from arpack@caam.rice.edu to
http://forge.scilab.org/index.php/p/arpack-ng/issues/
2012-01-10 05:59:23 +01:00
Sylvestre Ledru 78b7d449b4 * Always search for MPILIBS (in order to have the variable correctly set)
* Explicitly link against MPI fortran libs for parpack
2011-12-29 12:25:28 +01:00
Sylvestre Ledru 7c791977a1 Update of the changelog 2011-12-28 14:36:02 +01:00
Sylvestre Ledru 2d3cdaf9e5 arpack 96 => arpack-ng 3 2011-12-28 14:35:54 +01:00
Sylvestre Ledru a8e958e2d8 Install arpack.pc 2011-12-28 14:35:22 +01:00
Sylvestre Ledru fea0aabce0 pkg-config file added 2011-12-28 14:26:29 +01:00
Sylvestre Ledru 4c8e2ecc9e Readme updated regarding recent changes 2011-12-28 14:26:18 +01:00
Sylvestre Ledru eeae72a071 * Fix a long line in pznaup2.f which was showing some wrong symbols
(Closes: #620)
2011-12-28 13:47:11 +01:00
Sylvestre Ledru 2bcad73e6c Remove a useless file 2011-12-13 16:59:39 +01:00
Sylvestre Ledru 9f77178d43 * Missing license information (Closes: #614) 2011-12-13 16:44:10 +01:00
Sylvestre Ledru 30b8cc4cd4 * libtool was missing (Closes: #615) 2011-12-13 16:36:39 +01:00
476 changed files with 36243 additions and 64696 deletions
+1
View File
@@ -0,0 +1 @@
BasedOnStyle: Google
+39
View File
@@ -0,0 +1,39 @@
## Expected behavior
Do this.
## Actual behavior
Do that.
## Where/how to reproduce the problem
- arpack-ng: release or commit (SHA)
- OS: debian ? ubuntu ? mac ?...
- compiler: gcc ? intel ? clang ? version ?...
- environment: export FFLAGS ?...
- configure: ./configure --enable-stuff ? cmake -DSTUFFS=ON ?
- input data ?
## Steps to reproduce the problem
-
-
-
## Error message
Bad stuff.
## Traces
~/arpack-ng> tail -n 300 test-suite.log
~/arpack-ng/build> tail -n 300 Testing/Temporary/LastTest.log
## Callstack
(gdb) bt
## Notes, remarks
+9
View File
@@ -0,0 +1,9 @@
## Pull request purpose
fixing issue #xx ? enhancement ? new feature ?...
## Detailed changes proposed in this pull request
-
-
-
+293
View File
@@ -0,0 +1,293 @@
name: arpack-ng
on: [push, pull_request]
jobs:
ubuntu_latest_cmake:
runs-on: ubuntu-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
- name: Check commit
run: |
git log -1
- name: Update OS
run: sudo apt-get update
- name: Install apt-get dependencies
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev libeigen3-dev cmake
- name: Run job
run: |
mkdir build
cd build
cmake -DEXAMPLES=ON -DMPI=ON -DICB=ON -DICBEXMM=ON ..
make all
CTEST_OUTPUT_ON_FAILURE=1 make test
make package_source
ubuntu_latest_cmake_install:
runs-on: ubuntu-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
- name: Check commit
run: |
git log -1
- name: Update OS
run: sudo apt-get update
- name: Install apt-get dependencies
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev cmake
- name: Run job
run: |
mkdir build
cd build
cmake ..
bash ./tstCMakeInstall.sh
bash ./tstCMakeInstall.sh 64-
bash ./tstCMakeInstall.sh -ILP64
bash ./tstCMakeInstall.sh 64-ILP64
ubuntu_latest_autotools:
runs-on: ubuntu-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
- name: Check commit
run: |
git log -1
- name: Update OS
run: sudo apt-get update
- name: Install apt-get dependencies
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev libeigen3-dev automake autoconf pkg-config libtool
- name: Run job
run: |
./bootstrap
./configure --enable-mpi --enable-icb --enable-icbexmm
make all
make check
make distcheck
ubuntu_latest_autotools_install:
runs-on: ubuntu-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
- name: Check commit
run: |
git log -1
- name: Update OS
run: sudo apt-get update
- name: Install apt-get dependencies
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev automake autoconf pkg-config libtool
- name: Run job
run: |
./bootstrap
./configure
bash ./tstAutotoolsInstall.sh
bash ./tstAutotoolsInstall.sh 64-
bash ./tstAutotoolsInstall.sh -ILP64
bash ./tstAutotoolsInstall.sh 64-ILP64
ubuntu_latest_cmake_python:
runs-on: ubuntu-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
- name: Check commit
run: |
git log -1
- name: Update OS
run: sudo apt-get update
- name: Install apt-get dependencies
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev cmake libeigen3-dev
- name: Install python dependencies
run: sudo apt-get -y install python3-minimal python3-pip python3-numpy
- name: Build boost-python for python3 (not provided by apt-cache)
run : |
sudo apt-get -y install wget
wget https://sourceforge.net/projects/boost/files/boost/1.79.0/boost_1_79_0.tar.gz
tar -xf boost_1_79_0.tar.gz
cd boost_1_79_0
./bootstrap.sh --with-libraries=python --with-python=/usr/bin/python3 --with-toolset=gcc
sudo ./b2 toolset=gcc install
sudo apt-get install locate
sudo updatedb
- name: Run job
run: |
mkdir build
cd build
cmake -DEXAMPLES=ON -DMPI=ON -DICB=ON -DICBEXMM=ON -DPYTHON3=ON ..
make all
CTEST_OUTPUT_ON_FAILURE=1 make test
ubuntu_latest_autotools_ilp64:
runs-on: ubuntu-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
- name: Check commit
run: |
git log -1
- name: Update OS
run: sudo apt-get update
- name: Install apt-get dependencies
run: sudo apt-get install -y gfortran gcc g++ openmpi-bin libopenmpi-dev libblas-dev liblapack-dev automake autoconf pkg-config libtool libeigen3-dev
- name: Install Intel MKL (ILP64 blas/lapack)
run: echo yes | sudo apt-get -y install intel-mkl libmkl-dev
- name: Run job
run: |
./bootstrap
./configure --enable-icb --with-blas=mkl_gf_ilp64 --with-lapack=mkl_gf_ilp64
make all
make check
env:
FFLAGS: "-DMKL_ILP64 -I/usr/include/mkl"
FCFLAGS: "-DMKL_ILP64 -I/usr/include/mkl"
LIBS: "-Wl,--no-as-needed -L/usr/lib/x86_64-linux-gnu -lmkl_sequential -lmkl_core -lpthread -lm -ldl"
INTERFACE64: "1"
macos_latest_cmake:
runs-on: macos-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
- name: Check commit
run: |
git log -1
- name: Install brew dependencies
run: |
brew reinstall gcc # brings gfortran on path
brew install cmake mpich
- name: Run job
run: |
mkdir -p build
cd build
export FC=mpif90 # Uses gfortran.
export FFLAGS="-ff2c -fno-second-underscore"
export CC=mpicc # Uses clang.
export CFLAGS="-Qunused-arguments"
export CXX=mpic++ # Uses clang++.
export CXXFLAGS="-Qunused-arguments"
LIBS="-framework Accelerate" cmake -DBLA_VENDOR=Generic -DEXAMPLES=ON -DICB=ON -DMPI=ON ..
make all
CTEST_OUTPUT_ON_FAILURE=1 make test
macos_latest_cmake_python:
runs-on: macos-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
- name: Check commit
run: |
git log -1
- name: Install brew dependencies
run: |
# Unlink and re-link to prevent errors when github mac runner images
# install python outside of brew, for example:
# https://github.com/orgs/Homebrew/discussions/3895
# https://github.com/actions/setup-python/issues/577
# https://github.com/actions/runner-images/issues/6459
# https://github.com/actions/runner-images/issues/6507
# https://github.com/actions/runner-images/issues/2322
brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done
brew reinstall gcc # brings gfortran on path
brew install cmake eigen boost-python3 python3
pip3 install numpy
- name: Run job
run: |
mkdir -p build
cd build
export FC=gfortran
export FFLAGS="-ff2c -fno-second-underscore"
export CC=clang
export CFLAGS="-Qunused-arguments"
export CXX=clang++
export CXXFLAGS="-Qunused-arguments"
LIBS="-framework Accelerate" cmake -DBLA_VENDOR=Generic -DEXAMPLES=ON -DICB=ON -DPYTHON3=ON ..
make all
CTEST_OUTPUT_ON_FAILURE=1 make test
macos_latest_autotools:
runs-on: macos-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
- name: Check commit
run: |
git log -1
- name: Install brew dependencies
run: |
brew reinstall gcc # brings gfortran on path
brew install autoconf automake libtool pkg-config mpich
- name: Run job
run: |
./bootstrap
LIBS="-framework Accelerate" FFLAGS="-ff2c -fno-second-underscore" FCFLAGS="-ff2c -fno-second-underscore" ./configure --enable-icb --enable-mpi
make all
make check
windows_latest_cmake:
runs-on: windows-latest
defaults:
run:
# Use MSYS2 as default shell
shell: msys2 {0}
steps:
- name: Install MSYS2 build environment
uses: msys2/setup-msys2@v2
with:
update: true
msystem: MINGW64
install: >-
base-devel
git
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-openblas
mingw-w64-x86_64-msmpi
- name: Install MS-MPI (for mpiexec)
uses: mpi4py/setup-mpi@v1
- name: Clone and check out repository code
uses: actions/checkout@v2
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
repository: ${{github.event.pull_request.head.repo.full_name}} # Repo where changes are implemented.
- name: Check commit
run: |
git log -1
- name: Run job
run: |
mkdir -p build && cd build
cmake -GNinja -DICB=ON -DEXAMPLES=ON -DMPI=ON ..
cmake --build . -v
- name: Run tests
run: |
export PATH="/c/Program Files/Microsoft MPI/Bin":$PATH # add mpiexec to msys2 path
cd build
ctest --output-on-failure
+69 -8
View File
@@ -1,14 +1,71 @@
*.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
parpack*.pc
arpackSolver*.pc
arpackdef.h
arpackicb.h
tstAutotoolsInstall.sh
# Generated by `make`
.dirstamp
*.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]
EXAMPLES/MATRIX_MARKET/arpackmm
EXAMPLES/MATRIX_MARKET/arpackSolver.resid.out
EXAMPLES/MATRIX_MARKET/arpackSolver.v.out
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
@@ -17,4 +74,8 @@ libtool
*.u2d
*.suo
VISUAL_STUDIO/Release MKL/
VISUAL_STUDIO/bin/
VISUAL_STUDIO/bin/
# Temporary files
*~
\#*#
+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
+8
View File
@@ -0,0 +1,8 @@
pull_request_rules:
- name: automatic merge on CI success and review
conditions:
- status-success=continuous-integration/travis-ci/pr
- "#approved-reviews-by>=1"
actions:
merge:
method: merge
+387 -2
View File
@@ -1,3 +1,388 @@
-- Franck Houssen <fghoussen@users.noreply.github.com> Sat, 11 Feb 2023 13:52:57 +0100
arpack-ng - 3.9.0
[ Vikas Sharma ]
* Improve README.
[ Fabien Péan ]
* CI: Enable job `windows_latest_cmake` to run all tests
* CMake: Fix BLAS and LAPACK static library order needed to consume the library on Windows with static linkage
* Fix using ARPACK on Windows with MSVC compiler from C++17 onwards
[ Zhentao Wang ]
* [BUG FIX] parpack.h and parpack.hpp: type of rwork should be real instead of complex.
* Allow ritz_option {"LR", "SR", "LI", "SI"} for complex eigenvalue problems in ICB.
[ Jose E. Roman ]
* Avoid using isnan() in tests, since is GNU-specific
[ Tom Payerle ]
* Change the continuation line format for stat.h, debug.h
[ John Doe ]
* Avoid calling [c|z]dotc for better portability on macOS
[ Dima Pasechnik ]
* [BUG FIX] autotools: replace obsolete AC_TRY_COMPILE macros.
* Support for NAG's nagfor Fortran compiler
[ Franck Houssen ]
* Create one .cmake file per arpack-ng flavor (32-bits, 64-bits, ILP64).
* Test autotools pkg-config (*.pc files) with/without LIBSUFFIX/ITF64SUFFIX.
* Test CMake find_package (*.cmake files) with/without LIBSUFFIX/ITF64SUFFIX.
* [BUG FIX] autotools: ICB must be checked first (MPI changes compilers).
* [BUG FIX] BLAS/LAPACK: allow suffixes in case BLAS/LAPACK can not provide ICB.
* [BUG FIX] Compile C programs with ICB.
* arpackmm: command line bug fix.
* arpackmm: restart bug fix.
* pyarpack: fix compilation warning, test on macos and latest boost-python (1.79).
* arpackSolver: fix error messages.
* [BUG FIX] Make sure iseed is always initialized to values allowed by lapack ?larnv.
* [BUG FIX] According to lapack doc of ?larnv, iseed(4) must be odd.
* [BUG FIX] Use MPI ICB types (mpi_f08) instead of integer(kind=i_int).
* parpack: no ILP64 support.
[ Haoyang Liu ]
* CMake: minimum required version changed to 3.0
* CMake: add C99 standard checking
* CI: Support for centos7 added.
* CI: Add `scripts/travis_centos.sh` for centos builds
[ Robert Schütz ]
* use CMAKE_INSTALL_FULL_<dir> in arpack.pc
[ Markus Mützel ]
* CMake: Handle libraries without "lib" prefix.
* CMake: Don't override BLAS/LAPACK/MPI flags. Directly use results from the Find* modules instead.
[ Juan José García-Ripoll ]
* Adapt the C/C++ interface to accept also MSVC's non-standard complex types.
* Propagate dependencies to CMake targets that use arpack-ng:
- Create CMake-generated targets and configuration files that keep track of
arpack's dependencies (libraries, directories) and expose them to users.
- Install those files under ${prefix}/lib/cmake/arpackng* so that arpack can be
found using 'find_package(arpackng)' from CMake files.
- Add code to the arpackng-config.cmake to find required dependencies when this
module is loaded by find_package(arpackng).
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 07 Dec 2020 11:37:40 +0100
arpack-ng - 3.8.0
[ Myron Oikonomakis ]
* [BUG FIX]: bmat return "G" instead of "B" for generalized matrix in arpack.hpp
* [BUG FIX]: pass arrays of chars as scalar in fortran calls in order not to crash
* when calling subroutines through icb interface
[ Izaak "Zaak" Beekman ]
* [BUG FIX]: fix 'Unknown CMake command "check_symbol_exists".' when ICB=ON.
[ Franck Houssen ]
* CI: Support for Mac OS X added in automation (GNU + "-ff2c -fno-second-underscore" options).
* CI: Support for centos added in automation.
* CI: Support for opensuse added in automation.
* arpackSolver/arpackmm: switch eigen version to 3.3.
* [BUG FIX] fix arpackdef.h (resp. arpackicb.h) must be included only by C/C++ (resp. F77/F90).
* [BUG FIX] iparam/ipntr sizes may change depending on cases.
* pyarpack: python binding based on Boost.Python.Numpy exposing C++ API.
* [CLEAN] arpackSolver API: more convenient, suppress template parameters when possible.
* [BUG FIX] ICB using rvec/select: rvec/select turned to integer
bool should be, but, is not always supported (depend on compiler, options).
* extract arpackSolver.hpp from arpakmm.cpp.
* arpackmm: add --slvItrPC option (PC: Jacobi, ILU).
* arpackmm: add --slv LLT LDLT (for SPD matrices).
* arpackmm: add --simplePrec option (to enable use of s*upd).
* arpackmm: add --dense option.
* autotools: provide *.cmake files (in addition to *.pc file).
* [BUG FIX] ILP64 support: using debug_c and stat_c.
* [BUG FIX] fix check precision which may fail with some ATLAS versions.
[ Kyle Guinn ]
* [BUG FIX]: fix 'eval: Syntax error: "(" unexpected' error at build time.
* Only build shared libraries by default. To build static libraries, use
--enable-static (autotools) or -DBUILD_SHARED_LIBS=OFF (cmake).
* Add parpack.pc and arpackSolver.pc.
[ David Schwörer ]
* Support of gfortran 10
-- Sylvestre Ledru <sylvestre@debian.org> Mon, 07 Dec 2020 11:35:57 +0100
arpack-ng - 3.7.0
[ Franck Houssen ]
* [BUG FIX] ICB: missing workev for *[ds]neupd (real+not-sym) => API/ABI change for *[ds]neupd_c.
* [BUG FIX] autotools - make distcheck: fix circular dependencies.
* arpackmm: utility to test arpack with matrix market files.
* ICB: add ILP64 support.
The idea is:
- autoheader/cmake generates arpackdef.h/arpackicb.h from arpackdef.h.in/arpackicb.h.in
- in C/C++ files: arpackdef.h defines a_int according to architecture.
- in F77/F90 files: arpackicb.h defines i_int to architecture.
- MPI does not support ILP64: integer*4 must be imposed in all
calls involving MPI (f90 example/test code).
To enable ILP64 users to compile/link, arpackdef.h/arpackicb.h is added in
the arpack installation (make install).
[ Kyle Guinn ]
* Autoconf/Automake simplifications and fixes.
* Simplify the generation of arpackdef.h.
-- Sylvestre Ledru <sylvestre@debian.org> Sat, 12 Jan 2019 16:24:00 +0100
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 functional
* 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 using 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
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 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)
* Update of the doc about TOL in dnaupd.
* Reorder bug fixed when eigenvectors are requested and the resulting
number of converged eigenvalues is less than the number requested.
Patches from Tim Mitchell. (Closes: #664)
* TESTS/ directory added and built.
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Wed, 22 Feb 2012 10:58:39 +0100
arpack-ng - 3.0.2
* Fix a long line in pznaup2.f which was showing some wrong symbols
(Closes: #620)
* README content updated regarding ARPACK-NG
* arpack.pc (pkg-config) file added
* Update the title & version in the configure.ac
* Always search for MPILIBS (in order to have the variable correctly set)
* Explicitly link against MPI fortran libs for parpack
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Wed, 28 Dec 2011 13:45:53 +0100
arpack-ng - 3.0.1
* libtool was missing (Closes: #615)
* Missing license information (Closes: #614)
* TODO added
-- Sylvestre Ledru <sylvestre.ledru@scilab-enterprises.com> Tue, 13 Dec 2011 16:33:25 +0100
arpack-ng - 3.0
* Patches from Scilab
@@ -5,8 +390,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
+969
View File
@@ -0,0 +1,969 @@
cmake_minimum_required(VERSION 3.0)
if (NOT DEFINED CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
endif ()
project(arpack C Fortran)
set(arpack_ng_MAJOR_VERSION 3)
set(arpack_ng_MINOR_VERSION 9)
set(arpack_ng_PATCH_VERSION 0)
set(arpack_ng_VERSION ${arpack_ng_MAJOR_VERSION}.${arpack_ng_MINOR_VERSION}.${arpack_ng_PATCH_VERSION})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
# set C99 standard
set(CMAKE_C_STANDARD 99)
set(CMAKE_C_STANDARD_REQUIRED True)
# Adopted from https://github.com/feymark/arpack.git
if (POLICY CMP0042)
# enable MACOSX_RPATH by default
cmake_policy (SET CMP0042 NEW)
endif ()
option(BUILD_SHARED_LIBS "Build shared libraries instead of static libraries" ON)
option(MPI "Enable parallel support" OFF)
option(ICB "Enable support for *[ae]upd_c with ISO_C_BINDING" OFF)
option(ICBEXMM "Enable support for matrix market example based on ICB" OFF)
option(PYTHON3 "Enable python3 support" OFF)
set(BOOST_PYTHON_LIBSUFFIX "" CACHE STRING "suffix to add to custom boost python libs")
option(EXAMPLES "Compile ARPACK examples" OFF)
option(TESTS "Compile ARPACK tests" ON)
# Suffixes: LIBSUFFIX modify ONLY libraries names, ITF64SUFFIX modify BOTH libraries AND include directory names.
set(LIBSUFFIX ""
CACHE STRING "suffix to add to ARPACK libraries names")
set(ITF64SUFFIX ""
CACHE STRING "suffix to add to ARPACK include directory and libraries names (use with INTERFACE64)")
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")
# 'make install' to the correct location, and also define
# paths for target_include_directories and target_link_libraries
include(GNUInstallDirs)
set(ARPACK_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/arpack-ng${ITF64SUFFIX}")
set(ARPACK_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/arpackng${LIBSUFFIX}${ITF64SUFFIX}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
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::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(NAME "${lwe}_ex" COMMAND ${lwe})
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::MPI_Fortran)
add_test(NAME "${lwe}_ex" COMMAND mpiexec -n 2 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${lwe})
endforeach()
endfunction(pexamples)
if (PYTHON3)
enable_language(C CXX) # Boost requirement.
set(CMAKE_CXX_STANDARD 14) # Boost requirement.
find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
find_package(Boost 1.78 COMPONENTS python${BOOST_PYTHON_LIBSUFFIX} numpy${BOOST_PYTHON_LIBSUFFIX} REQUIRED)
set(ICBEXMM "ON")
endif ()
if (ICBEXMM)
find_package(Eigen3 3.3 QUIET)
if (NOT EIGEN3_FOUND) # If not found, piggy-back pkg-config files.
message(WARNING "CMake didn't find the Eigen3 package. Try to look for pkg-config file...")
find_package(PkgConfig REQUIRED)
pkg_check_modules(EIGEN3 REQUIRED eigen3>=3.3)
set(EIGEN3_INCLUDE_DIR ${EIGEN3_INCLUDE_DIRS})
endif ()
find_program (BASH_PROGRAM bash)
# Look for headers.
find_path(EIGEN3_ITERATIVE_SOLVER_DIR NAMES IterativeLinearSolvers PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
if (NOT EIGEN3_ITERATIVE_SOLVER_DIR)
message(FATAL_ERROR "-- Eigen/IterativeLinearSolvers header not found.")
endif ()
find_path(EIGEN3_SPARSE_DIR NAMES Sparse PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
if (NOT EIGEN3_SPARSE_DIR)
message(FATAL_ERROR "-- Eigen/Sparse header not found.")
endif ()
find_path(EIGEN3_SPARSELU_SOLVER_DIR NAMES SparseLU PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
if (NOT EIGEN3_SPARSELU_SOLVER_DIR)
message(FATAL_ERROR "-- Eigen/SparseLU header not found.")
endif ()
find_path(EIGEN3_SPARSEQR_SOLVER_DIR NAMES SparseQR PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
if (NOT EIGEN3_SPARSEQR_SOLVER_DIR)
message(FATAL_ERROR "-- Eigen/SparseQR header not found.")
endif ()
find_path(EIGEN3_SPARSECHOLESKY_SOLVER_DIR NAMES SparseCholesky PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
if (NOT EIGEN3_SPARSECHOLESKY_SOLVER_DIR)
message(FATAL_ERROR "-- Eigen/SparseCholesky header not found.")
endif ()
find_path(EIGEN3_DENSE_DIR NAMES Dense PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
if (NOT EIGEN3_DENSE_DIR)
message(FATAL_ERROR "-- Eigen/Dense header not found.")
endif ()
find_path(EIGEN3_DENSELU_DIR NAMES LU PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
if (NOT EIGEN3_DENSELU_DIR)
message(FATAL_ERROR "-- Eigen/LU header not found.")
endif ()
find_path(EIGEN3_DENSEQR_DIR NAMES QR PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
if (NOT EIGEN3_DENSEQR_DIR)
message(FATAL_ERROR "-- Eigen/QR header not found.")
endif ()
find_path(EIGEN3_DENSECHOLESKY_DIR NAMES Cholesky PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
if (NOT EIGEN3_DENSECHOLESKY_DIR)
message(FATAL_ERROR "-- Eigen/Cholesky header not found.")
endif ()
set(ICB "ON")
endif ()
# 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... For arpack symbols (only).
if (SYMBOLSUFFIX)
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)
foreach (f IN LISTS SCALARFUNS)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Ds${f}=s${f}${SYMBOLSUFFIX} -Dd${f}=d${f}${SYMBOLSUFFIX}")
endforeach ()
foreach (f IN LISTS COMPLEXFUNS)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Dc${f}=c${f}${SYMBOLSUFFIX} -Dz${f}=z${f}${SYMBOLSUFFIX}")
endforeach ()
set(CFUNS snaupd sneupd dnaupd dneupd)
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 ()
endif ()
# Find MPI
if (MPI)
if (NOT TARGET MPI::MPI_Fortran) # Search only if not already found by upper CMakeLists.txt
include(FindMPI)
find_package(MPI REQUIRED COMPONENTS Fortran)
# MPI::MPI_* target was already created at this point by FindMPI.cmake if cmake version >= 3.9
if (NOT TARGET MPI::MPI_Fortran) # Create target "at hand" to ensure compatibility if cmake version < 3.9
add_library(MPI::MPI_Fortran INTERFACE IMPORTED)
set_target_properties(MPI::MPI_Fortran PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MPI_Fortran_INCLUDE_DIRS}")
set_target_properties(MPI::MPI_Fortran PROPERTIES INTERFACE_LINK_LIBRARIES "${MPI_Fortran_LIBRARIES}")
endif()
endif()
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} ${MPI_Fortran_COMPILE_FLAG}")
if(CMAKE_SYSTEM_NAME MATCHES "Windows" AND CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fallow-invalid-boz")
endif()
# Check if we can use ISO_C_BINDING provided by MPI.
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/PROG_ICB.f90
"
PROGRAM PROG_ICB
USE :: mpi_f08
IMPLICIT NONE
type(MPI_Comm) comm
type(MPI_Status) status
END PROGRAM PROG_ICB
")
try_compile(COMPILE_ICB ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/PROG_ICB.f90 LINK_LIBRARIES MPI::MPI_Fortran)
if(NOT ${COMPILE_ICB})
message("-- MPI library does not support iso_c_binding.")
set(HAVE_MPI_ICB 0)
else()
message("-- MPI library does support iso_c_binding.")
set(HAVE_MPI_ICB 1)
add_compile_definitions(HAVE_MPI_ICB=1)
endif()
# As MPI can be used with or without ISO_C_BINDING (#ifdef), we need to preprocess code before compiling.
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp")
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp")
else ()
message(WARNING "build script does not know how to preprocess Fortran code: set it manually via FFLAGS.")
endif ()
if(ICB)
if (NOT TARGET MPI::MPI_C) # Search only if not already found by upper CMakeLists.txt
include(FindMPI)
find_package(MPI REQUIRED COMPONENTS C)
if (NOT TARGET MPI::MPI_C) # Create target "at hand" to ensure compatibility if cmake version < 3.9
add_library(MPI::MPI_C INTERFACE IMPORTED)
set_target_properties(MPI::MPI_C PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MPI_C_INCLUDE_DIRS}")
set_target_properties(MPI::MPI_C PROPERTIES INTERFACE_LINK_LIBRARIES "${MPI_C_LIBRARIES}")
endif()
endif()
if (NOT TARGET MPI::MPI_CXX) # Search only if not already found by upper CMakeLists.txt
include(FindMPI)
find_package(MPI REQUIRED COMPONENTS CXX)
if (NOT TARGET MPI::MPI_CXX) # Create target "at hand" to ensure compatibility if cmake version < 3.9
add_library(MPI::MPI_CXX INTERFACE IMPORTED)
set_target_properties(MPI::MPI_CXX PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${MPI_CXX_INCLUDE_DIRS}")
set_target_properties(MPI::MPI_CXX PROPERTIES INTERFACE_LINK_LIBRARIES "${MPI_CXX_LIBRARIES}")
endif()
endif()
include(CheckSymbolExists)
check_symbol_exists(MPI_Comm_c2f "${MPI_C_INCLUDE_DIRS}/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()
# Find BLAS
if (NOT TARGET BLAS::BLAS) # Search only if not already found by upper CMakeLists.txt
find_package(BLAS REQUIRED)
# BLAS::BLAS target was already created at this point by FindBLAS.cmake if cmake version >= 3.18
if (NOT TARGET BLAS::BLAS) # Create target "at hand" to ensure compatibility if cmake version < 3.18
add_library(BLAS::BLAS INTERFACE IMPORTED)
set_target_properties(BLAS::BLAS PROPERTIES INTERFACE_LINK_LIBRARIES "${BLAS_LIBRARIES}")
endif()
endif()
# Find LAPACK
if (NOT TARGET LAPACK::LAPACK) # Search only if not already found by upper CMakeLists.txt
find_package(LAPACK REQUIRED)
# LAPACK::LAPACK target was already created at this point by FindLAPACK.cmake if cmake version >= 3.18
if (NOT TARGET LAPACK::LAPACK) # Create target "at hand" to ensure compatibility if cmake version < 3.18
add_library(LAPACK::LAPACK INTERFACE IMPORTED)
set_target_properties(LAPACK::LAPACK PROPERTIES INTERFACE_LINK_LIBRARIES "${LAPACK_LIBRARIES}")
endif()
endif()
# As BLAS/LAPACK does not provide ICB, we may have to deal with symbols the old-fashion-boring-cumbersome-fortran/C way...
if (SYMBOLSUFFIX)
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(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)
foreach (f IN LISTS BLASFUNS1 BLASFUNS2)
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -Ds${f}=s${f}${SYMBOLSUFFIX} -Dd${f}=d${f}${SYMBOLSUFFIX}")
endforeach ()
foreach (f IN LISTS 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 ()
set(CFUNS sgemm 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 (MPI)
set(parpackutil_DIR ${arpack_SOURCE_DIR}/PARPACK/UTIL/)
set(parpacksrc_DIR ${arpack_SOURCE_DIR}/PARPACK/SRC/)
endif()
file(GLOB arpacksrc_STAT_SRCS ${arpack_SOURCE_DIR}/dbgini.f ${arpack_SOURCE_DIR}/staini.f ${arpack_SOURCE_DIR}/SRC/*.f)
set(arpacksrc_ICB "")
set(parpacksrc_ICB "")
if(ICB)
file(GLOB arpacksrc_ICB ${arpack_SOURCE_DIR}/SRC/icba*.F90 ${arpack_SOURCE_DIR}/ICB/debug_icb.F90 ${arpack_SOURCE_DIR}/ICB/stat_icb.F90)
file(GLOB parpacksrc_ICB ${arpack_SOURCE_DIR}/PARPACK/SRC/MPI/icbp*.F90 ${arpack_SOURCE_DIR}/ICB/debug_icb.F90 ${arpack_SOURCE_DIR}/ICB/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 ${arpack_SOURCE_DIR}/PARPACK/UTIL/MPI/*.f)
file(GLOB parpacksrc_STAT_SRCS ${arpack_SOURCE_DIR}/dbgini.f ${arpack_SOURCE_DIR}/staini.f ${arpack_SOURCE_DIR}/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})
target_link_libraries(arpack
PUBLIC
$<INSTALL_INTERFACE:$<IF:$<BOOL:${BUILD_SHARED_LIBS}>,,LAPACK::LAPACK>>
$<INSTALL_INTERFACE:$<IF:$<BOOL:${BUILD_SHARED_LIBS}>,,BLAS::BLAS>>
$<BUILD_INTERFACE:LAPACK::LAPACK>
$<BUILD_INTERFACE:BLAS::BLAS>
)
target_link_options(arpack PUBLIC "${EXTRA_LDFLAGS}")
set_target_properties(arpack PROPERTIES OUTPUT_NAME arpack${LIBSUFFIX}${ITF64SUFFIX})
set_target_properties(arpack PROPERTIES VERSION 2.1.0)
set_target_properties(arpack PROPERTIES SOVERSION 2)
target_include_directories(arpack
PUBLIC
# Exported location of headers
$<INSTALL_INTERFACE:${ARPACK_INSTALL_INCLUDEDIR}>
# Find arpackdef.h, arpackicb.h, stat*.h, debug*.h at build time
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}>
# For ICB interface
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/ICB>
)
if (MPI)
# use -DBUILD_SHARED_LIBS=ON|OFF to control static/shared
add_library(parpack ${parpacksrc_STAT_SRCS} ${parpackutil_STAT_SRCS} ${parpacksrc_ICB})
target_link_libraries(parpack
PUBLIC
arpack
$<INSTALL_INTERFACE:$<IF:$<BOOL:${BUILD_SHARED_LIBS}>,,MPI::MPI_Fortran>>
$<BUILD_INTERFACE:MPI::MPI_Fortran>
)
set_target_properties(parpack PROPERTIES OUTPUT_NAME parpack${LIBSUFFIX}${ITF64SUFFIX})
set_target_properties(parpack PROPERTIES VERSION 2.1.0)
set_target_properties(parpack PROPERTIES SOVERSION 2)
endif ()
set(PYINT "int32" CACHE STRING "int type to be used in python scripts") # PYINT : int used with python.
if (INTERFACE64)
set(PYINT "int64" CACHE STRING "int type to be used in python scripts") # PYINT : int used with python.
set(INTERFACE64 1)
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 ()
# TODO: this needs full re-write of parpack to support ILP64...
if (MPI)
message(FATAL_ERROR "Parallel arpack does not support ILP64.")
endif()
else ()
set(INTERFACE64 0)
endif ()
include_directories("${PROJECT_BINARY_DIR}") # Find arpackdef.h and arpackicb.h
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}/PARPACK/EXAMPLES/MPI/)
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
############################
function(build_tests)
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::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
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 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/dnsimp)
if (ICB)
add_executable(bug_1315_single TESTS/bug_1315_single.c)
target_include_directories(bug_1315_single PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.h
target_link_libraries(bug_1315_single arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(bug_1315_single_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_1315_single)
add_executable(bug_1315_double TESTS/bug_1315_double.c)
target_include_directories(bug_1315_double PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.h
target_link_libraries(bug_1315_double arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(bug_1315_double_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_1315_double)
endif()
add_executable(bug_1323 TESTS/bug_1323.f)
target_link_libraries(bug_1323 arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(bug_1323_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_1323)
add_executable(bug_58_double TESTS/bug_58_double.f)
target_link_libraries(bug_58_double arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(bug_58_double_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_58_double)
add_executable(bug_79_double_complex TESTS/bug_79_double_complex.f)
target_link_libraries(bug_79_double_complex arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(bug_79_double_complex_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_79_double_complex)
add_executable(bug_142 TESTS/bug_142.f)
target_link_libraries(bug_142 arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(bug_142_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_142)
add_executable(bug_142_gen TESTS/bug_142_gen.f)
target_link_libraries(bug_142_gen arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(bug_142_gen_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_142_gen)
if(MPI)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/PARPACK/TESTS/MPI)
add_executable(issue46 PARPACK/TESTS/MPI/issue46.f)
target_link_libraries(issue46 parpack arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(issue46_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue46)
endif()
if(ICB)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/TESTS)
add_executable(icb_arpack_c TESTS/icb_arpack_c.c)
target_include_directories(icb_arpack_c PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.h
target_link_libraries(icb_arpack_c arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(icb_arpack_c_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_arpack_c)
add_executable(icb_arpack_cpp TESTS/icb_arpack_cpp.cpp)
target_include_directories(icb_arpack_cpp PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.hpp
target_link_libraries(icb_arpack_cpp arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(icb_arpack_cpp_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_arpack_cpp)
if (ICBEXMM)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/EXAMPLES/MATRIX_MARKET)
add_executable(arpackmm EXAMPLES/MATRIX_MARKET/arpackmm.cpp)
target_include_directories(arpackmm PUBLIC ${PROJECT_SOURCE_DIR}/ICB ${EIGEN3_INCLUDE_DIR}) # Get arpack.h + eigen
target_link_libraries(arpackmm arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
configure_file(EXAMPLES/MATRIX_MARKET/As.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/As.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/An.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/An.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/Az.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Az.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/B.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/B.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/Bz.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Bz.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/arpackmm.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/arpackmm.sh)
add_test(NAME arpackmm_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} arpackmm.sh)
endif()
if (PYTHON3)
python_add_module(pyarpack ${arpackutil_STAT_SRCS} ${arpacksrc_STAT_SRCS} ${arpacksrc_ICB} ${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpack.cpp)
target_include_directories(pyarpack
PRIVATE
${PROJECT_BINARY_DIR}
${PROJECT_SOURCE_DIR}
${PROJECT_SOURCE_DIR}/ICB
${PROJECT_SOURCE_DIR}/EXAMPLES/MATRIX_MARKET
${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK
${EIGEN3_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS})
target_link_libraries(pyarpack
BLAS::BLAS LAPACK::LAPACK ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
install(TARGETS pyarpack
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/pyarpack
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/pyarpack)
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseBiCGDiag.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseBiCGDiag.py" @ONLY)
add_test(NAME pyarpackSparseBiCGDiag_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseBiCGDiag.py)
set_tests_properties(pyarpackSparseBiCGDiag_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseBiCGILU.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseBiCGILU.py" @ONLY)
add_test(NAME pyarpackSparseBiCGILU_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseBiCGILU.py)
set_tests_properties(pyarpackSparseBiCGILU_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseCGDiag.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseCGDiag.py" @ONLY)
add_test(NAME pyarpackSparseCGDiag_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseCGDiag.py)
set_tests_properties(pyarpackSparseCGDiag_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseCGILU.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseCGILU.py" @ONLY)
add_test(NAME pyarpackSparseCGILU_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseCGILU.py)
set_tests_properties(pyarpackSparseCGILU_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseLLT.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseLLT.py" @ONLY)
add_test(NAME pyarpackSparseLLT_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseLLT.py)
set_tests_properties(pyarpackSparseLLT_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseLDLT.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseLDLT.py" @ONLY)
add_test(NAME pyarpackSparseLDLT_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseLDLT.py)
set_tests_properties(pyarpackSparseLDLT_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseLU.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseLU.py" @ONLY)
add_test(NAME pyarpackSparseLU_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseLU.py)
set_tests_properties(pyarpackSparseLU_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackSparseQR.py.in" "${CMAKE_BINARY_DIR}/pyarpackSparseQR.py" @ONLY)
add_test(NAME pyarpackSparseQR_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackSparseQR.py)
set_tests_properties(pyarpackSparseQR_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseLLT.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseLLT.py" @ONLY)
add_test(NAME pyarpackDenseLLT_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseLLT.py)
set_tests_properties(pyarpackDenseLLT_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseLDLT.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseLDLT.py" @ONLY)
add_test(NAME pyarpackDenseLDLT_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseLDLT.py)
set_tests_properties(pyarpackDenseLDLT_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseLURR.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseLURR.py" @ONLY)
add_test(NAME pyarpackDenseLURR_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseLURR.py)
set_tests_properties(pyarpackDenseLURR_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseQRRR.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseQRRR.py" @ONLY)
add_test(NAME pyarpackDenseQRRR_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseQRRR.py)
set_tests_properties(pyarpackDenseQRRR_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseLUPP.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseLUPP.py" @ONLY)
add_test(NAME pyarpackDenseLUPP_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseLUPP.py)
set_tests_properties(pyarpackDenseLUPP_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackDenseQRPP.py.in" "${CMAKE_BINARY_DIR}/pyarpackDenseQRPP.py" @ONLY)
add_test(NAME pyarpackDenseQRPP_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackDenseQRPP.py)
set_tests_properties(pyarpackDenseQRPP_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
configure_file("${PROJECT_SOURCE_DIR}/EXAMPLES/PYARPACK/pyarpackRestart.py.in" "${CMAKE_BINARY_DIR}/pyarpackRestart.py" @ONLY)
add_test(NAME pyarpackRestart_tst COMMAND ${PYTHON_EXECUTABLE} pyarpackRestart.py)
set_tests_properties(pyarpackRestart_tst PROPERTIES ENVIRONMENT PYTHONPATH=${CMAKE_BINARY_DIR}/lib:$ENV{PYTHONPATH})
endif()
if (MPI)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/PARPACK/TESTS/MPI)
add_executable(icb_parpack_c PARPACK/TESTS/MPI/icb_parpack_c.c)
target_include_directories(icb_parpack_c PUBLIC ${PROJECT_SOURCE_DIR}/ICB MPI::MPI_C) # Get parpack.h mpi.h
target_link_libraries(icb_parpack_c parpack arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS} MPI::MPI_C)
add_test(icb_parpack_c_tst mpiexec -n 2 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/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}/ICB MPI::MPI_CXX) # Get parpack.hpp mpi.h
target_link_libraries(icb_parpack_cpp parpack arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS} MPI::MPI_CXX)
add_test(icb_parpack_cpp_tst mpiexec -n 2 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_parpack_cpp)
endif()
endif()
endfunction(build_tests)
if(TESTS)
enable_testing()
set(CMAKE_CTEST_COMMAND ctest -V)
build_tests()
endif()
############################
# install
############################
# Convert variable names to those expected by the .pc file.
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix \${prefix})
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
set(PACKAGE_NAME ${PROJECT_NAME})
set(PACKAGE_VERSION ${arpack_ng_VERSION})
set(PACKAGE_URL "https://github.com/opencollab/arpack-ng/")
# Convert (LAPACK|BLAS)_LIBRARIES to -l flags, store in ARPACK_PC_LIBS_PRIVATE.
# LAPACK_LIBRARIES contains transitive deps, no need to parse BLAS_LIBRARIES.
set(ARPACK_PC_LIBS_PRIVATE)
foreach(lib ${LAPACK_LIBRARIES})
get_filename_component(libname ${lib} NAME)
string(REGEX REPLACE "^(lib)?([^.]+).*$" "-l\\2" libname ${libname})
list(APPEND ARPACK_PC_LIBS_PRIVATE "${libname}")
endforeach()
string(REPLACE ";" " " ARPACK_PC_LIBS_PRIVATE "${ARPACK_PC_LIBS_PRIVATE}")
set(PARPACK_PC_LIBS_PRIVATE)
foreach(lib ${LAPACK_LIBRARIES} ${MPI_Fortran_LIBRARIES})
get_filename_component(libname ${lib} NAME)
string(REGEX REPLACE "^(lib)?([^.]+).*$" "-l\\2" libname ${libname})
list(APPEND PARPACK_PC_LIBS_PRIVATE "${libname}")
endforeach()
string(REPLACE ";" " " PARPACK_PC_LIBS_PRIVATE "${PARPACK_PC_LIBS_PRIVATE}")
configure_file(pkg-config/arpack.pc.in "${PROJECT_BINARY_DIR}/arpack${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY)
configure_file(pkg-config/parpack.pc.in "${PROJECT_BINARY_DIR}/parpack${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY)
configure_file(pkg-config/arpackSolver.pc.in "${PROJECT_BINARY_DIR}/arpackSolver${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY)
install(TARGETS arpack
EXPORT arpackngTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES "${PROJECT_BINARY_DIR}/arpack${LIBSUFFIX}${ITF64SUFFIX}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
if (MPI)
install(TARGETS parpack
EXPORT arpackngTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES "${PROJECT_BINARY_DIR}/parpack${LIBSUFFIX}${ITF64SUFFIX}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif ()
if(ICB)
install(FILES ICB/arpack.h DESTINATION "${ARPACK_INSTALL_INCLUDEDIR}")
install(FILES ICB/arpack.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
if (MPI)
install(FILES ICB/parpack.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
install(FILES ICB/parpack.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
endif()
if (ICBEXMM)
install(FILES EXAMPLES/MATRIX_MARKET/arpackSolver.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
install(FILES "${PROJECT_BINARY_DIR}/arpackSolver${LIBSUFFIX}${ITF64SUFFIX}.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
endif()
install(FILES debug.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
install(FILES debugF90.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
if(ICB)
install(FILES ICB/debug_c.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
install(FILES ICB/debug_c.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
endif()
install(FILES stat.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
install(FILES statF90.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
if(ICB)
install(FILES ICB/stat_c.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
install(FILES ICB/stat_c.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
endif()
configure_file(arpackdef.h.in "${PROJECT_BINARY_DIR}/arpackdef.h" @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/arpackdef.h" DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
configure_file(arpackicb.h.in "${PROJECT_BINARY_DIR}/arpackicb.h" @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/arpackicb.h" DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
install(EXPORT arpackngTargets
DESTINATION "${ARPACK_INSTALL_CMAKEDIR}"
)
# Provide find_package for arpack-ng to users.
configure_file(cmake/arpackng-config.cmake.in "${PROJECT_BINARY_DIR}/arpackng-config.cmake" @ONLY)
configure_file(cmake/arpackng-config-version.cmake.in "${PROJECT_BINARY_DIR}/arpackng-config-version.cmake" @ONLY)
install(
FILES
"${PROJECT_BINARY_DIR}/arpackng-config.cmake"
"${PROJECT_BINARY_DIR}/arpackng-config-version.cmake"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/arpackng${LIBSUFFIX}${ITF64SUFFIX}) # find_package(arpackng)
configure_file(cmake/tstCMakeInstall.sh.in ${PROJECT_BINARY_DIR}/tstCMakeInstall.sh @ONLY)
# 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)
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} (ICB provided ${HAVE_MPI_ICB})")
message(" -- ICB: ${ICB}")
message(" -- INTERFACE64: ${INTERFACE64}")
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_DIRS}" "${MPI_Fortran_LIBRARIES}")
if (ICB)
libsummary("MPICC" "${MPI_C_INCLUDE_DIRS}" "${MPI_C_LIBRARIES}")
libsummary("MPICXX" "${MPI_CXX_INCLUDE_DIRS}" "${MPI_CXX_LIBRARIES}")
endif()
endif()
libsummary("BLAS" "" "${BLAS_LIBRARIES}")
libsummary("LAPACK" "" "${LAPACK_LIBRARIES}")
if (ICBEXMM)
libsummary("EIGEN3" "${EIGEN3_INCLUDE_DIR}" "")
endif()
if (PYTHON3)
libsummary("PYTHON" "${PYTHON_INCLUDE_DIRS}" "${PYTHON_LIBRARIES}")
message(" -- exe: ${PYTHON_EXECUTABLE}")
libsummary("BOOST" "${Boost_INCLUDE_DIRS}" "${Boost_LIBRARIES}")
endif()
+45
View File
@@ -0,0 +1,45 @@
BSD Software License
Pertains to ARPACK and P_ARPACK
Copyright (c) 1996-2008 Rice University.
Developed by D.C. Sorensen, R.B. Lehoucq, C. Yang, and K. Maschhoff.
All rights reserved.
Arpack has been renamed to arpack-ng.
Copyright (c) 2001-2011 - Scilab Enterprises
Updated by Allan Cornet, Sylvestre Ledru.
Copyright (c) 2010 - Jordi Gutiérrez Hermoso (Octave patch)
Copyright (c) 2007 - Sébastien Fabbro (gentoo patch)
Redistribution and use in source and binary forms, with or without
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.
- 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
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
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
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
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)$(ITF64SUFFIX).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)$(ITF64SUFFIX).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
+79
View File
@@ -0,0 +1,79 @@
%% MatrixMarket matrix coordinate double symmetric
% This example is 0-based without (optional) nnz
%
% This is a 1D diffusive laplacian matrix (fixed at first end <=> invertible)
%
% 1 1
% . .--.
% / \ | |
% / \ 0 0 | |
% phi_i --o o o--o-- => grad(phi_i) --o o o--o--
% i j i| |j
% | |
% .--.
% -1.
%
% 1 1
% . .--.
% / \ | |
% / \ 0 i| |j
% phi_j --o--o o o-- => grad(phi_j) --o--o o o--
% i j | | 0
% | |
% .--.
% -1.
%
% i j
% | l_ii l_ij | i
% laplacian = | |
% | l_ji l_jj | j
%
% distance(i, j) = d = 1.
%
% l_ii = int_[i,j](grad(phi_i).grad(phi_i)) = d*(-1.)*(-1.) = 1.
% l_ij = int_[i,j](grad(phi_i).grad(phi_j)) = d*(-1.)*( 1.) = -1.
% l_ji = int_[i,j](grad(phi_j).grad(phi_i)) = d*( 1.)*(-1.) = -1.
% l_jj = int_[i,j](grad(phi_j).grad(phi_j)) = d*( 1.)*( 1.) = 1.
%
% i j
% | d_ii d_ij | i
% diffusion = | |
% | d_ji d_jj | j
%
% d_ii = int_[i,j](phi_i.grad(phi_i)) = int_[i,j]((1-x)*(-1.)) = -d*0.5 = -0.5
% d_ij = int_[i,j](phi_i.grad(phi_j)) = int_[i,j]((1-x)*( 1.)) = d*0.5 = 0.5
% d_ji = int_[i,j](phi_j.grad(phi_i)) = int_[i,j]( x *(-1.)) = -d*0.5 = -0.5
% d_jj = int_[i,j](phi_j.grad(phi_j)) = int_[i,j]( x *( 1.)) = d*0.5 = 0.5
%
% A <=> assembly of {kappa*laplacian + rho*diffusion}
% where kappa = 100 and rho = 2
%
% n m [nnz]
% i j Aij
8 8
0 0 1.
1 1 200.
2 2 200.
3 3 200.
4 4 200.
5 5 200.
6 6 200.
7 7 101.
1 0 0.
2 1 -101.
3 2 -101.
4 3 -101.
5 4 -101.
6 5 -101.
7 6 -101.
0 1 0.
1 2 -99.
2 3 -99.
3 4 -99.
4 5 -99.
5 6 -99.
6 7 -99.
+69
View File
@@ -0,0 +1,69 @@
%% MatrixMarket matrix coordinate double symmetric
% This example is 0-based without (optional) nnz
%
% This is a 1D laplacian matrix (fixed at first end <=> invertible)
%
% 1 1
% . .--.
% / \ | |
% / \ 0 0 | |
% phi_i --o o o--o-- => grad(phi_i) --o o o--o--
% i j i| |j
% | |
% .--.
% -1.
%
% 1 1
% . .--.
% / \ | |
% / \ 0 i| |j
% phi_j --o--o o o-- => grad(phi_j) --o--o o o--
% i j | | 0
% | |
% .--.
% -1.
%
% i j
% | l_ii l_ij | i
% laplacian = | |
% | l_ji l_jj | j
%
% distance(i, j) = d = 1.
%
% l_ii = int_[i,j](grad(phi_i).grad(phi_i)) = d*(-1.)*(-1.) = 1.
% l_ij = int_[i,j](grad(phi_i).grad(phi_j)) = d*(-1.)*( 1.) = -1.
% l_ji = int_[i,j](grad(phi_j).grad(phi_i)) = d*( 1.)*(-1.) = -1.
% l_jj = int_[i,j](grad(phi_j).grad(phi_j)) = d*( 1.)*( 1.) = 1.
%
% A <=> assembly of {kappa*laplacian}
% where kappa = 100
%
% n m [nnz]
% i j Aij
8 8
0 0 1.
1 1 200.
2 2 200.
3 3 200.
4 4 200.
5 5 200.
6 6 200.
7 7 100.
1 0 0.00
2 1 -100.00
3 2 -100.00
4 3 -100.00
5 4 -100.00
6 5 -100.00
7 6 -100.00
0 1 0.00
1 2 -100.00
2 3 -100.00
3 4 -100.00
4 5 -100.00
5 6 -100.00
6 7 -100.00
+79
View File
@@ -0,0 +1,79 @@
%% MatrixMarket matrix coordinate double symmetric
% This example is 0-based without (optional) nnz
%
% This is a 1D diffusive laplacian matrix (fixed at first end <=> invertible)
%
% 1 1
% . .--.
% / \ | |
% / \ 0 0 | |
% phi_i --o o o--o-- => grad(phi_i) --o o o--o--
% i j i| |j
% | |
% .--.
% -1.
%
% 1 1
% . .--.
% / \ | |
% / \ 0 i| |j
% phi_j --o--o o o-- => grad(phi_j) --o--o o o--
% i j | | 0
% | |
% .--.
% -1.
%
% i j
% | l_ii l_ij | i
% laplacian = | |
% | l_ji l_jj | j
%
% distance(i, j) = d = 1.
%
% l_ii = int_[i,j](grad(phi_i).grad(phi_i)) = d*(-1.)*(-1.) = 1.
% l_ij = int_[i,j](grad(phi_i).grad(phi_j)) = d*(-1.)*( 1.) = -1.
% l_ji = int_[i,j](grad(phi_j).grad(phi_i)) = d*( 1.)*(-1.) = -1.
% l_jj = int_[i,j](grad(phi_j).grad(phi_j)) = d*( 1.)*( 1.) = 1.
%
% i j
% | d_ii d_ij | i
% diffusion = | |
% | d_ji d_jj | j
%
% d_ii = int_[i,j](phi_i.grad(phi_i)) = int_[i,j]((1-x)*(-1.)) = -d*0.5 = -0.5
% d_ij = int_[i,j](phi_i.grad(phi_j)) = int_[i,j]((1-x)*( 1.)) = d*0.5 = 0.5
% d_ji = int_[i,j](phi_j.grad(phi_i)) = int_[i,j]( x *(-1.)) = -d*0.5 = -0.5
% d_jj = int_[i,j](phi_j.grad(phi_j)) = int_[i,j]( x *( 1.)) = d*0.5 = 0.5
%
% A <=> assembly of {kappa*laplacian + rho*diffusion}
% where kappa = 100 and rho = 2
%
% n m [nnz]
% i j Aij
8 8
0 0 ( 1., 0.)
1 1 (200., 0.)
2 2 (200., 0.)
3 3 (200., 0.)
4 4 (200., 0.)
5 5 (200., 0.)
6 6 (200., 0.)
7 7 (101., 0.)
1 0 ( 0., 0.)
2 1 (-101., 0.)
3 2 (-101., 0.)
4 3 (-101., 0.)
5 4 (-101., 0.)
6 5 (-101., 0.)
7 6 (-101., 0.)
0 1 ( 0., 0.)
1 2 (-99., 0.)
2 3 (-99., 0.)
3 4 (-99., 0.)
4 5 (-99., 0.)
5 6 (-99., 0.)
6 7 (-99., 0.)
+62
View File
@@ -0,0 +1,62 @@
%% MatrixMarket matrix coordinate double general
% This example is 1-based with (optional) nnz
%
% This is a 1D mass matrix
%
% 1
% .
% / \
% / \ 0
% phi_i --o o o--o--
% i j
%
% 1
% .
% / \
% / \ 0
% phi_j --o--o o o--
% i j
%
% i j
% | i_ii i_ij | i
% inertia = | |
% | i_ji i_jj | j
%
% distance(i, j) = d = 1.
%
% i_ii = int_[i,j](phi_i.phi_i) = int_[i,j]((1-x)(1-x)) = i_jj (area under the curve)
% i_ij = int_[i,j](phi_i.phi_j) = int_[i,j]((1-x) x ) = i_ji
% i_ji = int_[i,j](phi_j.phi_i) = int_[i,j]( x (1-x)) = d*1./6.
% i_jj = int_[i,j](phi_j.phi_j) = int_[i,j]( x x ) = d*1./3.
%
% B <=> mass assembly
%
% n m [nnz]
% i j Bij
8 8 22
1 1 0.333
2 2 0.333
3 3 0.333
4 4 0.333
5 5 0.333
6 6 0.333
7 7 0.333
8 8 0.333
2 1 0.166
3 2 0.166
4 3 0.166
5 4 0.166
6 5 0.166
7 6 0.166
8 7 0.166
1 2 0.166
2 3 0.166
3 4 0.166
4 5 0.166
5 6 0.166
6 7 0.166
7 8 0.166
+62
View File
@@ -0,0 +1,62 @@
%% MatrixMarket matrix coordinate double general
% This example is 1-based with (optional) nnz
%
% This is a 1D mass matrix
%
% 1
% .
% / \
% / \ 0
% phi_i --o o o--o--
% i j
%
% 1
% .
% / \
% / \ 0
% phi_j --o--o o o--
% i j
%
% i j
% | i_ii i_ij | i
% inertia = | |
% | i_ji i_jj | j
%
% distance(i, j) = d = 1.
%
% i_ii = int_[i,j](phi_i.phi_i) = int_[i,j]((1-x)(1-x)) = i_jj (area under the curve)
% i_ij = int_[i,j](phi_i.phi_j) = int_[i,j]((1-x) x ) = i_ji
% i_ji = int_[i,j](phi_j.phi_i) = int_[i,j]( x (1-x)) = d*1./6.
% i_jj = int_[i,j](phi_j.phi_j) = int_[i,j]( x x ) = d*1./3.
%
% B <=> mass assembly
%
% n m [nnz]
% i j Bij
8 8 22
1 1 (0.333, 0.)
2 2 (0.333, 0.)
3 3 (0.333, 0.)
4 4 (0.333, 0.)
5 5 (0.333, 0.)
6 6 (0.333, 0.)
7 7 (0.333, 0.)
8 8 (0.333, 0.)
2 1 (0.166, 0.)
3 2 (0.166, 0.)
4 3 (0.166, 0.)
5 4 (0.166, 0.)
6 5 (0.166, 0.)
7 6 (0.166, 0.)
8 7 (0.166, 0.)
1 2 (0.166, 0.)
2 3 (0.166, 0.)
3 4 (0.166, 0.)
4 5 (0.166, 0.)
5 6 (0.166, 0.)
6 7 (0.166, 0.)
7 8 (0.166, 0.)
+22
View File
@@ -0,0 +1,22 @@
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX)$(ITF64SUFFIX).la
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/ICB $(EIGEN3_CFLAGS)
EXTRA_DIST = README
check_PROGRAMS = arpackmm
dist_check_SCRIPTS = arpackmm.sh
dist_check_DATA = An.mtx As.mtx Az.mtx B.mtx Bz.mtx
TESTS = arpackmm.sh
arpackmm_SOURCES = arpackmm.cpp
if ICBEXMM
pkginclude_HEADERS = arpackSolver.hpp
endif
CLEANFILES = \
arpackmm.run.log \
arpackmm.resid.out \
arpackmm.v.out \
arpackSolver.resid.out \
arpackSolver.v.out
+39
View File
@@ -0,0 +1,39 @@
arpackmm: utility to test arpack with matrix market files.
This is meant to run arpack with different options to find
what are the ones that are the best for your particular
problem.
Typically: computing small eigen values may breakdown and/or
be slow (arpack is good at finding large eigen values only).
To compute small eigen values, it may be a better choice
to look for large eigen values with invert or shift+invert.
How to use this utility ?
Start simple, then, increase complexity if/when needed:
- defaults to: standard real symmetric eigen problem to be
solved accurately (double precision).
- list all possible options with --help.
- add --verbose or --debug to get more informations.
- if solve breaks down, you may:
- play with --nbCV (increase workspace size).
- play with --shiftReal/Imag and/or --invert.
- if arpack mode > 1, change solver with --slv.
- if arpack mode > 1, change solver parameters with --slv
(typically: pivoting threshold, solver tolerance, ...).
- try --restart (restart from previous eigen basis
approximation computed by previous run).
- etc...
Note: using openblas/mkl/atlas instead of netlib blas/lapack
may impact results. In some cases, it may also fail checks.
Use --noCheck to skip checks.
To build this utility, you need:
- to use a fortran compiler which supports iso_c_binding.
- to have installed eigen3 (to deal with the RCI).
- to configure arpack-ng this way:
- autotools:
~arpack-ng> ./configure --enable-icb-exmm; make all check
- cmake:
~arpack-ng/build> cmake -D ICBEXMM=ON ..; make all test
File diff suppressed because it is too large Load Diff
+983
View File
@@ -0,0 +1,983 @@
#include <chrono>
#include "arpackSolver.hpp"
#include "debug_c.hpp"
#include "stat_c.hpp"
using namespace std;
class options {
public:
options() {
fileA = "A.mtx";
fileB = "N.A."; // Not available.
dense = false;
denseRR = true;
nbEV = 1;
nbCV = 2 * nbEV + 1;
stdPb = true; // Standard or generalized (= not standard).
symPb = true;
cpxPb = false;
simplePrec = false; // Double precision.
mag = string("LM"); // Large magnitude.
shiftReal = false;
shiftImag = false;
sigmaReal = 0.;
sigmaImag = 0.; // Eigen value translation: look for lambda+sigma instead
// of lambda.
invert =
false; // Eigen value invertion: look for 1./lambda instead of lambda.
tol = 1.e-06;
maxIt = 100;
schur = false; // Compute Ritz vectors.
slv = "BiCG";
slvItrTol = 1.e-6;
slvItrMaxIt = 100;
slvItrPC = "Diag";
slvDrtPivot = 1.e-6;
slvDrtOffset = 0.;
slvDrtScale = 1.;
check = true;
verbose = 0;
debug = 0;
restart = false;
};
int readCmdLine(int argc, char** argv) {
// Check for command line independent parameters.
for (int a = 1; argv && a < argc; a++) {
string clo = argv[a]; // Command line option.
if (clo == "--help") return usage(0);
if (clo == "--A") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
fileA = argv[a];
}
if (clo == "--dense") {
dense = true;
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
string rr(argv[a]);
if (rr != "true" && rr != "false") {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
denseRR = (rr == "true") ? true : false;
}
if (clo == "--nbEV") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream nEV(argv[a]);
nEV >> nbEV;
if (!nEV) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
nbCV = 2 * nbEV + 1;
}
if (clo == "--genPb") {
stdPb = false;
fileB = "B.mtx";
}
if (clo == "--nonSymPb") symPb = false;
if (clo == "--cpxPb") {
symPb = false;
cpxPb = true;
}
if (clo == "--simplePrec") simplePrec = true;
if (clo == "--mag") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
mag = argv[a]; // small mag (likely poor perf) <=> large mag + invert
// (likely good perf).
bool ok = (mag == "LM" || mag == "SM" || mag == "LR" || mag == "SR" ||
mag == "LI" || mag == "SI")
? true
: false;
if (!ok) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--shiftReal") {
shiftReal = true;
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream s(argv[a]);
s >> sigmaReal;
if (!s) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--shiftImag") {
shiftImag = true;
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream s(argv[a]);
s >> sigmaImag;
if (!s) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--invert") invert = true;
if (clo == "--tol") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream t(argv[a]);
t >> tol;
if (!t) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--maxIt") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream mi(argv[a]);
mi >> maxIt;
if (!mi) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--slv") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
slv = argv[a];
}
if (clo == "--slvItrTol") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream t(argv[a]);
double tol = 0.;
t >> slvItrTol;
if (!t) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--slvItrMaxIt") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream mi(argv[a]);
int maxIt = 0;
mi >> slvItrMaxIt;
if (!mi) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--slvItrPC") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream pc(argv[a]);
pc >> slvItrPC;
if (!pc) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--slvDrtPivot") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream pv(argv[a]);
pv >> slvDrtPivot;
if (!pv) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--slvDrtOffset") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream of(argv[a]);
of >> slvDrtOffset;
if (!of) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--slvDrtScale") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream sc(argv[a]);
sc >> slvDrtScale;
if (!sc) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--noCheck") check = false;
if (clo == "--verbose") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream vb(argv[a]);
vb >> verbose;
if (!vb) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--debug") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream dbg(argv[a]);
dbg >> debug;
if (!dbg) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
if (debug > 3) debug = 3;
debug_c(6, -6, debug, debug, debug, debug, debug, debug, debug, debug,
debug, debug, debug, debug, debug, debug, debug, debug, debug,
debug, debug, debug, debug, debug);
}
if (clo == "--restart") restart = true;
}
// Check for command line dependent parameters.
for (int a = 1; argv && a < argc; a++) {
string clo = argv[a]; // Command line option.
if (clo == "--nbCV") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream nCV(argv[a]);
nCV >> nbCV;
if (!nCV) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--B") {
a++;
if (a >= argc) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
fileB = argv[a];
}
}
// Sanity checks.
if (!stdPb && fileB.empty()) {
cerr << "Error: generalized problem without B matrix" << endl;
return usage();
}
return 0;
};
int usage(int rc = 1) {
cout << "Usage: running arpack with matrix market files to check for eigen "
"values/vectors."
<< endl;
cout << endl;
cout << " --A F: file name of matrix A such that A X = lambda "
"X. (standard)"
<< endl;
cout << " the file F must be compliant with the matrix "
"market format."
<< endl;
cout << " default: A.mtx" << endl;
cout << " --B F: file name of matrix B such that A X = lambda "
"B X. (generalized)"
<< endl;
cout << " the file F must be compliant with the matrix "
"market format."
<< endl;
cout << " default: N.A. for standard problem, or, B.mtx "
"for generalized problem"
<< endl;
cout << " --dense RR: consider A and B as dense matrices." << endl;
cout << " if RR = true, use more-stable-but-slow "
"versions of LU / QR (rank revealing)."
<< endl;
cout << " if RR = false, use less-stable-but-fast "
"versions of LU / QR (depends on condition number)."
<< endl;
cout << " Notes:" << endl;
cout << " - only direct solvers are available when "
"using dense matrices."
<< endl;
cout
<< " - RR does not impact the use of LLT and LDLT."
<< endl;
cout << " - thresholds only make sense for "
"rank-revealing decompositions."
<< endl;
cout << " default: consider A and B as sparse matrices"
<< endl;
cout << " --nbEV: number of eigen values/vectors to compute."
<< endl;
cout << " default: 1" << endl;
cout << " --nbCV: number of columns of the matrix V." << endl;
cout << " default: 2*nbEV+1" << endl;
cout << " --genPb: generalized problem." << endl;
cout << " default: standard problem" << endl;
cout << " --nonSymPb: non symmetric problem (<=> use dn[ae]upd)."
<< endl;
cout << " default: symmetric problem (<=> use ds[ae]upd)"
<< endl;
cout << " --cpxPb: complex (non symmetric) problem (<=> use "
"zn[ae]upd)."
<< endl;
cout << " default: false (<=> use d*[ae]upd)" << endl;
cout << " --simplePrec: use simple precision (less accurate, but, "
"half memory footprint)."
<< endl;
cout << " default: false (<=> use double precision: use "
"[dz]*upd)"
<< endl;
cout << " --mag M: set magnitude of eigen values to look for "
"(LM, SM, LR, SR, LI, SI)."
<< endl;
cout << " default: large magnitude (LM)" << endl;
cout << " --shiftReal S: real shift where sigma = S (look for lambda+S "
"instead of lambda)."
<< endl;
cout << " default: no shift, S = 0." << endl;
cout << " --shiftImag S: imaginary shift where sigma = S (look for "
"lambda+S instead of lambda)."
<< endl;
cout << " default: no shift, S = 0." << endl;
cout << " --invert: invert mode (look for 1./lambda instead of "
"lambda)."
<< endl;
cout << " default: no invert" << endl;
cout << " --tol T: tolerance T." << endl;
cout << " default: 1.e-06" << endl;
cout << " --maxIt M: maximum iterations M." << endl;
cout << " default: 100" << endl;
cout << " --schur: compute Schur vectors." << endl;
cout << " the Schur decomposition is such that A = "
"Q^H x T x Q where:"
<< endl;
cout << " - the H superscript refers to the "
"Hermitian transpose: Q^H = (Q^t)^*."
<< endl;
cout
<< " - Q is unitary: Q is such that Q^H x Q = I."
<< endl;
cout << " - T is an upper-triangular matrix whose "
"diagonal elements are the eigenvalues of A."
<< endl;
cout << " every square matrix has a Schur "
"decomposition: columns of Q are the Schur vectors."
<< endl;
cout << " for a general matrix A, there is no "
"relation between Schur vectors of A and eigenvectors of A."
<< endl;
cout << " if q_j is the j-th Schur vector, then A x "
"q_j is a linear combination of q_1, ..., q_j."
<< endl;
cout << " Schur vectors q_1, q_2, ..., q_j span an "
"invariant subspace of A."
<< endl;
cout << " the Schur vectors and eigenvectors of A are "
"the same if A is a normal matrix."
<< endl;
cout << " default: compute Ritz vectors (approximations "
"of eigen vectors)"
<< endl;
cout << " --slv S: solver (needed if arpack mode > 1)." << endl;
cout << " BiCG: iterative method, any matrices"
<< endl;
cout << " CG: iterative method, sym matrices only"
<< endl;
cout << " LU: direct method, any matrices (pivoting "
"needed)"
<< endl;
cout << " QR: direct method, any matrices (pivoting "
"needed)"
<< endl;
cout << " LLT: direct method, SPD matrices only "
"(pivoting not needed)"
<< endl;
cout << " LDLT: direct method, symmetric positive "
"semi-definite matrices only (pivoting not needed)"
<< endl;
cout << " default: BiCG" << endl;
cout << " --slvItrTol T: solver tolerance T (for iterative solvers)."
<< endl;
cout << " default: 1.e-6" << endl;
cout << " --slvItrMaxIt M: solver maximum iterations M (for iterative "
"solvers)."
<< endl;
cout << " default: 100" << endl;
cout << " --slvItrPC PC: solver preconditioner (for iterative solvers)."
<< endl;
cout << " PC preconditioner:" << endl;
cout << " Diag: eigen diagonal preconditioner "
"(Jacobi)."
<< endl;
cout << " ILU#D#F: eigen ILU preconditioner."
<< endl;
cout << " D: drop tolerance." << endl;
cout << " F: fill factor." << endl;
cout << " default: diagonal preconditioner (Jacobi)"
<< endl;
cout << " --slvDrtPivot: P solver pivot P (for direct solvers)." << endl;
cout << " default: 1.e-06" << endl;
cout << " --slvDrtOffset: O solver offset O (for direct solvers)." << endl;
cout << " default: 0." << endl;
cout << " --slvDrtScale: S solver scale S (for direct solvers)." << endl;
cout << " default: 1." << endl;
cout << " --noCheck: check arpack eigen values/vectors." << endl;
cout << " check will fail if Schur vectors are computed "
"and A is NOT a normal matrix."
<< endl;
cout << " default: check" << endl;
cout << " --verbose V: verbosity level (up to 3)." << endl;
cout << " default: 0" << endl;
cout << " --debug D: debug level (up to 3)." << endl;
cout << " default: 0" << endl;
cout << " --restart: restart from previous run (which had produced "
"arpackSolver.*.out)."
<< endl;
cout << " restart from eigen basis approximation "
"computed during a previous run."
<< endl;
cout << " default: false" << endl;
if (rc == 0) exit(0);
return rc;
};
friend ostream& operator<<(ostream& ostr, options const& opt);
string fileA;
string fileB;
bool dense;
bool denseRR;
a_int nbEV;
a_int nbCV;
bool stdPb; // Standard or generalized (= not standard).
bool symPb;
bool cpxPb;
bool simplePrec;
string mag; // Magnitude <=> "which" arpack parameter.
bool shiftReal, shiftImag;
double sigmaReal, sigmaImag; // Eigen value translation: look for
// lambda+sigma instead of lambda.
bool invert; // Eigen value invertion: look for 1./lambda instead of lambda.
double tol;
int maxIt;
bool schur;
string slv;
double slvItrTol;
int slvItrMaxIt;
string slvItrPC;
double slvDrtPivot;
double slvDrtOffset;
double slvDrtScale;
bool check;
int verbose;
a_int debug;
bool restart;
};
ostream& operator<<(ostream& ostr, options const& opt) {
ostr << "OPT: A " << opt.fileA << ", B " << opt.fileB;
if (opt.dense && opt.denseRR)
ostr << ", dense yes (RR true)";
else if (opt.dense && !opt.denseRR)
ostr << ", dense yes (RR false)";
else
ostr << ", dense no";
ostr << ", nbEV " << opt.nbEV << ", nbCV " << opt.nbCV << ", stdPb "
<< (opt.stdPb ? "yes" : "no");
ostr << ", symPb " << (opt.symPb ? "yes" : "no") << ", cpxPb "
<< (opt.cpxPb ? "yes" : "no");
ostr << ", simplePrec " << (opt.simplePrec ? "yes" : "no") << ", mag "
<< opt.mag << endl;
ostr << "OPT: shiftReal " << (opt.shiftReal ? "yes" : "no") << ", sigmaReal "
<< opt.sigmaReal;
ostr << ", shiftImag " << (opt.shiftImag ? "yes" : "no") << ", sigmaImag "
<< opt.sigmaImag;
ostr << ", invert " << (opt.invert ? "yes" : "no") << ", tol " << opt.tol
<< ", maxIt " << opt.maxIt;
ostr << ", " << (opt.schur ? "Schur" : "Ritz") << " vectors" << endl;
ostr << "OPT: slv " << opt.slv << ", slvItrPC " << opt.slvItrPC
<< ", slvItrTol " << opt.slvItrTol;
ostr << ", slvItrMaxIt " << opt.slvItrMaxIt << ", slvDrtPivot "
<< opt.slvDrtPivot;
ostr << ", slvDrtOffset " << opt.slvDrtOffset << ", slvDrtScale "
<< opt.slvDrtScale << endl;
ostr << "OPT: check " << (opt.check ? "yes" : "no") << ", verbose "
<< opt.verbose << ", debug " << opt.debug;
ostr << ", restart " << (opt.restart ? "yes" : "no") << endl;
return ostr;
}
class output {
public:
output() {
nbVal = 0;
mode = 0;
nbIt = 0;
imsTime = 0.;
rciTime = 0.;
};
int nbVal; // Eigen values.
int mode; // Arpack mode.
int nbIt; // Arpack number of iterations.
double imsTime; // Init mode solver time.
double rciTime; // Reverse communication interface time.
};
template <typename RC, typename FD, typename EM, typename SLV>
int itrSolve(options& opt, output& out, double const& slvItrILUDropTol,
double const& slvItrILUFillFactor) {
// Init solver.
arpackItrSolver<RC, FD, EM, SLV> as;
as.symPb = opt.symPb;
as.nbEV = opt.nbEV;
as.nbCV = opt.nbCV;
as.tol = opt.tol;
as.sigmaReal = opt.sigmaReal;
as.sigmaImag = opt.sigmaImag;
as.dumpToFile = true;
as.restartFromFile = opt.restart;
as.mag = opt.mag;
as.maxIt = opt.maxIt;
as.schur = opt.schur;
as.verbose = opt.verbose;
as.slvTol = opt.slvItrTol;
as.slvMaxIt = opt.slvItrMaxIt;
as.slvILUDropTol = slvItrILUDropTol;
as.slvILUFillFactor = slvItrILUFillFactor;
// Read A and B matrices.
EM A;
auto start = chrono::high_resolution_clock::now();
int rc = as.createMatrix(opt.fileA, A);
if (rc != 0) {
cerr << "Error: read A KO" << endl;
return rc;
}
auto stop = chrono::high_resolution_clock::now();
double readATime =
chrono::duration_cast<chrono::milliseconds>(stop - start).count() / 1000.;
cout << endl;
cout << "INP: create A " << readATime << " s" << endl;
if (opt.nbCV > A.cols()) opt.nbCV = A.cols(); /* Cut-off */
EM B;
if (!opt.stdPb) {
start = chrono::high_resolution_clock::now();
rc = as.createMatrix(opt.fileB, B);
if (rc != 0) {
cerr << "Error: read B KO" << endl;
return rc;
}
stop = chrono::high_resolution_clock::now();
double readBTime =
chrono::duration_cast<chrono::milliseconds>(stop - start).count() /
1000.;
cout << endl;
cout << "INP: create B " << readBTime << " s" << endl;
if (A.rows() != B.rows()) {
cerr << "Error: A.rows() != B.rows()" << endl;
return rc;
}
if (A.cols() != B.cols()) {
cerr << "Error: A.cols() != B.cols()" << endl;
return rc;
}
}
// Solve.
rc = as.solve(A, opt.stdPb ? nullptr : &B);
if (rc != 0) {
cerr << "Error: solve KO" << endl;
return rc;
}
if (opt.check) {
rc = as.checkEigVec(A, opt.stdPb ? nullptr : &B);
if (rc != 0) {
cerr << "Error: check KO" << endl;
return rc;
}
}
// Retrieve outputs.
out.nbVal = as.val.size();
out.mode = as.mode;
out.nbIt = as.nbIt;
out.imsTime = as.imsTime;
out.rciTime = as.rciTime;
return 0;
}
template <typename RC, typename FD, typename EM, typename SLV>
int drtSolve(options& opt, output& out) {
// Init solver.
arpackDrtSolver<RC, FD, EM, SLV> as;
as.symPb = opt.symPb;
as.nbEV = opt.nbEV;
as.nbCV = opt.nbCV;
as.tol = opt.tol;
as.sigmaReal = opt.sigmaReal;
as.sigmaImag = opt.sigmaImag;
as.dumpToFile = true;
as.restartFromFile = opt.restart;
as.mag = opt.mag;
as.maxIt = opt.maxIt;
as.schur = opt.schur;
as.verbose = opt.verbose;
as.slvPvtThd = opt.slvDrtPivot;
as.slvOffset = opt.slvDrtOffset;
as.slvScale = opt.slvDrtScale;
// Read A and B matrices.
EM A;
auto start = chrono::high_resolution_clock::now();
int rc = as.createMatrix(opt.fileA, A);
if (rc != 0) {
cerr << "Error: read A KO" << endl;
return rc;
}
auto stop = chrono::high_resolution_clock::now();
double readATime =
chrono::duration_cast<chrono::milliseconds>(stop - start).count() / 1000.;
cout << endl;
cout << "INP: create A " << readATime << " s" << endl;
if (opt.nbCV > A.cols()) opt.nbCV = A.cols(); /* Cut-off */
EM B;
if (!opt.stdPb) {
start = chrono::high_resolution_clock::now();
rc = as.createMatrix(opt.fileB, B);
if (rc != 0) {
cerr << "Error: read B KO" << endl;
return rc;
}
stop = chrono::high_resolution_clock::now();
double readBTime =
chrono::duration_cast<chrono::milliseconds>(stop - start).count() /
1000.;
cout << endl;
cout << "INP: create B " << readBTime << " s" << endl;
if (A.rows() != B.rows()) {
cerr << "Error: A.rows() != B.rows()" << endl;
return rc;
}
if (A.cols() != B.cols()) {
cerr << "Error: A.cols() != B.cols()" << endl;
return rc;
}
}
// Solve.
rc = as.solve(A, opt.stdPb ? nullptr : &B);
if (rc != 0) {
cerr << "Error: solve KO" << endl;
return rc;
}
if (opt.check) {
rc = as.checkEigVec(A, opt.stdPb ? nullptr : &B);
if (rc != 0) {
cerr << "Error: check KO" << endl;
return rc;
}
}
// Retrieve outputs.
out.nbVal = as.val.size();
out.mode = as.mode;
out.nbIt = as.nbIt;
out.imsTime = as.imsTime;
out.rciTime = as.rciTime;
return 0;
}
template <typename RC, typename FD, typename EM, typename SLV1, typename SLV2,
typename SLV3, typename SLV4>
int drtSolve(options& opt, output& out) {
int rc = 1;
if (opt.slv == "LU") rc = drtSolve<RC, FD, EM, SLV1>(opt, out);
if (opt.slv == "QR") rc = drtSolve<RC, FD, EM, SLV2>(opt, out);
if (opt.slv == "LLT") rc = drtSolve<RC, FD, EM, SLV3>(opt, out);
if (opt.slv == "LDLT") rc = drtSolve<RC, FD, EM, SLV4>(opt, out);
return rc;
}
template <typename RC, typename FD, typename EM, typename SLV1, typename SLV2,
typename SLV3, typename SLV4>
int itrSolve(options& opt, output& out) {
int rc = 1;
stringstream clo(opt.slvItrPC);
string slvItrPC;
getline(clo, slvItrPC, '#');
double slvItrILUDropTol = 1.;
if (slvItrPC == "ILU") {
string dropTol;
getline(clo, dropTol, '#');
stringstream dt(dropTol);
dt >> slvItrILUDropTol;
}
int slvItrILUFillFactor = 2;
if (slvItrPC == "ILU") {
string fillFactor;
getline(clo, fillFactor);
stringstream ff(fillFactor);
ff >> slvItrILUFillFactor;
}
if (opt.slv == "BiCG") {
if (slvItrPC == "Diag")
rc = itrSolve<RC, FD, EM, SLV1>(opt, out, slvItrILUDropTol,
slvItrILUFillFactor);
if (slvItrPC == "ILU")
rc = itrSolve<RC, FD, EM, SLV2>(opt, out, slvItrILUDropTol,
slvItrILUFillFactor);
}
if (opt.slv == "CG") {
if (slvItrPC == "Diag")
rc = itrSolve<RC, FD, EM, SLV3>(opt, out, slvItrILUDropTol,
slvItrILUFillFactor);
if (slvItrPC == "ILU")
rc = itrSolve<RC, FD, EM, SLV4>(opt, out, slvItrILUDropTol,
slvItrILUFillFactor);
}
return rc;
}
int main(int argc, char** argv) {
// Check for options.
options opt;
int rc = opt.readCmdLine(argc, argv);
if (rc != 0) {
cerr << "Error: read cmd line KO" << endl;
return rc;
}
cout << opt; // Print options.
// Solve with arpack.
sstats_c(); // Reset timers.
sstatn_c(); // Reset timers.
cstatn_c(); // Reset timers.
bool itrSlv = true; // Use iterative solvers.
if (opt.slv.find("LU") != string::npos ||
opt.slv.find("QR") != string::npos ||
opt.slv.find("LLT") != string::npos ||
opt.slv.find("LDLT") != string::npos)
itrSlv = false;
output out;
auto start = chrono::high_resolution_clock::now();
if (opt.dense) {
if (itrSlv) {
cerr << "Error: dense matrices does not support iterative solvers"
<< endl;
return 1;
}
if (opt.simplePrec) {
if (opt.cpxPb) {
if (opt.denseRR) {
rc = drtSolve<complex<float>, float, EigDMxC, EigDFLUC, EigDFQRC,
EigDLLTC, EigDLDLTC>(opt, out);
} else {
rc = drtSolve<complex<float>, float, EigDMxC, EigDPLUC, EigDPQRC,
EigDLLTC, EigDLDLTC>(opt, out);
}
} else {
if (opt.denseRR) {
rc = drtSolve<float, float, EigDMxS, EigDFLUS, EigDFQRS, EigDLLTS,
EigDLDLTS>(opt, out);
} else {
rc = drtSolve<float, float, EigDMxS, EigDPLUS, EigDPQRS, EigDLLTS,
EigDLDLTS>(opt, out);
}
}
} else {
if (opt.cpxPb) {
if (opt.denseRR) {
rc = drtSolve<complex<double>, double, EigDMxZ, EigDFLUZ, EigDFQRZ,
EigDLLTZ, EigDLDLTZ>(opt, out);
} else {
rc = drtSolve<complex<double>, double, EigDMxZ, EigDPLUZ, EigDPQRZ,
EigDLLTZ, EigDLDLTZ>(opt, out);
}
} else {
if (opt.denseRR) {
rc = drtSolve<double, double, EigDMxD, EigDFLUD, EigDFQRD, EigDLLTD,
EigDLDLTD>(opt, out);
} else {
rc = drtSolve<double, double, EigDMxD, EigDPLUD, EigDPQRD, EigDLLTD,
EigDLDLTD>(opt, out);
}
}
}
} else {
if (opt.simplePrec) {
if (opt.cpxPb) {
if (itrSlv) {
rc = itrSolve<complex<float>, float, EigSMxC, EigSBiCGC, EigSBiCGILUC,
EigSCGC, EigSCGILUC>(opt, out);
} else {
rc = drtSolve<complex<float>, float, EigSMxC, EigSLUC, EigSQRC,
EigSLLTC, EigSLDLTC>(opt, out);
}
} else {
if (itrSlv) {
rc = itrSolve<float, float, EigSMxS, EigSBiCGS, EigSBiCGILUS, EigSCGS,
EigSCGILUS>(opt, out);
} else {
rc = drtSolve<float, float, EigSMxS, EigSLUS, EigSQRS, EigSLLTS,
EigSLDLTS>(opt, out);
}
}
} else {
if (opt.cpxPb) {
if (itrSlv) {
rc = itrSolve<complex<double>, double, EigSMxZ, EigSBiCGZ,
EigSBiCGILUZ, EigSCGZ, EigSCGILUZ>(opt, out);
} else {
rc = drtSolve<complex<double>, double, EigSMxZ, EigSLUZ, EigSQRZ,
EigSLLTZ, EigSLDLTZ>(opt, out);
}
} else {
if (itrSlv) {
rc = itrSolve<double, double, EigSMxD, EigSBiCGD, EigSBiCGILUD,
EigSCGD, EigSCGILUD>(opt, out);
} else {
rc = drtSolve<double, double, EigSMxD, EigSLUD, EigSQRD, EigSLLTD,
EigSLDLTD>(opt, out);
}
}
}
}
if (rc != 0) {
cerr << "Error: arpack solve KO" << endl;
return rc;
}
// Output results and stats.
auto stop = chrono::high_resolution_clock::now();
double fullTime =
chrono::duration_cast<chrono::milliseconds>(stop - start).count() / 1000.;
cout << endl;
cout << "OUT: mode " << out.mode << ", nb EV found " << out.nbVal
<< ", nb iterations " << out.nbIt << endl;
cout << "OUT: init mode solver " << out.imsTime << " s, RCI time "
<< out.rciTime << " s" << endl;
cout << "OUT: full time " << fullTime << " s" << endl;
a_int nopx = 0, nbx = 0, nrorth = 0, nitref = 0, nrstrt = 0;
float tsaupd = 0., tsaup2 = 0., tsaitr = 0., tseigt = 0., tsgets = 0.,
tsapps = 0., tsconv = 0.;
float tnaupd = 0., tnaup2 = 0., tnaitr = 0., tneigt = 0., tngets = 0.,
tnapps = 0., tnconv = 0.;
float tcaupd = 0., tcaup2 = 0., tcaitr = 0., tceigt = 0., tcgets = 0.,
tcapps = 0., tcconv = 0.;
float tmvopx = 0., tmvbx = 0., tgetv0 = 0., titref = 0., trvec = 0.;
stat_c(nopx, nbx, nrorth, nitref, nrstrt, tsaupd, tsaup2, tsaitr, tseigt,
tsgets, tsapps, tsconv, tnaupd, tnaup2, tnaitr, tneigt, tngets, tnapps,
tnconv, tcaupd, tcaup2, tcaitr, tceigt, tcgets, tcapps, tcconv, tmvopx,
tmvbx, tgetv0, titref, trvec);
cout << endl;
cout << "STAT: total number of user OP*x operation "
<< nopx << endl;
cout << "STAT: total number of user B*x operation "
<< nbx << endl;
cout << "STAT: total number of reorthogonalization steps taken "
<< nrorth << endl;
cout << "STAT: total number of it. refinement steps in reorthogonalization "
<< nitref << endl;
cout << "STAT: total number of restart steps "
<< nrstrt << endl;
return 0;
}
// Local Variables:
// mode: c++
// c-file-style:"stroustrup"
// show-trailing-whitespace: t
// End:
/* vim: set sw=2 ts=2 et smartindent :*/
+98
View File
@@ -0,0 +1,98 @@
#!/bin/bash -eu
export CMD="./arpackmm --help" # For coverage
echo "$CMD"
eval "$CMD &> arpackmm.run.log"
echo ""
echo "========================================================================================"
echo ""
for eigPb in "--A As.mtx" "--nonSymPb --A An.mtx" "--nonSymPb --cpxPb --A Az.mtx --B Bz.mtx"
do
for genPb in "" "--genPb"
do
for smallMag in "" "--mag SM --noCheck" # SM is known to be difficult to converge.
do
export shiftOpt=""
if [[ "$eigPb" == *nonSymPb* ]]; then
if [[ "$genPb" == *genPb* ]]; then
continue # Skip to ensure stable test: tricky to convergence.
else
export shiftOpt="--shiftReal 100.0 --shiftImag 100.0"
fi
else
if [[ "$genPb" == *genPb* ]]; then
continue # Skip to ensure stable test: tricky to convergence.
else
export shiftOpt="--shiftReal 100.0"
fi
fi
for shiftRI in "" "$shiftOpt"
do
for invert in "" "--invert"
do
for tol in "" "--tol 1.e-5"
do
for slv in "--slv BiCG --slvItrTol 1.e-06 --slvItrMaxIt 150" "--slv CG --slvItrTol 1.e-06 --slvItrMaxIt 150" \
"--slv BiCG --slvItrPC ILU" "--slv CG --slvItrPC ILU#1.e-06#2" \
"--slv LU" "--slv QR --slvDrtPivot 1.e-06" \
"--slv LLT" "--slv LLT --slvDrtOffset 0." \
"--slv LDLT" "--slv LDLT --slvDrtScale 1."
do
for rs in "" "--schur"
do
for dsPrec in "" "--simplePrec"
do
for dsMat in "" "--dense false" "--dense true"
do
export extraGenPb=""
if [[ "$genPb" == *genPb* ]]; then
export extraGenPb="$shiftOpt" # Force shift if genPb.
fi
if [[ "$slv" == *CG* ]]; then
if [[ "$eigPb" == *nonSymPb* ]]; then
continue # Skip CG that could fail (CG is meant to deal with sym matrices).
fi
fi
if [[ "$slv" == *LLT* ]] || [[ "$slv" == *LDLT* ]]; then
if [[ "$eigPb" == *nonSymPb* ]] || [[ "$genPb" == *genPb* ]]; then
continue # Skip LLT/LDLT that could fail (LLT/LDLT are meant to deal with SPD matrices).
fi
fi
if [[ "$dsMat" == *dense* ]]; then
if [[ "$slv" == *CG* ]]; then
continue # Iterative solvers are not allowed when using dense matrices.
fi
fi
# Run arpackmm: use --nbCV 6 and --maxIt 200 to ease convergence, and, --verbose 3 for debug.
export CMD="./arpackmm $eigPb $genPb $smallMag $shiftRI $invert $tol $slv $rs $dsPrec $dsMat $extraGenPb --nbCV 6 --maxIt 200 --verbose 3 --debug 3"
echo "$CMD"
eval "$CMD &> arpackmm.run.log"
echo ""
echo "========================================================================================"
echo ""
# Run arpackmm: re-run with restart.
export CMD="$CMD --restart"
echo "$CMD"
eval "$CMD &> arpackmm.run.log"
echo ""
echo "========================================================================================"
echo ""
done
done
done
done
done
done
done
done
done
done
echo "OK"
+6
View File
@@ -0,0 +1,6 @@
SUBDIRS = BAND COMPLEX NONSYM SIMPLE SVD SYM
if ICBEXMM
SUBDIRS += MATRIX_MARKET
endif
EXTRA_DIST = README README.CALLING-ARPACK-FROM-C-OR-CPP
+26
View File
@@ -0,0 +1,26 @@
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX)$(ITF64SUFFIX).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
+73
View File
@@ -0,0 +1,73 @@
pyarpack: python binding based on Boost.Python.Numpy used to expose arpack C++ API
Installation:
-------------
Python3: ~/arpack-ng/build> cmake -DCMAKE_INSTALL_PREFIX=/tmp/local -DPYTHON3=ON -DBOOST_PYTHON_LIBSUFFIX="3" ..
~/arpack-ng/build> make all test
~/arpack-ng/build> make install
Note: Boost must have been compiled for Python3.
Note: installation will install libpyarpack.so in the install directory.
Note: python3 minimal packages must be installed (apt-get install python3-minimal python3-pip).
numpy must be installed (apt-get install python3-numpy) as the A/B matrices used by arpack
solver must be numpy arrays.
Usage:
------
PYTHONPATH must include the directory where libpyarpack.so has been installed.
>> export PYTHONPATH="/tmp/local/lib/pyarpack:${PYTHONPATH}"
>> python
>> import pyarpack
>> help(pyarpack)
You can use sparse or dense matrices, and, play with iterative or direct mode solvers (CG, LU, ...):
1. choose arpack solver with a given mode solver
1.1. if you need to handle sparse matrices
>> from pyarpack import sparseBiCG as pyarpackSlv
1.2. if you need to handle dense matrices
>> from pyarpack import denseBiCG as pyarpackSlv
2. choose arpack data type (float, double, ...)
>> arpackSlv = pyarpackSlv.double()
3. solve the eigen problem
>> arpackSlv.solve(A, B)
4. get eigen values and vectors
>> print(arpackSlv.vec)
>> print(arpackSlv.val)
You can also:
1. restart a solve from the workspace of a previous solve: check out pyarpackRestart.py.in.
2. compute eigen and / or schur vectors.
Note:
1. arpack data type (float, double, ...) must be consistent with A/B numpy dtypes (float32, float64, ...).
at python side, the data MUST be casted in the EXACT expected type (int32, int64, float, double, ...).
otherwise, C++ may not get the data the way it expects them: C++ will not know how to read python data.
if you are not sure how data have been passed from python to C++, set arpackSlv.debug = 1 and check out debug traces.
in other words, pyarpack users MUST :
1.1. create numpy arrays specifying explicitly the type:
>> Aij = np.array([], dtype='complex128')
1.2. filling numpy arrays casting value on append:
>> Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
1.3. calling the solver flavor which is consistent with the numpy array data type:
>> arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
note: NO data type check can be done at C++ side, the pyarpack user MUST insure data consistency.
2. sparse matrices must be provided in coo format (n, i, j, Mij), that is, as a tuple where:
2.1. n is an integer.
2.2. i, j, Mij are 1 x nnz numpy arrays.
3. dense matrices must be provided in raw format (Mij, rowOrdered), that is, as a tuple where:
3.1. Mij is an n x n numpy array.
3.2. rowOrdered is a boolean (column ordered if False).
4. arpack mode solver are provided by eigen:
4.1. when solver is iterative, A and B can be sparse only.
4.2. when solver is direct, A and B can be sparse or dense.
Examples:
---------
~/arpack-ng> find . -name *.py.in (template files from which python scripts will result)
+431
View File
@@ -0,0 +1,431 @@
#include <Python.h> // PyErr_SetString.
#include <boost/python.hpp>
#include <boost/python/numpy.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <complex>
#include <pyarpackDrtSolver.hpp>
#include <pyarpackItrSolver.hpp>
#include <sstream> // ostringstream.
#include <string>
#include <vector>
namespace bp = boost::python;
namespace bn = boost::python::numpy;
template <typename RC, typename FD, typename EM, typename SLV>
void exportArpackSparseItr(bp::scope& pySlv, std::string const& dtype) {
// Created nested namespace in module.
pySlv.attr(dtype.c_str()) =
bp::class_<pyarpackSparseItrSolver<RC, FD, EM, SLV>>(
dtype.c_str(),
"arpack data type (must be consistent with numpy dtype)")
.def("solve", &pyarpackSparseItrSolver<RC, FD, EM, SLV>::solve,
(bp::arg("A"), bp::arg("B") = bp::tuple()),
"solve standard or generalised eigen problem where A and B must "
"be sparse and provided in coo format: (dimension, row-indice "
"array, column-indice array, matrice-value array) tuple")
.def("checkEigVec",
&pyarpackSparseItrSolver<RC, FD, EM, SLV>::checkEigVec,
(bp::arg("A"), bp::arg("B") = bp::tuple(),
bp::arg("diffTol") = 1.e-3),
"check eigen vectors accuracy where A and B must be sparse and "
"provided in coo format: (dimension, row-indice array, "
"column-indice array, matrice-value array) tuple")
ARPACKSOLVERMEMBER(pyarpackSparseItrSolver)
.def_readwrite(
"slvTol", &pyarpackSparseItrSolver<RC, FD, EM, SLV>::slvTol,
"tolerance of the iterative mode solver - default: 1.e-6")
.def_readwrite("slvMaxIt",
&pyarpackSparseItrSolver<RC, FD, EM, SLV>::slvMaxIt,
"maximum number of iterations of the iterative mode "
"solver - default: 100")
.def_readwrite(
"slvILUDropTol",
&pyarpackSparseItrSolver<RC, FD, EM, SLV>::slvILUDropTol,
"drop tolerance of the ILU preconditioner (if any) of the "
"iterative mode solver - default: 1")
.def_readwrite(
"slvILUFillFactor",
&pyarpackSparseItrSolver<RC, FD, EM, SLV>::slvILUFillFactor,
"fill factor of the ILU preconditioner (if any) of the iterative "
"mode solver - default: 2");
};
template <typename RC, typename FD, typename EM, typename SLV>
void exportArpackSparseDrt(bp::scope& pySlv, std::string const& dtype) {
// Created nested namespace in module.
pySlv.attr(dtype.c_str()) =
bp::class_<pyarpackSparseDrtSolver<RC, FD, EM, SLV>>(
dtype.c_str(),
"arpack data type (must be consistent with numpy dtype)")
.def("solve", &pyarpackSparseDrtSolver<RC, FD, EM, SLV>::solve,
(bp::arg("A"), bp::arg("B") = bp::tuple()),
"solve standard or generalised eigen problem where A and B must "
"be sparse and provided in coo format: (dimension, row-indice "
"array, column-indice array, matrice-value array) tuple")
.def("checkEigVec",
&pyarpackSparseDrtSolver<RC, FD, EM, SLV>::checkEigVec,
(bp::arg("A"), bp::arg("B") = bp::tuple(),
bp::arg("diffTol") = 1.e-3),
"check eigen vectors accuracy where A and B must be sparse and "
"provided in coo format: (dimension, row-indice array, "
"column-indice array, matrice-value array) tuple")
ARPACKSOLVERMEMBER(pyarpackSparseDrtSolver)
.def_readwrite(
"slvPvtThd", &pyarpackSparseDrtSolver<RC, FD, EM, SLV>::slvPvtThd,
"pivoting tolerance of the direct mode solver - default: 1.e-6")
.def_readwrite("slvOffset",
&pyarpackSparseDrtSolver<RC, FD, EM, SLV>::slvOffset,
"cholesky offset (LLT, LDLT) of the direct mode "
"solver - default: 0.")
.def_readwrite("slvScale",
&pyarpackSparseDrtSolver<RC, FD, EM, SLV>::slvScale,
"cholesky scale (LLT, LDLT) of the direct mode solver "
"- default: 1.");
};
template <typename RC, typename FD, typename EM, typename SLV>
void exportArpackDenseDrt(bp::scope& pySlv, std::string const& dtype) {
// Created nested namespace in module.
pySlv.attr(dtype.c_str()) =
bp::class_<pyarpackDenseDrtSolver<RC, FD, EM, SLV>>(
dtype.c_str(),
"arpack data type (must be consistent with numpy dtype)")
.def("solve", &pyarpackDenseDrtSolver<RC, FD, EM, SLV>::solve,
(bp::arg("A"), bp::arg("B") = bp::tuple()),
"solve standard or generalised eigen problem where A and B must "
"be dense and provided in raw format: (n-squared matrice-value "
"array, row or column ordered boolean)")
.def("checkEigVec",
&pyarpackDenseDrtSolver<RC, FD, EM, SLV>::checkEigVec,
(bp::arg("A"), bp::arg("B") = bp::tuple(),
bp::arg("diffTol") = 1.e-3),
"check eigen vectors accuracy where A and B must be dense and "
"provided in raw format: (n-squared matrice-value array, row or "
"column ordered boolean)")
ARPACKSOLVERMEMBER(pyarpackDenseDrtSolver)
.def_readwrite(
"slvPvtThd", &pyarpackDenseDrtSolver<RC, FD, EM, SLV>::slvPvtThd,
"pivoting tolerance of the direct mode solver - default: 1.e-6")
.def_readwrite("slvOffset",
&pyarpackDenseDrtSolver<RC, FD, EM, SLV>::slvOffset,
"cholesky offset (LLT, LDLT) of the direct mode "
"solver - default: 0.")
.def_readwrite("slvScale",
&pyarpackDenseDrtSolver<RC, FD, EM, SLV>::slvScale,
"cholesky scale (LLT, LDLT) of the direct mode solver "
"- default: 1.");
};
class sparseBiCGDiag {};
class sparseBiCGILU {};
class sparseCGDiag {};
class sparseCGILU {};
class sparseLLT {};
class sparseLDLT {};
class sparseLU {};
class sparseQR {};
class denseLLT {};
class denseLDLT {};
class denseLURR {};
class denseQRRR {};
class denseLUPP {};
class denseQRPP {};
std::complex<double> EigVecZGetItem(
Eigen::Matrix<std::complex<double>, Eigen::Dynamic, 1>& M, int idx) {
if (idx < 0 || idx >= M.size()) {
pyarpackThrowError("index out of range");
return std::complex<double>();
}
return M[idx];
};
std::string EigVecZToString(EigVecZ const& vec) {
std::ostringstream s;
s << vec;
return s.str();
};
BOOST_PYTHON_MODULE(pyarpack) {
// Initialize.
bn::initialize();
bp::class_<std::vector<std::complex<double>>>("StdVecZ").def(
bp::vector_indexing_suite<std::vector<std::complex<double>>>());
bp::class_<Eigen::Matrix<std::complex<double>, Eigen::Dynamic, 1>>("EigVecZ")
.def("__getitem__", &EigVecZGetItem)
.def("__str__", &EigVecZToString);
bp::class_<std::vector<EigVecZ>>("StdVecEVZ")
.def("__iter__", bp::iterator<std::vector<EigVecZ>>())
.def(bp::vector_indexing_suite<std::vector<EigVecZ>>());
// Documentation of the python module.
std::ostringstream doc;
doc << "You can use sparse or dense matrices, and, play with iterative or direct mode solvers (CG, LU, ...):" << std::endl;
doc << "1. choose arpack solver with a given mode solver" << std::endl;
doc << " 1.1. if you need to handle sparse matrices" << std::endl;
doc << " >> from pyarpack import sparseBiCG as pyarpackSlv" << std::endl;
doc << " 1.2. if you need to handle dense matrices" << std::endl;
doc << " >> from pyarpack import denseBiCG as pyarpackSlv" << std::endl;
doc << "2. choose arpack data type (float, double, ...)" << std::endl;
doc << " >> arpackSlv = pyarpackSlv.double()" << std::endl;
doc << "3. solve the eigen problem" << std::endl;
doc << " >> arpackSlv.solve(A, B)" << std::endl;
doc << "4. get eigen values and vectors" << std::endl;
doc << " >> print(arpackSlv.vec)" << std::endl;
doc << " >> print(arpackSlv.val)" << std::endl;
doc << std::endl;
doc << "Notes:" << std::endl;
doc << "1. arpack data type (float, double, ...) must be consistent with A/B numpy dtypes (float32, float64, ...)." << std::endl;
doc << " at python side, the data MUST be casted in the EXACT expected type (int32, int64, float, double, ...)." << std::endl;
doc << " otherwise, C++ may not get the data the way it expects them: C++ will not know how to read python data." << std::endl;
doc << " if you are not sure how data have been passed from python to C++, set arpackSlv.debug = 1 and check out debug traces." << std::endl;
doc << " in other words, pyarpack users MUST :" << std::endl;
doc << " 1.1. create numpy arrays specifying explicitly the type:" << std::endl;
doc << " >> Aij = np.array([], dtype='complex128')" << std::endl;
doc << " 1.2. filling numpy arrays casting value on append:" << std::endl;
doc << " >> Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type." << std::endl;
doc << " 1.3. calling the solver flavor which is consistent with the numpy array data type:" << std::endl;
doc << " >> arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')" << std::endl;
doc << " note: NO data type check can be done at C++ side, the pyarpack user MUST insure data consistency." << std::endl;
doc << "2. sparse matrices must be provided in coo format (n, i, j, Mij), that is, as a tuple where:" << std::endl;
doc << " 2.1. n is an integer." << std::endl;
doc << " 2.2. i, j, Mij are 1 x nnz numpy arrays." << std::endl;
doc << "3. dense matrices must be provided in raw format (Mij, rowOrdered), that is, as a tuple where:" << std::endl;
doc << " 3.1. Mij is an n x n numpy array." << std::endl;
doc << " 3.2. rowOrdered is a boolean (column ordered if False)." << std::endl;
doc << "4. arpack mode solver are provided by eigen:" << std::endl;
doc << " 4.1. when solver is iterative, A and B can be sparse only." << std::endl;
doc << " 4.2. when solver is direct, A and B can be sparse or dense." << std::endl;
bp::scope().attr("__doc__") = doc.str().c_str();
// Specify that this module is actually a package.
bp::object package = bp::scope();
package.attr("__path__") = "pyarpack";
// Create python module.
std::string module = "pyarpack";
bp::object pyModule(
bp::handle<>(bp::borrowed(PyImport_AddModule(module.c_str()))));
// Create modules.
{
std::string slv = "sparseBiCGDiag";
std::string slvHelp =
"arpack internal mode solver (mode > 1): BiCG with diagonal (Jacobi) "
"preconditioner";
bp::scope pySlvBiCGDiag =
bp::class_<sparseBiCGDiag>(slv.c_str(), slvHelp.c_str());
exportArpackSparseItr<float, float, EigSMxS, EigSBiCGS>(pySlvBiCGDiag,
"float");
exportArpackSparseItr<double, double, EigSMxD, EigSBiCGD>(pySlvBiCGDiag,
"double");
exportArpackSparseItr<std::complex<float>, float, EigSMxC, EigSBiCGC>(
pySlvBiCGDiag, "complexFloat");
exportArpackSparseItr<std::complex<double>, double, EigSMxZ, EigSBiCGZ>(
pySlvBiCGDiag, "complexDouble");
}
{
std::string slv = "sparseBiCGILU";
std::string slvHelp =
"arpack internal mode solver (mode > 1): BiCG with ILU preconditioner";
bp::scope pySlvBiCGILU =
bp::class_<sparseBiCGILU>(slv.c_str(), slvHelp.c_str());
exportArpackSparseItr<float, float, EigSMxS, EigSBiCGILUS>(pySlvBiCGILU,
"float");
exportArpackSparseItr<double, double, EigSMxD, EigSBiCGILUD>(pySlvBiCGILU,
"double");
exportArpackSparseItr<std::complex<float>, float, EigSMxC, EigSBiCGILUC>(
pySlvBiCGILU, "complexFloat");
exportArpackSparseItr<std::complex<double>, double, EigSMxZ, EigSBiCGILUZ>(
pySlvBiCGILU, "complexDouble");
}
{
std::string slv = "sparseCGDiag";
std::string slvHelp =
"arpack internal mode solver (mode > 1): CG with diagonal (Jacobi) "
"preconditioner";
bp::scope pySlvCGDiag =
bp::class_<sparseCGDiag>(slv.c_str(), slvHelp.c_str());
exportArpackSparseItr<float, float, EigSMxS, EigSCGS>(pySlvCGDiag, "float");
exportArpackSparseItr<double, double, EigSMxD, EigSCGD>(pySlvCGDiag,
"double");
exportArpackSparseItr<std::complex<float>, float, EigSMxC, EigSCGC>(
pySlvCGDiag, "complexFloat");
exportArpackSparseItr<std::complex<double>, double, EigSMxZ, EigSCGZ>(
pySlvCGDiag, "complexDouble");
}
{
std::string slv = "sparseCGILU";
std::string slvHelp =
"arpack internal mode solver (mode > 1): CG with ILU preconditioner";
bp::scope pySlvCGILU =
bp::class_<sparseCGILU>(slv.c_str(), slvHelp.c_str());
exportArpackSparseItr<float, float, EigSMxS, EigSCGILUS>(pySlvCGILU,
"float");
exportArpackSparseItr<double, double, EigSMxD, EigSCGILUD>(pySlvCGILU,
"double");
exportArpackSparseItr<std::complex<float>, float, EigSMxC, EigSCGILUC>(
pySlvCGILU, "complexFloat");
exportArpackSparseItr<std::complex<double>, double, EigSMxZ, EigSCGILUZ>(
pySlvCGILU, "complexDouble");
}
{
std::string slv = "sparseLLT";
std::string slvHelp = "arpack internal mode solver (mode > 1): LLT";
bp::scope pySlvLLT = bp::class_<sparseLLT>(slv.c_str(), slvHelp.c_str());
exportArpackSparseDrt<float, float, EigSMxS, EigSLLTS>(pySlvLLT, "float");
exportArpackSparseDrt<double, double, EigSMxD, EigSLLTD>(pySlvLLT,
"double");
exportArpackSparseDrt<std::complex<float>, float, EigSMxC, EigSLLTC>(
pySlvLLT, "complexFloat");
exportArpackSparseDrt<std::complex<double>, double, EigSMxZ, EigSLLTZ>(
pySlvLLT, "complexDouble");
}
{
std::string slv = "sparseLDLT";
std::string slvHelp = "arpack internal mode solver (mode > 1): LDLT";
bp::scope pySlvLDLT = bp::class_<sparseLDLT>(slv.c_str(), slvHelp.c_str());
exportArpackSparseDrt<float, float, EigSMxS, EigSLDLTS>(pySlvLDLT, "float");
exportArpackSparseDrt<double, double, EigSMxD, EigSLDLTD>(pySlvLDLT,
"double");
exportArpackSparseDrt<std::complex<float>, float, EigSMxC, EigSLDLTC>(
pySlvLDLT, "complexFloat");
exportArpackSparseDrt<std::complex<double>, double, EigSMxZ, EigSLDLTZ>(
pySlvLDLT, "complexDouble");
}
{
std::string slv = "sparseLU";
std::string slvHelp = "arpack internal mode solver (mode > 1): LU";
bp::scope pySlvLU = bp::class_<sparseLU>(slv.c_str(), slvHelp.c_str());
exportArpackSparseDrt<float, float, EigSMxS, EigSLUS>(pySlvLU, "float");
exportArpackSparseDrt<double, double, EigSMxD, EigSLUD>(pySlvLU, "double");
exportArpackSparseDrt<std::complex<float>, float, EigSMxC, EigSLUC>(
pySlvLU, "complexFloat");
exportArpackSparseDrt<std::complex<double>, double, EigSMxZ, EigSLUZ>(
pySlvLU, "complexDouble");
}
{
std::string slv = "sparseQR";
std::string slvHelp = "arpack internal mode solver (mode > 1): QR";
bp::scope pySlvQR = bp::class_<sparseQR>(slv.c_str(), slvHelp.c_str());
exportArpackSparseDrt<float, float, EigSMxS, EigSQRS>(pySlvQR, "float");
exportArpackSparseDrt<double, double, EigSMxD, EigSQRD>(pySlvQR, "double");
exportArpackSparseDrt<std::complex<float>, float, EigSMxC, EigSQRC>(
pySlvQR, "complexFloat");
exportArpackSparseDrt<std::complex<double>, double, EigSMxZ, EigSQRZ>(
pySlvQR, "complexDouble");
}
{
std::string slv = "denseLLT";
std::string slvHelp = "arpack internal mode solver (mode > 1): LLT";
bp::scope pySlvLLT = bp::class_<denseLLT>(slv.c_str(), slvHelp.c_str());
exportArpackDenseDrt<float, float, EigDMxS, EigDLLTS>(pySlvLLT, "float");
exportArpackDenseDrt<double, double, EigDMxD, EigDLLTD>(pySlvLLT, "double");
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDLLTC>(
pySlvLLT, "complexFloat");
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDLLTZ>(
pySlvLLT, "complexDouble");
}
{
std::string slv = "denseLDLT";
std::string slvHelp = "arpack internal mode solver (mode > 1): LDLT";
bp::scope pySlvLDLT = bp::class_<denseLDLT>(slv.c_str(), slvHelp.c_str());
exportArpackDenseDrt<float, float, EigDMxS, EigDLDLTS>(pySlvLDLT, "float");
exportArpackDenseDrt<double, double, EigDMxD, EigDLDLTD>(pySlvLDLT,
"double");
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDLDLTC>(
pySlvLDLT, "complexFloat");
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDLDLTZ>(
pySlvLDLT, "complexDouble");
}
{
std::string slv = "denseLURR";
std::string slvHelp =
"arpack internal mode solver (mode > 1): LU Rank Revealing (slower, "
"more stable)";
bp::scope pySlvLURR = bp::class_<denseLURR>(slv.c_str(), slvHelp.c_str());
exportArpackDenseDrt<float, float, EigDMxS, EigDFLUS>(pySlvLURR, "float");
exportArpackDenseDrt<double, double, EigDMxD, EigDFLUD>(pySlvLURR,
"double");
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDFLUC>(
pySlvLURR, "complexFloat");
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDFLUZ>(
pySlvLURR, "complexDouble");
}
{
std::string slv = "denseQRRR";
std::string slvHelp =
"arpack internal mode solver (mode > 1): QR Rank Revealing (slower, "
"more stable)";
bp::scope pySlvQRRR = bp::class_<denseQRRR>(slv.c_str(), slvHelp.c_str());
exportArpackDenseDrt<float, float, EigDMxS, EigDFQRS>(pySlvQRRR, "float");
exportArpackDenseDrt<double, double, EigDMxD, EigDFQRD>(pySlvQRRR,
"double");
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDFQRC>(
pySlvQRRR, "complexFloat");
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDFQRZ>(
pySlvQRRR, "complexDouble");
}
{
std::string slv = "denseLUPP";
std::string slvHelp =
"arpack internal mode solver (mode > 1): LU Partial Pivoting (faster, "
"less stable)";
bp::scope pySlvLUPP = bp::class_<denseLUPP>(slv.c_str(), slvHelp.c_str());
exportArpackDenseDrt<float, float, EigDMxS, EigDPLUS>(pySlvLUPP, "float");
exportArpackDenseDrt<double, double, EigDMxD, EigDPLUD>(pySlvLUPP,
"double");
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDPLUC>(
pySlvLUPP, "complexFloat");
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDPLUZ>(
pySlvLUPP, "complexDouble");
}
{
std::string slv = "denseQRPP";
std::string slvHelp =
"arpack internal mode solver (mode > 1): QR Partial Pivoting (faster, "
"less stable)";
bp::scope pySlvQPPR = bp::class_<denseQRPP>(slv.c_str(), slvHelp.c_str());
exportArpackDenseDrt<float, float, EigDMxS, EigDPQRS>(pySlvQPPR, "float");
exportArpackDenseDrt<double, double, EigDMxD, EigDPQRD>(pySlvQPPR,
"double");
exportArpackDenseDrt<std::complex<float>, float, EigDMxC, EigDPQRC>(
pySlvQPPR, "complexFloat");
exportArpackDenseDrt<std::complex<double>, double, EigDMxZ, EigDPQRZ>(
pySlvQPPR, "complexDouble");
}
}
// Local Variables:
// mode: c++
// c-file-style:"stroustrup"
// show-trailing-whitespace: t
// End:
/* vim: set sw=2 ts=2 et smartindent :*/
+118
View File
@@ -0,0 +1,118 @@
#!/usr/bin/env python
import numpy as np
from pyarpack import denseLDLT as pyarpackSlv
# Build laplacian.
n = 4
Aij = np.array([], dtype='complex128')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex128(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 1
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvOffset = 0.
arpackSlv.slvScale = 1.
arpackSlv.symPb = False
# Solve eigen problem.
rc = arpackSlv.solve(A)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
print(vec)
#######################################################################################
print("\n##########################################################################\n")
#######################################################################################
# Build laplacian.
n = 8
Aij = np.array([], dtype='complex64')
Bij = np.array([], dtype='complex64')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
for idx, val in enumerate(Bij):
print("B[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
B = (Bij, True) # raw format: Bij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.complexFloat() # Caution: complexFloat <=> np.array(..., dtype='complex64')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 2
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvOffset = 0.
arpackSlv.slvScale = 1.
arpackSlv.sigmaReal = 1
arpackSlv.symPb = False
# Solve eigen problem.
rc = arpackSlv.solve(A, B)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
for v in range(n):
print(vec[v])
+110
View File
@@ -0,0 +1,110 @@
#!/usr/bin/env python
import numpy as np
from pyarpack import denseLLT as pyarpackSlv
# Build laplacian.
n = 4
Aij = np.array([], dtype='float64')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.float64( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1 or l == k+1:
Aij = np.append(Aij, np.float64(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.float64( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 1
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvOffset = 0.
arpackSlv.slvScale = 1.
# Solve eigen problem.
rc = arpackSlv.solve(A)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
print(vec)
#######################################################################################
print("\n##########################################################################\n")
#######################################################################################
# Build laplacian.
n = 8
Aij = np.array([], dtype='float32')
Bij = np.array([], dtype='float32')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.float32( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 33.3)) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1 or l == k+1:
Aij = np.append(Aij, np.float32(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 16.6)) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
for idx, val in enumerate(Bij):
print("B[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
B = (Bij, True) # raw format: Bij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.float() # Caution: float <=> np.array(..., dtype='float32')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 2
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvOffset = 0.
arpackSlv.slvScale = 1.
# Solve eigen problem.
rc = arpackSlv.solve(A, B)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
for v in range(n):
print(vec[v])
+109
View File
@@ -0,0 +1,109 @@
#!/usr/bin/env python
import numpy as np
from pyarpack import denseLUPP as pyarpackSlv
# Build laplacian.
n = 4
Aij = np.array([], dtype='float64')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.float64( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1 or l == k+1:
Aij = np.append(Aij, np.float64(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.float64( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 1
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
# Solve eigen problem.
rc = arpackSlv.solve(A)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
print(vec)
#######################################################################################
print("\n##########################################################################\n")
#######################################################################################
# Build laplacian.
n = 8
Aij = np.array([], dtype='float32')
Bij = np.array([], dtype='float32')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.float32( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 33.3)) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1 or l == k+1:
Aij = np.append(Aij, np.float32(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 16.6)) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
for idx, val in enumerate(Bij):
print("B[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
B = (Bij, True) # raw format: Bij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.float() # Caution: float <=> np.array(..., dtype='float32')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 2
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.sigmaReal = 1
# Solve eigen problem.
rc = arpackSlv.solve(A, B)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
for v in range(n):
print(vec[v])
+109
View File
@@ -0,0 +1,109 @@
#!/usr/bin/env python
import numpy as np
from pyarpack import denseLURR as pyarpackSlv
# Build laplacian.
n = 4
Aij = np.array([], dtype='float64')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.float64( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1 or l == k+1:
Aij = np.append(Aij, np.float64(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.float64( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 1
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
# Solve eigen problem.
rc = arpackSlv.solve(A)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
print(vec)
#######################################################################################
print("\n##########################################################################\n")
#######################################################################################
# Build laplacian.
n = 8
Aij = np.array([], dtype='float32')
Bij = np.array([], dtype='float32')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.float32( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 33.3)) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1 or l == k+1:
Aij = np.append(Aij, np.float32(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 16.6)) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
for idx, val in enumerate(Bij):
print("B[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
B = (Bij, True) # raw format: Bij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.float() # Caution: float <=> np.array(..., dtype='float32')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 2
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.sigmaReal = 1
# Solve eigen problem.
rc = arpackSlv.solve(A, B)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
for v in range(n):
print(vec[v])
+116
View File
@@ -0,0 +1,116 @@
#!/usr/bin/env python
import numpy as np
from pyarpack import denseQRPP as pyarpackSlv
# Build laplacian.
n = 4
Aij = np.array([], dtype='complex128')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex128(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 1
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.symPb = False
# Solve eigen problem.
rc = arpackSlv.solve(A)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
print(vec)
#######################################################################################
print("\n##########################################################################\n")
#######################################################################################
# Build laplacian.
n = 8
Aij = np.array([], dtype='complex64')
Bij = np.array([], dtype='complex64')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
for idx, val in enumerate(Bij):
print("B[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
B = (Bij, True) # raw format: Bij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.complexFloat() # Caution: complexFloat <=> np.array(..., dtype='complex64')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 2
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.sigmaReal = 1
arpackSlv.symPb = False
# Solve eigen problem.
rc = arpackSlv.solve(A, B)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
for v in range(n):
print(vec[v])
+116
View File
@@ -0,0 +1,116 @@
#!/usr/bin/env python
import numpy as np
from pyarpack import denseQRRR as pyarpackSlv
# Build laplacian.
n = 4
Aij = np.array([], dtype='complex128')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex128(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 1
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.symPb = False
# Solve eigen problem.
rc = arpackSlv.solve(A)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
print(vec)
#######################################################################################
print("\n##########################################################################\n")
#######################################################################################
# Build laplacian.
n = 8
Aij = np.array([], dtype='complex64')
Bij = np.array([], dtype='complex64')
for k in range(n):
for l in range(n):
if l == k:
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k-1:
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
elif l == k+1:
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
else:
Aij = np.append(Aij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for idx, val in enumerate(Aij):
print("A[", idx, "] =", val)
for idx, val in enumerate(Bij):
print("B[", idx, "] =", val)
A = (Aij, False) # raw format: Aij values, row ordered (or not).
B = (Bij, True) # raw format: Bij values, row ordered (or not).
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.complexFloat() # Caution: complexFloat <=> np.array(..., dtype='complex64')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 2
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.sigmaReal = 1
arpackSlv.symPb = False
# Solve eigen problem.
rc = arpackSlv.solve(A, B)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
for v in range(n):
print(vec[v])
+138
View File
@@ -0,0 +1,138 @@
#ifndef __PYARPACKDRTSOLVER_HPP__
#define __PYARPACKDRTSOLVER_HPP__
#include <string>
#include <arpackSolver.hpp>
#include <pyarpackServices.hpp>
#include "debug_c.hpp"
#include "stat_c.hpp"
#include <boost/python.hpp>
#include <boost/python/numpy.hpp>
namespace bp = boost::python;
namespace bn = boost::python::numpy;
template<typename RC, typename FD, typename EM, typename SLV>
class pyarpackSparseDrtSolver: public arpackDrtSolver<RC, FD, EM, SLV> {
// Public methods.
public:
pyarpackSparseDrtSolver(): arpackDrtSolver<RC, FD, EM, SLV>() {
debug = 0;
nopx = 0, nbx = 0, nrorth = 0, nitref = 0, nrstrt = 0;
tsaupd = 0., tsaup2 = 0., tsaitr = 0., tseigt = 0., tsgets = 0., tsapps = 0., tsconv = 0.;
tnaupd = 0., tnaup2 = 0., tnaitr = 0., tneigt = 0., tngets = 0., tnapps = 0., tnconv = 0.;
tcaupd = 0., tcaup2 = 0., tcaitr = 0., tceigt = 0., tcgets = 0., tcapps = 0., tcconv = 0.;
tmvopx = 0., tmvbx = 0., tgetv0 = 0., titref = 0., trvec = 0.;
};
int solve(bp::tuple & A, bp::tuple B = bp::tuple()) {
ARPACKSOLVERDEBUGSTAT();
EM M;
int rc = pyarpackServices<RC, EM>::buildSparseMatrice(A, M, debug, "A");
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
bool stdPb = (bp::len(B) > 0) ? false : true;
EM N;
if (!stdPb) {
rc = pyarpackServices<RC, EM>::buildSparseMatrice(B, N, debug, "B");
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
}
return arpackDrtSolver<RC, FD, EM, SLV>::solve(M, (stdPb ? NULL : &N));
};
int checkEigVec(bp::tuple const & A, bp::tuple const B = bp::tuple(), double const diffTol = 1.e-3) {
ARPACKSOLVERDEBUGSTAT();
EM M;
int rc = pyarpackServices<RC, EM>::buildSparseMatrice(A, M, debug, "A");
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
bool stdPb = (bp::len(B) > 0) ? false : true;
EM N;
if (!stdPb) {
rc = pyarpackServices<RC, EM>::buildSparseMatrice(B, N, debug, "B");
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
}
return arpackDrtSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), &diffTol);
};
// Public members.
public:
a_int debug;
a_int nopx, nbx, nrorth, nitref, nrstrt;
float tsaupd, tsaup2, tsaitr, tseigt, tsgets, tsapps, tsconv;
float tnaupd, tnaup2, tnaitr, tneigt, tngets, tnapps, tnconv;
float tcaupd, tcaup2, tcaitr, tceigt, tcgets, tcapps, tcconv;
float tmvopx, tmvbx, tgetv0, titref, trvec;
};
template<typename RC, typename FD, typename EM, typename SLV>
class pyarpackDenseDrtSolver: public arpackDrtSolver<RC, FD, EM, SLV> {
// Public methods.
public:
pyarpackDenseDrtSolver(): arpackDrtSolver<RC, FD, EM, SLV>() {
debug = 0;
nopx = 0, nbx = 0, nrorth = 0, nitref = 0, nrstrt = 0;
tsaupd = 0., tsaup2 = 0., tsaitr = 0., tseigt = 0., tsgets = 0., tsapps = 0., tsconv = 0.;
tnaupd = 0., tnaup2 = 0., tnaitr = 0., tneigt = 0., tngets = 0., tnapps = 0., tnconv = 0.;
tcaupd = 0., tcaup2 = 0., tcaitr = 0., tceigt = 0., tcgets = 0., tcapps = 0., tcconv = 0.;
tmvopx = 0., tmvbx = 0., tgetv0 = 0., titref = 0., trvec = 0.;
};
int solve(bp::tuple & A, bp::tuple B = bp::tuple()) {
ARPACKSOLVERDEBUGSTAT();
EM M;
int rc = pyarpackServices<RC, EM>::buildDenseMatrice(A, M, debug, "A");
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
bool stdPb = (bp::len(B) > 0) ? false : true;
EM N;
if (!stdPb) {
rc = pyarpackServices<RC, EM>::buildDenseMatrice(B, N, debug, "B");
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
}
return arpackDrtSolver<RC, FD, EM, SLV>::solve(M, (stdPb ? NULL : &N));
};
int checkEigVec(bp::tuple const & A, bp::tuple const B = bp::tuple(), double const diffTol = 1.e-3) {
ARPACKSOLVERDEBUGSTAT();
EM M;
int rc = pyarpackServices<RC, EM>::buildDenseMatrice(A, M, debug, "A");
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
bool stdPb = (bp::len(B) > 0) ? false : true;
EM N;
if (!stdPb) {
rc = pyarpackServices<RC, EM>::buildDenseMatrice(B, N, debug, "B");
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
}
return arpackDrtSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), &diffTol);
};
// Public members.
public:
a_int debug;
a_int nopx, nbx, nrorth, nitref, nrstrt;
float tsaupd, tsaup2, tsaitr, tseigt, tsgets, tsapps, tsconv;
float tnaupd, tnaup2, tnaitr, tneigt, tngets, tnapps, tnconv;
float tcaupd, tcaup2, tcaitr, tceigt, tcgets, tcapps, tcconv;
float tmvopx, tmvbx, tgetv0, titref, trvec;
};
#endif
// Local Variables:
// mode: c++
// c-file-style:"stroustrup"
// show-trailing-whitespace: t
// End:
/* vim: set sw=2 ts=2 et smartindent :*/
+80
View File
@@ -0,0 +1,80 @@
#ifndef __PYARPACKITRSOLVER_HPP__
#define __PYARPACKITRSOLVER_HPP__
#include <string>
#include <arpackSolver.hpp>
#include <pyarpackServices.hpp>
#include "debug_c.hpp"
#include "stat_c.hpp"
#include <boost/python.hpp>
#include <boost/python/numpy.hpp>
namespace bp = boost::python;
template<typename RC, typename FD, typename EM, typename SLV>
class pyarpackSparseItrSolver: public arpackItrSolver<RC, FD, EM, SLV> {
// Public methods.
public:
pyarpackSparseItrSolver(): arpackItrSolver<RC, FD, EM, SLV>() {
debug = 0;
nopx = 0, nbx = 0, nrorth = 0, nitref = 0, nrstrt = 0;
tsaupd = 0., tsaup2 = 0., tsaitr = 0., tseigt = 0., tsgets = 0., tsapps = 0., tsconv = 0.;
tnaupd = 0., tnaup2 = 0., tnaitr = 0., tneigt = 0., tngets = 0., tnapps = 0., tnconv = 0.;
tcaupd = 0., tcaup2 = 0., tcaitr = 0., tceigt = 0., tcgets = 0., tcapps = 0., tcconv = 0.;
tmvopx = 0., tmvbx = 0., tgetv0 = 0., titref = 0., trvec = 0.;
};
int solve(bp::tuple & A, bp::tuple B = bp::tuple()) {
ARPACKSOLVERDEBUGSTAT();
EM M;
int rc = pyarpackServices<RC, EM>::buildSparseMatrice(A, M, debug, "A");
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
bool stdPb = (bp::len(B) > 0) ? false : true;
EM N;
if (!stdPb) {
rc = pyarpackServices<RC, EM>::buildSparseMatrice(B, N, debug, "B");
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
}
return arpackItrSolver<RC, FD, EM, SLV>::solve(M, (stdPb ? NULL : &N));
};
int checkEigVec(bp::tuple const & A, bp::tuple const B = bp::tuple(), double const diffTol = 1.e-3) {
ARPACKSOLVERDEBUGSTAT();
EM M;
int rc = pyarpackServices<RC, EM>::buildSparseMatrice(A, M, debug, "A");
if (rc != 0) {pyarpackThrowError("build matrice from A KO"); return rc;}
bool stdPb = (bp::len(B) > 0) ? false : true;
EM N;
if (!stdPb) {
rc = pyarpackServices<RC, EM>::buildSparseMatrice(B, N, debug, "B");
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
}
return arpackItrSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), &diffTol);
};
// Public members.
public:
a_int debug;
a_int nopx, nbx, nrorth, nitref, nrstrt;
float tsaupd, tsaup2, tsaitr, tseigt, tsgets, tsapps, tsconv;
float tnaupd, tnaup2, tnaitr, tneigt, tngets, tnapps, tnconv;
float tcaupd, tcaup2, tcaitr, tceigt, tcgets, tcapps, tcconv;
float tmvopx, tmvbx, tgetv0, titref, trvec;
};
#endif
// Local Variables:
// mode: c++
// c-file-style:"stroustrup"
// show-trailing-whitespace: t
// End:
/* vim: set sw=2 ts=2 et smartindent :*/
+119
View File
@@ -0,0 +1,119 @@
#!/usr/bin/env python
import numpy as np
from pyarpack import sparseBiCGDiag as pyarpackSlv
# Build laplacian.
n = 8
i = np.array([], dtype='@PYINT@')
j = np.array([], dtype='@PYINT@')
Aij = np.array([], dtype='float64')
for k in range(n):
for l in [k-1, k, k+1]:
if l < 0 or l > n-1:
continue
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.float64( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1 or l == k+1:
Aij = np.append(Aij, np.float64(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 1
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvTol = 1.e-6
arpackSlv.slvMaxIt = 100
arpackSlv.dumpToFile = True # Dump eigen vectors to arpackSolver.*.out files.
arpackSlv.schur = True # Schur vectors and eigenvectors of A are the same if A is a normal matrix.
# Solve eigen problem.
rc = arpackSlv.solve(A)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A)
assert rc == 0, "bad checkEigVec"
nbIt1 = arpackSlv.nbIt
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
print(vec)
#######################################################################################
print("\n##########################################################################\n")
#######################################################################################
# Build laplacian (similar-but-different from the previous one).
n = 8
i = np.array([], dtype='@PYINT@')
j = np.array([], dtype='@PYINT@')
Aij = np.array([], dtype='float64')
for k in range(n):
for l in [k-1, k, k+1]:
if l < 0 or l > n-1:
continue
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.float64( 210.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1 or l == k+1:
Aij = np.append(Aij, np.float64( -90.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 1
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvTol = 1.e-6
arpackSlv.slvMaxIt = 100
arpackSlv.restartFromFile = True # Restart from eigen vectors found in arpackSolver.*.out files.
arpackSlv.schur = True # Schur vectors and eigenvectors of A are the same if A is a normal matrix.
# Solve eigen problem.
rc = arpackSlv.solve(A)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A)
assert rc == 0, "bad checkEigVec"
nbIt2 = arpackSlv.nbIt
assert nbIt2 < nbIt1, "bad restart" # Restart from the first solve to run the second solve for a similar-but-different A.
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
print(vec)
+194
View File
@@ -0,0 +1,194 @@
#ifndef __PYARPACKSERVICES_HPP__
#define __PYARPACKSERVICES_HPP__
#include <vector>
#include <string>
#include <complex>
#include <iostream>
#include <cmath> // sqrt.
#include <Eigen/Sparse>
#include <boost/python.hpp>
#include <boost/python/numpy.hpp>
namespace bp = boost::python;
namespace bn = boost::python::numpy;
#define ARPACKSOLVERMEMBER(pyarpackSolver) \
.def_readwrite("symPb", &pyarpackSolver<RC, FD, EM, SLV>::symPb, \
"symmetric problem - default: true") \
.def_readwrite("nbEV", &pyarpackSolver<RC, FD, EM, SLV>::nbEV, \
"number of eigen vectors to find - default: 1") \
.def_readwrite("nbCV", &pyarpackSolver<RC, FD, EM, SLV>::nbCV, \
"number of dimensions of the workspace - default: 3") \
.def_readwrite("tol", &pyarpackSolver<RC, FD, EM, SLV>::tol, \
"tolerance - default: 1.e-6") \
.def_readwrite("sigmaReal", &pyarpackSolver<RC, FD, EM, SLV>::sigmaReal, \
"shift over real axis - default: 0.") \
.def_readwrite("sigmaImag", &pyarpackSolver<RC, FD, EM, SLV>::sigmaImag, \
"shift over imaginary axis - default: 0.") \
.def_readwrite("dumpToFile", &pyarpackSolver<RC, FD, EM, SLV>::dumpToFile, \
"dump eigen vectors to arpackSolver.*.out files - default: false") \
.def_readwrite("restartFromFile", &pyarpackSolver<RC, FD, EM, SLV>::restartFromFile, \
"restart from eigen vectors found in arpackSolver.*.out files - default: false") \
.def_readwrite("mag", &pyarpackSolver<RC, FD, EM, SLV>::mag, \
"magnitude - default: LM") \
.def_readwrite("maxIt", &pyarpackSolver<RC, FD, EM, SLV>::maxIt, \
"maximum number of arpack iterations - default: 100") \
.def_readwrite("schur", &pyarpackSolver<RC, FD, EM, SLV>::schur, \
"compute schur vectors - default: false") \
.def_readwrite("verbose", &pyarpackSolver<RC, FD, EM, SLV>::verbose, \
"verbosity level - default: 0") \
.def_readonly ("stdPb", &pyarpackSolver<RC, FD, EM, SLV>::stdPb, \
"standard or generalised problem - default: true") \
.def_readonly ("val", &pyarpackSolver<RC, FD, EM, SLV>::val, \
"eigen values found") \
.def_readonly ("vec", &pyarpackSolver<RC, FD, EM, SLV>::vec, \
"eigen vectors found") \
.def_readonly ("mode", &pyarpackSolver<RC, FD, EM, SLV>::mode, \
"selected arpack mode (according to input options: std/gen, shift, ...)") \
.def_readonly ("nbIt", &pyarpackSolver<RC, FD, EM, SLV>::nbIt, \
"number of arpack iterations") \
.def_readonly ("imsTime", &pyarpackSolver<RC, FD, EM, SLV>::imsTime, \
"time spent to initialize the mode solver if needed") \
.def_readonly ("rciTime", &pyarpackSolver<RC, FD, EM, SLV>::rciTime, \
"time spent in Reverse Communication Interface") \
.def_readwrite("debug", &pyarpackSolver<RC, FD, EM, SLV>::debug, \
"debug traces (up to 3) - default: 0") \
#define ARPACKSOLVERDEBUGSTAT() \
if (debug > 3) debug = 3; \
debug_c(6, -6, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, \
debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, debug); \
stat_c(nopx, nbx, nrorth, nitref, nrstrt, tsaupd, tsaup2, \
tsaitr, tseigt, tsgets, tsapps, tsconv, tnaupd, tnaup2, \
tnaitr, tneigt, tngets, tnapps, tnconv, tcaupd, tcaup2, \
tcaitr, tceigt, tcgets, tcapps, tcconv, tmvopx, tmvbx, \
tgetv0, titref, trvec); \
void pyarpackThrowError(std::string const & msg) {
std::string const info = "Error: " + msg;
std::cerr << info << std::endl;
PyErr_SetString(PyExc_IndexError, info.c_str());
bp::throw_error_already_set();
};
template<typename RC, typename EM>
class pyarpackServices {
// Public methods.
public:
static int buildSparseMatrice(bp::tuple const & T, Eigen::SparseMatrix<RC> & M,
a_int const & debug, std::string const & msg) {
// Get boost data as C++ data.
if (bp::len(T) != 4) {pyarpackThrowError(msg + " must be a 3-tuple"); return 1;}
bp::extract<int> nExt(T[0]);
bp::extract<bn::ndarray> iExt(T[1]);
bp::extract<bn::ndarray> jExt(T[2]);
bp::extract<bn::ndarray> mijExt(T[3]);
if (! nExt.check()) {pyarpackThrowError(msg + "[0] must be an integer" ); return 1;}
if (! iExt.check()) {pyarpackThrowError(msg + "[1] must be numpy.array"); return 1;}
if (! jExt.check()) {pyarpackThrowError(msg + "[2] must be numpy.array"); return 1;}
if (!mijExt.check()) {pyarpackThrowError(msg + "[3] must be numpy.array"); return 1;}
bn::ndarray iArray = iExt();
bn::ndarray jArray = jExt();
bn::ndarray mijArray = mijExt();
if (iArray.get_dtype() != bn::dtype::get_builtin<a_int>()) {pyarpackThrowError(msg + "[1] type is not consistent"); return 1;}
if (jArray.get_dtype() != bn::dtype::get_builtin<a_int>()) {pyarpackThrowError(msg + "[2] type is not consistent"); return 1;}
if (mijArray.get_dtype() != bn::dtype::get_builtin<RC>() ) {pyarpackThrowError(msg + "[3] type is not consistent with arpack type"); return 1;}
a_int iSz = iArray.shape(0);
a_int * iPtr = reinterpret_cast<a_int*>(iArray.get_data());
a_int jSz = jArray.shape(0);
a_int * jPtr = reinterpret_cast<a_int*>(jArray.get_data());
a_int mSz = mijArray.shape(0);
RC * mPtr = reinterpret_cast<RC*>(mijArray.get_data());
if (iSz != jSz) {pyarpackThrowError(msg + "[1] and " + msg + "[2] must have same lenght"); return 1;}
if (iSz != mSz) {pyarpackThrowError(msg + "[1] and " + msg + "[3] must have same lenght"); return 1;}
// Debug on demand: casting value on numpy.append is MANDATORY or C++ won't get the expected type..
for (auto k = 0; debug && k < mSz; k++) {
std::cout << "pyarpackServices::buildSparseMatrice - " << msg << "[" << iPtr[k] << ", " << jPtr[k] << "] = " << mPtr[k] << std::endl;
};
// Build sparse matrice.
a_uint n = nExt();
a_uint iMin = n+1, jMin = n+1;
for (auto k = 0; k < mSz; k++) {
if (iPtr[k] < iMin) iMin = iPtr[k];
if (jPtr[k] < jMin) jMin = jPtr[k];
};
if (iMin != 0 && iMin != 1) {pyarpackThrowError(msg + ": smallest row indice must be 0 or 1"); return 1;}
if (jMin != 0 && jMin != 1) {pyarpackThrowError(msg + ": smallest column indice must be 0 or 1"); return 1;}
a_int iBased = 0, jBased = 0;
if (iMin == 1) iBased = 1;
if (jMin == 1) jBased = 1;
M = Eigen::SparseMatrix<RC>(n, n); // Set matrice dimensions.
std::vector<Eigen::Triplet<RC>> triplets;
a_uint nnz = mSz;
triplets.reserve(nnz);
for (auto k = 0; k < nnz; k++) triplets.emplace_back(iPtr[k] - iBased, jPtr[k] - jBased, mPtr[k]);
M.setFromTriplets(triplets.begin(), triplets.end()); // Set all (i, j, Mij).
return 0;
};
static int buildDenseMatrice(bp::tuple const & T, Eigen::Matrix<RC, Eigen::Dynamic, Eigen::Dynamic> & M,
a_int const & debug, std::string const & msg) {
// Get boost data as C++ data.
if (bp::len(T) != 2) {pyarpackThrowError(msg + " must be a 2-tuple"); return 1;}
bp::extract<bn::ndarray> mijExt(T[0]);
bp::extract<bool> oExt(T[1]);
if (!mijExt.check()) {pyarpackThrowError(msg + " must be numpy.array"); return 1;}
if ( !oExt.check()) {pyarpackThrowError(msg + " must be a boolean"); return 1;}
bn::ndarray mijArray = mijExt();
bool rowOrdered = oExt();
if (mijArray.get_dtype() != bn::dtype::get_builtin<RC>()) {pyarpackThrowError(msg + " type is not consistent with arpack type"); return 1;}
a_int mSz = mijArray.shape(0);
RC * mPtr = reinterpret_cast<RC*>(mijArray.get_data());
a_uint n = std::sqrt(mSz);
if (n*n != mSz) {pyarpackThrowError(msg + " must be a squared matrice"); return 1;}
// Debug on demand: casting value on numpy.append is MANDATORY or C++ won't get the expected type..
for (auto k = 0; debug && k < mSz; k++) {
std::cout << "pyarpackServices::buildDenseMatrice - " << msg << "[" << k << "] = " << mPtr[k] << std::endl;
};
// Build dense matrice.
M = Eigen::Matrix<RC, Eigen::Dynamic, Eigen::Dynamic>(n, n); // Set matrice dimensions.
M.setZero(n, n); // Avoid spurious/random values which may break solves (LU, QR, ...).
if (rowOrdered) {
for (size_t k = 0; k < n; k++) {
for (size_t l = 0; l < n; l++) M(k, l) = mPtr[l+k*n];
}
}
else {
for (size_t l = 0; l < n; l++) {
for (size_t k = 0; k < n; k++) M(k, l) = mPtr[k+l*n];
}
}
return 0;
};
};
#endif
// Local Variables:
// mode: c++
// c-file-style:"stroustrup"
// show-trailing-whitespace: t
// End:
/* vim: set sw=2 ts=2 et smartindent :*/
@@ -0,0 +1,118 @@
#!/usr/bin/env python
import numpy as np
from pyarpack import sparseBiCGDiag as pyarpackSlv
# Build laplacian.
n = 4
i = np.array([], dtype='@PYINT@')
j = np.array([], dtype='@PYINT@')
Aij = np.array([], dtype='float64')
for k in range(n):
for l in [k-1, k, k+1]:
if l < 0 or l > n-1:
continue
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.float64( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1 or l == k+1:
Aij = np.append(Aij, np.float64(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 1
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvTol = 1.e-6
arpackSlv.slvMaxIt = 100
# Solve eigen problem.
rc = arpackSlv.solve(A)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
print(vec)
#######################################################################################
print("\n##########################################################################\n")
#######################################################################################
# Build laplacian.
n = 8
i = np.array([], dtype='@PYINT@')
j = np.array([], dtype='@PYINT@')
Aij = np.array([], dtype='float32')
Bij = np.array([], dtype='float32')
for k in range(n):
for l in [k-1, k, k+1]:
if l < 0 or l > n-1:
continue
i = np.append(i, np.@PYINT@(k+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.float32( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 33.3)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1 or l == k+1:
Aij = np.append(Aij, np.float32(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 16.6)) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
for k, l, Bkl in zip(i, j, Bij):
print("B[", k, ",", l, "] =", Bkl)
A = (n, i, j, Aij) # coo format: dimension, i 1-based indices, j 1-based indices, Aij values.
B = (n, i, j, Bij) # coo format: dimension, i 1-based indices, j 1-based indices, Bij values.
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.float() # Caution: float <=> np.array(..., dtype='float32')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 2
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvTol = 1.e-6
arpackSlv.slvMaxIt = 100
arpackSlv.sigmaReal = 1
# Solve eigen problem.
rc = arpackSlv.solve(A, B)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
for v in range(n):
print(vec[v])
@@ -0,0 +1,130 @@
#!/usr/bin/env python
import numpy as np
from pyarpack import sparseBiCGILU as pyarpackSlv
# Build laplacian.
n = 4
i = np.array([], dtype='@PYINT@')
j = np.array([], dtype='@PYINT@')
Aij = np.array([], dtype='complex128')
for k in range(n):
for l in [k-1, k, k+1]:
if l < 0 or l > n-1:
continue
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 1
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvTol = 1.e-6
arpackSlv.slvMaxIt = 200
arpackSlv.slvILUDropTol = 1.
arpackSlv.slvILUFillFactor = 2
arpackSlv.symPb = False
# Solve eigen problem.
rc = arpackSlv.solve(A)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
print(vec)
#######################################################################################
print("\n##########################################################################\n")
#######################################################################################
# Build laplacian.
n = 8
i = np.array([], dtype='@PYINT@')
j = np.array([], dtype='@PYINT@')
Aij = np.array([], dtype='complex64')
Bij = np.array([], dtype='complex64')
for k in range(n):
for l in [k-1, k, k+1]:
if l < 0 or l > n-1:
continue
i = np.append(i, np.@PYINT@(k+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
for k, l, Bkl in zip(i, j, Bij):
print("B[", k, ",", l, "] =", Bkl)
A = (n, i, j, Aij) # coo format: dimension, i 1-based indices, j 1-based indices, Aij values.
B = (n, i, j, Bij) # coo format: dimension, i 1-based indices, j 1-based indices, Bij values.
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.complexFloat() # Caution: complexFloat <=> np.array(..., dtype='complex64')
arpackSlv.verbose = 3 # Set to 0 to get a quiet solve.
arpackSlv.debug = 1 # Set to 0 to get a quiet solve.
arpackSlv.nbEV = 2
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvTol = 1.e-6
arpackSlv.slvMaxIt = 200
arpackSlv.slvILUDropTol = 1.
arpackSlv.slvILUFillFactor = 2
arpackSlv.sigmaReal = 1
arpackSlv.sigmaImag = 1
arpackSlv.symPb = False
# Solve eigen problem.
rc = arpackSlv.solve(A, B)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A, B, 1.e-2)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
assert arpackSlv.nbEV == len(arpackSlv.val), "bad result"
print("\nresults:\n")
print("mode selected:", arpackSlv.mode)
print("nb iterations:", arpackSlv.nbIt)
print("Reverse Communication Interface time:", arpackSlv.rciTime, "s")
for val, vec in zip(arpackSlv.val, arpackSlv.vec):
print("eigen value:", val)
print("eigen vector:")
for v in range(n):
print(vec[v])

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