Skip to content

Commit

Permalink
Merge branch 'master' into pkgconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
sylvestre committed Oct 15, 2023
2 parents afd8413 + 569a385 commit 8c10e2f
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 100 deletions.
10 changes: 5 additions & 5 deletions CHANGES
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ arpack-ng - 3.9.1
* [BUG FIX] Don't install pkg-config files for libraries that were not built.

[ 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).
Expand All @@ -14,9 +17,6 @@ arpack-ng - 3.9.1
* 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.

[ Fabien Péan ]
* README: Add details on Windows installation.

[ 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
Expand All @@ -26,7 +26,7 @@ arpack-ng - 3.9.1
* [BUG FIX] arpackmm: fix restart.
* README: document where to find arpack user's guide.

-- Franck Houssen <fghoussen@users.noreply.github.com> Sat, 11 Feb 2023 13:52:57 +0100
-- Franck Houssen <fghoussen@users.noreply.github.com> Sat, 14 Oct 2023 13:37:37 +0200

arpack-ng - 3.9.0

Expand Down
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -95,7 +95,6 @@ if (EIGEN)
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)
Expand Down Expand Up @@ -692,6 +691,8 @@ function(build_tests)
add_test(icb_arpack_cpp_tst ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/icb_arpack_cpp)

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)
Expand All @@ -703,13 +704,13 @@ function(build_tests)
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(NAME arpackmm_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} -eu 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(NAME issue401_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} issue401.sh)
add_test(NAME issue401_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} -eu 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(NAME issue215_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} issue215.sh)
add_test(NAME issue215_tst WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} COMMAND ${BASH_PROGRAM} -eu issue215.sh)
endif()

if (PYTHON3)
Expand Down
2 changes: 1 addition & 1 deletion EXAMPLES/MATRIX_MARKET/arpackmm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ do
export extraGenPb="$shiftOpt" # Force shift if genPb.
fi

if [[ "$slv" == *CG* ]]; then
if [[ "$slv" == *" CG "* ]]; then
if [[ "$eigPb" == *nonSymPb* ]]; then
continue # Skip CG that could fail (CG is meant to deal with sym matrices).
fi
Expand Down
41 changes: 18 additions & 23 deletions EXAMPLES/PYARPACK/pyarpackDenseLDLT.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.

Expand Down Expand Up @@ -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):
Expand All @@ -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
Expand All @@ -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.

Expand Down
39 changes: 23 additions & 16 deletions EXAMPLES/PYARPACK/pyarpackDenseLUPP.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,32 @@ 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
arpackSlv.nbCV = 2*arpackSlv.nbEV + 1
arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.symPb = False

# Solve eigen problem.

Expand Down Expand Up @@ -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):
Expand All @@ -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
Expand All @@ -87,6 +93,7 @@ arpackSlv.mag = 'LM'
arpackSlv.maxIt = 200
arpackSlv.slvPvtThd = 1.e-6
arpackSlv.sigmaReal = 1
arpackSlv.symPb = False

# Solve eigen problem.

Expand Down
19 changes: 6 additions & 13 deletions EXAMPLES/PYARPACK/pyarpackSparseCGILU.py.in
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand All @@ -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.

Expand All @@ -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, ...).
Expand Down
Loading

0 comments on commit 8c10e2f

Please sign in to comment.