339 Commits
Author SHA1 Message Date
Markus Mützel 9304416095 Select different targets for building in CI on Alpine
build-alpine / alpine (armv7) (push) Waiting to run
build-alpine / alpine (loongarch64) (push) Waiting to run
build-alpine / alpine (x86) (push) Waiting to run
cross-build-ubuntu / cross armhf (push) Waiting to run
cross-build-ubuntu / cross ppc64el (push) Waiting to run
cross-build-ubuntu / cross riscv64 (push) Waiting to run
cross-build-ubuntu / cross s390x (push) Waiting to run
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 / MinGW-w64 CLANG64 INTERFACE64=OFF/MPI=OFF (push) Waiting to run
arpack-ng / MinGW-w64 UCRT64 INTERFACE64=OFF/MPI=OFF (push) Waiting to run
arpack-ng / MinGW-w64 CLANG64 INTERFACE64=OFF/MPI=ON (push) Waiting to run
arpack-ng / MinGW-w64 UCRT64 INTERFACE64=OFF/MPI=ON (push) Waiting to run
arpack-ng / MinGW-w64 CLANG64 INTERFACE64=ON/MPI=OFF (push) Waiting to run
arpack-ng / MinGW-w64 UCRT64 INTERFACE64=ON/MPI=OFF (push) Waiting to run
The Alpine repository for the PowerPC target got more and more unreliable
recently.
Additionally, the PowerPC target is covered with the cross-build rules on
Ubuntu now.

Drop some (expensive) targets to reduce the overlap in coverage with the
workflow that cross-builds on Ubuntu.
Add LoongArch64 target which is not (yet?) available for Ubuntu.
Keep targets that can be build natively (which should be reasonably fast).
Use an Ubuntu on ARM runner for the armv7 target.
Rename workflow because out of the three remaining targets only one is
actually emulated - the others can execute natively.
2026-08-16 14:01:08 +02:00
Markus Mützel 9f90017bf8 Add CI workflow that cross-builds for several targets on Ubuntu
Cross build ARPACK for some targets on Ubuntu using their cross-compilation
toolchains and packages.
Run the test suite using `qemu` if necessary.
2026-08-16 14:01:08 +02:00
Markus Mützel 6ae2072b0c PARPACK: Initialize machine dependent constants only once in PDNAITR
The current implementation checks the value of the variable `aitr_first` but
sets `first`.

Change that to set `aitr_first` to false after the initialization has run.

This also brings that part of the implementation of `PDNAITR` in line with
the corresponding logic that is used in the implementation of the other
`P?NAITR`.
2026-08-01 15:59:19 +02:00
Markus Mützel 8a4ede774e CI: Use VecLibFort as shim library for Apple Accelerate/VecLib on macOS.
Currently, the CI rules are building ARPACK using the old `f2c` Fortran
ABI. However, all packages of applications written in Fortran that are
distributed by Homebrew are using the default GNU Fortran ABI.
Testing the package with the ABI expected by most macOS users would
probably be better than what is currently done in the CI setup.

Instead of building a version of ARPACK using that old, non-default `f2c`
Fortran ABI, use a library that "translates" from the default GNU Fortran
ABI to the old `f2c` ABI used by Apple Accelerate/VecLib.
2026-07-26 18:28:41 +02:00
dependabot[bot] 7217471833 Bump actions/checkout from 2 to 7
Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 7.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v7)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-25 17:22:12 +02:00
dependabot[bot] 96892b7938 Bump actions/cache from 4 to 6
Bumps [actions/cache](https://github.com/actions/cache) from 4 to 6.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v4...v6)

---
updated-dependencies:
- dependency-name: actions/cache
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-07-24 19:48:01 +02:00
Markus Mützel b36bddadd2 CI: Use dependabot to periodically check for updated actions
Currently, a warning like the following is emitted for each job in the CI:
> Node.js 20 is deprecated. The following actions target Node.js 20 but are being forced to run on Node.js 24: actions/checkout@v2. For more information see: https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/

Let dependabot check for updates to avoid the chore of manually updating the versions of GitHub actions every time the Node.js version on the runner images is updated.
2026-07-24 15:18:16 +02:00
evanbiederstedt f284b0682d Fix "Warning: Obsolescent feature: Old-style character length at (1)", found in /UTIL (#482)
* fix obsolescent character length warning, arpack/utils

* updates to changelog, other fixes to avoid warning

* try brew install open-mpi

* use brew install open-mpi instead

* remove F77 syntax, TESTS/mmio.f

* Update CHANGES
2026-06-06 12:47:15 +02:00
Kyle GuinnandFranck HOUSSEN f73592dd1e Fix header and pkg-config file installation (#426)
* Don't install pkg-config files for unbuilt libraries

The autotools build is configured to skip entire directories depending
on the configuration.  Each directory's Makefile is responsible for
installing what it needs, and moving the .pc files to the toplevel broke
that.

In the pkg-config files, leave ${includedir} unmodified from how
configure defines it.

* Install arpackicb.h only when ICB is ON.

---------

Co-authored-by: Franck HOUSSEN <fghoussen@users.noreply.github.com>
2025-10-31 15:05:59 +01:00
Theodore 07dbd37e52 Reorder library linking for robustness (#478)
* fix: reorder library linking for consistency in CMakeLists.txt

* fix: unify LAPACK and BLAS library linking across targets

* feat: set C++ standard to C++14 for improved language features

* fix: update C++ standard to C++14 for Python3, Eigen, and ICB support

* fix: improve dependency linking and bump minimum C++ standard version in CMake

* Remove redundant C language as it is already enabled previously
2025-10-12 12:03:39 +02:00
Sylvestre Ledru 804fa3149a Document the recent change 2024-10-21 09:03:36 +02:00
Sylvestre Ledru b63d37f4b6 Merge pull request #473 from szhorvat/fix/obsolescent-character-length
fix: fix obsolescent character length warnings, fixes #472
2024-10-21 09:01:08 +02:00
Szabolcs Horvát 7ada6520f5 fix: fix obsolescent character length warnings, fixes #472 2024-10-20 19:31:46 +00:00
Sylvestre Ledru 9431fd5ea6 Merge pull request #461 from mmuetzel/cmake
Make ctests platform independent
2024-09-23 10:14:56 +02:00
Sylvestre Ledru bc1944851f Merge pull request #471 from vaerksted/master
fix typos
2024-09-23 10:14:09 +02:00
Markus Mützel 2c1203e23f Update CHANGELOG. 2024-09-22 18:34:27 +02:00
Markus Mützel 32070150c7 CMake: Add function to add tests that change working directory.
Add a new CMake function that helps to add tests that change their
working directory to somewhere else than the directory with the
libarpack library.

In that case, the environment variable PATH is set to include the
directory with the library on Windows while running the tests.

Use that new CMake function for the three ctests involving the Eigen
library.
2024-09-22 18:09:41 +02:00
Markus Mützel 7671cebf29 CI: Remove work-around from rules for MinGW that is no longer needed 2024-09-22 17:59:20 +02:00
Markus Mützel 44fe87f3fc Make ctests platform independent
Windows doesn't have a mechanism similar to rpaths. Instead, shared
libraries are searched in the current working directory and  in the
directory with the executable followed by directories in the environment
variable PATH.

Add the path to the shared libarpack library to PATH for ctests that run
executables that are located in a different directory and that set the
current working directory not to the directory with the libarpack.dll.
Use a generator expression that should be working independent on the CMake
generator.
2024-09-22 17:59:20 +02:00
musvaage 04b192a2b1 typos 2024-09-22 10:03:26 -05:00
Franck HOUSSEN f2921f232b arpackmm: improve command line for testing. (#470) 2024-09-19 18:58:07 +02:00
Franck HOUSSEN 43d3e5606b Fix arpack solver (#468)
* arpackmm: improve command line.

* [BUG FIX] arpackmm: run arpack with real or imag shift.

* [BUG FIX] arpackmm: make sure the restart file is written.

* [BUG FIX] arpackmm: rewrite the test.

  - Do NOT use eval in bash script which does NOT return command exit code.

  - Use a dedicated maxResNorm to test the residual (no point to deduce
    it from tol).

* Update .gitignore.

* Update CHANGELOG.
2024-09-18 21:55:38 +02:00
Henri Menke e55d3b2dcb Add missing stdexcept header (#467) 2024-09-14 12:05:42 +02:00
Sylvestre Ledru 0b3038d139 Merge pull request #462 from mmuetzel/ci-macos
CI: Enable eigen on macOS runners
2024-06-27 14:30:51 +02:00
Markus Mützel 081e13cd3f CI: Enable eigen on macOS runners 2024-06-27 13:26:14 +02:00
Sylvestre Ledru 77ba50e800 Merge pull request #459 from mmuetzel/ci
CI: Add CI for CLANG64 environment of MSYS2
2024-06-22 14:00:26 +02:00
Markus Mützel aea67a3426 CI: Re-run tests on error with more output for debugging 2024-06-22 13:04:24 +02:00
Markus Mützel ca979855b4 CI: Install Eigen on MSYS2 runners 2024-06-22 13:04:24 +02:00
Markus Mützel 8d58c1ac1d CI: Setup workflow for MSYS2 CLANG64 2024-06-22 13:04:24 +02:00
Sylvestre Ledru 1ebaf744b6 Merge pull request #460 from mmuetzel/ci-macos
CI: Install numpy from Homebrew on macOS
2024-06-22 13:04:11 +02:00
Markus Mützel e5643dce21 CI: Use clearer settings for BLAS/LAPACK implementation on macOS
With the previous configuration it was unclear whether the reference
implementation (from Netlib) or Apple's implementation of the BLAS
and LAPACK libraries should be used. (`LIBS` pointed to Apple's
implementation, but `BLA_VENDOR` selected the reference implementation.)

Use only `BLA_VENDOR` to select Apple's implementation.
2024-06-22 11:51:22 +02:00
Markus Mützel 0efe8a6113 CI: Install numpy from Homebrew on macOS 2024-06-22 11:51:19 +02:00
Sylvestre Ledru 9d9e1bf36d Merge pull request #458 from mmuetzel/ci
Add CI runners on emulated hardware
2024-06-21 11:48:28 +02:00
Markus Mützel 416011c701 CI (Alpine Linux): Use ccache
The compilation (especially of the C++ objects) is pretty slow with qemu.
Use ccache to speed up build time on subsequent runs.
2024-06-17 11:15:40 +02:00
Markus Mützel fec63adf5f Add CI runners on emulated hardware
Use a GitHub action to install Alpine Linux for different, less common
architectures that are emulated with qemu (apart from x86).
Additionally, Alpine Linux is one of those distributions that are based
on musl (instead of glibc).

This increases coverage for different configurations in CI.
2024-06-12 19:14:45 +02:00
Franck HOUSSEN 217e25ac7c Improve documentation. (#456) 2024-05-08 13:02:16 +02:00
Franck HOUSSEN 7f25013f29 [CI] Fix macos job. (#457)
* [CI] Fix macos job.
2024-05-08 12:35:10 +02:00
Franck HOUSSEN 4caa8f4c70 Add documentation on ILP64. (#453)
* Add documentation on ILP64.

* Rephrase.
2024-04-01 20:37:14 +02:00
Kyle Guinn 51ce061ff7 Update changelog 2024-01-31 09:59:28 +01:00
Kyle Guinn ef90e416cf Build all PARPACK files with optimization 2024-01-31 09:59:28 +01:00
Sylvestre Ledru ba440d1322 Merge pull request #446 from turboencabulator/quoting
Quote the default pkgconfigdir
2024-01-21 08:39:45 +01:00
Kyle Guinn 243a1011e5 Quote the default pkgconfigdir
The second argument to AC_SUBST is placed on the right-hand-side of a
shell variable assignment.  Without the single quotes, ${libdir} is
expanded when that variable assignment is executed, which is earlier
than we want.
2024-01-20 21:25:36 -06:00
wo80 0eaf38bd51 Fix examples BAND _nbdr2 returning error info = -9
Both examples access the M matrix, so we initialize M to be the identity matrix. See #443 for discussion.
2023-12-20 09:41:27 +01:00
Sam James 31b50762a5 configure.ac: fix bashisms
configure scripts need to be runnable with a POSIX-compliant /bin/sh.

On many (but not all!) systems, /bin/sh is provided by Bash, so errors
like this aren't spotted. Notably Debian defaults to /bin/sh provided
by dash which doesn't tolerate such bashisms as '=='.

This retains compatibility with bash.

Fixes configure warnings/errors like:
```
checking for cheev_ in -llapack... yes
./configure: 8590: test: x: unexpected operator
checking how to print strings... printf
```
2023-12-20 08:57:16 +01:00
Sylvestre Ledru 569a3859c1 Merge pull request #438 from sylvestre/cmake
configure should still install cmake files
2023-10-15 13:46:22 +02:00
Sylvestre Ledru 3371fdfc8e configure should still install cmake files 2023-10-14 14:48:34 +02:00
Sylvestre Ledru 40329031ae also update cmake configure
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-10-14 13:55:37 +02:00
Sylvestre Ledru 85c35d5d57 update of the version to 3.9.1 2023-10-14 13:38:28 +02:00
Sylvestre Ledru a80ff0d017 Update of the changelog 2023-10-14 13:38:01 +02:00
Fabien Péan 0f7c32bf78 Update changelog 2023-09-14 12:12:59 +02:00
Fabien Péan 93c048fae3 Fix solver parameters for pyarpackSparse{LDLT/LU} 2023-09-14 12:12:59 +02:00
Fabien Péan 447b4387e9 Swap pyarpackDenseLDLT and pyarpackDenseLUPP tests
DenseLUPP tests solves now
 - complex128 non-symmetric problem
 - complex64 non-symmetric general problem

DenseLDLT solves now
- float64 symmetric problem
- float32 symmetric general problem
2023-09-14 12:12:59 +02:00
Fabien Péan 12300c1d4b Change pyarpackCGILU to solve hermitian non-general problem 2023-09-14 12:12:59 +02:00
Fabien Péan de52ee6e32 Swap pyarpackSparseLDLT and pyarpackSparseLU tests
SparseLU tests solves now
- complex128 non-symmetric problem
- complex64 non-symmetric general problem

SparseLDLT solves now
- float64 symmetric problem
- float32 symmetric general problem
2023-09-14 12:12:59 +02:00
Fabien Péan bdb881c973 Fix error report in ctest when calling bash script 2023-09-03 18:54:28 +02:00
Fabien Péan cdeaaeafa0 Update changelog 2023-09-03 15:29:46 +02:00
Fabien Péan c783dbbb0a Enable non symmetric tests with BiCG solver in arpackmm test suite 2023-09-03 15:29:46 +02:00
VinceNeede 3c48b9508b Update README.md MKL options
cmake option for mkl BLA_VENDOR=INTEL works for obsolete verdions, replaced with INTEL10_64lp and INTEL10_64ilp for lp64 and ilp64 respectively.
2023-09-02 19:30:16 +02:00
Franck HOUSSEN e7cf106bc2 Merge pull request #425 from fghoussen/fix-install
Fix installation tests: compile and run icb_arpack_c.
2023-08-14 12:26:23 +02:00
Franck HOUSSEN c08859052b README: document use of *.pc and *.cmake files. 2023-08-13 11:04:17 +02:00
Franck HOUSSEN 5a2f942473 CMake test install: add comments + make it symmetric with autotools's one. 2023-08-13 10:59:18 +02:00
Franck HOUSSEN a857b80721 [CI] Increase CMake version to avoid deprecation messages in logs. 2023-08-13 10:56:55 +02:00
Franck HOUSSEN cdcb80a0ff Export LD_LIBRARY_PATH before running binaries. 2023-08-12 21:33:05 +02:00
Franck HOUSSEN a0ee97487e README: document use of *.pc and *.cmake files. 2023-08-12 21:05:52 +02:00
Franck HOUSSEN 4bd39d7a39 [CI] Increase CMake version to avoid deprecation messages in logs. 2023-08-12 20:57:24 +02:00
Franck HOUSSEN 798f87698f [CI] Add eigen to test installs. 2023-08-12 20:55:42 +02:00
Franck HOUSSEN 031ea2554d Update change log. 2023-08-12 19:18:35 +02:00
Franck HOUSSEN 7f0e2dca4a Fix installation tests: compile and run arpackmm. 2023-08-12 19:18:22 +02:00
Franck HOUSSEN 2239bf22e6 Fix installation tests: compile and run icb_parpack_cpp. 2023-08-12 18:02:03 +02:00
Franck HOUSSEN f4b2f31a64 Fix installation tests: compile and run icb_parpack_c. 2023-08-12 17:40:31 +02:00
Franck HOUSSEN c46da4f87a Fix installation tests: compile and run icb_arpack_cpp. 2023-08-12 13:55:09 +02:00
Franck HOUSSEN 1b525b649c Fix installation tests: compile and run icb_arpack_c. 2023-08-12 13:26:52 +02:00
Fabien Péan c18d153f20 Update FAQ 2023-08-12 12:39:18 +02:00
Fabien Péan 46d1dd36d0 Fix icb_parpack_[c|cpp] to split the problem across MPI processes 2023-08-12 12:39:18 +02:00
Szabolcs Horvát e7ae5f818d chore: update changelog 2023-08-12 12:39:18 +02:00
Szabolcs Horvát b29d5630fc fix: ensure separate seeds on parallel threads, fixes #411 2023-08-12 12:39:18 +02:00
Szabolcs Horvát 9fe9d462a6 fix: propagte RNG state in PARPACK as well 2023-08-12 12:39:18 +02:00
Szabolcs Horvát 0996200c7a fix: ensure that LAPACK RNG state is propagated 2023-08-12 12:39:18 +02:00
Bálint Aradi 6d625dbf34 Fix package name in CMake find_package() examples (#419) 2023-05-27 14:09:41 +02:00
Ivan Rostov 3e3e12fef2 Update CMakeLists.txt , add mpiexec to issue46_tst run (#418) 2023-05-25 22:47:39 +02:00
Vonfry 662cd51fc1 Fix windows icb macros (#416)
* Distinct new intel llvm compiler on windows

intel llvm compiler uses clang-cl who also defines _MSC_VER, which let icx find msc complex.h instead intel copmlex.h

* Undef I in windows complex.h

I macro is defined by windows complex.h which is used as variable name in arpackSolver as well.
2023-05-18 12:26:31 +02:00
مهدي شينون (Mehdi Chinoune) 22172ff212 Add LLVMFlang flag to build with INTERFACE64 (#412)
* LLVMFlang: Add required flag to build with INTERFACE64

* LLVMFlang: Add compile flags

Add compile flags for preprocessing and for
supporting lines longer than 72
2023-04-15 08:40:44 +02:00
Sylvestre Ledru 25524b70c2 Merge pull request #413 from FabienPean/patch-1
Add details on Windows installation
2023-04-10 10:52:38 +02:00
Fabien Péan 2219bef7ea Update changelog 2023-04-08 19:35:58 +00:00
Fabien Péan 98cd927215 Update README.md 2023-04-08 19:59:20 +02:00
Sylvestre Ledru 396b90a015 Merge pull request #409 from fghoussen/readme
README: document where to find arpack user's guide.
2023-03-11 10:07:40 +01:00
Franck HOUSSEN b13558c527 README: document where to find arpack user's guide. 2023-03-05 22:58:48 +01:00
Franck HOUSSEN e124fcabc2 [BUG FIX] arpackmm: fix restart. (#408)
* Fixing issue401.
* Fixing issue215 with shift.
2023-02-28 19:29:32 +01:00
Franck HOUSSEN e144e946ec README: document how to use ICB. 2023-02-25 10:49:55 +01:00
Franck HOUSSEN 5a963c4d31 Rename icbexmm option into eigen option. 2023-02-18 10:21:19 +01:00
Franck HOUSSEN ae350abfed arpackSolver: cut-off arpack workspace dim. (#404) 2023-02-18 10:20:38 +01:00
Franck HOUSSEN cd49a7fb98 arpackmm: allow for using LA/SA magnitudes. (#402) 2023-02-17 22:30:40 +01:00
Franck HOUSSEN 3a9a9ce8c0 Add comments to README. (#400) 2023-02-15 22:39:19 +01:00
Franck HOUSSEN 459f46a6dd [BUG FIX] Fix install: headers in /path/to/local/include/arpack (#398) 2023-02-12 15:29:33 +01:00
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
461 changed files with 26991 additions and 17946 deletions
+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
-
-
-
+10
View File
@@ -0,0 +1,10 @@
# Set update schedule for GitHub Actions
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
+128
View File
@@ -0,0 +1,128 @@
name: build-alpine
on:
workflow_dispatch:
push:
pull_request:
concurrency: ci-arch-emu-${{ github.ref }}
jobs:
alpine:
# Run armv7 on aarch64 runners
runs-on: ${{ matrix.arch == 'armv7' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
defaults:
run:
# Use emulated shell as default
shell: alpine.sh {0}
strategy:
# Allow other runners in the matrix to continue if some fail
fail-fast: false
matrix:
# For available CPU architectures, see:
# https://github.com/marketplace/actions/setup-alpine-linux-environment
arch: [x86, armv7, loongarch64]
name: alpine (${{ matrix.arch }})
steps:
- name: get CPU information (host)
shell: bash
run: lscpu
- name: checkout repository
uses: actions/checkout@v7
- name: install dependencies
uses: jirutka/setup-alpine@v1
with:
arch: ${{ matrix.arch }}
apk-tools-url: ${{ matrix.arch == 'armv7'
&& 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/aarch64/apk.static#!sha256!27a975638ddc95a411c9f17c63383e335da9edf6bb7de2281d950c291a11f878'
|| 'https://gitlab.alpinelinux.org/api/v4/projects/5/packages/generic/v2.14.7/x86_64/apk.static#!sha256!bdd044e0fd6cc388c5e571e1093efa5f35f7767cc5aa338b0a2576a429009a62' }}
packages: >
bash
build-base
ccache
cmake
gfortran
eigen-dev
lapack-dev
lscpu
- name: disable QEMU emulation
if: matrix.arch == 'armv7'
shell: bash
run: sudo update-binfmts --disable qemu-arm
- name: get CPU information (emulated)
run: lscpu
- name: prepare ccache
# create key with human readable timestamp
# used in action/cache/restore and action/cache/save steps
id: ccache-prepare
run: |
echo "key=ccache:alpine:${{ matrix.arch }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
- name: restore ccache
# setup the GitHub cache used to maintain the ccache from one job to the next
uses: actions/cache/restore@v6
with:
# location of the ccache of the chroot in the root file system
path: /home/runner/rootfs/alpine-latest-${{ matrix.arch }}/home/runner/.ccache
key: ${{ steps.ccache-prepare.outputs.key }}
# Prefer caches from the same branch. Fall back to caches from the default branch.
restore-keys: |
ccache:alpine:${{ matrix.arch }}:${{ github.ref }}
ccache:alpine:${{ matrix.arch }}
- name: configure ccache
run: |
test -d ~/.ccache || mkdir ~/.ccache
echo "max_size = 20M" >> ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
ccache -s
which ccache
- name: configure
run: |
echo "gcc --version"
gcc --version
echo "gcc -dumpmachine"
gcc -dumpmachine
echo " "
mkdir -p ${GITHUB_WORKSPACE}/build && cd ${GITHUB_WORKSPACE}/build
cmake \
-DEXAMPLES=ON \
-DMPI=OFF \
-DICB=ON \
-DEIGEN=ON \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
..
- name: build
run: |
cd ${GITHUB_WORKSPACE}/build
cmake --build .
- name: ccache status
continue-on-error: true
run: ccache -s
- name: save ccache
# Save the cache after we are done (successfully) building
# This helps to retain the ccache even if the subsequent steps are failing.
uses: actions/cache/save@v6
with:
path: /home/runner/rootfs/alpine-latest-${{ matrix.arch }}/home/runner/.ccache
key: ${{ steps.ccache-prepare.outputs.key }}
- name: test
run: |
cd ${GITHUB_WORKSPACE}/build
CTEST_OUTPUT_ON_FAILURE=1 ctest .
+219
View File
@@ -0,0 +1,219 @@
name: cross-build-ubuntu
on:
workflow_dispatch:
push:
pull_request:
concurrency: ci-cross-build-ubuntu-${{ github.ref }}
jobs:
cross-build:
runs-on: ${{ matrix.os }}
strategy:
# Allow other runners in the matrix to continue if some fail
fail-fast: false
matrix:
# List of architectures that are supported by Ubuntu:
# https://canonical-ubuntu-packaging-guide.readthedocs-hosted.com/en/latest/reference/architectures/
arch: [armhf, ppc64el, s390x, riscv64]
include:
- arch: armhf
target-triple: arm-linux-gnueabihf
os: ubuntu-24.04-arm
ccache-max: 1G
qemu-user:
- arch: ppc64el
target-triple: powerpc64le-linux-gnu
os: ubuntu-24.04-arm
ccache-max: 1G
qemu-user: qemu-ppc64le
- arch: s390x
target-triple: s390x-linux-gnu
os: ubuntu-24.04
ccache-max: 1G
qemu-user: qemu-s390x
- arch: riscv64
target-triple: riscv64-linux-gnu
os: ubuntu-24.04-arm
ccache-max: 1.4G
qemu-user: qemu-riscv64
name: cross ${{ matrix.arch }}
env:
CC: ${{ matrix.target-triple }}-gcc
CXX: ${{ matrix.target-triple }}-g++
FC: ${{ matrix.target-triple }}-gfortran
steps:
- name: get CPU information
run: lscpu
- name: checkout repository
uses: actions/checkout@v7
- name: install toolchain for ${{ matrix.arch }}
run: |
sudo apt -qq update
sudo apt install -y \
g++-${{ matrix.target-triple }} \
gfortran-${{ matrix.target-triple }} \
cmake \
ccache \
${{ matrix.arch == 'armhf' && ' ' || 'qemu-user-binfmt' }}
- name: add repositories for ${{ matrix.arch }} packages
# deb822-style format:
# https://manpages.ubuntu.com/manpages/noble/man5/sources.list.5.html
run: |
sudo dpkg --add-architecture ${{ matrix.arch }}
case ${{ matrix.os }} in
"ubuntu-24.04-arm")
sudo bash -c 'cat - >/etc/apt/sources.list.d/ubuntu.sources' <<-EOF
Types: deb
URIs: http://ports.ubuntu.com/ubuntu-ports/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Architectures: arm64 ${{ matrix.arch }}
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: http://security.ports.ubuntu.com/ubuntu-ports/
Suites: noble-security
Components: main restricted universe multiverse
Architectures: arm64 ${{ matrix.arch }}
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
EOF
;;
"ubuntu-24.04")
sudo bash -c 'cat - >/etc/apt/sources.list.d/ubuntu.sources' <<-EOF
Types: deb
URIs: http://archive.ubuntu.com/ubuntu/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Architectures: amd64
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: http://security.ubuntu.com/ubuntu/
Suites: noble-security
Components: main restricted universe multiverse
Architectures: amd64
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: http://ports.ubuntu.com/ubuntu-ports/
Suites: noble noble-updates noble-backports
Components: main restricted universe multiverse
Architectures: ${{ matrix.arch }}
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
Types: deb
URIs: http://security.ports.ubuntu.com/ubuntu-ports/
Suites: noble-security
Components: main restricted universe multiverse
Architectures: ${{ matrix.arch }}
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
EOF
;;
esac
sudo apt update
- name: install dependencies for ${{ matrix.arch }}
run: |
sudo apt install -y \
openmpi-bin:${{ matrix.arch }} \
libblas-dev:${{ matrix.arch }} \
liblapack-dev:${{ matrix.arch }} \
libeigen3-dev:${{ matrix.arch }}
# Trying to install libopenmpi-dev for the cross-environment causes
# apt to complain about missing .mod file dependencies. Those .mod
# files are already installed with the cross-compiler. Ignore those
# bogus dependency errors and install the package manually.
apt-get download libopenmpi-dev:${{ matrix.arch }}
sudo dpkg -i --force-depends libopenmpi-dev_*_${{ matrix.arch }}.deb
- name: prepare ccache
# create key with human readable timestamp
# used in action/cache/restore and action/cache/save steps
id: ccache-prepare
run: |
echo "key=ccache:cross:${{ matrix.os }}:${{ matrix.arch }}:${{ github.ref }}:$(date +"%Y-%m-%d_%H-%M-%S"):${{ github.sha }}" >> $GITHUB_OUTPUT
- name: restore ccache
# setup the github cache used to maintain the ccache from one job to the next
uses: actions/cache/restore@v6
with:
path: ~/.ccache
key: ${{ steps.ccache-prepare.outputs.key }}
restore-keys: |
ccache:cross:${{ matrix.os }}:${{ matrix.arch }}:${{ github.ref }}
ccache:cross:${{ matrix.os }}:${{ matrix.arch }}:refs/heads/default
- name: configure ccache
env:
CCACHE_MAX: ${{ matrix.ccache-max }}
run: |
test -d ~/.ccache || mkdir ~/.ccache
echo "max_size = $CCACHE_MAX" >> ~/.ccache/ccache.conf
echo "compression = true" >> ~/.ccache/ccache.conf
ccache -s
echo "/usr/lib/ccache" >> $GITHUB_PATH
- name: configure
run: |
echo $PATH
echo which ccache
which ccache
echo which $CC
which $CC
echo $CC --version
$CC --version
echo which $CXX
which $CXX
echo $CXX --version
$CXX --version
echo which $FC
which $FC
echo $FC --version
$FC --version
mkdir -p ${GITHUB_WORKSPACE}/build && cd ${GITHUB_WORKSPACE}/build
echo "::group::Configure with CMake"
cmake \
-DEXAMPLES=ON \
-DMPI=OFF \
-DICB=ON \
-DEIGEN=ON \
-DCMAKE_C_COMPILER_LAUNCHER="ccache" \
-DCMAKE_CXX_COMPILER_LAUNCHER="ccache" \
-DBLA_VENDOR="Generic" \
..
echo "::endgroup::"
- name: build
run: |
cd ${GITHUB_WORKSPACE}/build
cmake --build .
- name: ccache status
continue-on-error: true
run: ccache -s
- name: save ccache
# Save the cache after we are done (successfully) building
uses: actions/cache/save@v6
with:
path: ~/.ccache
key: ${{ steps.ccache-prepare.outputs.key }}
- name: test
env:
driver: ${{ matrix.qemu-user }}
run: |
cd ${GITHUB_WORKSPACE}/build
CTEST_OUTPUT_ON_FAILURE=1 ctest .
+359
View File
@@ -0,0 +1,359 @@
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@v7
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 -DEIGEN=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@v7
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 ..
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@v7
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-eigen
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@v7
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
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@v7
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 -DEIGEN=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@v7
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@v7
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 open-mpi eigen veclibfort
- name: Run job
run: |
mkdir -p build
cd build
export FC=mpif90 # Uses gfortran.
export CC=mpicc # Uses clang.
export CFLAGS="-Qunused-arguments"
export CXX=mpic++ # Uses clang++.
export CXXFLAGS="-Qunused-arguments"
export VECLIBFORT_PREFIX=$(brew --prefix veclibfort)
cmake \
-DBLAS_LIBRARIES="${VECLIBFORT_PREFIX}/lib/libvecLibFort.dylib" \
-DLAPACK_LIBRARIES="${VECLIBFORT_PREFIX}/lib/libvecLibFort.dylib" \
-DEXAMPLES=ON -DICB=ON -DEIGEN=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@v7
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 numpy veclibfort
- name: Run job
run: |
mkdir -p build
cd build
export FC=gfortran
export CC=clang
export CFLAGS="-Qunused-arguments"
export CXX=clang++
export CXXFLAGS="-Qunused-arguments"
export VECLIBFORT_PREFIX=$(brew --prefix veclibfort)
cmake \
-DBLAS_LIBRARIES="${VECLIBFORT_PREFIX}/lib/libvecLibFort.dylib" \
-DLAPACK_LIBRARIES="${VECLIBFORT_PREFIX}/lib/libvecLibFort.dylib" \
-DEXAMPLES=ON -DICB=ON -DEIGEN=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@v7
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 pkgconfig open-mpi eigen veclibfort
- name: Run job
run: |
./bootstrap
export VECLIBFORT_PREFIX=$(brew --prefix veclibfort)
BLAS_LIBS="-L${VECLIBFORT_PREFIX}/lib -lvecLibFort" \
LAPACK_LIBS="-L${VECLIBFORT_PREFIX}/lib -lvecLibFort" \
./configure --enable-icb --enable-eigen --enable-mpi
make all
make check
windows_latest_cmake:
runs-on: windows-latest
name: MinGW-w64 ${{ matrix.msystem }} INTERFACE64=${{ matrix.int64 }}/MPI=${{ matrix.mpi }}
strategy:
fail-fast: false
matrix:
msystem: [UCRT64, CLANG64]
int64: [ON, OFF]
mpi: [ON, OFF]
exclude:
- int64: ON
mpi: ON
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: ${{ matrix.msystem }}
install: >-
base-devel
git
pacboy: >-
cmake:p
ninja:p
cc:p
fc:p
eigen3:p
- name: Install OpenBLAS and MS-MPI from MSYS2
run: |
if [[ ${{ matrix.int64 }} != ON ]]; then
pacboy -S openblas:p --noconfirm
else
pacboy -S openblas64:p --noconfirm
fi
if [[ ${{ matrix.mpi }} = ON ]]; then
# This installs only the link library.
# The actual library will be installed in the next step.
pacboy -S msmpi:p --noconfirm
fi
- name: Install MS-MPI (for mpiexec)
uses: mpi4py/setup-mpi@v1
- name: Clone and check out repository code
uses: actions/checkout@v7
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
echo "::group::Configure"
if [[ ${{ matrix.int64 }} == ON ]]; then
_blas_lib_flag="-DBLAS_LIBRARIES=openblas_64"
fi
cmake \
-GNinja \
-DICB=ON \
-DEIGEN=ON \
-DEXAMPLES=ON \
-DMPI=${{ matrix.mpi }} \
-DINTERFACE64=${{ matrix.int64 }} \
${_blas_lib_flag} \
..
echo "::endgroup::"
echo "::group::Build"
cmake --build . -v
echo "::endgroup::"
- name: Run tests
id: run-ctest
run: |
if [[ ${{ matrix.mpi }} == ON ]]; then
export PATH="/c/Program Files/Microsoft MPI/Bin":$PATH # add mpiexec to msys2 path
fi
cd build
ctest
- name: Re-run tests
if: always() && (steps.run-ctest.outcome == 'failure')
timeout-minutes: 60
run: |
if [[ ${{ matrix.mpi }} == ON ]]; then
export PATH="/c/Program Files/Microsoft MPI/Bin":$PATH # add mpiexec to msys2 path
fi
cd build
echo "::group::Re-run ctest"
ctest --rerun-failed --output-on-failure || true
echo "::endgroup::"
echo "::group::Log from these tests"
[ ! -f Testing/Temporary/LastTest.log ] || cat Testing/Temporary/LastTest.log
echo "::endgroup::"
echo "::group::Content of arpackmm.run.log"
[ ! -f EXAMPLES/MATRIX_MARKET/arpackmm.run.log ] || cat EXAMPLES/MATRIX_MARKET/arpackmm.run.log
echo "::endgroup::"
+17 -1
View File
@@ -15,9 +15,16 @@ config.log
config.status
libtool
.deps/
arpack.pc
arpack*.pc
parpack*.pc
arpackdef.h
arpackicb.h
tstAutotoolsInstall.sh
cmake/arpackng-config-version.cmake
cmake/arpackng-config.cmake
# Generated by `make`
.dirstamp
*.o
*.mod
*.lo
@@ -40,6 +47,8 @@ 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]
@@ -48,6 +57,9 @@ 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
@@ -64,3 +76,7 @@ PARPACK/TESTS/MPI/issue46
*.suo
VISUAL_STUDIO/Release MKL/
VISUAL_STUDIO/bin/
# Temporary files
*~
\#*#
+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
-75
View File
@@ -1,75 +0,0 @@
sudo: false
language: c
compiler:
- gcc
addons:
apt:
packages:
- gfortran
- gcc
- g++
- libblas-dev
- liblapack-dev
- libopenmpi-dev
- openmpi-bin
env:
- BUILD=cmake
- BUILD=configure
script:
# CMAKE
- if [ "$BUILD" == "cmake" ]; then mkdir build ; fi
- if [ "$BUILD" == "cmake" ]; then cd build ; fi
- if [ "$BUILD" == "cmake" ]; then cmake -D EXAMPLES=ON -D MPI=ON -D ICB=OFF .. ; fi
- if [ "$BUILD" == "cmake" ]; then make all ; fi
- if [ "$BUILD" == "cmake" ]; then make test ; fi
- if [ "$BUILD" == "cmake" ]; then rm -fr * ; fi # Restart cmake from scratch.
- if [ "$BUILD" == "cmake" ]; then cmake -D EXAMPLES=ON -D MPI=ON -D ICB=ON .. ; fi
- if [ "$BUILD" == "cmake" ]; then make all ; fi
- if [ "$BUILD" == "cmake" ]; then make test ; fi
- if [ "$BUILD" == "cmake" ]; then rm -fr * ; fi # Restart cmake from scratch.
- if [ "$BUILD" == "cmake" ]; then cmake -D EXAMPLES=ON -D MPI=OFF -D ICB=OFF .. ; fi
- if [ "$BUILD" == "cmake" ]; then make all ; fi
- if [ "$BUILD" == "cmake" ]; then make test ; fi
- if [ "$BUILD" == "cmake" ]; then rm -fr * ; fi # Restart cmake from scratch.
- if [ "$BUILD" == "cmake" ]; then cmake -D EXAMPLES=ON -D MPI=OFF -D ICB=ON .. ; fi
- if [ "$BUILD" == "cmake" ]; then make all ; fi
- if [ "$BUILD" == "cmake" ]; then make test ; fi
- if [ "$BUILD" == "cmake" ]; then rm -fr * ; fi # Restart cmake from scratch.
- if [ "$BUILD" == "cmake" ]; then cmake -D BUILD_SHARED_LIBS=ON -D MPI=ON -D ICB=OFF .. ; fi
- if [ "$BUILD" == "cmake" ]; then make all ; fi
- if [ "$BUILD" == "cmake" ]; then make test ; fi
- if [ "$BUILD" == "cmake" ]; then rm -fr * ; fi # Restart cmake from scratch.
- if [ "$BUILD" == "cmake" ]; then cmake -D BUILD_SHARED_LIBS=ON -D MPI=ON -D ICB=ON .. ; fi
- if [ "$BUILD" == "cmake" ]; then make all ; fi
- if [ "$BUILD" == "cmake" ]; then make test ; fi
- if [ "$BUILD" == "cmake" ]; then rm -fr * ; fi # Restart cmake from scratch.
- if [ "$BUILD" == "cmake" ]; then cmake -D BUILD_SHARED_LIBS=ON -D MPI=OFF -D ICB=OFF .. ; fi
- if [ "$BUILD" == "cmake" ]; then make all ; fi
- if [ "$BUILD" == "cmake" ]; then make test ; fi
- if [ "$BUILD" == "cmake" ]; then rm -fr * ; fi # Restart cmake from scratch.
- if [ "$BUILD" == "cmake" ]; then cmake -D BUILD_SHARED_LIBS=ON -D MPI=OFF -D ICB=ON .. ; fi
- if [ "$BUILD" == "cmake" ]; then make all ; fi
- if [ "$BUILD" == "cmake" ]; then make test ; fi
- if [ "$BUILD" == "cmake" ]; then rm -fr * ; fi # Restart cmake from scratch for code coverage
- if [ "$BUILD" == "cmake" ]; then cmake -D EXAMPLES=ON -DCOVERALLS=ON -D MPI=ON -D ICB=ON .. ; fi
- if [ "$BUILD" == "cmake" ]; then make all test coveralls VERBOSE=1 ; fi
# CONFIGURE
- if [ "$BUILD" == "configure" ]; then ./bootstrap ; fi
- if [ "$BUILD" == "configure" ]; then ./configure --enable-mpi ; fi
- if [ "$BUILD" == "configure" ]; then make all ; fi
- if [ "$BUILD" == "configure" ]; then make check ; fi
- if [ "$BUILD" == "configure" ]; then make distcheck ; fi
- if [ "$BUILD" == "configure" ]; then ./configure --enable-mpi --enable-icb ; fi
- if [ "$BUILD" == "configure" ]; then make all ; fi
- if [ "$BUILD" == "configure" ]; then make check ; fi
- if [ "$BUILD" == "configure" ]; then ./configure --enable-icb ; fi
- if [ "$BUILD" == "configure" ]; then make all ; fi
- if [ "$BUILD" == "configure" ]; then make check ; fi
- if [ "$BUILD" == "configure" ]; then ./configure ; fi
- if [ "$BUILD" == "configure" ]; then make all ; fi
- if [ "$BUILD" == "configure" ]; then make check ; fi
+219 -6
View File
@@ -1,12 +1,225 @@
arpack-ng - 3.6.1
arpack-ng - next
* Rename debug.h to debug-arpack.h to avoid collision (Closes #126)
[ Evan Biederstedt ]
* Fix warnings for "Warning: Obsolescent feature: Old-style character length at (1)", compiled with `gfortran-16 -fpic -g -O2 -Wall -pedantic -mtune=native`
* Changed GitHub CI workflows for Mac OS to use 'brew install open-mpi', as `mpich` fails.
[ Theodore Chang ]
* CMake: Improve dependency linking, bump up minimum C++ standard version.
[ Franck Houssen ]
* [BUG FIX] Fix arpack solver to handle real and imag shifts.
* [BUG FIX] Make sure the restart file of the arpack solver i written.
* [BUG FIX] Change arpack solver API.
[ Henri Menke ]
* [BUG FIX] Add missing stdexcept header
[ Kyle Guinn ]
* Build PARPACK p[sd]lamch10.f with FFLAGS from ./configure instead of forcing -O0. Build all of PARPACK with AM_FFLAGS.
* [BUG FIX] Don't install pkg-config files for libraries that were not built.
[ Markus Mützel ]
* CMake: Fix running CTests on Windows.
* Use GNU Fortran ABI in CI tests on macOS.
* Initialize machine dependent constants only once in `PDNAITR`.
[ Szabolcs Horvát ]
* fix obsolescent character length warnings
-- TODO <TODO@users.noreply.github.com> DATE
arpack-ng - 3.9.1
[ Fabien Péan ]
* pyarpack: Ensure that the matrix properties (symmetric/hermitian) fit the solver (CG/LDL) with which they are used in the tests
* [BUG FIX] Tests for PARPACK with C/C++ bindings icb_parpack_c and icb_parpack_cpp are now really parallel and split the problem across MPI processes.
* Update arpackmm test suite: enable solving non-symmetric tests with BiCG solver
* README: Add details on Windows installation.
[ Szabolcs Horvát ]
* [BUG FIX] Ensure that LAPACK RNG state is propagated (regression in 3.9.0).
* [BUG FIX] Ensure that separate random seeds are used on different parallel thread in D and S versions of functions (issue from original ARPACK).
[ Ruoyu Feng ]
* ICB(arpackdef.h): distinct intel llvm compiler (icx with clang-cl) from msvc on windows
* ICB(arpackdef.h): Undef macro I if complex.h from msvc version is loaded, which is an usual name and causes issues on arpackSolver.
[ Franck Houssen ]
* [BUG FIX] Fix install: headers in /path/to/local/include/arpack for ICB samples
* [BUG FIX] Fix install: headers in /path/to/local/include/arpack
* arpackmm: allow for using LA/SA magnitudes.
* Rename icbexmm option into eigen option.
* README: document how to use ICB.
* [BUG FIX] arpackmm: fix restart.
* README: document where to find arpack user's guide.
-- Franck Houssen <fghoussen@users.noreply.github.com> Sat, 14 Oct 2023 13:37:37 +0200
[ Franck Houssen ]
* Add documentation on ILP64.
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 ]
@@ -45,7 +258,7 @@ arpack-ng - 3.5.0
* 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
* Use AC_PROG_FC instead of AC_PROG_F77 for proper initialization
for the usage of AC_FC_LINE_LENGTH. Noted on Cygwin.
[ Denis Davydov ]
@@ -163,7 +376,7 @@ arpack-ng - 3.1.3
* Replace arpack.pc with proper autotooled arpack.pc.in
* Add debug.h to TESTS/Makefile.am sources
* "make dist" is functionnal
* "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
@@ -176,7 +389,7 @@ arpack-ng - 3.1.2
* Compile also PARPACK / MPI example (Closes: #783)
* Configure detected built-in LAPACK and BLAS, but refused to use them
(Closes: #784)
* Fixed division by zero in smlnum by usind p[d,s]lamch instead of the
* 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
+649 -228
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -4,7 +4,7 @@
The following statements may be used within the calling program to
initiate and request this output.
include 'debug-arpack.h'
include 'debug.h'
ndigit = -3
logfil = 6
msgets = 0
@@ -63,13 +63,13 @@
once some familiarity has been gained with the routines.
The include statement sets up the storage declarations that are
solely associated with this trace debugging feature. "debug-arpack.h"
solely associated with this trace debugging feature. "debug.h"
has the following structure:
---------------------------------------------------------------------
c
c\SCCS Information: @(#)
c FILE: debug-arpack.h SID: 2.3 DATE OF SID: 11/16/95 RELEASE: 2
c FILE: debug.h SID: 2.3 DATE OF SID: 11/16/95 RELEASE: 2
c
c %---------------------------------%
c | See debug.doc for documentation |
+1 -1
View File
@@ -1,4 +1,4 @@
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
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
+96 -96
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,7 +152,7 @@ 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))
@@ -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
+38 -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,14 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = (4.0E+0, 0.0E+0) / h2
30 continue
c
m(idiag,j) = (1.0E+0, 0.0E+0)
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 +221,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 +236,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 +245,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 +298,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 +313,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
+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
+100 -100
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,7 +152,7 @@ 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))
@@ -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
+41 -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,14 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = (4.0D+0, 0.0D+0) / h2
30 continue
c
m(idiag,j) = (1.0D+0, 0.0D+0)
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 +221,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 +236,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 +245,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 +298,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 +313,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
+1 -1
View File
@@ -1,4 +1,4 @@
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX)$(ITF64SUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
CNDRV = cndrv1 cndrv2 cndrv3 cndrv4
ZNDRV = zndrv1 zndrv2 zndrv3 zndrv4
+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
+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.)
+23
View File
@@ -0,0 +1,23 @@
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 issue401.sh issue215.sh
dist_check_DATA = An.mtx As.mtx Az.mtx B.mtx Bz.mtx issue401.mtx issue215.mtx
TESTS = arpackmm.sh issue401.sh issue215.sh
arpackmm_SOURCES = arpackmm.cpp
pkgincludedir = $(includedir)/arpack@ITF64SUFFIX@
if EIGEN
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-eigen; make all check
- cmake:
~arpack-ng/build> cmake -D EIGEN=ON ..; make all test
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+102
View File
@@ -0,0 +1,102 @@
#!/bin/bash -eu
trap 'catch' ERR
catch() {
grep OPT arpackmm.run.log
grep Error arpackmm.run.log
exit 1
}
# For all these eigen problems, the first eigen value is about 382 or (382, 0.).
for stdPb in "--A As.mtx" "--nonSymPb --A An.mtx" "--nonSymPb --cpxPb --A Az.mtx"
do
# Choose B matrix according to A.
export fileB=""
if [[ "$stdPb" == *cpxPb* ]]; then
export fileB="--B Bz.mtx"
else
export fileB="--B B.mtx"
fi
for genPb in "" "$fileB"
do
# SM may not converge so we can not apply checks.
# LM + invert is equivalent to SM and does converge.
# Note: this is expected as "power-like" methods are designed to find largest eigen values.
for magOpt in "--mag LM" "--mag SM --noCheck"
do
export mrn="--maxResNorm 1.e-1" # Relax residual check to get stable tests.
# Shift slightly to avoid the zero-vector starting problem.
export shiftZV=""
if [[ "$stdPb" == *cpxPb* ]]; then
export shiftZV="--shiftReal 1.0 --shiftImag 1.0"
else
export shiftZV="--shiftReal 1.0"
fi
# Shift according to the estimation of the eigen value we may have.
export shiftEV=""
if [[ "$stdPb" == *cpxPb* ]]; then
export shiftEV="--shiftReal 380.0 --shiftImag 1.0"
else
export shiftEV="--shiftReal 380.0"
fi
for shiftRI in "$shiftZV" "$shiftEV"
do
for invert in "" "--invert"
do
# Choose solver according to the sym/non-sym type of the problem.
export cgSlv=""
if [[ "$stdPb" == *nonSymPb* ]]; then
export cgSlv="BiCG"
else
export cgSlv="CG"
fi
for slv in "--slv $cgSlv" "--slv LU"
do
for rs in "" "--schur"
do
for dsPrec in "" "--simplePrec"
do
for dsMat in "" "--dense true"
do
# Skip not supported cases.
if [[ "$dsMat" == *dense* ]]; then
if [[ "$slv" == *CG* ]]; then
continue # Iterative solvers are not allowed when using dense matrices.
fi
fi
export easeCV="--nbCV 6 --maxIt 200" # Use --nbCV 6 and --maxIt 200 to ease convergence.
echo "CLI: ./arpackmm $stdPb $genPb $magOpt $mrn $shiftRI $invert $slv $rs $dsPrec $dsMat $easeCV"
echo "----------------------------------------------------------------------------------------"
# Run arpackmm.
./arpackmm "$stdPb" "$genPb" "$magOpt" "$mrn" "$shiftRI" "$invert" "$slv" "$rs" "$dsPrec" "$dsMat" \
"$easeCV" --verbose 3 &> arpackmm.run.log
grep OPT arpackmm.run.log
grep OUT arpackmm.run.log
echo "----------------------------------------------------------------------------------------"
# Run arpackmm: re-run with restart always with small shift to avoid the zero-starting vector problem.
./arpackmm "$stdPb" "$genPb" "$magOpt" "$mrn" "$shiftZV" "$invert" "$slv" "$rs" "$dsPrec" "$dsMat" \
--restart \
"$easeCV" --verbose 3 &> arpackmm.run.log
grep OPT arpackmm.run.log
grep OUT arpackmm.run.log
echo "========================================================================================"
done
done
done
done
done
done
done
done
done
echo "arpackmm: OK"
+6
View File
@@ -0,0 +1,6 @@
%% MatrixMarket matrix coordinate double symmetric
% 4x4 matrix filled with zero
%
4 4 0
+9
View File
@@ -0,0 +1,9 @@
#!/bin/bash -eu
# Note: need to shift slightly as eigen value is zero.
./arpackmm --A issue215.mtx --mag LM --nbEV 1 --nbCV 4 --shiftReal 0.1
if [ "$?" -ne "0" ]; then exit 1; fi
./arpackmm --A issue215.mtx --mag LM --nbEV 1 --nbCV 4 --shiftReal 0.1 --restart
if [ "$?" -ne "0" ]; then exit 1; fi
echo "OK"
+8
View File
@@ -0,0 +1,8 @@
%% MatrixMarket matrix coordinate double symmetric
% 10x10 matrix with 2 non-zero values
%
10 10 2
0 1 1.
1 0 1.
+10
View File
@@ -0,0 +1,10 @@
#!/bin/bash -eu
./arpackmm --A issue401.mtx --mag LA --nbEV 1 --nbCV 5
if [ "$?" -ne "0" ]; then exit 1; fi
./arpackmm --A issue401.mtx --mag LA --nbEV 1 --nbCV 5 --restart
if [ "$?" -ne "0" ]; then exit 1; fi
./arpackmm --A issue401.mtx --mag LA --nbEV 1 --nbCV 5 --restart --shiftReal 0.9
if [ "$?" -ne "0" ]; then exit 1; fi
echo "OK"
+5 -1
View File
@@ -1,2 +1,6 @@
SUBDIRS = BAND COMPLEX NONSYM SIMPLE SVD SYM
EXTRA_DIST = README
if EIGEN
SUBDIRS += MATRIX_MARKET
endif
EXTRA_DIST = README README.CALLING-ARPACK-FROM-C-OR-CPP
+1 -1
View File
@@ -1,4 +1,4 @@
LDADD = $(top_builddir)/SRC/libarpack$(LIBSUFFIX).la $(LAPACK_LIBS) $(BLAS_LIBS)
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
+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
+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)
+434
View File
@@ -0,0 +1,434 @@
#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("maxResNorm") = 1.e-3),
"check eigen vectors accuracy (according to max allowed residual norm) "
"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("maxResNorm") = 1.e-3),
"check eigen vectors accuracy (according to max allowed residual norm) "
"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("maxResNorm") = 1.e-3),
"check eigen vectors accuracy (according to max allowed residual norm) "
"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 :*/
+113
View File
@@ -0,0 +1,113 @@
#!/usr/bin/env python
import numpy as np
from pyarpack import denseLDLT 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.
arpackSlv.symPb = True
# 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.
arpackSlv.sigmaReal = 1
arpackSlv.symPb = True
# 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])
+116
View File
@@ -0,0 +1,116 @@
#!/usr/bin/env python
import numpy as np
from pyarpack import denseLUPP 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])
+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 maxResNorm = 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), maxResNorm);
};
// 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 maxResNorm = 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), maxResNorm);
};
// 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 maxResNorm = 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), maxResNorm);
};
// 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 :*/

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