94 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
105 changed files with 1755 additions and 703 deletions
+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 .
+99 -33
View File
@@ -5,7 +5,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
@@ -21,7 +21,7 @@ jobs:
run: |
mkdir build
cd build
cmake -DEXAMPLES=ON -DMPI=ON -DICB=ON -DICBEXMM=ON ..
cmake -DEXAMPLES=ON -DMPI=ON -DICB=ON -DEIGEN=ON ..
make all
CTEST_OUTPUT_ON_FAILURE=1 make test
make package_source
@@ -29,7 +29,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
@@ -40,7 +40,7 @@ jobs:
- 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
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
@@ -54,7 +54,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
@@ -69,7 +69,7 @@ jobs:
- name: Run job
run: |
./bootstrap
./configure --enable-mpi --enable-icb --enable-icbexmm
./configure --enable-mpi --enable-icb --enable-eigen
make all
make check
make distcheck
@@ -77,7 +77,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
@@ -88,7 +88,7 @@ jobs:
- 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
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
@@ -101,7 +101,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
@@ -129,14 +129,14 @@ jobs:
run: |
mkdir build
cd build
cmake -DEXAMPLES=ON -DMPI=ON -DICB=ON -DICBEXMM=ON -DPYTHON3=ON ..
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@v2
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
@@ -165,7 +165,7 @@ jobs:
runs-on: macos-latest
steps:
- name: Clone and check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
@@ -176,25 +176,28 @@ jobs:
- name: Install brew dependencies
run: |
brew reinstall gcc # brings gfortran on path
brew install cmake mpich
brew install cmake open-mpi eigen veclibfort
- name: Run job
run: |
mkdir -p build
cd build
export FC=mpif90 # Uses gfortran.
export FFLAGS="-ff2c -fno-second-underscore"
export CC=mpicc # Uses clang.
export CFLAGS="-Qunused-arguments"
export CXX=mpic++ # Uses clang++.
export CXXFLAGS="-Qunused-arguments"
LIBS="-framework Accelerate" cmake -DBLA_VENDOR=Generic -DEXAMPLES=ON -DICB=ON -DMPI=ON ..
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@v2
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
@@ -213,26 +216,28 @@ jobs:
# https://github.com/actions/runner-images/issues/2322
brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done
brew reinstall gcc # brings gfortran on path
brew install cmake eigen boost-python3 python3
pip3 install numpy
brew install cmake eigen boost-python3 python3 numpy veclibfort
- name: Run job
run: |
mkdir -p build
cd build
export FC=gfortran
export FFLAGS="-ff2c -fno-second-underscore"
export CC=clang
export CFLAGS="-Qunused-arguments"
export CXX=clang++
export CXXFLAGS="-Qunused-arguments"
LIBS="-framework Accelerate" cmake -DBLA_VENDOR=Generic -DEXAMPLES=ON -DICB=ON -DPYTHON3=ON ..
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@v2
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
@@ -243,15 +248,28 @@ jobs:
- name: Install brew dependencies
run: |
brew reinstall gcc # brings gfortran on path
brew install autoconf automake libtool pkg-config mpich
brew install autoconf automake libtool pkgconfig open-mpi eigen veclibfort
- name: Run job
run: |
./bootstrap
LIBS="-framework Accelerate" FFLAGS="-ff2c -fno-second-underscore" FCFLAGS="-ff2c -fno-second-underscore" ./configure --enable-icb --enable-mpi
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
@@ -261,19 +279,32 @@ jobs:
uses: msys2/setup-msys2@v2
with:
update: true
msystem: MINGW64
msystem: ${{ matrix.msystem }}
install: >-
base-devel
git
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-gcc-fortran
mingw-w64-x86_64-openblas
mingw-w64-x86_64-msmpi
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@v2
uses: actions/checkout@v7
with:
fetch-depth: 0
ref: ${{github.event.pull_request.head.ref}} # Branch where changes are implemented.
@@ -284,10 +315,45 @@ jobs:
- name: Run job
run: |
mkdir -p build && cd build
cmake -GNinja -DICB=ON -DEXAMPLES=ON -DMPI=ON ..
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: |
export PATH="/c/Program Files/Microsoft MPI/Bin":$PATH # add mpiexec to msys2 path
if [[ ${{ matrix.mpi }} == ON ]]; then
export PATH="/c/Program Files/Microsoft MPI/Bin":$PATH # add mpiexec to msys2 path
fi
cd build
ctest --output-on-failure
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::"
+2 -1
View File
@@ -17,10 +17,11 @@ libtool
.deps/
arpack*.pc
parpack*.pc
arpackSolver*.pc
arpackdef.h
arpackicb.h
tstAutotoolsInstall.sh
cmake/arpackng-config-version.cmake
cmake/arpackng-config.cmake
# Generated by `make`
.dirstamp
+61 -2
View File
@@ -1,4 +1,63 @@
-- Franck Houssen <fghoussen@users.noreply.github.com> Sat, 11 Feb 2023 13:52:57 +0100
arpack-ng - next
[ 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
@@ -199,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 ]
+73 -48
View File
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.5)
if (NOT DEFINED CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE Release CACHE STRING "Build type")
@@ -8,7 +8,7 @@ project(arpack C Fortran)
set(arpack_ng_MAJOR_VERSION 3)
set(arpack_ng_MINOR_VERSION 9)
set(arpack_ng_PATCH_VERSION 0)
set(arpack_ng_PATCH_VERSION 1)
set(arpack_ng_VERSION ${arpack_ng_MAJOR_VERSION}.${arpack_ng_MINOR_VERSION}.${arpack_ng_PATCH_VERSION})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake)
@@ -27,7 +27,7 @@ endif ()
option(BUILD_SHARED_LIBS "Build shared libraries instead of static libraries" ON)
option(MPI "Enable parallel support" OFF)
option(ICB "Enable support for *[ae]upd_c with ISO_C_BINDING" OFF)
option(ICBEXMM "Enable support for matrix market example based on ICB" OFF)
option(EIGEN "Enable support for eigenvalue-problems solver based on ICB and eigen" OFF)
option(PYTHON3 "Enable python3 support" OFF)
set(BOOST_PYTHON_LIBSUFFIX "" CACHE STRING "suffix to add to custom boost python libs")
option(EXAMPLES "Compile ARPACK examples" OFF)
@@ -45,7 +45,7 @@ option(INTERFACE64 "use the 64-bit integer interface (ILP64) for ARPACK, BLAS an
# 'make install' to the correct location, and also define
# paths for target_include_directories and target_link_libraries
include(GNUInstallDirs)
set(ARPACK_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/arpack-ng${ITF64SUFFIX}")
set(ARPACK_INSTALL_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}/arpack${ITF64SUFFIX}")
set(ARPACK_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/arpackng${LIBSUFFIX}${ITF64SUFFIX}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
@@ -62,7 +62,7 @@ function(examples list_name)
foreach(l ${${list_name}})
get_filename_component(lwe ${l} NAME_WE)
add_executable(${lwe} ${arpackexample_DIR}/${l} ${examples_EXTRA_SRCS})
target_link_libraries(${lwe} arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(${lwe} arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_test(NAME "${lwe}_ex" COMMAND ${lwe})
endforeach()
endfunction(examples)
@@ -76,18 +76,21 @@ function(pexamples list_name)
endforeach()
endfunction(pexamples)
if (PYTHON3)
enable_language(C CXX) # Boost requirement.
set(CMAKE_CXX_STANDARD 14) # Boost requirement.
if (PYTHON3 OR EIGEN OR ICB)
enable_language(CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif ()
if (PYTHON3)
find_package(PythonInterp 3 REQUIRED)
find_package(PythonLibs 3 REQUIRED)
find_package(Boost 1.78 COMPONENTS python${BOOST_PYTHON_LIBSUFFIX} numpy${BOOST_PYTHON_LIBSUFFIX} REQUIRED)
set(ICBEXMM "ON")
set(EIGEN "ON")
endif ()
if (ICBEXMM)
if (EIGEN)
find_package(Eigen3 3.3 QUIET)
if (NOT EIGEN3_FOUND) # If not found, piggy-back pkg-config files.
message(WARNING "CMake didn't find the Eigen3 package. Try to look for pkg-config file...")
@@ -95,7 +98,6 @@ if (ICBEXMM)
pkg_check_modules(EIGEN3 REQUIRED eigen3>=3.3)
set(EIGEN3_INCLUDE_DIR ${EIGEN3_INCLUDE_DIRS})
endif ()
find_program (BASH_PROGRAM bash)
# Look for headers.
find_path(EIGEN3_ITERATIVE_SOLVER_DIR NAMES IterativeLinearSolvers PATHS ${EIGEN3_INCLUDE_DIR} PATH_SUFFIXES Eigen)
@@ -140,10 +142,6 @@ endif ()
# Enable language(s) before any find_package (in particular before MPI find_package).
if (ICB)
enable_language(C CXX) # For testing binding with c/c++.
set(CMAKE_CXX_STANDARD 11) # OK, since cmake-3.1 only.
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/PROG_ICB.f90
"
PROGRAM PROG_ICB
@@ -165,6 +163,8 @@ else()
if (SYMBOLSUFFIX)
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp -ffixed-line-length-none")
elseif ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "LLVMFlang")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -cpp -ffixed-line-length=none")
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fpp -extend-source")
else ()
@@ -301,6 +301,8 @@ if (NOT TARGET LAPACK::LAPACK) # Search only if not already found by upper CMake
endif()
endif()
set(LAPACK_BLAS_LIBS LAPACK::LAPACK BLAS::BLAS)
# As BLAS/LAPACK does not provide ICB, we may have to deal with symbols the old-fashion-boring-cumbersome-fortran/C way...
if (SYMBOLSUFFIX)
@@ -427,7 +429,7 @@ set(PYINT "int32" CACHE STRING "int type to be used in python scripts") # PYINT
if (INTERFACE64)
set(PYINT "int64" CACHE STRING "int type to be used in python scripts") # PYINT : int used with python.
set(INTERFACE64 1)
if ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU")
if ("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU" OR "${CMAKE_Fortran_COMPILER_ID}" STREQUAL "LLVMFlang")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -fdefault-integer-8")
elseif ("${CMAKE_Fortran_COMPILER_ID}" MATCHES "Intel")
set(CMAKE_Fortran_FLAGS "${CMAKE_Fortran_FLAGS} -i8")
@@ -625,12 +627,28 @@ endif()
############################
# TEST
############################
function(build_tests)
function(add_test_with_rpath test_name)
# Add test which sets a current working directory that doesn't contain the
# libarpack library.
# Windows doesn't have a mechanism similar to RPATH on Linux or macOS.
# On Windows, if a test is running in a working directory that doesn't contain
# the ARPACK (and PARPACK) libraries, the path to these libraries has to be
# added to the PATH environment variable.
add_test(NAME ${test_name} ${ARGN})
if (WIN32 AND BUILD_SHARED_LIBS)
set_tests_properties(${test_name}
PROPERTIES
ENVIRONMENT_MODIFICATION "PATH=path_list_prepend:$<TARGET_FILE_DIR:arpack>")
endif()
endfunction()
function(build_tests)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/TESTS)
add_executable(dnsimp_test TESTS/dnsimp.f TESTS/mmio.f TESTS/debug.h)
set_target_properties( dnsimp_test PROPERTIES OUTPUT_NAME dnsimp )
target_link_libraries(dnsimp_test arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(dnsimp_test arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_custom_command(TARGET dnsimp_test POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/TESTS/testA.mtx testA.mtx
)
@@ -639,41 +657,41 @@ function(build_tests)
if (ICB)
add_executable(bug_1315_single TESTS/bug_1315_single.c)
target_include_directories(bug_1315_single PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.h
target_link_libraries(bug_1315_single arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(bug_1315_single arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_test(bug_1315_single_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_1315_single)
add_executable(bug_1315_double TESTS/bug_1315_double.c)
target_include_directories(bug_1315_double PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.h
target_link_libraries(bug_1315_double arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(bug_1315_double arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_test(bug_1315_double_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_1315_double)
endif()
add_executable(bug_1323 TESTS/bug_1323.f)
target_link_libraries(bug_1323 arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(bug_1323 arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_test(bug_1323_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_1323)
add_executable(bug_58_double TESTS/bug_58_double.f)
target_link_libraries(bug_58_double arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(bug_58_double arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_test(bug_58_double_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_58_double)
add_executable(bug_79_double_complex TESTS/bug_79_double_complex.f)
target_link_libraries(bug_79_double_complex arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(bug_79_double_complex arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_test(bug_79_double_complex_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_79_double_complex)
add_executable(bug_142 TESTS/bug_142.f)
target_link_libraries(bug_142 arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(bug_142 arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_test(bug_142_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_142)
add_executable(bug_142_gen TESTS/bug_142_gen.f)
target_link_libraries(bug_142_gen arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(bug_142_gen arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_test(bug_142_gen_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/bug_142_gen)
if(MPI)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/PARPACK/TESTS/MPI)
add_executable(issue46 PARPACK/TESTS/MPI/issue46.f)
target_link_libraries(issue46 parpack arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
add_test(issue46_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue46)
target_link_libraries(issue46 parpack arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_test(issue46_tst mpiexec -n 2 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue46)
endif()
if(ICB)
@@ -681,27 +699,35 @@ function(build_tests)
add_executable(icb_arpack_c TESTS/icb_arpack_c.c)
target_include_directories(icb_arpack_c PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.h
target_link_libraries(icb_arpack_c arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(icb_arpack_c arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_test(icb_arpack_c_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_arpack_c)
add_executable(icb_arpack_cpp TESTS/icb_arpack_cpp.cpp)
target_include_directories(icb_arpack_cpp PUBLIC ${PROJECT_SOURCE_DIR}/ICB) # Get arpack.hpp
target_link_libraries(icb_arpack_cpp arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(icb_arpack_cpp arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
add_test(icb_arpack_cpp_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_arpack_cpp)
if (ICBEXMM)
if (EIGEN)
find_program (BASH_PROGRAM bash)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/EXAMPLES/MATRIX_MARKET)
add_executable(arpackmm EXAMPLES/MATRIX_MARKET/arpackmm.cpp)
target_include_directories(arpackmm PUBLIC ${PROJECT_SOURCE_DIR}/ICB ${EIGEN3_INCLUDE_DIR}) # Get arpack.h + eigen
target_link_libraries(arpackmm arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS})
target_link_libraries(arpackmm arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS})
configure_file(EXAMPLES/MATRIX_MARKET/As.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/As.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/An.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/An.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/Az.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Az.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/B.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/B.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/Bz.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/Bz.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/arpackmm.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/arpackmm.sh)
add_test(NAME arpackmm_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} arpackmm.sh)
add_test_with_rpath(arpackmm_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} arpackmm.sh)
configure_file(EXAMPLES/MATRIX_MARKET/issue401.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue401.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/issue401.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue401.sh)
add_test_with_rpath(issue401_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} issue401.sh)
configure_file(EXAMPLES/MATRIX_MARKET/issue215.mtx ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue215.mtx)
configure_file(EXAMPLES/MATRIX_MARKET/issue215.sh ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/issue215.sh)
add_test_with_rpath(issue215_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} issue215.sh)
endif()
if (PYTHON3)
@@ -717,7 +743,7 @@ function(build_tests)
${Boost_INCLUDE_DIRS}
${PYTHON_INCLUDE_DIRS})
target_link_libraries(pyarpack
BLAS::BLAS LAPACK::LAPACK ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
${LAPACK_BLAS_LIBS} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES})
install(TARGETS pyarpack
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/pyarpack
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/pyarpack)
@@ -773,12 +799,12 @@ function(build_tests)
add_executable(icb_parpack_c PARPACK/TESTS/MPI/icb_parpack_c.c)
target_include_directories(icb_parpack_c PUBLIC ${PROJECT_SOURCE_DIR}/ICB MPI::MPI_C) # Get parpack.h mpi.h
target_link_libraries(icb_parpack_c parpack arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS} MPI::MPI_C)
target_link_libraries(icb_parpack_c parpack arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS} MPI::MPI_C)
add_test(icb_parpack_c_tst mpiexec -n 2 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_parpack_c)
add_executable(icb_parpack_cpp PARPACK/TESTS/MPI/icb_parpack_cpp.cpp)
target_include_directories(icb_parpack_cpp PUBLIC ${PROJECT_SOURCE_DIR}/ICB MPI::MPI_CXX) # Get parpack.hpp mpi.h
target_link_libraries(icb_parpack_cpp parpack arpack BLAS::BLAS LAPACK::LAPACK ${EXTRA_LDFLAGS} MPI::MPI_CXX)
target_link_libraries(icb_parpack_cpp parpack arpack ${LAPACK_BLAS_LIBS} ${EXTRA_LDFLAGS} MPI::MPI_CXX)
add_test(icb_parpack_cpp_tst mpiexec -n 2 ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_parpack_cpp)
endif()
endif()
@@ -786,7 +812,7 @@ endfunction(build_tests)
if(TESTS)
enable_testing()
set(CMAKE_CTEST_COMMAND ctest -V)
set(CMAKE_CTEST_COMMAND ctest -V)
build_tests()
endif()
@@ -798,7 +824,7 @@ endif()
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix \${prefix})
set(libdir ${CMAKE_INSTALL_FULL_LIBDIR})
set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
set(includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
set(PACKAGE_NAME ${PROJECT_NAME})
set(PACKAGE_VERSION ${arpack_ng_VERSION})
set(PACKAGE_URL "https://github.com/opencollab/arpack-ng/")
@@ -821,17 +847,15 @@ foreach(lib ${LAPACK_LIBRARIES} ${MPI_Fortran_LIBRARIES})
endforeach()
string(REPLACE ";" " " PARPACK_PC_LIBS_PRIVATE "${PARPACK_PC_LIBS_PRIVATE}")
configure_file(pkg-config/arpack.pc.in "${PROJECT_BINARY_DIR}/arpack${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY)
configure_file(pkg-config/parpack.pc.in "${PROJECT_BINARY_DIR}/parpack${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY)
configure_file(pkg-config/arpackSolver.pc.in "${PROJECT_BINARY_DIR}/arpackSolver${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY)
configure_file(SRC/arpack.pc.in "${PROJECT_BINARY_DIR}/SRC/arpack${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY)
configure_file(PARPACK/SRC/MPI/parpack.pc.in "${PROJECT_BINARY_DIR}/PARPACK/SRC/MPI/parpack${LIBSUFFIX}${ITF64SUFFIX}.pc" @ONLY)
install(TARGETS arpack
EXPORT arpackngTargets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES "${PROJECT_BINARY_DIR}/arpack${LIBSUFFIX}${ITF64SUFFIX}.pc"
install(FILES "${PROJECT_BINARY_DIR}/SRC/arpack${LIBSUFFIX}${ITF64SUFFIX}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
if (MPI)
@@ -840,7 +864,7 @@ if (MPI)
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
install(FILES "${PROJECT_BINARY_DIR}/parpack${LIBSUFFIX}${ITF64SUFFIX}.pc"
install(FILES "${PROJECT_BINARY_DIR}/PARPACK/SRC/MPI/parpack${LIBSUFFIX}${ITF64SUFFIX}.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif ()
@@ -851,9 +875,8 @@ if(ICB)
install(FILES ICB/parpack.h DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
install(FILES ICB/parpack.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
endif()
if (ICBEXMM)
if (EIGEN)
install(FILES EXAMPLES/MATRIX_MARKET/arpackSolver.hpp DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
install(FILES "${PROJECT_BINARY_DIR}/arpackSolver${LIBSUFFIX}${ITF64SUFFIX}.pc" DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
endif()
@@ -874,8 +897,10 @@ endif()
configure_file(arpackdef.h.in "${PROJECT_BINARY_DIR}/arpackdef.h" @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/arpackdef.h" DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
configure_file(arpackicb.h.in "${PROJECT_BINARY_DIR}/arpackicb.h" @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/arpackicb.h" DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
if(ICB)
configure_file(arpackicb.h.in "${PROJECT_BINARY_DIR}/arpackicb.h" @ONLY)
install(FILES "${PROJECT_BINARY_DIR}/arpackicb.h" DESTINATION ${ARPACK_INSTALL_INCLUDEDIR})
endif()
install(EXPORT arpackngTargets
DESTINATION "${ARPACK_INSTALL_CMAKEDIR}"
@@ -959,7 +984,7 @@ if (MPI)
endif()
libsummary("BLAS" "" "${BLAS_LIBRARIES}")
libsummary("LAPACK" "" "${LAPACK_LIBRARIES}")
if (ICBEXMM)
if (EIGEN)
libsummary("EIGEN3" "${EIGEN3_INCLUDE_DIR}" "")
endif()
if (PYTHON3)
+1
View File
@@ -206,6 +206,7 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = (4.0E+0, 0.0E+0) / h2
m(idiag,j) = (1.0E+0, 0.0E+0)
30 continue
c
c %-------------------------------------%
+1
View File
@@ -206,6 +206,7 @@ c
idiag = kl+ku+1
do 30 j = 1, n
a(idiag,j) = (4.0D+0, 0.0D+0) / h2
m(idiag,j) = (1.0D+0, 0.0D+0)
30 continue
c
c %-------------------------------------%
+5 -4
View File
@@ -4,13 +4,14 @@ AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)/ICB $(EIGEN3_CFLAGS)
EXTRA_DIST = README
check_PROGRAMS = arpackmm
dist_check_SCRIPTS = arpackmm.sh
dist_check_DATA = An.mtx As.mtx Az.mtx B.mtx Bz.mtx
TESTS = arpackmm.sh
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
if ICBEXMM
pkgincludedir = $(includedir)/arpack@ITF64SUFFIX@
if EIGEN
pkginclude_HEADERS = arpackSolver.hpp
endif
+2 -2
View File
@@ -34,6 +34,6 @@ To build this utility, you need:
- to have installed eigen3 (to deal with the RCI).
- to configure arpack-ng this way:
- autotools:
~arpack-ng> ./configure --enable-icb-exmm; make all check
~arpack-ng> ./configure --enable-eigen; make all check
- cmake:
~arpack-ng/build> cmake -D ICBEXMM=ON ..; make all test
~arpack-ng/build> cmake -D EIGEN=ON ..; make all test
+119 -55
View File
@@ -12,6 +12,9 @@
#include <cassert>
#include <vector>
#include <type_traits> // is_same.
#include <cmath> // abs
#include <complex>
#include <limits> // epsilon
#include <Eigen/Sparse>
#include <Eigen/IterativeLinearSolvers>
@@ -173,6 +176,7 @@ class arpackSolver {
int createMatrix(string const & fileName, Eigen::SparseMatrix<RC> & M) {
// Read matrix from file.
if (fileName.empty()) { cerr << "Error: matrix file missing" << endl; return 1; }
a_uint n = 0, m = 0;
vector<a_uint> i, j;
vector<RC> Mij;
@@ -229,6 +233,7 @@ class arpackSolver {
int solve(EM & A, EM const * B = nullptr) {
stdPb = !B ? true : false;
if (nbCV > A.cols()) nbCV = A.cols(); // Cut-off arpack workspace dim.
dumpParameters();
if (verbose == 3) {
@@ -244,14 +249,15 @@ class arpackSolver {
// If needed, transform the initial problem into a new one that arpack can handle.
auto eps = numeric_limits<double>::epsilon();
auto eps = numeric_limits<FD>::epsilon();
bool shiftReal = (fabs(sigmaReal) > eps) ? true : false;
bool shiftImag = (fabs(sigmaImag) > eps) ? true : false;
bool backTransform = false;
mode = 0;
if (stdPb) {
mode = 1;
if (shiftReal && !shiftImag) {
// CAUTION: back transform must be done only if mode = 1.
if (shiftReal || shiftImag) {
EM I(A.rows(), A.cols());
I.setIdentity();
RC sigma; makeSigma(sigma);
@@ -260,6 +266,7 @@ class arpackSolver {
}
}
else {
// CAUTION: back transform must NOT be done if mode > 1.
mode = 2;
if (shiftReal || shiftImag) mode = 3;
}
@@ -290,10 +297,7 @@ class arpackSolver {
return 0;
};
int checkEigVec(EM const & A, EM const * B = nullptr, double const * diffTol = nullptr) {
stdPb = !B ? true : false;
double dTol = !diffTol ? sqrt(tol) : *diffTol;
int checkEigVec(EM const & A, EM const * B = nullptr, double const maxResNorm = 1.e-3) const {
// Check eigen vectors.
string rs = schur ? "Schur" : "Ritz";
@@ -315,26 +319,18 @@ class arpackSolver {
}
}
EigVecZ left = A.template cast<complex<double>>() * V;
EigVecZ right = stdPb ? V : B->template cast<complex<double>>() * V;
right *= lambda;
EigVecZ diff = left - right;
if (diff.norm() > dTol) {
cerr << endl << "Error: bad vector " << setw(3) << i << " (norm " << V.norm() << "):" << endl;
cerr << endl << V << endl;
cerr << endl << "Error: left side (A*V - norm " << left.norm() << "):" << endl;
cerr << endl << left << endl;
cerr << endl << "Error: right side (lambda*" << (stdPb ? "" : "B*") << "V - norm " << right.norm() << "):" << endl;
cerr << endl << right << endl;
cerr << endl << "Error: diff (norm " << diff.norm() << ", tol " << dTol << "):" << endl;
cerr << endl << diff << endl;
double resNorm = computeResidualNorm(i, A, B);
if (resNorm > maxResNorm) {
cout << endl << "arpackSolver:" << endl;
cout << endl << rs << " value/vector " << setw(3) << i << ": check KO";
cout << ", residual (norm " << resNorm << ", maxResNorm " << maxResNorm << ")" << endl;
return 1;
}
else {
if (verbose >= 1) {
cout << endl << "arpackSolver:" << endl;
cout << endl << rs << " value/vector " << setw(3) << i << ": check OK";
cout << ", diff (norm " << diff.norm() << ", tol " << dTol << ")" << endl;
cout << ", residual (norm " << resNorm << ", maxResNorm " << maxResNorm << ")" << endl;
}
}
}
@@ -342,17 +338,33 @@ class arpackSolver {
return 0;
};
double computeResidualNorm(size_t const & idx, EM const & A, EM const * B = nullptr) const {
// Check eigen value index.
if (idx >= val.size()) return -1.; // Error.
if (idx >= vec.size()) return -1.; // Error.
// Compute residual norm.
EigVecZ V = vec[idx];
complex<double> lambda = val[idx];
EigVecZ left = A.template cast<complex<double>>() * V;
EigVecZ right = stdPb ? V : B->template cast<complex<double>>() * V;
right *= lambda;
EigVecZ residual = left - right;
return residual.norm();
};
// Private methods.
private:
void makeZero( float & zero) {zero = 0.f;};
void makeConstant( float & cst, float const & val) {cst = val;};
void makeZero( double & zero) {zero = 0.;};
void makeConstant( double & cst, double const & val) {cst = val;};
void makeZero(complex< float> & zero) {zero = complex<double>(0.f, 0.f);};
void makeConstant(complex< float> & cst, float const & val) {cst = complex<float>(val, val);};
void makeZero(complex<double> & zero) {zero = complex<double>(0., 0.);};
void makeConstant(complex<double> & cst, double const & val) {cst = complex<double>(val, val);};
int readMatrixMarket(string const & fileName,
a_uint & n, a_uint & m, vector<a_uint> & i, vector<a_uint> & j, vector<RC> & Mij) {
@@ -368,7 +380,7 @@ class arpackSolver {
string inpLine; getline(inp, inpLine); l++;
while (isspace(*inpLine.begin())) inpLine.erase(inpLine.begin()); // Suppress leading white spaces.
if (inpLine.length() == 0) continue; // Empty line.
if (inpLine[0] == '%') continue; // Comments skipped, begin reading.
if (inpLine[0] == '%' || inpLine[0] == '#') continue; // Comments skipped, begin reading.
// Read matrix market file.
@@ -378,7 +390,13 @@ class arpackSolver {
if (!inpSS) {cerr << "Error: bad header (n, m)" << endl; return 1;}
if (nnz == 0) {
inpSS >> nnz;
if (inpSS) { // OK, (optional) nnz has been provided.
if (inpSS && nnz > 0) { // OK, (optional) nnz has been provided.
i.reserve(nnz);
j.reserve(nnz);
Mij.reserve(nnz);
}
else {
nnz = n*m;
i.reserve(nnz);
j.reserve(nnz);
Mij.reserve(nnz);
@@ -387,7 +405,7 @@ class arpackSolver {
}
else { // Body.
a_uint k = 0, l = 0;
RC zero; makeZero(zero);
RC zero; makeConstant(zero, 0.);
RC Mkl = zero;
inpSS >> k >> l >> Mkl;
if (!inpSS) {cerr << "Error: bad line (" << fileName << ", line " << l << ")" << endl; return 1;}
@@ -400,10 +418,20 @@ class arpackSolver {
// Handle 1-based -> 0-based.
nnz = i.size(); // In case nnz was not provided.
if (*max_element(begin(i), end(i)) == n || *max_element(begin(j), end(j)) == m) {
for (size_t k = 0; k < nnz; k++) i[k] -= 1;
for (size_t k = 0; k < nnz; k++) j[k] -= 1;
if (!i.empty() && !j.empty()) {
if (*max_element(begin(i), end(i)) == n && *max_element(begin(j), end(j)) == m) {
for (size_t k = 0; k < i.size(); k++) { if (i[k] > 0) i[k] -= 1; }
for (size_t k = 0; k < j.size(); k++) { if (j[k] > 0) j[k] -= 1; }
}
}
// Checking indices.
for (size_t k = 0; k < i.size(); k++) {
if (i[k] >= n) {cerr << "Error: bad index (" << fileName << ", i " << i[k] << ")" << endl; return 1;};
}
for (size_t k = 0; k < j.size(); k++) {
if (j[k] >= m) {cerr << "Error: bad index (" << fileName << ", j " << j[k] << ")" << endl; return 1;};
}
return 0;
@@ -654,26 +682,48 @@ class arpackSolver {
return rc;
};
void restartSolve(string const & fileName,
a_int const & nbDim, RC * rv, bool readNbCV) {
if (restartFromFile) {
ifstream ifs(fileName.c_str());
if (ifs.is_open()) {
a_int nbCV = 1;
if (readNbCV) {
ifs >> nbCV;
if (nbCV < nbDim) nbCV = nbDim; // Cut-off in case previous run used different nbDim.
template <typename T>
int saveSolve(string const & fileName,
a_int const & nbDim, T * rv) {
ofstream ofs(fileName.c_str(), ofstream::trunc);
if (ofs.is_open()) {
ofs << nbDim << endl;
for (a_int n = 0; rv && n < nbDim; n++) ofs << rv[n] << endl;
ofs.close(); // Make sure the file is written.
}
return 0;
};
template <typename T>
int restartSolve(string const & fileName,
a_int const & nbDim, T * rv,
bool allowZero = true) {
ifstream ifs(fileName.c_str());
if (ifs.is_open()) {
a_int nDim = 0;
ifs >> nDim;
if (nDim != nbDim) {cerr << "Error: bad dim - restart KO" << endl; return 1;}
for (a_int n = 0; rv && n < nbDim; n++) {
RC val; makeConstant(val, 0.);
ifs >> val;
if (abs(val) < 1.e-6 && !allowZero) {
// Do NOT let residual be zero: this stops arpack to iterate (info = -9).
auto eps = numeric_limits<FD>::epsilon();
RC epsilon; makeConstant(epsilon, eps);
val = epsilon;
}
for (a_int n = 0; rv && n < nbDim*nbCV; n++) ifs >> rv[n];
if (verbose >= 1) {
cout << endl << "arpackSolver:" << endl;
cout << endl << fileName << ": restart OK" << endl;
if (verbose >= 2) {
for (a_int n = 0; rv && n < nbDim; n++) cout << rv[n] << endl;
}
rv[n] = val;
}
if (verbose >= 1) {
cout << endl << "arpackSolver:" << endl;
cout << endl << fileName << ": restart OK" << endl;
if (verbose >= 2) {
for (a_int n = 0; rv && n < nbDim; n++) cout << rv[n] << endl;
}
}
}
return 0;
};
int initPointerSize(a_int & iparamSz, a_int & ipntrSz, string const & aeupd) {
@@ -706,18 +756,20 @@ class arpackSolver {
char const * gMat = "G";
char const * bMat = (mode == 1) ? iMat : gMat;
a_int nbDim = A.rows();
RC zero; makeZero(zero);
auto eps = numeric_limits<FD>::epsilon();
RC epsilon; makeConstant(epsilon, eps);
if (!resid) {
resid = new RC[nbDim];
for (a_int n = 0; n < nbDim; n++) resid[n] = zero; // Avoid "bad" starting vector.
// Do NOT let residual be zero: this stops arpack to iterate (info = -9).
for (a_int n = 0; n < nbDim; n++) resid[n] = epsilon;
};
restartSolve("arpackSolver.resid.out", nbDim, resid, false);
a_int ldv = nbDim;
RC cst; makeConstant(cst, 10.);
RC v0 = cst * epsilon; // Start with something close to zero but *not* exactly zero.
if (!v) {
v = new RC[ldv*nbCV];
for (a_int n = 0; n < ldv*nbCV; n++) v[n] = zero; // Avoid "bad" starting vector.
for (a_int n = 0; n < ldv*nbCV; n++) v[n] = v0;
};
restartSolve("arpackSolver.v.out", ldv, v, true);
a_int iparamSz = 0, ipntrSz = 0;
int rc = initPointerSize(iparamSz, ipntrSz, "aupd");
if (rc != 0) {cerr << "Error: bad iparam/ipntr initialization for aupd" << endl; return rc;}
@@ -727,12 +779,22 @@ class arpackSolver {
iparamAupd[3] = 1; // Block size.
iparamAupd[4] = 0; // Number of ev found by arpack.
iparamAupd[6] = mode;
RC zero; makeConstant(zero, 0.);
vector<a_int> ipntrAupd(ipntrSz, 0);
RC * workd = new RC[3*nbDim]; for (a_int n = 0; n < 3*nbDim; n++) workd[n] = zero; // Avoid "bad" X/Y vector.
a_int lworkl = symPb ? nbCV*nbCV + 8*nbCV : 3*nbCV*nbCV + 6*nbCV;
RC * workl = new RC[lworkl];
a_int info = 0; // Use random initial residual vector.
if (restartFromFile) info = 1;
// Handling restart.
if (restartFromFile) {
info = 1; // Restart.
rc = restartSolve("arpackSolver.resid.out", nbDim, resid, false);
if (rc != 0) {cerr << "Error: bad restart (resid)" << endl; return rc;}
rc = restartSolve("arpackSolver.v.out", ldv*nbCV, v);
if (rc != 0) {cerr << "Error: bad restart (v)" << endl; return rc;}
}
// Initialize solver.
@@ -826,9 +888,11 @@ class arpackSolver {
rc = eupd(rvec, howmny, select, z, ldz, bMat, nbDim, which, resid, v, ldv, iparamEupd.data(), ipntrEupd.data(), workd, workl, lworkl, rwork, info);
if (rc != 0) {cerr << "Error: bad arpack eupd" << endl; return rc;}
// Save solve (dump results to file) to allow later restart.
if (dumpToFile) {
ofstream rfs("arpackSolver.resid.out"); for (a_int n = 0; n < nbDim; n++) rfs << resid[n] << endl;
ofstream vfs("arpackSolver.v.out"); vfs << nbCV << endl; for (a_int n = 0; n < ldv*nbCV; n++) vfs << v[n] << endl;
saveSolve("arpackSolver.resid.out", nbDim, resid);
saveSolve("arpackSolver.v.out", ldv*nbCV, v);
}
// Clean.
+173 -99
View File
@@ -1,4 +1,9 @@
#include <iostream>
#include <exception>
#include <sstream>
#include <chrono>
#include <vector>
#include <tuple>
#include "arpackSolver.hpp"
#include "debug_c.hpp"
@@ -9,8 +14,8 @@ using namespace std;
class options {
public:
options() {
fileA = "A.mtx";
fileB = "N.A."; // Not available.
fileA = "";
fileB = "";
dense = false;
denseRR = true;
nbEV = 1;
@@ -28,6 +33,7 @@ class options {
invert =
false; // Eigen value invertion: look for 1./lambda instead of lambda.
tol = 1.e-06;
maxResNorm = 1.e-3;
maxIt = 100;
schur = false; // Compute Ritz vectors.
slv = "BiCG";
@@ -44,27 +50,39 @@ class options {
};
int readCmdLine(int argc, char** argv) {
// Convert command line to stream.
stringstream ssIP; // Independent parameters.
for (int a = 1; argv && a < argc; a++) {
ssIP << argv[a] << " ";
}
// Check for command line independent parameters.
for (int a = 1; argv && a < argc; a++) {
string clo = argv[a]; // Command line option.
if (clo == "--help") return usage(0);
string clo; // Command line option.
while (ssIP >> clo) {
if (clo == "--help" || clo == "-h") return usage();
if (clo.find("--") == std::string::npos) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
if (clo == "--A") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
fileA = argv[a];
fileA = clo;
}
if (clo == "--dense") {
dense = true;
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
string rr(argv[a]);
string rr = clo;
if (rr != "true" && rr != "false") {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
@@ -72,12 +90,12 @@ class options {
denseRR = (rr == "true") ? true : false;
}
if (clo == "--nbEV") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream nEV(argv[a]);
stringstream nEV(clo);
nEV >> nbEV;
if (!nEV) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
@@ -85,10 +103,6 @@ class options {
}
nbCV = 2 * nbEV + 1;
}
if (clo == "--genPb") {
stdPb = false;
fileB = "B.mtx";
}
if (clo == "--nonSymPb") symPb = false;
if (clo == "--cpxPb") {
symPb = false;
@@ -96,15 +110,15 @@ class options {
}
if (clo == "--simplePrec") simplePrec = true;
if (clo == "--mag") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
mag = argv[a]; // small mag (likely poor perf) <=> large mag + invert
mag = clo; // small mag (likely poor perf) <=> large mag + invert
// (likely good perf).
bool ok = (mag == "LM" || mag == "SM" || mag == "LR" || mag == "SR" ||
mag == "LI" || mag == "SI")
mag == "LA" || mag == "SA" || mag == "LI" || mag == "SI")
? true
: false;
if (!ok) {
@@ -114,12 +128,12 @@ class options {
}
if (clo == "--shiftReal") {
shiftReal = true;
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream s(argv[a]);
stringstream s(clo);
s >> sigmaReal;
if (!s) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
@@ -128,12 +142,12 @@ class options {
}
if (clo == "--shiftImag") {
shiftImag = true;
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream s(argv[a]);
stringstream s(clo);
s >> sigmaImag;
if (!s) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
@@ -142,47 +156,62 @@ class options {
}
if (clo == "--invert") invert = true;
if (clo == "--tol") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream t(argv[a]);
stringstream t(clo);
t >> tol;
if (!t) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--maxIt") {
a++;
if (a >= argc) {
if (clo == "--maxResNorm") {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream mi(argv[a]);
stringstream mrn(clo);
mrn >> maxResNorm;
if (!mrn) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--maxIt") {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream mi(clo);
mi >> maxIt;
if (!mi) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
return usage();
}
}
if (clo == "--schur") {
schur = true;
}
if (clo == "--slv") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
slv = argv[a];
slv = clo;
}
if (clo == "--slvItrTol") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream t(argv[a]);
double tol = 0.;
stringstream t(clo);
t >> slvItrTol;
if (!t) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
@@ -190,12 +219,12 @@ class options {
}
}
if (clo == "--slvItrMaxIt") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream mi(argv[a]);
stringstream mi(clo);
int maxIt = 0;
mi >> slvItrMaxIt;
if (!mi) {
@@ -204,12 +233,12 @@ class options {
}
}
if (clo == "--slvItrPC") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream pc(argv[a]);
stringstream pc(clo);
pc >> slvItrPC;
if (!pc) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
@@ -217,12 +246,12 @@ class options {
}
}
if (clo == "--slvDrtPivot") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream pv(argv[a]);
stringstream pv(clo);
pv >> slvDrtPivot;
if (!pv) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
@@ -230,12 +259,12 @@ class options {
}
}
if (clo == "--slvDrtOffset") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream of(argv[a]);
stringstream of(clo);
of >> slvDrtOffset;
if (!of) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
@@ -243,12 +272,12 @@ class options {
}
}
if (clo == "--slvDrtScale") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream sc(argv[a]);
stringstream sc(clo);
sc >> slvDrtScale;
if (!sc) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
@@ -257,12 +286,12 @@ class options {
}
if (clo == "--noCheck") check = false;
if (clo == "--verbose") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream vb(argv[a]);
stringstream vb(clo);
vb >> verbose;
if (!vb) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
@@ -270,12 +299,12 @@ class options {
}
}
if (clo == "--debug") {
a++;
if (a >= argc) {
ssIP >> clo;
if (!ssIP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream dbg(argv[a]);
stringstream dbg(clo);
dbg >> debug;
if (!dbg) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
@@ -287,19 +316,29 @@ class options {
debug, debug, debug, debug, debug);
}
if (clo == "--restart") restart = true;
// Skip dependent parameters.
if (clo == "--nbCV") { ssIP >> clo; continue; }
if (clo == "--B") { ssIP >> clo; continue; }
}
// Convert command line to stream.
stringstream ssDP; // Dependent parameters.
for (int a = 1; argv && a < argc; a++) {
ssDP << argv[a] << " ";
}
// Check for command line dependent parameters.
for (int a = 1; argv && a < argc; a++) {
string clo = argv[a]; // Command line option.
while (ssDP >> clo) {
if (clo == "--nbCV") {
a++;
if (a >= argc) {
ssDP >> clo;
if (!ssDP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
stringstream nCV(argv[a]);
stringstream nCV(clo);
nCV >> nbCV;
if (!nCV) {
cerr << "Error: bad " << clo << " - bad argument" << endl;
@@ -307,26 +346,20 @@ class options {
}
}
if (clo == "--B") {
a++;
if (a >= argc) {
ssDP >> clo;
if (!ssDP) {
cerr << "Error: bad " << clo << " - need argument" << endl;
return usage();
}
fileB = argv[a];
fileB = clo;
stdPb = false; // Generalized problem.
}
}
// Sanity checks.
if (!stdPb && fileB.empty()) {
cerr << "Error: generalized problem without B matrix" << endl;
return usage();
}
return 0;
};
int usage(int rc = 1) {
int usage() {
cout << "Usage: running arpack with matrix market files to check for eigen "
"values/vectors."
<< endl;
@@ -371,8 +404,6 @@ class options {
cout << " default: 1" << endl;
cout << " --nbCV: number of columns of the matrix V." << endl;
cout << " default: 2*nbEV+1" << endl;
cout << " --genPb: generalized problem." << endl;
cout << " default: standard problem" << endl;
cout << " --nonSymPb: non symmetric problem (<=> use dn[ae]upd)."
<< endl;
cout << " default: symmetric problem (<=> use ds[ae]upd)"
@@ -388,7 +419,7 @@ class options {
"[dz]*upd)"
<< endl;
cout << " --mag M: set magnitude of eigen values to look for "
"(LM, SM, LR, SR, LI, SI)."
"(LM, SM, LR, SR, LA, SA, LI, SI)."
<< endl;
cout << " default: large magnitude (LM)" << endl;
cout << " --shiftReal S: real shift where sigma = S (look for lambda+S "
@@ -405,6 +436,8 @@ class options {
cout << " default: no invert" << endl;
cout << " --tol T: tolerance T." << endl;
cout << " default: 1.e-06" << endl;
cout << " --maxResNorm R: maximum residual norm R." << endl;
cout << " default: 1.e-3" << endl;
cout << " --maxIt M: maximum iterations M." << endl;
cout << " default: 100" << endl;
cout << " --schur: compute Schur vectors." << endl;
@@ -497,8 +530,7 @@ class options {
"computed during a previous run."
<< endl;
cout << " default: false" << endl;
if (rc == 0) exit(0);
return rc;
return 1;
};
friend ostream& operator<<(ostream& ostr, options const& opt);
@@ -519,6 +551,7 @@ class options {
// lambda+sigma instead of lambda.
bool invert; // Eigen value invertion: look for 1./lambda instead of lambda.
double tol;
double maxResNorm;
int maxIt;
bool schur;
string slv;
@@ -535,7 +568,8 @@ class options {
};
ostream& operator<<(ostream& ostr, options const& opt) {
ostr << "OPT: A " << opt.fileA << ", B " << opt.fileB;
ostr << "OPT: A " << opt.fileA;
if (!opt.fileB.empty()) ostr << ", B " << opt.fileB;
if (opt.dense && opt.denseRR)
ostr << ", dense yes (RR true)";
else if (opt.dense && !opt.denseRR)
@@ -553,14 +587,25 @@ ostream& operator<<(ostream& ostr, options const& opt) {
ostr << ", shiftImag " << (opt.shiftImag ? "yes" : "no") << ", sigmaImag "
<< opt.sigmaImag;
ostr << ", invert " << (opt.invert ? "yes" : "no") << ", tol " << opt.tol
<< ", maxIt " << opt.maxIt;
<< ", maxResNorm " << opt.maxResNorm << ", maxIt " << opt.maxIt;
ostr << ", " << (opt.schur ? "Schur" : "Ritz") << " vectors" << endl;
ostr << "OPT: slv " << opt.slv << ", slvItrPC " << opt.slvItrPC
<< ", slvItrTol " << opt.slvItrTol;
ostr << ", slvItrMaxIt " << opt.slvItrMaxIt << ", slvDrtPivot "
<< opt.slvDrtPivot;
ostr << ", slvDrtOffset " << opt.slvDrtOffset << ", slvDrtScale "
<< opt.slvDrtScale << endl;
ostr << "OPT: slv " << opt.slv;
bool itrSlv = true; // Use iterative solvers.
if (opt.slv.find("LU") != string::npos ||
opt.slv.find("QR") != string::npos ||
opt.slv.find("LLT") != string::npos ||
opt.slv.find("LDLT") != string::npos)
itrSlv = false;
if (itrSlv) {
ostr << ", slvItrPC " << opt.slvItrPC;
ostr << ", slvItrTol " << opt.slvItrTol;
ostr << ", slvItrMaxIt " << opt.slvItrMaxIt;
} else {
ostr << ", slvDrtPivot " << opt.slvDrtPivot;
ostr << ", slvDrtOffset " << opt.slvDrtOffset;
ostr << ", slvDrtScale " << opt.slvDrtScale;
}
ostr << endl;
ostr << "OPT: check " << (opt.check ? "yes" : "no") << ", verbose "
<< opt.verbose << ", debug " << opt.debug;
ostr << ", restart " << (opt.restart ? "yes" : "no") << endl;
@@ -582,6 +627,7 @@ class output {
int nbIt; // Arpack number of iterations.
double imsTime; // Init mode solver time.
double rciTime; // Reverse communication interface time.
vector<tuple<double, double>> res; // Results: eigen values and associated residual.
};
template <typename RC, typename FD, typename EM, typename SLV>
@@ -622,8 +668,6 @@ int itrSolve(options& opt, output& out, double const& slvItrILUDropTol,
cout << endl;
cout << "INP: create A " << readATime << " s" << endl;
if (opt.nbCV > A.cols()) opt.nbCV = A.cols(); /* Cut-off */
EM B;
if (!opt.stdPb) {
start = chrono::high_resolution_clock::now();
@@ -657,7 +701,7 @@ int itrSolve(options& opt, output& out, double const& slvItrILUDropTol,
return rc;
}
if (opt.check) {
rc = as.checkEigVec(A, opt.stdPb ? nullptr : &B);
rc = as.checkEigVec(A, opt.stdPb ? nullptr : &B, opt.maxResNorm);
if (rc != 0) {
cerr << "Error: check KO" << endl;
return rc;
@@ -671,6 +715,11 @@ int itrSolve(options& opt, output& out, double const& slvItrILUDropTol,
out.nbIt = as.nbIt;
out.imsTime = as.imsTime;
out.rciTime = as.rciTime;
for (auto idx = 0; idx < as.val.size(); idx++) {
double val = norm(as.val[idx]);
double res = as.computeResidualNorm(idx, A, opt.stdPb ? nullptr : &B);
out.res.push_back(tuple<double, double>{val, res});
}
return 0;
}
@@ -711,8 +760,6 @@ int drtSolve(options& opt, output& out) {
cout << endl;
cout << "INP: create A " << readATime << " s" << endl;
if (opt.nbCV > A.cols()) opt.nbCV = A.cols(); /* Cut-off */
EM B;
if (!opt.stdPb) {
start = chrono::high_resolution_clock::now();
@@ -746,7 +793,7 @@ int drtSolve(options& opt, output& out) {
return rc;
}
if (opt.check) {
rc = as.checkEigVec(A, opt.stdPb ? nullptr : &B);
rc = as.checkEigVec(A, opt.stdPb ? nullptr : &B, opt.maxResNorm);
if (rc != 0) {
cerr << "Error: check KO" << endl;
return rc;
@@ -760,6 +807,11 @@ int drtSolve(options& opt, output& out) {
out.nbIt = as.nbIt;
out.imsTime = as.imsTime;
out.rciTime = as.rciTime;
for (auto idx = 0; idx < as.val.size(); idx++) {
double val = norm(as.val[idx]);
double res = as.computeResidualNorm(idx, A, opt.stdPb ? nullptr : &B);
out.res.push_back(tuple<double, double>{val, res});
}
return 0;
}
@@ -822,7 +874,7 @@ int itrSolve(options& opt, output& out) {
return rc;
}
int main(int argc, char** argv) {
int run(int argc, char** argv) {
// Check for options.
options opt;
@@ -851,6 +903,7 @@ int main(int argc, char** argv) {
if (opt.dense) {
if (itrSlv) {
cerr << "Error: dense matrices does not support iterative solvers"
<< ", specify --slv XX with XX being a direct solver"
<< endl;
return 1;
}
@@ -972,9 +1025,30 @@ int main(int argc, char** argv) {
cout << "STAT: total number of restart steps "
<< nrstrt << endl;
// Output eigen values and residuals.
cout << endl;
for (auto idx = 0; idx < out.res.size(); idx++) {
tuple<double, double> res = out.res[idx];
cout << "RES: eigen value " << idx << ": norm " << get<0>(res);
cout << " (residual norm " << get<1>(res) << ")";
cout << endl;
}
return 0;
}
int main(int argc, char** argv) {
int rc = 1;
try {
rc = run(argc, argv);
}
catch (exception& e) {
cout << "Error - exception:" << e.what() << endl;
}
return rc;
}
// Local Variables:
// mode: c++
// c-file-style:"stroustrup"
+71 -67
View File
@@ -1,90 +1,94 @@
#!/bin/bash -eu
export CMD="./arpackmm --help" # For coverage
echo "$CMD"
eval "$CMD &> arpackmm.run.log"
echo ""
echo "========================================================================================"
echo ""
trap 'catch' ERR
catch() {
grep OPT arpackmm.run.log
grep Error arpackmm.run.log
exit 1
}
for eigPb in "--A As.mtx" "--nonSymPb --A An.mtx" "--nonSymPb --cpxPb --A Az.mtx --B Bz.mtx"
# 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
for genPb in "" "--genPb"
# 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
for smallMag in "" "--mag SM --noCheck" # SM is known to be difficult to converge.
# 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 shiftOpt=""
if [[ "$eigPb" == *nonSymPb* ]]; then
if [[ "$genPb" == *genPb* ]]; then
continue # Skip to ensure stable test: tricky to convergence.
else
export shiftOpt="--shiftReal 100.0 --shiftImag 100.0"
fi
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
if [[ "$genPb" == *genPb* ]]; then
continue # Skip to ensure stable test: tricky to convergence.
else
export shiftOpt="--shiftReal 100.0"
fi
export shiftZV="--shiftReal 1.0"
fi
for shiftRI in "" "$shiftOpt"
# 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
for tol in "" "--tol 1.e-5"
# 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 slv in "--slv BiCG --slvItrTol 1.e-06 --slvItrMaxIt 150" "--slv CG --slvItrTol 1.e-06 --slvItrMaxIt 150" \
"--slv BiCG --slvItrPC ILU" "--slv CG --slvItrPC ILU#1.e-06#2" \
"--slv LU" "--slv QR --slvDrtPivot 1.e-06" \
"--slv LLT" "--slv LLT --slvDrtOffset 0." \
"--slv LDLT" "--slv LDLT --slvDrtScale 1."
for rs in "" "--schur"
do
for rs in "" "--schur"
for dsPrec in "" "--simplePrec"
do
for dsPrec in "" "--simplePrec"
for dsMat in "" "--dense true"
do
for dsMat in "" "--dense false" "--dense true"
do
export extraGenPb=""
if [[ "$genPb" == *genPb* ]]; then
export extraGenPb="$shiftOpt" # Force shift if genPb.
fi
# Skip not supported cases.
if [[ "$dsMat" == *dense* ]]; then
if [[ "$slv" == *CG* ]]; then
if [[ "$eigPb" == *nonSymPb* ]]; then
continue # Skip CG that could fail (CG is meant to deal with sym matrices).
fi
continue # Iterative solvers are not allowed when using dense matrices.
fi
fi
if [[ "$slv" == *LLT* ]] || [[ "$slv" == *LDLT* ]]; then
if [[ "$eigPb" == *nonSymPb* ]] || [[ "$genPb" == *genPb* ]]; then
continue # Skip LLT/LDLT that could fail (LLT/LDLT are meant to deal with SPD matrices).
fi
fi
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 "----------------------------------------------------------------------------------------"
if [[ "$dsMat" == *dense* ]]; then
if [[ "$slv" == *CG* ]]; then
continue # Iterative solvers are not allowed when using dense matrices.
fi
fi
# 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: use --nbCV 6 and --maxIt 200 to ease convergence, and, --verbose 3 for debug.
export CMD="./arpackmm $eigPb $genPb $smallMag $shiftRI $invert $tol $slv $rs $dsPrec $dsMat $extraGenPb --nbCV 6 --maxIt 200 --verbose 3 --debug 3"
echo "$CMD"
eval "$CMD &> arpackmm.run.log"
echo ""
echo "========================================================================================"
echo ""
# Run arpackmm: re-run with restart.
export CMD="$CMD --restart"
echo "$CMD"
eval "$CMD &> arpackmm.run.log"
echo ""
echo "========================================================================================"
echo ""
done
# 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
@@ -95,4 +99,4 @@ do
done
done
echo "OK"
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"
+1 -1
View File
@@ -1,5 +1,5 @@
SUBDIRS = BAND COMPLEX NONSYM SIMPLE SVD SYM
if ICBEXMM
if EIGEN
SUBDIRS += MATRIX_MARKET
endif
+9 -6
View File
@@ -29,8 +29,9 @@ void exportArpackSparseItr(bp::scope& pySlv, std::string const& dtype) {
.def("checkEigVec",
&pyarpackSparseItrSolver<RC, FD, EM, SLV>::checkEigVec,
(bp::arg("A"), bp::arg("B") = bp::tuple(),
bp::arg("diffTol") = 1.e-3),
"check eigen vectors accuracy where A and B must be sparse and "
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)
@@ -69,8 +70,9 @@ void exportArpackSparseDrt(bp::scope& pySlv, std::string const& dtype) {
.def("checkEigVec",
&pyarpackSparseDrtSolver<RC, FD, EM, SLV>::checkEigVec,
(bp::arg("A"), bp::arg("B") = bp::tuple(),
bp::arg("diffTol") = 1.e-3),
"check eigen vectors accuracy where A and B must be sparse and "
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)
@@ -103,8 +105,9 @@ void exportArpackDenseDrt(bp::scope& pySlv, std::string const& dtype) {
.def("checkEigVec",
&pyarpackDenseDrtSolver<RC, FD, EM, SLV>::checkEigVec,
(bp::arg("A"), bp::arg("B") = bp::tuple(),
bp::arg("diffTol") = 1.e-3),
"check eigen vectors accuracy where A and B must be dense and "
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)
+18 -23
View File
@@ -6,24 +6,22 @@ from pyarpack import denseLDLT as pyarpackSlv
# Build laplacian.
n = 4
Aij = np.array([], dtype='complex128')
Aij = np.array([], dtype='float64')
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.
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.complex128(complex( 0., 0.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
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.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
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
@@ -32,7 +30,7 @@ arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvOffset = 0.
arpackSlv.slvScale = 1.
arpackSlv.symPb = False
arpackSlv.symPb = True
# Solve eigen problem.
@@ -60,22 +58,19 @@ print("\n#######################################################################
# Build laplacian.
n = 8
Aij = np.array([], dtype='complex64')
Bij = np.array([], dtype='complex64')
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.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.
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.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.
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):
@@ -85,7 +80,7 @@ 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 = 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
@@ -95,7 +90,7 @@ arpackSlv.maxIt = 200
arpackSlv.slvOffset = 0.
arpackSlv.slvScale = 1.
arpackSlv.sigmaReal = 1
arpackSlv.symPb = False
arpackSlv.symPb = True
# Solve eigen problem.
+23 -16
View File
@@ -6,22 +6,24 @@ from pyarpack import denseLUPP as pyarpackSlv
# Build laplacian.
n = 4
Aij = np.array([], dtype='float64')
Aij = np.array([], dtype='complex128')
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.
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.float64( 0.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
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.double() # Caution: double <=> np.array(..., dtype='float64')
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
@@ -29,6 +31,7 @@ arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.symPb = False
# Solve eigen problem.
@@ -56,19 +59,22 @@ print("\n#######################################################################
# Build laplacian.
n = 8
Aij = np.array([], dtype='float32')
Bij = np.array([], dtype='float32')
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.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.
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.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.
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):
@@ -78,7 +84,7 @@ 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 = 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
@@ -87,6 +93,7 @@ arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.sigmaReal = 1
arpackSlv.symPb = False
# Solve eigen problem.
+4 -4
View File
@@ -44,7 +44,7 @@ class pyarpackSparseDrtSolver: public arpackDrtSolver<RC, FD, EM, SLV> {
return arpackDrtSolver<RC, FD, EM, SLV>::solve(M, (stdPb ? NULL : &N));
};
int checkEigVec(bp::tuple const & A, bp::tuple const B = bp::tuple(), double const diffTol = 1.e-3) {
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");
@@ -55,7 +55,7 @@ class pyarpackSparseDrtSolver: public arpackDrtSolver<RC, FD, EM, SLV> {
rc = pyarpackServices<RC, EM>::buildSparseMatrice(B, N, debug, "B");
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
}
return arpackDrtSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), &diffTol);
return arpackDrtSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), maxResNorm);
};
// Public members.
@@ -101,7 +101,7 @@ class pyarpackDenseDrtSolver: public arpackDrtSolver<RC, FD, EM, SLV> {
return arpackDrtSolver<RC, FD, EM, SLV>::solve(M, (stdPb ? NULL : &N));
};
int checkEigVec(bp::tuple const & A, bp::tuple const B = bp::tuple(), double const diffTol = 1.e-3) {
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");
@@ -112,7 +112,7 @@ class pyarpackDenseDrtSolver: public arpackDrtSolver<RC, FD, EM, SLV> {
rc = pyarpackServices<RC, EM>::buildDenseMatrice(B, N, debug, "B");
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
}
return arpackDrtSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), &diffTol);
return arpackDrtSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), maxResNorm);
};
// Public members.
+2 -2
View File
@@ -43,7 +43,7 @@ class pyarpackSparseItrSolver: public arpackItrSolver<RC, FD, EM, SLV> {
return arpackItrSolver<RC, FD, EM, SLV>::solve(M, (stdPb ? NULL : &N));
};
int checkEigVec(bp::tuple const & A, bp::tuple const B = bp::tuple(), double const diffTol = 1.e-3) {
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");
@@ -54,7 +54,7 @@ class pyarpackSparseItrSolver: public arpackItrSolver<RC, FD, EM, SLV> {
rc = pyarpackServices<RC, EM>::buildSparseMatrice(B, N, debug, "B");
if (rc != 0) {pyarpackThrowError("build matrice from B KO"); return rc;}
}
return arpackItrSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), &diffTol);
return arpackItrSolver<RC, FD, EM, SLV>::checkEigVec(M, (stdPb ? NULL : &N), maxResNorm);
};
// Public members.
+6 -13
View File
@@ -18,9 +18,9 @@ for k 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.
if l == k-1:
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex(-100., -100.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex128(complex( -100., 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.
@@ -69,7 +69,6 @@ n = 8
i = np.array([], dtype='@PYINT@')
j = np.array([], dtype='@PYINT@')
Aij = np.array([], dtype='complex64')
Bij = np.array([], dtype='complex64')
for k in range(n):
for l in [k-1, k, k+1]:
if l < 0 or l > n-1:
@@ -78,19 +77,13 @@ for k in range(n):
j = np.append(j, np.@PYINT@(l+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex(-100., -100.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( -100., 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)
for k, l, Bkl in zip(i, j, Bij):
print("B[", k, ",", l, "] =", Bkl)
A = (n, i, j, Aij) # coo format: dimension, i 1-based indices, j 1-based indices, Aij values.
B = (n, i, j, Bij) # coo format: dimension, i 1-based indices, j 1-based indices, Bij values.
# Get and tune arpack solver.
@@ -111,9 +104,9 @@ arpackSlv.symPb = False
# Solve eigen problem.
rc = arpackSlv.solve(A, B)
rc = arpackSlv.solve(A)
assert rc == 0, "bad solve"
rc = arpackSlv.checkEigVec(A, B, 1.)
rc = arpackSlv.checkEigVec(A)
assert rc == 0, "bad checkEigVec"
# Print out results (mode selected, eigen vectors, eigen values, ...).
+15 -21
View File
@@ -8,7 +8,7 @@ from pyarpack import sparseLDLT as pyarpackSlv
n = 4
i = np.array([], dtype='@PYINT@')
j = np.array([], dtype='@PYINT@')
Aij = np.array([], dtype='complex128')
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:
@@ -16,18 +16,16 @@ for k in range(n):
i = np.append(i, np.@PYINT@(k)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
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.complexDouble() # Caution: complexDouble <=> np.array(..., dtype='complex128')
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
@@ -36,7 +34,7 @@ arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvOffset = 0.
arpackSlv.slvScale = 1.
arpackSlv.symPb = False
arpackSlv.symPb = True
# Solve eigen problem.
@@ -66,8 +64,8 @@ print("\n#######################################################################
n = 8
i = np.array([], dtype='@PYINT@')
j = np.array([], dtype='@PYINT@')
Aij = np.array([], dtype='complex64')
Bij = np.array([], dtype='complex64')
Aij = np.array([], dtype='float32')
Bij = np.array([], dtype='float32')
for k in range(n):
for l in [k-1, k, k+1]:
if l < 0 or l > n-1:
@@ -75,14 +73,11 @@ for k in range(n):
i = np.append(i, np.@PYINT@(k+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.float32( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 33.3)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1 or l == k+1:
Aij = np.append(Aij, np.float32(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 16.6)) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
for k, l, Bkl in zip(i, j, Bij):
@@ -92,7 +87,7 @@ B = (n, i, j, Bij) # coo format: dimension, i 1-based indices, j 1-based indices
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.complexFloat() # Caution: complexFloat <=> np.array(..., dtype='complex64')
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
@@ -102,8 +97,7 @@ arpackSlv.maxIt = 200
arpackSlv.slvOffset = 0.
arpackSlv.slvScale = 1.
arpackSlv.sigmaReal = 1
arpackSlv.sigmaImag = 1
arpackSlv.symPb = False
arpackSlv.symPb = True
# Solve eigen problem.
+21 -14
View File
@@ -2,13 +2,12 @@
import numpy as np
from pyarpack import sparseLU as pyarpackSlv
# Build laplacian.
n = 4
i = np.array([], dtype='@PYINT@')
j = np.array([], dtype='@PYINT@')
Aij = np.array([], dtype='float64')
Aij = np.array([], dtype='complex128')
for k in range(n):
for l in [k-1, k, k+1]:
if l < 0 or l > n-1:
@@ -16,16 +15,18 @@ for k in range(n):
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.
Aij = np.append(Aij, np.complex128(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex128(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex128(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
A = (n, i, j, Aij) # coo format: dimension, i 0-based indices, j 0-based indices, Aij values.
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.double() # Caution: double <=> np.array(..., dtype='float64')
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
@@ -33,6 +34,7 @@ arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.symPb = False
# Solve eigen problem.
@@ -62,8 +64,8 @@ print("\n#######################################################################
n = 8
i = np.array([], dtype='@PYINT@')
j = np.array([], dtype='@PYINT@')
Aij = np.array([], dtype='float32')
Bij = np.array([], dtype='float32')
Aij = np.array([], dtype='complex64')
Bij = np.array([], dtype='complex64')
for k in range(n):
for l in [k-1, k, k+1]:
if l < 0 or l > n-1:
@@ -71,11 +73,14 @@ for k in range(n):
i = np.append(i, np.@PYINT@(k+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
j = np.append(j, np.@PYINT@(l+1)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k:
Aij = np.append(Aij, np.float32( 200.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 33.3)) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1 or l == k+1:
Aij = np.append(Aij, np.float32(-100.)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.float32( 16.6)) # Casting value on append is MANDATORY or C++ won't get the expected type.
Aij = np.append(Aij, np.complex64(complex( 200., 200.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 33.3, 33.3))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k-1:
Aij = np.append(Aij, np.complex64(complex(-101., -101.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
if l == k+1:
Aij = np.append(Aij, np.complex64(complex( -99., -99.))) # Casting value on append is MANDATORY or C++ won't get the expected type.
Bij = np.append(Bij, np.complex64(complex( 16.6, 16.6))) # Casting value on append is MANDATORY or C++ won't get the expected type.
for k, l, Akl in zip(i, j, Aij):
print("A[", k, ",", l, "] =", Akl)
for k, l, Bkl in zip(i, j, Bij):
@@ -85,7 +90,7 @@ B = (n, i, j, Bij) # coo format: dimension, i 1-based indices, j 1-based indices
# Get and tune arpack solver.
arpackSlv = pyarpackSlv.float() # Caution: float <=> np.array(..., dtype='float32')
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
@@ -94,6 +99,8 @@ arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.sigmaReal = 1
arpackSlv.sigmaImag = 1
arpackSlv.symPb = False
# Solve eigen problem.
+1
View File
@@ -1,5 +1,6 @@
AM_CPPFLAGS = -I$(top_builddir) -I$(top_srcdir)
pkgincludedir = $(includedir)/arpack@ITF64SUFFIX@
pkginclude_HEADERS = debug_c.h debug_c.hpp
pkginclude_HEADERS += stat_c.h stat_c.hpp
pkginclude_HEADERS += arpack.h arpack.hpp
+6 -7
View File
@@ -1,6 +1,6 @@
ACLOCAL_AMFLAGS = -I m4
pkgincludedir = $(includedir)/arpack-ng@ITF64SUFFIX@
pkgincludedir = $(includedir)/arpack@ITF64SUFFIX@
pkginclude_HEADERS = debug.h stat.h debugF90.h statF90.h arpackdef.h
AM_DISTCHECK_CONFIGURE_FLAGS =
@@ -11,8 +11,8 @@ if ICB
AM_DISTCHECK_CONFIGURE_FLAGS += --enable-icb
pkginclude_HEADERS += arpackicb.h
endif
if ICBEXMM
AM_DISTCHECK_CONFIGURE_FLAGS += --enable-icb-exmm
if EIGEN
AM_DISTCHECK_CONFIGURE_FLAGS += --enable-eigen
endif
SUBDIRS = .
@@ -27,7 +27,6 @@ endif
EXTRA_DIST = README.md PARPACK_CHANGES CHANGES DOCUMENTS VISUAL_STUDIO \
detect_arpack_bug.m4 CMakeLists.txt
pkgconfig_DATA = arpack@LIBSUFFIX@@ITF64SUFFIX@.pc parpack@LIBSUFFIX@@ITF64SUFFIX@.pc arpackSolver@LIBSUFFIX@@ITF64SUFFIX@.pc
# Due to the LIBSUFFIX/ITF64SUFFIX, configure doesn't automatically clean this file:
DISTCLEANFILES = arpack@LIBSUFFIX@@ITF64SUFFIX@.pc parpack@LIBSUFFIX@@ITF64SUFFIX@.pc arpackSolver@LIBSUFFIX@@ITF64SUFFIX@.pc
cmakedir = $(libdir)/cmake/arpack-ng
cmake_DATA = cmake/arpackng-config-version.cmake \
cmake/arpackng-config.cmake
+1 -1
View File
@@ -114,7 +114,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -120,7 +120,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -117,7 +117,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -120,7 +120,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -117,7 +117,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -114,7 +114,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+8 -10
View File
@@ -1,17 +1,15 @@
AUTOMAKE_OPTIONS = subdir-objects # Needed as debug/stat* are not in current directory.
F77 = $(MPIF77)
FFLAGS_SAV = @FFLAGS@
FFLAGS =
PSRC = pcontext.f
SSRC = psnaitr.f psnapps.f psnaup2.f psnaupd.f psneigh.f psneupd.f psngets.f \
pssaitr.f pssapps.f pssaup2.f pssaupd.f psseigt.f psseupd.f pssgets.f \
psgetv0.f pslarnv.f psnorm2.f
psgetv0.f pslarnv.f psnorm2.f pslamch10.f
DSRC = pdnaitr.f pdnapps.f pdnaup2.f pdnaupd.f pdneigh.f pdneupd.f pdngets.f \
pdsaitr.f pdsapps.f pdsaup2.f pdsaupd.f pdseigt.f pdseupd.f pdsgets.f \
pdgetv0.f pdlarnv.f pdnorm2.f
pdgetv0.f pdlarnv.f pdnorm2.f pdlamch10.f
CSRC = pcnaitr.f pcnapps.f pcnaup2.f pcnaupd.f pcneigh.f pcneupd.f pcngets.f \
pcgetv0.f pclarnv.f pscnorm2.f
@@ -28,16 +26,11 @@ endif
EXTRA_DIST = debug.h stat.h pcontext.h
noinst_LTLIBRARIES = libparpack@LIBSUFFIX@@ITF64SUFFIX@_noopt.la
libparpack@LIBSUFFIX@@ITF64SUFFIX@_noopt_la_SOURCES = pslamch10.f pdlamch10.f
libparpack@LIBSUFFIX@@ITF64SUFFIX@_noopt_la_FFLAGS = -O0
lib_LTLIBRARIES = libparpack@LIBSUFFIX@@ITF64SUFFIX@.la
libparpack@LIBSUFFIX@@ITF64SUFFIX@_la_SOURCES = $(PSRC) $(SSRC) $(DSRC) $(CSRC) $(ZSRC)
libparpack@LIBSUFFIX@@ITF64SUFFIX@_la_SOURCES += $(top_builddir)/dbgini.f
libparpack@LIBSUFFIX@@ITF64SUFFIX@_la_SOURCES += $(top_builddir)/staini.f
libparpack@LIBSUFFIX@@ITF64SUFFIX@_la_FFLAGS = $(FFLAGS_SAV)
libparpack@LIBSUFFIX@@ITF64SUFFIX@_la_LIBADD = libparpack@LIBSUFFIX@@ITF64SUFFIX@_noopt.la \
libparpack@LIBSUFFIX@@ITF64SUFFIX@_la_LIBADD = \
$(top_builddir)/PARPACK/UTIL/MPI/libparpackutil.la \
$(top_builddir)/SRC/libarpack@LIBSUFFIX@@ITF64SUFFIX@.la \
$(LAPACK_LIBS) $(BLAS_LIBS) $(MPI_Fortran_LIBS)
@@ -46,3 +39,8 @@ if ICB
libparpack@LIBSUFFIX@@ITF64SUFFIX@_la_LIBADD += $(top_builddir)/ICB/libdbgicb.la $(top_builddir)/ICB/libstaicb.la
libparpack@LIBSUFFIX@@ITF64SUFFIX@_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)
endif
pkgconfig_DATA = parpack@LIBSUFFIX@@ITF64SUFFIX@.pc
# Due to the LIBSUFFIX/ITF64SUFFIX, configure doesn't automatically clean this file:
DISTCLEANFILES = parpack@LIBSUFFIX@@ITF64SUFFIX@.pc
@@ -1,7 +1,7 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/arpack-ng@ITF64SUFFIX@
includedir=@includedir@
Name: @PACKAGE_NAME@
Description: Collection of Fortran77 subroutines designed to solve large scale eigenvalue problems
@@ -10,4 +10,4 @@ URL: @PACKAGE_URL@
Requires.private: arpack@LIBSUFFIX@@ITF64SUFFIX@
Libs: -L${libdir} -lparpack@LIBSUFFIX@@ITF64SUFFIX@
Libs.private: @PARPACK_PC_LIBS_PRIVATE@
Cflags: -I${includedir}
Cflags: -I${includedir}/arpack@ITF64SUFFIX@
+29 -19
View File
@@ -176,13 +176,13 @@ c %------------------------%
c | Local Scalars & Arrays |
c %------------------------%
c
logical first, orth
logical first, inits, orth
integer idist, iseed(4), iter, msglvl, jj, myid, igen
Real
& rnorm0
Complex
& cnorm, cnorm2
save first, iseed, iter, msglvl, orth, rnorm0
save first, iseed, inits, iter, msglvl, orth, rnorm0
c
Complex
& cnorm_buf, buf2(1)
@@ -203,6 +203,12 @@ c
& ccdotc
external ccdotc, pscnorm2, slapy2
c
c %-----------------%
c | Data Statements |
c %-----------------%
c
data inits /.true./
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
@@ -213,26 +219,30 @@ c | Initialize the seed of the LAPACK |
c | random number generator |
c %-----------------------------------%
c
if (inits) then
c
c %-----------------------------------%
c | Generate a seed on each processor |
c | using process id (myid). |
c | Note: the seed must be between 1 |
c | and 4095. iseed(4) must be odd. |
c %-----------------------------------%
c %-----------------------------------%
c | Generate a seed on each processor |
c | using process id (myid). |
c | Note: the seed must be between 1 |
c | and 4095. iseed(4) must be odd. |
c %-----------------------------------%
c
call MPI_COMM_RANK(comm, myid, ierr)
igen = 1000 + 2*myid + 1
if (igen .gt. 4095) then
write(0,*) 'Error in p_getv0: seed exceeds 4095!'
call MPI_COMM_RANK(comm, myid, ierr)
igen = 1000 + 2*myid + 1
if (igen .gt. 4095) then
write(0,*) 'Error in p_getv0: seed exceeds 4095!'
end if
c
iseed(1) = igen/1000
igen = mod(igen,1000)
iseed(2) = igen/100
igen = mod(igen,100)
iseed(3) = igen/10
iseed(4) = mod(igen,10)
c
inits = .false.
end if
c
iseed(1) = igen/1000
igen = mod(igen,1000)
iseed(2) = igen/100
igen = mod(igen,100)
iseed(3) = igen/10
iseed(4) = 7
c
if (ido .eq. 0) then
c
+1 -1
View File
@@ -114,7 +114,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+33 -7
View File
@@ -177,11 +177,11 @@ c %------------------------%
c | Local Scalars & Arrays |
c %------------------------%
c
logical first, orth
integer idist, iseed(4), iter, msglvl, jj
logical first, inits, orth
integer idist, iseed(4), iter, msglvl, jj, myid, igen
Double precision
& rnorm0, buf2(1)
save first, iseed, iter, msglvl, orth, rnorm0
save first, iseed, inits, iter, msglvl, orth, rnorm0
c
Double precision
& rnorm_buf
@@ -206,6 +206,12 @@ c %---------------------%
c
intrinsic abs, sqrt
c
c %-----------------%
c | Data Statements |
c %-----------------%
c
data inits /.true./
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
@@ -216,10 +222,30 @@ c | Initialize the seed of the LAPACK |
c | random number generator |
c %-----------------------------------%
c
iseed(1) = 1
iseed(2) = 3
iseed(3) = 5
iseed(4) = 7
if (inits) then
c
c %-----------------------------------%
c | Generate a seed on each processor |
c | using process id (myid). |
c | Note: the seed must be between 1 |
c | and 4095. iseed(4) must be odd. |
c %-----------------------------------%
c
call MPI_COMM_RANK(comm, myid, ierr)
igen = 1000 + 2*myid + 1
if (igen .gt. 4095) then
write(0,*) 'Error in p_getv0: seed exceeds 4095!'
end if
c
iseed(1) = igen/1000
igen = mod(igen,1000)
iseed(2) = igen/100
igen = mod(igen,100)
iseed(3) = igen/10
iseed(4) = mod(igen,10)
c
inits = .false.
end if
c
if (ido .eq. 0) then
c
+1 -1
View File
@@ -331,7 +331,7 @@ c
call dlabad( unfl, ovfl )
ulp = pdlamch10( comm, 'precision' )
smlnum = unfl*( n / ulp )
first = .false.
aitr_first = .false.
end if
c
if (ido .eq. 0) then
+1 -1
View File
@@ -120,7 +120,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -117,7 +117,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+32 -11
View File
@@ -177,11 +177,11 @@ c %------------------------%
c | Local Scalars & Arrays |
c %------------------------%
c
logical first, orth
integer idist, iseed(4), iter, msglvl, jj
logical first, inits, orth
integer idist, iseed(4), iter, msglvl, jj, myid, igen
Real
& rnorm0
save first, iseed, iter, msglvl, orth, rnorm0
save first, iseed, inits, iter, msglvl, orth, rnorm0
c
Real
& rnorm_buf
@@ -206,20 +206,41 @@ c %---------------------%
c
intrinsic abs, sqrt
c
c %-----------------%
c | Data Statements |
c %-----------------%
c
data inits /.true./
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
c
c
c %-----------------------------------%
c | Initialize the seed of the LAPACK |
c | random number generator |
c %-----------------------------------%
if (inits) then
c
iseed(1) = 1
iseed(2) = 3
iseed(3) = 5
iseed(4) = 7
c %-----------------------------------%
c | Generate a seed on each processor |
c | using process id (myid). |
c | Note: the seed must be between 1 |
c | and 4095. iseed(4) must be odd. |
c %-----------------------------------%
c
call MPI_COMM_RANK(comm, myid, ierr)
igen = 1000 + 2*myid + 1
if (igen .gt. 4095) then
write(0,*) 'Error in p_getv0: seed exceeds 4095!'
end if
c
iseed(1) = igen/1000
igen = mod(igen,1000)
iseed(2) = igen/100
igen = mod(igen,100)
iseed(3) = igen/10
iseed(4) = mod(igen,10)
c
inits = .false.
end if
c
if (ido .eq. 0) then
c
+1 -1
View File
@@ -120,7 +120,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -117,7 +117,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+29 -19
View File
@@ -176,13 +176,13 @@ c %------------------------%
c | Local Scalars & Arrays |
c %------------------------%
c
logical first, orth
logical first, inits, orth
integer idist, iseed(4), iter, msglvl, jj, myid, igen
Double precision
& rnorm0
Complex*16
& cnorm, cnorm2
save first, iseed, iter, msglvl, orth, rnorm0
save first, iseed, inits, iter, msglvl, orth, rnorm0
c
Complex*16
& cnorm_buf, buf2(1)
@@ -203,6 +203,12 @@ c
& zzdotc
external zzdotc , pdznorm2 , dlapy2
c
c %-----------------%
c | Data Statements |
c %-----------------%
c
data inits /.true./
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
@@ -213,26 +219,30 @@ c | Initialize the seed of the LAPACK |
c | random number generator |
c %-----------------------------------%
c
if (inits) then
c
c %-----------------------------------%
c | Generate a seed on each processor |
c | using process id (myid). |
c | Note: the seed must be between 1 |
c | and 4095. iseed(4) must be odd. |
c %-----------------------------------%
c %-----------------------------------%
c | Generate a seed on each processor |
c | using process id (myid). |
c | Note: the seed must be between 1 |
c | and 4095. iseed(4) must be odd. |
c %-----------------------------------%
c
call MPI_COMM_RANK(comm, myid, ierr)
igen = 1000 + 2*myid + 1
if (igen .gt. 4095) then
write(0,*) 'Error in p_getv0: seed exceeds 4095!'
call MPI_COMM_RANK(comm, myid, ierr)
igen = 1000 + 2*myid + 1
if (igen .gt. 4095) then
write(0,*) 'Error in p_getv0: seed exceeds 4095!'
end if
c
iseed(1) = igen/1000
igen = mod(igen,1000)
iseed(2) = igen/100
igen = mod(igen,100)
iseed(3) = igen/10
iseed(4) = mod(igen,10)
c
inits = .false.
end if
c
iseed(1) = igen/1000
igen = mod(igen,1000)
iseed(2) = igen/100
igen = mod(igen,100)
iseed(3) = igen/10
iseed(4) = 7
c
if (ido .eq. 0) then
c
+1 -1
View File
@@ -114,7 +114,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+32 -16
View File
@@ -22,9 +22,9 @@
* with entries 1000, 999, ... , 2, 1 on the diagonal.
* */
void dMatVec(const double* x, double* y) {
void dMatVec(int start, int N, const double* x, double* y) {
int i;
for (i = 0; i < 1000; ++i) y[i] = ((double)(i + 1)) * x[i];
for (i = 0; i < N; ++i) y[i] = ((double)(start + i + 1)) * x[i];
};
int ds() {
@@ -57,16 +57,24 @@ int ds() {
char which[] = "LM";
char howmny[] = "A";
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Fint MCW = MPI_Comm_c2f(MPI_COMM_WORLD);
/// Split problem across each process/////////////////////
int rank, nprocs;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
a_int N_local = N / nprocs;
if (rank < N % nprocs) // spread the remaining on each process
N_local = N_local + 1;
printf("rank: %d, size: %d\n", rank, N_local);
int start = rank*(N / nprocs) + ((rank < N % nprocs) ? rank : N % nprocs);
printf("rank: %d, start: %d\n", rank, start);
//////////////////////////////////////////////////////////
a_int info = 0, ido = 0;
do {
pdsaupd_c(MCW, &ido, bmat, N, which, nev, tol, resid, ncv, V, ldv, iparam,
pdsaupd_c(MCW, &ido, bmat, N_local, which, nev, tol, resid, ncv, V, ldv, iparam,
ipntr, workd, workl, lworkl, &info);
dMatVec(&(workd[ipntr[0] - 1]), &(workd[ipntr[1] - 1]));
dMatVec(start, N_local, &(workd[ipntr[0] - 1]), &(workd[ipntr[1] - 1]));
} while (ido == 1 || ido == -1);
// check info and number of ev found by arpack.
@@ -75,7 +83,7 @@ int ds() {
return 1;
}
pdseupd_c(MCW, rvec, howmny, select, d, z, ldz, sigma, bmat, N, which, nev,
pdseupd_c(MCW, rvec, howmny, select, d, z, ldz, sigma, bmat, N_local, which, nev,
tol, resid, ncv, V, ldv, iparam, ipntr, workd, workl, lworkl, &info);
if (info < 0) {
printf("Error in seupd: info %d\n", info);
@@ -94,9 +102,9 @@ int ds() {
return 0;
}
void zMatVec(const a_dcomplex* x, a_dcomplex* y) {
void zMatVec(int start, int N, const a_dcomplex* x, a_dcomplex* y) {
int i;
for (i = 0; i < 1000; ++i) y[i] = x[i] * CMPLXF(i + 1.0, i + 1.0);
for (i = 0; i < N; ++i) y[i] = x[i] * CMPLXF(start + i + 1.0, start + i + 1.0);
};
int zn() {
@@ -131,16 +139,24 @@ int zn() {
char which[] = "LM";
char howmny[] = "A";
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Fint MCW = MPI_Comm_c2f(MPI_COMM_WORLD);
/// Split problem across each process/////////////////////
int rank, nprocs;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
a_int N_local = N / nprocs;
if (rank < N % nprocs) // spread the remaining on each process
N_local = N_local + 1;
printf("rank: %d, size: %d\n", rank, N_local);
int start = rank*(N / nprocs) + ((rank < N % nprocs) ? rank : N % nprocs);
printf("rank: %d, start: %d\n", rank, start);
//////////////////////////////////////////////////////////
a_int info = 0, ido = 0;
do {
pznaupd_c(MCW, &ido, bmat, N, which, nev, tol, resid, ncv, V, ldv, iparam,
pznaupd_c(MCW, &ido, bmat, N_local, which, nev, tol, resid, ncv, V, ldv, iparam,
ipntr, workd, workl, lworkl, rwork, &info);
zMatVec(&(workd[ipntr[0] - 1]), &(workd[ipntr[1] - 1]));
zMatVec(start, N_local, &(workd[ipntr[0] - 1]), &(workd[ipntr[1] - 1]));
} while (ido == 1 || ido == -1);
// check info and number of ev found by arpack.
@@ -149,7 +165,7 @@ int zn() {
return 1;
}
pzneupd_c(MCW, rvec, howmny, select, d, z, ldz, sigma, workev, bmat, N, which,
pzneupd_c(MCW, rvec, howmny, select, d, z, ldz, sigma, workev, bmat, N_local, which,
nev, tol, resid, ncv, V, ldv, iparam, ipntr, workd, workl, lworkl,
rwork, &info);
if (info < 0) {
+35 -17
View File
@@ -13,6 +13,7 @@
#include <cmath>
#include <iostream>
#include <stdexcept>
#include <vector>
#include "parpack.hpp"
@@ -20,9 +21,9 @@
#include "stat_c.hpp" // arpack statistics.
template <typename Real>
void diagonal_matrix_vector_product(const Real* x, Real* y) {
for (int i = 0; i < 1000; ++i) {
y[i] = static_cast<float>(i + 1) * x[i];
void diagonal_matrix_vector_product(int start, int nloc, const Real* x, Real* y) {
for (int i = 0; i < nloc; ++i) {
y[i] = static_cast<Real>(start + i + 1) * x[i];
}
}
@@ -53,18 +54,27 @@ void real_symmetric_runner(double const& tol_check, arpack::which const& ritz_op
iparam[3] = 1; // NB, only 1 allowed
iparam[6] = 1; // mode
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Fint MCW = MPI_Comm_c2f(MPI_COMM_WORLD);
/// Split problem across each process/////////////////////
int rank, nprocs;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
a_int N_local = N / nprocs;
if (rank < N % nprocs) // spread the remaining on each process
N_local = N_local + 1;
std::cout<< "rank: " << rank << ", size :" << N_local << "\n";
int start = rank*(N / nprocs) + std::min(rank, N % nprocs);
std::cout<< "rank: " <<rank<< ", start:" << start<<"\n";
//////////////////////////////////////////////////////////
a_int info = 0, ido = 0;
do {
arpack::saupd(MCW, ido, arpack::bmat::identity, N,
arpack::saupd(MCW, ido, arpack::bmat::identity, N_local,
ritz_option, nev, tol, resid.data(), ncv,
V.data(), ldv, iparam, ipntr, workd.data(),
workl.data(), lworkl, info);
diagonal_matrix_vector_product(&(workd[ipntr[0] - 1]), &(workd[ipntr[1] - 1]));
diagonal_matrix_vector_product(start, N_local, &(workd[ipntr[0] - 1]), &(workd[ipntr[1] - 1]));
} while (ido == 1 || ido == -1);
// check info and number of ev found by arpack.
@@ -75,7 +85,7 @@ void real_symmetric_runner(double const& tol_check, arpack::which const& ritz_op
}
arpack::seupd(MCW, rvec, arpack::howmny::ritz_vectors, select.data(),
d.data(), z.data(), ldz, sigma, arpack::bmat::identity, N,
d.data(), z.data(), ldz, sigma, arpack::bmat::identity, N_local,
ritz_option, nev, tol, resid.data(), ncv,
V.data(), ldv, iparam, ipntr, workd.data(),
workl.data(), lworkl, info);
@@ -94,11 +104,11 @@ void real_symmetric_runner(double const& tol_check, arpack::which const& ritz_op
}
template <typename Real>
void diagonal_matrix_vector_product(const std::complex<Real>* x, std::complex<Real>* y) {
for (int i = 0; i < 1000; ++i) {
void diagonal_matrix_vector_product(int start, int N_local, const std::complex<Real>* x, std::complex<Real>* y) {
for (int i = 0; i < N_local; ++i) {
// Use complex matrix (i, -i) instead of (i, i): this way "largest_magnitude"
// and "largest_imaginary" options produce different results that can be checked.
y[i] = x[i] * std::complex<Real>{Real(i + 1), -Real(i + 1)};
y[i] = x[i] * std::complex<Real>{Real(start + i + 1), -Real(start + i + 1)};
}
}
@@ -131,18 +141,26 @@ void complex_nonsymmetric_runner(double const& tol_check, arpack::which const& r
iparam[3] = 1; // NB, only 1 allowed
iparam[6] = 1; // mode
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Fint MCW = MPI_Comm_c2f(MPI_COMM_WORLD);
/// Split problem across each process/////////////////////
int rank, nprocs;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
a_int N_local = N / nprocs;
if (rank < N % nprocs) // spread the remaining on each process
N_local = N_local + 1;
std::cout<< "rank: "<<rank<<", size :"<<N_local<<"\n";
int start = rank * (N / nprocs) + std::min(rank, N % nprocs);
std::cout<< "rank: " << rank << ", start:" << start << "\n";
//////////////////////////////////////////////////////////
a_int info = 0, ido = 0;
do {
arpack::naupd(MCW, ido, arpack::bmat::identity, N,
arpack::naupd(MCW, ido, arpack::bmat::identity, N_local,
ritz_option, nev, tol, resid.data(), ncv,
V.data(), ldv, iparam, ipntr, workd.data(),
workl.data(), lworkl, rwork.data(), info);
diagonal_matrix_vector_product(&(workd[ipntr[0] - 1]), &(workd[ipntr[1] - 1]));
diagonal_matrix_vector_product(start, N_local, &(workd[ipntr[0] - 1]), &(workd[ipntr[1] - 1]));
} while (ido == 1 || ido == -1);
// check info and number of ev found by arpack
@@ -154,7 +172,7 @@ void complex_nonsymmetric_runner(double const& tol_check, arpack::which const& r
arpack::neupd(MCW, rvec, arpack::howmny::ritz_vectors, select.data(),
d.data(), z.data(), ldz, sigma, workev.data(),
arpack::bmat::identity, N, ritz_option,
arpack::bmat::identity, N_local, ritz_option,
nev, tol, resid.data(), ncv, V.data(), ldv, iparam,
ipntr, workd.data(), workl.data(), lworkl, rwork.data(), info);
if (info < 0) throw std::runtime_error("Error in neupd, info " + std::to_string(info));
+2 -2
View File
@@ -38,8 +38,8 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, J, NDIGIT, K1, K2, LLL
CHARACTER*1 ICOL( 3 )
CHARACTER*80 LINE
CHARACTER ICOL( 3 )
CHARACTER LINE*80
* ...
* ... SPECIFICATIONS INTRINSICS
INTRINSIC MIN
+1 -1
View File
@@ -34,7 +34,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, NDIGIT, K1, K2, LLL
CHARACTER*80 LINE
CHARACTER LINE*80
* ...
* ... FIRST EXECUTABLE STATEMENT
*
+2 -2
View File
@@ -34,7 +34,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
* .. Scalar Arguments ..
CHARACTER*( * ) IFMT
CHARACTER IFMT*( * )
INTEGER IDIGIT, LDA, LOUT, M, N
* ..
* .. Array Arguments ..
@@ -42,7 +42,7 @@
& A( LDA, * )
* ..
* .. Local Scalars ..
CHARACTER*80 LINE
CHARACTER LINE*80
INTEGER I, J, K1, K2, LLL, NDIGIT
* ..
* .. Local Arrays ..
+2 -2
View File
@@ -31,7 +31,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
* .. Scalar Arguments ..
CHARACTER*( * ) IFMT
CHARACTER IFMT*( * )
INTEGER IDIGIT, LOUT, N
* ..
* .. Array Arguments ..
@@ -39,7 +39,7 @@
& SX( * )
* ..
* .. Local Scalars ..
CHARACTER*80 LINE
CHARACTER LINE*80
INTEGER I, K1, K2, LLL, NDIGIT
* ..
* .. Intrinsic Functions ..
+1 -1
View File
@@ -34,7 +34,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, NDIGIT, K1, K2, LLL
CHARACTER*80 LINE
CHARACTER LINE*80
* ...
* ... SPECIFICATIONS INTRINSICS
INTRINSIC MIN
+2 -2
View File
@@ -34,7 +34,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
* .. Scalar Arguments ..
CHARACTER*( * ) IFMT
CHARACTER IFMT*( * )
INTEGER IDIGIT, LDA, LOUT, M, N
* ..
* .. Array Arguments ..
@@ -42,7 +42,7 @@
& A( LDA, * )
* ..
* .. Local Scalars ..
CHARACTER*80 LINE
CHARACTER LINE*80
INTEGER I, J, K1, K2, LLL, NDIGIT
* ..
* .. Local Arrays ..
+2 -2
View File
@@ -31,7 +31,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
* .. Scalar Arguments ..
CHARACTER*( * ) IFMT
CHARACTER IFMT*( * )
INTEGER IDIGIT, LOUT, N
* ..
* .. Array Arguments ..
@@ -39,7 +39,7 @@
& SX( * )
* ..
* .. Local Scalars ..
CHARACTER*80 LINE
CHARACTER LINE*80
INTEGER I, K1, K2, LLL, NDIGIT
* ..
* .. Intrinsic Functions ..
+2 -2
View File
@@ -38,8 +38,8 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, J, NDIGIT, K1, K2, LLL
CHARACTER*1 ICOL( 3 )
CHARACTER*80 LINE
CHARACTER ICOL( 3 )
CHARACTER LINE*80
* ...
* ... SPECIFICATIONS INTRINSICS
INTRINSIC MIN
+1 -1
View File
@@ -34,7 +34,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, NDIGIT, K1, K2, LLL
CHARACTER*80 LINE
CHARACTER LINE*80
* ...
* ... FIRST EXECUTABLE STATEMENT
*
+2 -2
View File
@@ -37,8 +37,8 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, J, NDIGIT, K1, K2, LLL
CHARACTER*1 ICOL( 3 )
CHARACTER*80 LINE
CHARACTER ICOL( 3 )
CHARACTER LINE*80
* ...
* ... SPECIFICATIONS INTRINSICS
INTRINSIC MIN
+1 -1
View File
@@ -33,7 +33,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, NDIGIT, K1, K2, LLL
CHARACTER*80 LINE
CHARACTER LINE*80
* ...
* ... FIRST EXECUTABLE STATEMENT
*
+2 -2
View File
@@ -33,7 +33,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
* .. Scalar Arguments ..
CHARACTER*( * ) IFMT
CHARACTER IFMT*( * )
INTEGER IDIGIT, LDA, LOUT, M, N
* ..
* .. Array Arguments ..
@@ -41,7 +41,7 @@
& A( LDA, * )
* ..
* .. Local Scalars ..
CHARACTER*80 LINE
CHARACTER LINE*80
INTEGER I, J, K1, K2, LLL, NDIGIT
* ..
* .. Local Arrays ..
+2 -2
View File
@@ -30,7 +30,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
* .. Scalar Arguments ..
CHARACTER*( * ) IFMT
CHARACTER IFMT*( * )
INTEGER IDIGIT, LOUT, N
* ..
* .. Array Arguments ..
@@ -38,7 +38,7 @@
& SX( * )
* ..
* .. Local Scalars ..
CHARACTER*80 LINE
CHARACTER LINE*80
INTEGER I, K1, K2, LLL, NDIGIT
* ..
* .. Intrinsic Functions ..
+1 -1
View File
@@ -33,7 +33,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, NDIGIT, K1, K2, LLL
CHARACTER*80 LINE
CHARACTER LINE*80
* ...
* ... SPECIFICATIONS INTRINSICS
INTRINSIC MIN
+2 -2
View File
@@ -33,7 +33,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
* .. Scalar Arguments ..
CHARACTER*( * ) IFMT
CHARACTER IFMT*( * )
INTEGER IDIGIT, LDA, LOUT, M, N
* ..
* .. Array Arguments ..
@@ -41,7 +41,7 @@
& A( LDA, * )
* ..
* .. Local Scalars ..
CHARACTER*80 LINE
CHARACTER LINE*80
INTEGER I, J, K1, K2, LLL, NDIGIT
* ..
* .. Local Arrays ..
+2 -2
View File
@@ -30,7 +30,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
* .. Scalar Arguments ..
CHARACTER*( * ) IFMT
CHARACTER IFMT*( * )
INTEGER IDIGIT, LOUT, N
* ..
* .. Array Arguments ..
@@ -38,7 +38,7 @@
& SX( * )
* ..
* .. Local Scalars ..
CHARACTER*80 LINE
CHARACTER LINE*80
INTEGER I, K1, K2, LLL, NDIGIT
* ..
* .. Intrinsic Functions ..
+2 -2
View File
@@ -37,8 +37,8 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, J, NDIGIT, K1, K2, LLL
CHARACTER*1 ICOL( 3 )
CHARACTER*80 LINE
CHARACTER ICOL( 3 )
CHARACTER LINE*80
* ...
* ... SPECIFICATIONS INTRINSICS
INTRINSIC MIN
+1 -1
View File
@@ -33,7 +33,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, NDIGIT, K1, K2, LLL
CHARACTER*80 LINE
CHARACTER LINE*80
* ...
* ... FIRST EXECUTABLE STATEMENT
*
+85 -14
View File
@@ -42,11 +42,32 @@ About ILP64 support:
- Sequential arpack supports [ILP64](https://www.intel.com/content/www/us/en/develop/documentation/onemkl-linux-developer-guide/top/linking-your-application-with-onemkl/linking-in-detail/linking-with-interface-libraries/using-the-ilp64-interface-vs-lp64-interface.html), but, parallel arpack doesn't.
- Reminder: you can NOT mix `ILP64` with `LP64`. If you compile `arpack-ng` with `ILP64` (resp. `LP64`) support, you MUST insure your BLAS/LAPACK is compliant with `ILP64` (resp. `LP64`).
- Set `INTERFACE64` at configure time.
- As this can not be automated, you need to make sure that the BLAS/LAPACK libraries you pass to `arpack-ng`:
- Are built with ILP64 support.
In case these ILP64 BLAS/LAPACK libraries have a non-usual name, you must specify them like so:
```
>> ./configure --with-blas=openblas64_ ...
```
- Do export ILP64-flavored symbols. In case these symbols have a non-usual name, you must:
- Check for ILP64 symbols exported by the ILP64 BLAS/LAPACK libraries:
```
>> nm /path/to/libopenblas64_.so | grep scopy64_
0000000000000000 T scopy64_
```
- Specify them to `arpack-ng` using `SYMBOLSUFFIX`:
```
>> SYMBOLSUFFIX=64_ ./configure ...
...
Configuration summary for ARPACK-NG
...
FFLAGS : -fdefault-integer-8 -Dscopy=scopy64_ ...
```
FFLAGS used by `arpack-ng` (built from `SYMBOLSUFFIX` - reported in configure log) *must* redirect the usual symbols to the non-usual ones exported by the ILP64 BLAS/LAPACK libraries: this check is the responsability of the user.
Note for F77/F90 developers:
- All files which needs `ILP64` support must include `"arpackicb.h"`.
- When coding, use `i_int` (defined in `arpackicb.h`) instead of `c_int`. `i_int` stands for `iso_c_binding int`: it's `#defined` to `c_int` or `c_int64_t` according to the architecture.
- When coding, use `i_int` (defined in `arpackicb.h`) instead of `c_int`. `i_int` stands for ISO_C_BINDING integer: it's `#defined` to `c_int` or `c_int64_t` according to the architecture.
Note for C/C++ developers:
@@ -72,11 +93,16 @@ About ISO_C_BINDING support:
- The install will now provide `arpack.h/hpp`, `parpack.h/hpp` and friends.
- Examples of use can be found in `./TESTS` and` ./PARPACK/TESTS/MPI`.
Those who are interested in `ISO_C_BINDING` support can checkout following links for more informations.
ISO_C_BINDING is a feature of modern Fortran meant to handle safely interoperability between Fortran and C (in practice, no more need to use ugly tricks to link F77 functions to C code using "underscored" symbols). Basically, ISO_C_BINDING make sure all fortran variables are typed (which may not always be the case when using `implicit` keyword in fortran): this way, C compilers can link properly. For more information on ISO_C_BINDING, you can checkout the following links:
- <http://fortranwiki.org/fortran/show/ISO_C_BINDING>
- <http://fortranwiki.org/fortran/show/Generating+C+Interfaces>
- <https://www.roguewave.com/sites/rw/files/attachments/StandardizedMixedLanguageProgrammingforCandFortran.pdf>
Using ICB is seamless:
- Compile `arpack-ng` with ISO_C_BINDING: you'll get both old-fashion fortran symbols and new ISO_C_BINDING symbols available for linking.
- Add `#include "arpack.h"` in your C code.
- Replace all [sdcz][ae]upd calls by [sdcz][ae]upd_c: functions suffixed with _c are ISO_C_BINDING compliant (exposing same arguments than original fortran functions).
**Example**: to test arpack with ISO_C_BINDING
@@ -87,7 +113,7 @@ $ cmake -D ICB=ON
## Eigen support
`arpack-ng` provides C++ eigensolver based on `eigen`.
`arpack-ng` provides C++ eigensolver based on both ISO_C_BINDING and `eigen`.
Check out `./EXAMPLES/MATRIX_MARKET/README` for more details.
@@ -96,7 +122,7 @@ Check out `./EXAMPLES/MATRIX_MARKET/README` for more details.
```bash
$ mkdir build
$ cd build
$ cmake -D EXAMPLES=ON -D ICB=ON -D ICBEXMM=ON ..
$ cmake -D EXAMPLES=ON -D ICB=ON -D EIGEN=ON ..
$ make all check
```
@@ -112,7 +138,7 @@ Check out `./EXAMPLES/PYARPACK/README` for more details.
```bash
$ mkdir build
$ cd build
$ cmake -D EXAMPLES=ON -D ICB=ON -D ICBEXMM=ON -D PYTHON3=ON ..
$ cmake -D EXAMPLES=ON -D ICB=ON -D EIGEN=ON -D PYTHON3=ON ..
$ make all check
```
@@ -156,7 +182,7 @@ $ make all check
### Getting arpack-ng
Unlike ARPACK, ARPACK-NG is providing autotools and cmake based build system. In addition, `ARPACK-NG` also provides
`iso_c_binding` support, which enables to call fortran subroutines natively from C or C++.
ISO_C_BINDING support, which enables to call fortran subroutines natively from C or C++.
First, obtain the source code 📥 from github:
@@ -277,10 +303,23 @@ $ LIBS="-framework Accelerate" FFLAGS="-ff2c -fno-second-underscore" FCFLAGS="-f
### Windows support
`arpack-ng` runs on windows using `mingw64`.
`arpack-ng` can be installed on Windows as a MinGW-w64 package via various distribution, for example through [MSYS2](https://packages.msys2.org/package/mingw-w64-x86_64-arpack) with `pacman -S mingw-w64-x86_64-arpack`. It can also be built and installed through [vcpkg](https://github.com/microsoft/vcpkg) with `vcpkg install arpack-ng`.
## Using arpack-ng from your own codebase
The `*.pc` and `*.cmake` files provided by `arpack-ng` are only pointing to arpack libraries.
If you need other libraries (like MPI), you must add them alongside arpack (see CMake example below).
Typically, if you need
- ARPACK: at compile/link time, you'll need to provide BLAS and LAPACK.
- ARPACK with eigen support (arpackSolver): at compile/link time, you'll need to provide BLAS, LAPACK and Eigen.
- PARPACK: at compile/link time, you'll need to provide BLAS, LAPACK and MPI.
Examples are provided in `tstCMakeInstall.sh` and `tstAutotoolsInstall.sh` generated after running cmake/configure.
### With autotools
First, set `PKG_CONFIG_PATH` to the location in the installation directory where `arpack.pc` lies.
@@ -299,7 +338,7 @@ Note: make sure you have installed `pkg-config`.
You can use arpack in your CMake builds by using `ARPACK::ARPACK` target. For example,
```cmake
FIND_PACKAGE(arpack-ng)
FIND_PACKAGE(arpackng)
ADD_EXECUTABLE(main main.f)
TARGET_INCLUDE_DIRECTORIES(main PUBLIC ARPACK::ARPACK)
TARGET_LINK_LIBRARIES(main ARPACK::ARPACK)
@@ -308,19 +347,51 @@ TARGET_LINK_LIBRARIES(main ARPACK::ARPACK)
To use PARPACK in your Cmake builds, use `PARPACK::PARPACK` target:
```cmake
FIND_PACKAGE(arpack-ng)
FIND_PACKAGE(arpackng)
FIND_PACKAGE(MPI REQUIRED COMPONENTS Fortran)
ADD_EXECUTABLE(main main.f)
TARGET_INCLUDE_DIRECTORIES(main PUBLIC PARPACK::PARPACK)
TARGET_LINK_LIBRARIES(main PARPACK::PARPACK)
TARGET_INCLUDE_DIRECTORIES(main PUBLIC MPI::MPI_Fortran)
TARGET_LINK_LIBRARIES(main MPI::MPI_Fortran)
```
Note: Make sure to update `CMAKE_MODULE_PATH` env variable (otheriwse, `find_package` won't find arpack-ng cmake file).
Note: Make sure to update `CMAKE_MODULE_PATH` env variable (otherwise, `find_package` won't find arpack-ng cmake file).
## Using MKL instead of BLAS / LAPACK
### FAQ
- Where can I find ARPACK user's guide?
http://li.mit.edu/Archive/Activities/Archive/CourseWork/Ju_Li/MITCourses/18.335/Doc/ARPACK/Lehoucq97.pdf
- Calling arpack's aupd methods returns `info = -9 - Starting vector is zero.`: why?
Residuals are null. Try to set `resid` to small values (like epsilon machine magnitude) but *not exactly* zero.
Residuals `resid = A*v - lamdba*v` target *exactly* the zero vector.
When `resid` is close enough to zero, the iterative procedure stops.
- Say I have an estimate of an eigen value, how to give this information to arpack?
You need to shift of an amount of about this estimate of `lambda`. Grep `backTransform` in `arpackSolver.hpp` to see an example.
For more information, checkout "NUMERICAL METHODS FOR LARGE EIGENVALUE PROBLEMS" by Yousef Saad: https://www-users.cse.umn.edu/~saad/eig_book_2ndEd.pdf (paragraph 4.1.2. and section 4.1.).
- Say I have an estimate of an eigen vector, how to give this information to arpack?
You need to copy this eigen vector estimate in `v` (not `resid`) and set `info` to 1 before calling aupd methods.
The `v` vector targets a non-null vector such that `resid = 0`, that is, such that `A*v = lambda*v`.
- Using PARPACK, I get incorrect eigen values.
Make sure each MPI processor handles a subpart of the eigen system (matrices) only.
ARPACK handles and solves the whole eigen problem (matrices) at once.
PARPACK doesn't: each MPI processor must handle and solve a subpart of the eigen system (matrices) only (independently from the other processors).
See examples for Fortran in folder `PARPACK/EXAMPLES/MPI`, and for C/C++ examples in `PARPACK/TESTS/MPI/icb_parpack_c.c` and `PARPACK/TESTS/MPI/icb_parpack_cpp.cpp`
## Using MKL (also known as Intel oneAPI or oneMKL) instead of BLAS / LAPACK
How to use arpack-ng with Intel MKL:
- Let autotools/cmake find MKL for you based on pkg-config files (setting `PKG_CONFIG_PATH`) or cmake options (`BLA_VENDOR=Intel`).
- Refers to the Intel Link Advisor: <https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html>.
- Let autotools/cmake find MKL for you based on pkg-config files (setting `PKG_CONFIG_PATH`) or cmake options (`BLA_VENDOR=Intel10_64lp` for lp64, `BLA_VENDOR=Intel10_64ilp` for ilp64).
- Refers to the Intel Link Advisor: <https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-link-line-advisor.html>. Whatever build system you use, you must make sure (e.g. with `make VERBOSE=1`) in the very end that the compile/link options used by the compiler/linker are _exactly_ what Intel libraries expect.
## Good luck and enjoy 🎊
+5
View File
@@ -33,3 +33,8 @@ if ICB
libarpack@LIBSUFFIX@@ITF64SUFFIX@_la_LIBADD += $(top_builddir)/ICB/libdbgicb.la $(top_builddir)/ICB/libstaicb.la
libarpack@LIBSUFFIX@@ITF64SUFFIX@_la_CPPFLAGS = $(AM_CPPFLAGS) -I$(top_builddir)
endif
pkgconfig_DATA = arpack@LIBSUFFIX@@ITF64SUFFIX@.pc
# Due to the LIBSUFFIX/ITF64SUFFIX, configure doesn't automatically clean this file:
DISTCLEANFILES = arpack@LIBSUFFIX@@ITF64SUFFIX@.pc
+2 -2
View File
@@ -1,7 +1,7 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/arpack-ng@ITF64SUFFIX@
includedir=@includedir@
Name: @PACKAGE_NAME@
Description: Collection of Fortran77 subroutines designed to solve large scale eigenvalue problems
@@ -9,4 +9,4 @@ Version: @PACKAGE_VERSION@
URL: @PACKAGE_URL@
Libs: -L${libdir} -larpack@LIBSUFFIX@@ITF64SUFFIX@
Libs.private: @ARPACK_PC_LIBS_PRIVATE@
Cflags: -I${includedir}
Cflags: -I${includedir}/arpack@ITF64SUFFIX@
+15 -6
View File
@@ -156,13 +156,13 @@ c %------------------------%
c | Local Scalars & Arrays |
c %------------------------%
c
logical first, orth
logical first, inits, orth
integer idist, iseed(4), iter, msglvl, jj
Real
& rnorm0
Complex
& cnorm
save first, iseed, iter, msglvl, orth, rnorm0
save first, iseed, inits, iter, msglvl, orth, rnorm0
c
c %----------------------%
c | External Subroutines |
@@ -180,6 +180,12 @@ c
& ccdotc
external ccdotc, scnrm2, slapy2
c
c %-----------------%
c | Data Statements |
c %-----------------%
c
data inits /.true./
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
@@ -190,10 +196,13 @@ c | Initialize the seed of the LAPACK |
c | random number generator |
c %-----------------------------------%
c
iseed(1) = 1
iseed(2) = 3
iseed(3) = 5
iseed(4) = 7
if (inits) then
iseed(1) = 1
iseed(2) = 3
iseed(3) = 5
iseed(4) = 7
inits = .false.
end if
c
if (ido .eq. 0) then
c
+1 -1
View File
@@ -98,7 +98,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -64,7 +64,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
logical apply
integer n
c
+15 -6
View File
@@ -157,11 +157,11 @@ c %------------------------%
c | Local Scalars & Arrays |
c %------------------------%
c
logical first, orth
logical first, inits, orth
integer idist, iseed(4), iter, msglvl, jj
Double precision
& rnorm0
save first, iseed, iter, msglvl, orth, rnorm0
save first, iseed, inits, iter, msglvl, orth, rnorm0
c
c %----------------------%
c | External Subroutines |
@@ -183,6 +183,12 @@ c %---------------------%
c
intrinsic abs, sqrt
c
c %-----------------%
c | Data Statements |
c %-----------------%
c
data inits /.true./
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
@@ -193,10 +199,13 @@ c | Initialize the seed of the LAPACK |
c | random number generator |
c %-----------------------------------%
c
iseed(1) = 1
iseed(2) = 3
iseed(3) = 5
iseed(4) = 7
if (inits) then
iseed(1) = 1
iseed(2) = 3
iseed(3) = 5
iseed(4) = 7
inits = .false.
end if
c
if (ido .eq. 0) then
c
+1 -1
View File
@@ -106,7 +106,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -71,7 +71,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
logical apply
integer lda, n, na
c
+1 -1
View File
@@ -103,7 +103,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -69,7 +69,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
logical apply
integer n
c
+1 -1
View File
@@ -62,7 +62,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
logical apply
integer n
c
+15 -6
View File
@@ -157,11 +157,11 @@ c %------------------------%
c | Local Scalars & Arrays |
c %------------------------%
c
logical first, orth
logical first, inits, orth
integer idist, iseed(4), iter, msglvl, jj
Real
& rnorm0
save first, iseed, iter, msglvl, orth, rnorm0
save first, iseed, inits, iter, msglvl, orth, rnorm0
c
c %----------------------%
c | External Subroutines |
@@ -183,6 +183,12 @@ c %---------------------%
c
intrinsic abs, sqrt
c
c %-----------------%
c | Data Statements |
c %-----------------%
c
data inits /.true./
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
@@ -193,10 +199,13 @@ c | Initialize the seed of the LAPACK |
c | random number generator |
c %-----------------------------------%
c
iseed(1) = 1
iseed(2) = 3
iseed(3) = 5
iseed(4) = 7
if (inits) then
iseed(1) = 1
iseed(2) = 3
iseed(3) = 5
iseed(4) = 7
inits = .false.
end if
c
if (ido .eq. 0) then
c
+1 -1
View File
@@ -106,7 +106,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -71,7 +71,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
logical apply
integer lda, n, na
c
+1 -1
View File
@@ -103,7 +103,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -69,7 +69,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
logical apply
integer n
c
+1 -1
View File
@@ -62,7 +62,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
logical apply
integer n
c
+15 -6
View File
@@ -156,13 +156,13 @@ c %------------------------%
c | Local Scalars & Arrays |
c %------------------------%
c
logical first, orth
logical first, inits, orth
integer idist, iseed(4), iter, msglvl, jj
Double precision
& rnorm0
Complex*16
& cnorm
save first, iseed, iter, msglvl, orth, rnorm0
save first, iseed, inits, iter, msglvl, orth, rnorm0
c
c %----------------------%
c | External Subroutines |
@@ -180,6 +180,12 @@ c
& zzdotc
external zzdotc, dznrm2, dlapy2
c
c %-----------------%
c | Data Statements |
c %-----------------%
c
data inits /.true./
c
c %-----------------------%
c | Executable Statements |
c %-----------------------%
@@ -190,10 +196,13 @@ c | Initialize the seed of the LAPACK |
c | random number generator |
c %-----------------------------------%
c
iseed(1) = 1
iseed(2) = 3
iseed(3) = 5
iseed(4) = 7
if (inits) then
iseed(1) = 1
iseed(2) = 3
iseed(3) = 5
iseed(4) = 7
inits = .false.
end if
c
if (ido .eq. 0) then
c
+1 -1
View File
@@ -98,7 +98,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
integer ishift, kev, np
c
c %-----------------%
+1 -1
View File
@@ -64,7 +64,7 @@ c %------------------%
c | Scalar Arguments |
c %------------------%
c
character*2 which
character which*2
logical apply
integer n
c
+1
View File
@@ -11,6 +11,7 @@
#include <cmath>
#include <iostream>
#include <stdexcept>
#include <vector>
#include "arpack.hpp"
+6 -6
View File
@@ -641,7 +641,7 @@ c
integer indx(*)
integer jndx(*)
integer i, rows, cols, nnz, nnzreq, ounit
character*(*)rep,field,symm
character rep*(*),field*(*),symm*(*)
c
c Test input qualifiers:
c
@@ -753,9 +753,9 @@ c Convert uppercase letters to lowercase letters in string with
c starting position pos and length len.
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
integer pos, len
character*(*) string
character string*(*)
character*26 lcase, ucase
character lcase*26, ucase*26
save lcase,ucase
data lcase/'abcdefghijklmnopqrstuvwxyz'/
data ucase/'ABCDEFGHIJKLMNOPQRSTUVWXYZ'/
@@ -780,8 +780,8 @@ c
c 30-Oct-96 Bug fix: fixed non-ansi zero stringlength
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
integer slen, start, next, begin, space, wlen
character*(*) word
character*(*) string
character word*(*)
character string*(*)
begin = start
do 5 i=start,slen
@@ -809,7 +809,7 @@ c Countwd counts the number of words in string starting
c at position start. On return, count is the number of words.
c 30-Oct-96 Routine added
cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
character*(*) string
character string*(*)
integer slen, start, next, wordlength, count
character tmp2*2
+2 -2
View File
@@ -31,8 +31,8 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, J, NDIGIT, K1, K2, LLL
CHARACTER*1 ICOL( 3 )
CHARACTER*80 LINE
CHARACTER ICOL( 3 )
CHARACTER LINE*80
* ...
* ... SPECIFICATIONS INTRINSICS
INTRINSIC MIN
+1 -1
View File
@@ -30,7 +30,7 @@ c
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, NDIGIT, K1, K2, LLL
CHARACTER*80 LINE
CHARACTER LINE*80
* ...
* ... FIRST EXECUTABLE STATEMENT
*
+2 -2
View File
@@ -24,14 +24,14 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
* .. Scalar Arguments ..
CHARACTER*( * ) IFMT
CHARACTER IFMT*( * )
INTEGER IDIGIT, LDA, LOUT, M, N
* ..
* .. Array Arguments ..
DOUBLE PRECISION A( LDA, * )
* ..
* .. Local Scalars ..
CHARACTER*80 LINE
CHARACTER LINE*80
INTEGER I, J, K1, K2, LLL, NDIGIT
* ..
* .. Local Arrays ..
+2 -2
View File
@@ -21,14 +21,14 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
* .. Scalar Arguments ..
CHARACTER*( * ) IFMT
CHARACTER IFMT*( * )
INTEGER IDIGIT, LOUT, N
* ..
* .. Array Arguments ..
DOUBLE PRECISION SX( * )
* ..
* .. Local Scalars ..
CHARACTER*80 LINE
CHARACTER LINE*80
INTEGER I, K1, K2, LLL, NDIGIT
* ..
* .. Intrinsic Functions ..
+1 -1
View File
@@ -23,7 +23,7 @@ C ... SPECIFICATIONS FOR ARGUMENTS
C ...
C ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, NDIGIT, K1, K2, LLL
CHARACTER*80 LINE
CHARACTER LINE*80
* ...
* ... SPECIFICATIONS INTRINSICS
INTRINSIC MIN
+2 -2
View File
@@ -27,8 +27,8 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, J, NDIGIT, K1, K2, LLL
CHARACTER*1 ICOL( 3 )
CHARACTER*80 LINE
CHARACTER ICOL( 3 )
CHARACTER LINE*80
* ...
* ... SPECIFICATIONS INTRINSICS
INTRINSIC MIN
+1 -1
View File
@@ -24,7 +24,7 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, NDIGIT, K1, K2, LLL
CHARACTER*80 LINE
CHARACTER LINE*80
* ...
* ... FIRST EXECUTABLE STATEMENT
*
+2 -2
View File
@@ -31,8 +31,8 @@
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, J, NDIGIT, K1, K2, LLL
CHARACTER*1 ICOL( 3 )
CHARACTER*80 LINE
CHARACTER ICOL( 3 )
CHARACTER LINE*80
* ...
* ... SPECIFICATIONS INTRINSICS
INTRINSIC MIN
+1 -1
View File
@@ -30,7 +30,7 @@ c
* ...
* ... SPECIFICATIONS FOR LOCAL VARIABLES
INTEGER I, NDIGIT, K1, K2, LLL
CHARACTER*80 LINE
CHARACTER LINE*80
* ...
* ... FIRST EXECUTABLE STATEMENT
*

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