diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..a2187d9 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,59 @@ +name: CMake build + +on: [push, pull_request] + +jobs: + ubuntu: + name: ubuntu (build and test) + runs-on: ubuntu-latest + + strategy: + matrix: + compiler: + - gcc + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install dependencies + run: sudo apt install -y cmake gfortran libopenblas-dev libarpack2-dev libsuperlu-dev libsuitesparse-dev + + - name: Configure + run: cmake -B build + -D ENABLE_SUPERLU=ON + -D ENABLE_CHOLMOD=ON + -D ENABLE_UMFPACK=ON + -D CMAKE_BUILD_TYPE=Debug + + - name: Build + run: cmake --build build --config Debug + + - name: Test + run: ctest --test-dir build --output-on-failure -C Debug + + macos: + name: macos (build and test) + runs-on: macos-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Install dependencies + run: brew install cmake openblas arpack superlu suite-sparse + + - name: Configure + run: cmake -B build + -D ENABLE_SUPERLU=ON + -D ENABLE_CHOLMOD=ON + -D ENABLE_UMFPACK=ON + -D CMAKE_BUILD_TYPE=Debug + -D BLA_VENDOR=OpenBLAS + -D CMAKE_PREFIX_PATH="/usr/local/opt/lapack;/usr/local/opt/openblas" + + - name: Build + run: cmake --build build --config Debug + + - name: Test + run: ctest --test-dir build --output-on-failure -C Debug diff --git a/CMakeLists.txt b/CMakeLists.txt index c78aae1..302107e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,7 @@ else() set (suitesparse_static OFF) endif() -option(ENABLE_EXAMPLES "Enable examples" ON) +option(ENABLE_TESTS "Build tests (examples)" ON) option(ENABLE_FORTRAN "Enable Fortran language (for static linking of ARPACK)" OFF) option(ENABLE_SUPERLU "Enable SUPERLU" OFF) option(ENABLE_UMFPACK "Enable UMFPACK" OFF) @@ -125,7 +125,8 @@ target_include_directories(arpackpp INTERFACE include) # Examples -if (ENABLE_EXAMPLES) +if(ENABLE_TESTS) + enable_testing() add_subdirectory(examples) endif() diff --git a/INSTALL.md b/INSTALL.md index 2338e42..e751d87 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -1,9 +1,9 @@ # arpackpp installation The arpackpp library consists of header files and can be -installed without compiling. However, to compile the examples -or a program that includes these headers, it is necessary to -install some libraries first. +installed without compiling. However, to compile the tests / +examples or a program that includes these headers, it is +necessary to install some libraries first. ## Install Headers Only @@ -11,7 +11,7 @@ Installing the headers into the default include/arpackpp directory can be done via `cmake`, for example: ``` -$ cmake -B build -D ENABLE_EXAMPLES=OFF +$ cmake -B build -D ENABLE_TESTS=OFF $ cmake --install build --prefix /path/to/install ``` diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 20949c8..6709291 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,4 +1,4 @@ -add_custom_target (examples) +add_custom_target (tests) set(COMMON_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/matrices/complex @@ -11,117 +11,137 @@ set(COMMON_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/areig ) -function(examples list_name) - # Get optional solver argument - set (solver ${ARGN}) +function(setup_tests list) + # Optional arguments: + # - SOLVER = name of solver (string) + # - INPUT = arguments passed to test executable (list of strings) + cmake_parse_arguments(test "" "SOLVER" "INPUT" ${ARGN} ) - foreach(l ${${list_name}}) - get_filename_component(lwe ${l} NAME_WE) - add_executable(${lwe} ${l}) - target_link_libraries(${lwe} + foreach(file ${${list}}) + get_filename_component(target ${file} NAME_WE) + add_executable(${target} ${file}) + target_link_libraries(${target} PRIVATE $ $ arpackpp) - if (solver STREQUAL "superlu") - target_link_libraries(${lwe} PRIVATE $) - elseif (solver STREQUAL "cholmod") - target_link_libraries(${lwe} PRIVATE $,SuiteSparse::CHOLMOD_static,SuiteSparse::CHOLMOD>>) - target_include_directories(${lwe} PRIVATE ${CHOLMOD_INCLUDE_DIR}) - elseif (solver STREQUAL "umfpack") - target_link_libraries(${lwe} PRIVATE $,SuiteSparse::UMFPACK_static,SuiteSparse::UMFPACK>>) + if (test_SOLVER STREQUAL "superlu") + target_link_libraries(${target} PRIVATE $) + elseif (test_SOLVER STREQUAL "cholmod") + target_link_libraries(${target} PRIVATE $,SuiteSparse::CHOLMOD_static,SuiteSparse::CHOLMOD>>) + target_include_directories(${target} PRIVATE ${CHOLMOD_INCLUDE_DIR}) + elseif (test_SOLVER STREQUAL "umfpack") + target_link_libraries(${target} PRIVATE $,SuiteSparse::UMFPACK_static,SuiteSparse::UMFPACK>>) endif () - target_include_directories(${lwe} PRIVATE ${COMMON_INCLUDES}) - add_dependencies (examples ${lwe}) + target_include_directories(${target} PRIVATE ${COMMON_INCLUDES}) + add_dependencies (tests ${target}) + + add_test(NAME ${target}_test + COMMAND ${target} ${test_INPUT} + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/data") + endforeach() endfunction() # examples product set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/product/) file(GLOB product_complex product/complex/*.cc) -examples(product_complex) +setup_tests(product_complex) file(GLOB product_nonsym product/nonsym/*.cc) -examples(product_nonsym) +setup_tests(product_nonsym) file(GLOB product_simple product/simple/*.cc) -examples(product_simple) +setup_tests(product_simple) file(GLOB product_sym product/sym/*.cc) -examples(product_sym) +setup_tests(product_sym) # examples reverse set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/reverse/) file(GLOB reverse_complex reverse/complex/*.cc) -examples(reverse_complex) +setup_tests(reverse_complex) file(GLOB reverse_nonsym reverse/nonsym/*.cc) -examples(reverse_nonsym) +setup_tests(reverse_nonsym) file(GLOB reverse_sym reverse/sym/*.cc) -examples(reverse_sym) +setup_tests(reverse_sym) # examples band set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/band/) file(GLOB band_complex band/complex/*.cc) -examples(band_complex) +setup_tests(band_complex) file(GLOB band_nonsym band/nonsym/*.cc) -examples(band_nonsym) +setup_tests(band_nonsym) file(GLOB band_sym band/sym/*.cc) -examples(band_sym) +setup_tests(band_sym) # examples dense set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/dense/) file(GLOB dense_complex dense/complex/*.cc) -examples(dense_complex) +setup_tests(dense_complex) file(GLOB dense_nonsym dense/nonsym/*.cc) -examples(dense_nonsym) +setup_tests(dense_nonsym) file(GLOB dense_sym dense/sym/*.cc) -examples(dense_sym) +setup_tests(dense_sym) +# copy test data +file(ARCHIVE_EXTRACT INPUT "${CMAKE_CURRENT_SOURCE_DIR}/dense/nonsym/matrix.zip" DESTINATION "${CMAKE_BINARY_DIR}/data") if (ENABLE_SUPERLU) # examples areig set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/areig/) file(GLOB areig_complex areig/complex/*.cc) - examples(areig_complex "superlu") + setup_tests(areig_complex SOLVER "superlu") file(GLOB areig_nonsym areig/nonsym/*.cc) - examples(areig_nonsym "superlu") + setup_tests(areig_nonsym SOLVER "superlu") file(GLOB areig_sym areig/sym/*.cc) - examples(areig_sym "superlu") + setup_tests(areig_sym SOLVER "superlu") # examples superlu set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/superlu/) file(GLOB superlu_complex superlu/complex/*.cc) - examples(superlu_complex "superlu") + setup_tests(superlu_complex SOLVER "superlu") file(GLOB superlu_nonsym superlu/nonsym/*.cc) - examples(superlu_nonsym "superlu") + setup_tests(superlu_nonsym SOLVER "superlu") file(GLOB superlu_sym superlu/sym/*.cc) - examples(superlu_sym "superlu") + setup_tests(superlu_sym SOLVER "superlu") # examples harwell (needs SuperLU) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/harwell/) - file(GLOB harwell_complex harwell/complex/*.cc) - examples(harwell_complex "superlu") - file(GLOB harwell_nonsym harwell/nonsym/*.cc) - examples(harwell_nonsym "superlu") - file(GLOB harwell_sym harwell/sym/*.cc) - examples(harwell_sym "superlu") - # also copy binaries - add_custom_target(harwellbin - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/harwell/complex/mhd1280a.cua.gz" ${CMAKE_BINARY_DIR}/harwell/ - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/harwell/complex/mhd1280b.cua.gz" ${CMAKE_BINARY_DIR}/harwell/ - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/harwell/nonsym/mhd416a.rua" ${CMAKE_BINARY_DIR}/harwell/ - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/harwell/nonsym/mhd416b.rua" ${CMAKE_BINARY_DIR}/harwell/ - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/harwell/sym/lund_a.rsa" ${CMAKE_BINARY_DIR}/harwell/ - COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_CURRENT_SOURCE_DIR}/harwell/sym/lund_b.rsa" ${CMAKE_BINARY_DIR}/harwell/ - COMMENT "Copying Harwell binary examples" - SOURCES harwell/complex/mhd1280a.cua.gz - harwell/complex/mhd1280b.cua.gz - harwell/nonsym/mhd416a.rua - harwell/nonsym/mhd416b.rua - harwell/sym/lund_a.rsa - harwell/sym/lund_b.rsa - ) - add_dependencies(examples harwellbin) + + set(file "harwell/complex/hcompstd.cc") + set(args "-n" "4" "mhd1280a.cua") + setup_tests(file SOLVER "superlu" INPUT ${args}) + + set(file "harwell/complex/hcompgen.cc") + set(args "-n" "4" "mhd1280a.cua" "mhd1280b.cua") + setup_tests(file SOLVER "superlu" INPUT ${args}) + + set(file "harwell/nonsym/hnsymstd.cc") + set(args "-n" "4" "mhd416a.rua") + setup_tests(file SOLVER "superlu" INPUT ${args}) + + set(file "harwell/nonsym/hnsymgen.cc") + set(args "-n" "4" "mhd416a.rua" "mhd416b.rua") + setup_tests(file SOLVER "superlu" INPUT ${args}) + + set(file "harwell/sym/hsymstd.cc") + set(args "-n" "4" "lund_a.rsa") + setup_tests(file SOLVER "superlu" INPUT ${args}) + + set(file "harwell/sym/hsymgen.cc") + set(args "-n" "4" "lund_a.rsa" "lund_b.rsa") + setup_tests(file SOLVER "superlu" INPUT ${args}) + + # copy test data + file(ARCHIVE_EXTRACT INPUT "${CMAKE_CURRENT_SOURCE_DIR}/harwell/complex/mhd1280a.zip" DESTINATION "${CMAKE_BINARY_DIR}/data") + file(ARCHIVE_EXTRACT INPUT "${CMAKE_CURRENT_SOURCE_DIR}/harwell/complex/mhd1280b.zip" DESTINATION "${CMAKE_BINARY_DIR}/data") + file(COPY + "${CMAKE_CURRENT_SOURCE_DIR}/harwell/nonsym/mhd416a.rua" + "${CMAKE_CURRENT_SOURCE_DIR}/harwell/nonsym/mhd416b.rua" + "${CMAKE_CURRENT_SOURCE_DIR}/harwell/sym/lund_a.rsa" + "${CMAKE_CURRENT_SOURCE_DIR}/harwell/sym/lund_b.rsa" + DESTINATION "${CMAKE_BINARY_DIR}/data") endif() if (ENABLE_UMFPACK) @@ -129,11 +149,11 @@ if (ENABLE_UMFPACK) # examples umfpack set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/umfpack/) file(GLOB umfpack_complex umfpack/complex/*.cc) - #examples(umfpack_complex "umfpack") + #setup_tests(umfpack_complex SOLVER "umfpack") file(GLOB umfpack_nonsym umfpack/nonsym/*.cc) - #examples(umfpack_nonsym "umfpack") + #setup_tests(umfpack_nonsym SOLVER "umfpack") file(GLOB umfpack_sym umfpack/sym/*.cc) - examples(umfpack_sym "umfpack") + setup_tests(umfpack_sym SOLVER "umfpack") endif() @@ -142,6 +162,6 @@ if (ENABLE_CHOLMOD) # examples cholmod set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/cholmod/) file(GLOB cholmod_sym cholmod/sym/*.cc) - examples(cholmod_sym "cholmod") + setup_tests(cholmod_sym SOLVER "cholmod") endif() diff --git a/examples/areig/complex/acompgre.cc b/examples/areig/complex/acompgre.cc index 76a9154..bf054f2 100644 --- a/examples/areig/complex/acompgre.cc +++ b/examples/areig/complex/acompgre.cc @@ -74,6 +74,8 @@ int main() arcomplex EigVal[101]; // Eigenvalues. arcomplex EigVec[1001]; // Eigenvectors stored sequentially. + int nev = 4; // Number of requested eigenvalues. + // Creating complex matrices A and B. n = 100; @@ -85,11 +87,12 @@ int main() // and the related eigenvectors. nconv = AREig(EigVal, EigVec, n, nnzA, valA, irowA, - pcolA, nnzB, valB, irowB, pcolB, 4); + pcolA, nnzB, valB, irowB, pcolB, nev); // Printing solution. Solution(nconv, n, nnzA, valA, irowA, pcolA, nnzB, valB, irowB, pcolB, EigVal, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/complex/acompgsh.cc b/examples/areig/complex/acompgsh.cc index 0f23724..7808838 100644 --- a/examples/areig/complex/acompgsh.cc +++ b/examples/areig/complex/acompgsh.cc @@ -74,6 +74,8 @@ int main() arcomplex EigVal[101]; // Eigenvalues. arcomplex EigVec[1001]; // Eigenvectors stored sequentially. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; // Dimension of A and B. @@ -85,11 +87,12 @@ int main() // related eigenvectors. nconv = AREig(EigVal, EigVec, n, nnzA, valA, irowA, pcolA, nnzB, - valB, irowB, pcolB, arcomplex(1.0, 0.0), 4); + valB, irowB, pcolB, arcomplex(1.0, 0.0), nev); // Printing solution. Solution(nconv, n, nnzA, valA, irowA, pcolA, nnzB, valB, irowB, pcolB, EigVal, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/complex/acompreg.cc b/examples/areig/complex/acompreg.cc index 8ac2de5..24b92a6 100644 --- a/examples/areig/complex/acompreg.cc +++ b/examples/areig/complex/acompreg.cc @@ -64,6 +64,8 @@ int main() arcomplex EigVal[101]; // Eigenvalues. arcomplex EigVec[1001]; // Eigenvectors stored sequentially. + int nev = 4; // Number of requested eigenvalues. + // Creating a complex matrix. nx = 10; @@ -73,10 +75,11 @@ int main() // Finding the four eigenvalues of A with largest magnitude // and the related eigenvectors. - nconv = AREig(EigVal, EigVec, n, nnz, A, irow, pcol, 4); + nconv = AREig(EigVal, EigVec, n, nnz, A, irow, pcol, nev); // Printing solution. Solution(nconv, n, nnz, A, irow, pcol, EigVal, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/areig/complex/acompshf.cc b/examples/areig/complex/acompshf.cc index b0e09fb..2095e46 100644 --- a/examples/areig/complex/acompshf.cc +++ b/examples/areig/complex/acompshf.cc @@ -68,6 +68,8 @@ int main() arcomplex EigVal[101]; // Eigenvalues. arcomplex EigVec[1001]; // Eigenvectors stored sequentially. + int nev = 4; // Number of requested eigenvalues. + // Creating a complex matrix. n = 100; @@ -78,10 +80,11 @@ int main() // related eigenvectors. nconv = AREig(EigVal, EigVec, n, nnz, A, irow, pcol, - arcomplex(0.0, 0.0), 4L); + arcomplex(0.0, 0.0), nev); // Printing solution. Solution(nconv, n, nnz, A, irow, pcol, EigVal, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/nonsym/ansymgre.cc b/examples/areig/nonsym/ansymgre.cc index 0a40a33..fb74bff 100644 --- a/examples/areig/nonsym/ansymgre.cc +++ b/examples/areig/nonsym/ansymgre.cc @@ -73,6 +73,8 @@ int main() double EigValI[101]; // Imaginary part of the eigenvalues. double EigVec[1201]; // Eigenvectors stored sequentially. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; // Dimension of A and B. @@ -84,12 +86,13 @@ int main() // and the related eigenvectors. nconv = AREig(EigValR, EigValI, EigVec, n, nnzA, valA, - irowA, pcolA, nnzB, valB, irowB, pcolB, 4); + irowA, pcolA, nnzB, valB, irowB, pcolB, nev); // Printing solution. Solution(nconv, n, nnzA, valA, irowA, pcolA, nnzB, valB, irowB, pcolB, EigValR, EigValI, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/areig/nonsym/ansymgsc.cc b/examples/areig/nonsym/ansymgsc.cc index 796eeda..3ca9a69 100644 --- a/examples/areig/nonsym/ansymgsc.cc +++ b/examples/areig/nonsym/ansymgsc.cc @@ -73,6 +73,8 @@ int main() float EigValI[101]; // Imaginary part of the eigenvalues. float EigVec[1201]; // Eigenvectors stored sequentially. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; // Dimension of A and B. @@ -84,11 +86,12 @@ int main() nconv = AREig(EigValR, EigValI, EigVec, n, nnzA, valA, irowA, pcolA, nnzB, valB, irowB, pcolB, - 'R', (float)0.4, (float)0.6, 4); + 'R', (float)0.4, (float)0.6, nev); // Printing solution. Solution(nconv, n, nnzA, valA, irowA, pcolA, nnzB, valB, irowB, pcolB, EigValR, EigValI, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/nonsym/ansymgsh.cc b/examples/areig/nonsym/ansymgsh.cc index e8097e7..3c9ec5d 100644 --- a/examples/areig/nonsym/ansymgsh.cc +++ b/examples/areig/nonsym/ansymgsh.cc @@ -76,6 +76,8 @@ int main() double EigValI[101]; // Imaginary part of the eigenvalues. double EigVec[1201]; // Eigenvectors stored sequentially. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; // Dimension of A and B. @@ -87,12 +89,13 @@ int main() // related eigenvectors. nconv = AREig(EigValR, EigValI, EigVec, n, nnzA, valA, - irowA, pcolA, nnzB, valB, irowB, pcolB, 1.0, 4); + irowA, pcolA, nnzB, valB, irowB, pcolB, 1.0, nev); // Printing solution. Solution(nconv, n, nnzA, valA, irowA, pcolA, nnzB, valB, irowB, pcolB, EigValR, EigValI, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/nonsym/ansymreg.cc b/examples/areig/nonsym/ansymreg.cc index 5ab879d..c5cf583 100644 --- a/examples/areig/nonsym/ansymreg.cc +++ b/examples/areig/nonsym/ansymreg.cc @@ -63,6 +63,8 @@ int main() double EigValI[101]; // Imaginary part of the eigenvalues. double EigVec[1001]; // Eigenvectors stored sequentially. + int nev = 4; // Number of requested eigenvalues. + // Creating a double precision 100x100 matrix. nx = 10; @@ -71,10 +73,11 @@ int main() // Finding the four eigenvalues with largest magnitude and // the related eigenvectors. - nconv = AREig(EigValR, EigValI, EigVec, n, nnz, A, irow, pcol, 4); + nconv = AREig(EigValR, EigValI, EigVec, n, nnz, A, irow, pcol, nev); // Printing solution. Solution(nconv, n, nnz, A, irow, pcol, EigValR, EigValI, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/nonsym/ansymshf.cc b/examples/areig/nonsym/ansymshf.cc index 0698859..c46615c 100644 --- a/examples/areig/nonsym/ansymshf.cc +++ b/examples/areig/nonsym/ansymshf.cc @@ -65,6 +65,8 @@ int main() double EigValI[101]; // Imaginary part of the eigenvalues. double EigVec[1201]; // Eigenvectors stored sequentially. + int nev = 4; // Number of requested eigenvalues. + // Creating a double precision matrix. n = 200; @@ -73,10 +75,11 @@ int main() // Finding the four eigenvalues nearest to 0.0 and the // related eigenvectors. - nconv = AREig(EigValR, EigValI, EigVec, n, nnz, A, irow, pcol, 0.0, 4); + nconv = AREig(EigValR, EigValI, EigVec, n, nnz, A, irow, pcol, 0.0, nev); // Printing solution. Solution(nconv, n, nnz, A, irow, pcol, EigValR, EigValI, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/nonsym/simple.cc b/examples/areig/nonsym/simple.cc index 9668749..5df6075 100644 --- a/examples/areig/nonsym/simple.cc +++ b/examples/areig/nonsym/simple.cc @@ -31,6 +31,8 @@ int main() int* pcol; // Pointer to the beginning of each column (in irow and A). double* A; // Nonzero elements of A. + int nev = 5; // Number of requested eigenvalues. + // Creating a double precision matrix. n = 100; @@ -46,7 +48,7 @@ int main() // Finding the five eigenvalues with largest magnitude // and the related eigenvectors. - nconv = AREig(EigValR, EigValI, EigVec, n, nnz, A, irow, pcol, 5); + nconv = AREig(EigValR, EigValI, EigVec, n, nnz, A, irow, pcol, nev); // Printing eigenvalues. @@ -62,4 +64,5 @@ int main() } std::cout << std::endl; + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/areig/sym/asymgbkl.cc b/examples/areig/sym/asymgbkl.cc index 1db3b1c..a51d7a9 100644 --- a/examples/areig/sym/asymgbkl.cc +++ b/examples/areig/sym/asymgbkl.cc @@ -76,6 +76,8 @@ int main() // (uplo='U') ot the lower (uplo='L') part of // A and B will be supplied to AREig. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -87,12 +89,13 @@ int main() // related eigenvectors. nconv = AREig(EigVal, EigVec, n, nnzA, valA, irowA, pcolA, - nnzB, valB, irowB, pcolB, uplo, 'B', 1.0, 4); + nnzB, valB, irowB, pcolB, uplo, 'B', 1.0, nev); // Printing solution. Solution(nconv, n, nnzA, valA, irowA, pcolA, nnzB, valB, irowB, pcolB, uplo, EigVal, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/sym/asymgcay.cc b/examples/areig/sym/asymgcay.cc index 4cf9ca0..1524d32 100644 --- a/examples/areig/sym/asymgcay.cc +++ b/examples/areig/sym/asymgcay.cc @@ -76,6 +76,8 @@ int main() // (uplo='U') ot the lower (uplo='L') part of // A and B will be supplied to AREig. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -87,12 +89,13 @@ int main() // related eigenvectors. nconv = AREig(EigVal, EigVec, n, nnzA, valA, irowA, pcolA, - nnzB, valB, irowB, pcolB, uplo, 'C', 150.0, 4); + nnzB, valB, irowB, pcolB, uplo, 'C', 150.0, nev); // Printing solution. Solution(nconv, n, nnzA, valA, irowA, pcolA, nnzB, valB, irowB, pcolB, uplo, EigVal, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/sym/asymgreg.cc b/examples/areig/sym/asymgreg.cc index 4fc2586..3ff42ff 100644 --- a/examples/areig/sym/asymgreg.cc +++ b/examples/areig/sym/asymgreg.cc @@ -76,6 +76,8 @@ int main() // (uplo='U') ot the lower (uplo='L') part of // A and B will be supplied to AREig. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -87,12 +89,13 @@ int main() // related eigenvectors. nconv = AREig(EigVal, EigVec, n, nnzA, valA, irowA, - pcolA, nnzB, valB, irowB, pcolB, uplo, 4); + pcolA, nnzB, valB, irowB, pcolB, uplo, nev); // Printing solution. Solution(nconv, n, nnzA, valA, irowA, pcolA, nnzB, valB, irowB, pcolB, uplo, EigVal, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/sym/asymgshf.cc b/examples/areig/sym/asymgshf.cc index ababcb3..d31a567 100644 --- a/examples/areig/sym/asymgshf.cc +++ b/examples/areig/sym/asymgshf.cc @@ -76,6 +76,8 @@ int main() // (uplo='U') ot the lower (uplo='L') part of // A and B will be supplied to AREig. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -87,12 +89,13 @@ int main() // related eigenvectors. nconv = AREig(EigVal, EigVec, n, nnzA, valA, irowA, pcolA, - nnzB, valB, irowB, pcolB, uplo, 'S', 0.0, 4); + nnzB, valB, irowB, pcolB, uplo, 'S', 0.0, nev); // Printing solution. Solution(nconv, n, nnzA, valA, irowA, pcolA, nnzB, valB, irowB, pcolB, uplo, EigVal, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/sym/asymreg.cc b/examples/areig/sym/asymreg.cc index 44f1d2c..c333516 100644 --- a/examples/areig/sym/asymreg.cc +++ b/examples/areig/sym/asymreg.cc @@ -65,6 +65,8 @@ int main() // (uplo='U') ot the lower (uplo='L') part of // A will be stored in A, irow and pcol. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -74,11 +76,12 @@ int main() // Finding the four eigenvalues with smallest magnitude and // the related eigenvectors. - nconv = AREig(EigVal, EigVec, n, nnz, A, irow, pcol, uplo, 4, "SM"); + nconv = AREig(EigVal, EigVec, n, nnz, A, irow, pcol, uplo, nev, "SM"); // Printing solution. Solution(nconv, n, nnz, A, irow, pcol, uplo, EigVal, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/areig/sym/asymshf.cc b/examples/areig/sym/asymshf.cc index 355aa9f..dd255f8 100644 --- a/examples/areig/sym/asymshf.cc +++ b/examples/areig/sym/asymshf.cc @@ -70,6 +70,8 @@ int main() // (uplo='U') ot the lower (uplo='L') part of // A will be stored in A, irow and pcol. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. n = 100; @@ -79,11 +81,12 @@ int main() // Finding the four eigenvalues of A nearest to 1.0 and the // related eigenvectors. - nconv = AREig(EigVal, EigVec, n, nnz, A, irow, pcol, uplo, 1.0, 4); + nconv = AREig(EigVal, EigVec, n, nnz, A, irow, pcol, uplo, 1.0, nev); // Printing solution. Solution(nconv, n, nnz, A, irow, pcol, uplo, EigVal, EigVec); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/band/complex/bcompgre.cc b/examples/band/complex/bcompgre.cc index 891ae2e..a4b7348 100644 --- a/examples/band/complex/bcompgre.cc +++ b/examples/band/complex/bcompgre.cc @@ -71,6 +71,8 @@ int main() arcomplex *valA, *valB; // pointers to arrays that store // the elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating complex matrices A and B. n = 100; @@ -83,7 +85,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluCompGenEig dprob(4L, A, B); + ARluCompGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -93,4 +95,7 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/complex/bcompgsh.cc b/examples/band/complex/bcompgsh.cc index adb619c..6bcf3ec 100644 --- a/examples/band/complex/bcompgsh.cc +++ b/examples/band/complex/bcompgsh.cc @@ -72,6 +72,8 @@ int main() arcomplex *valA, *valB; // pointers to arrays that store // the elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating complex matrices A and B. n = 100; @@ -84,7 +86,7 @@ int main() // Defining what we need: the four eigenvectors nearest to sigma. - ARluCompGenEig dprob(4L, A, B, arcomplex(10.0,0.0)); + ARluCompGenEig dprob(nev, A, B, arcomplex(10.0,0.0)); // Finding eigenvalues and eigenvectors. @@ -94,5 +96,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/complex/bcompreg.cc b/examples/band/complex/bcompreg.cc index a8dbec6..d802a55 100644 --- a/examples/band/complex/bcompreg.cc +++ b/examples/band/complex/bcompreg.cc @@ -62,6 +62,8 @@ int main() arcomplex* valA; // pointer to an array that stores // the elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a complex matrix. nx = 10; @@ -70,7 +72,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluCompStdEig dprob(4L, A); + ARluCompStdEig dprob(nev, A); // Finding eigenvalues and eigenvectors. @@ -80,5 +82,8 @@ int main() Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/band/complex/bcompshf.cc b/examples/band/complex/bcompshf.cc index c33201c..f7c3a0f 100644 --- a/examples/band/complex/bcompshf.cc +++ b/examples/band/complex/bcompshf.cc @@ -69,6 +69,8 @@ int main() arcomplex* valA; // pointer to an array that stores // the elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a complex matrix. nx = 10; @@ -77,7 +79,7 @@ int main() // Defining what we need: the four eigenvectors of F nearest to 0.0. - ARluCompStdEig dprob(4L, A, arcomplex(0.0, 0.0)); + ARluCompStdEig dprob(nev, A, arcomplex(0.0, 0.0)); // Finding eigenvalues and eigenvectors. @@ -87,5 +89,8 @@ int main() Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/nonsym/bnsymgre.cc b/examples/band/nonsym/bnsymgre.cc index d8d1e47..29b9fba 100644 --- a/examples/band/nonsym/bnsymgre.cc +++ b/examples/band/nonsym/bnsymgre.cc @@ -70,6 +70,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -82,7 +84,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluNonSymGenEig dprob(4L, A, B); + ARluNonSymGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -92,5 +94,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/nonsym/bnsymgsc.cc b/examples/band/nonsym/bnsymgsc.cc index 4b87051..749cdda 100644 --- a/examples/band/nonsym/bnsymgsc.cc +++ b/examples/band/nonsym/bnsymgsc.cc @@ -74,6 +74,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. nx = 10; @@ -86,7 +88,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 0.4+0.6I. - ARluNonSymGenEig dprob(4L, A, B, 'I', 0.4, 0.6); + ARluNonSymGenEig dprob(nev, A, B, 'I', 0.4, 0.6); // Finding eigenvalues and eigenvectors. @@ -96,5 +98,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/nonsym/bnsymgsh.cc b/examples/band/nonsym/bnsymgsh.cc index 38292b6..851dfdb 100644 --- a/examples/band/nonsym/bnsymgsh.cc +++ b/examples/band/nonsym/bnsymgsh.cc @@ -70,6 +70,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -82,7 +84,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 0.0. - ARluNonSymGenEig dprob(4L, A, B, 0.0); + ARluNonSymGenEig dprob(nev, A, B, 0.0); // Finding eigenvalues and eigenvectors. @@ -92,5 +94,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/nonsym/bnsymreg.cc b/examples/band/nonsym/bnsymreg.cc index 17d16b5..26522e5 100644 --- a/examples/band/nonsym/bnsymreg.cc +++ b/examples/band/nonsym/bnsymreg.cc @@ -60,6 +60,8 @@ int main() double rho; // Parameter used to define A. double* A; // Pointer to an array that stores the elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -69,7 +71,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluNonSymStdEig dprob(4, matrix, "SM", 20); + ARluNonSymStdEig dprob(nev, matrix, "SM", 20); // Finding eigenvalues and eigenvectors. @@ -79,5 +81,8 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/nonsym/bnsymshf.cc b/examples/band/nonsym/bnsymshf.cc index 8612f50..0726bea 100644 --- a/examples/band/nonsym/bnsymshf.cc +++ b/examples/band/nonsym/bnsymshf.cc @@ -67,6 +67,8 @@ int main() double rho; // Parameter used to define A. double* A; // pointer to an array that stores the elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -76,7 +78,7 @@ int main() // Defining what we need: the four eigenvectors of A nearest to 1000.0. - ARluNonSymStdEig dprob(4L, matrix, 1000.0, "LM", 20); + ARluNonSymStdEig dprob(nev, matrix, 1000.0, "LM", 20); // Finding eigenvalues and eigenvectors. @@ -86,4 +88,7 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/band/nonsym/bsvd.cc b/examples/band/nonsym/bsvd.cc index 77b1ebc..3bd0b12 100644 --- a/examples/band/nonsym/bsvd.cc +++ b/examples/band/nonsym/bsvd.cc @@ -61,6 +61,8 @@ int main() double* valA; // Pointer to an array that stores the elements of A. double* svalue = new double[4]; + int nev = 4; // Number of requested eigenvalues. + // Creating a band matrix with n = 100. n = 100; @@ -76,7 +78,7 @@ int main() // Defining what we need: eigenvalues with largest magnitude. ARSymStdEig > - dprob(n, 4L, &A, &ARbdNonSymMatrix::MultMtMv); + dprob(n, nev, &A, &ARbdNonSymMatrix::MultMtMv); // Finding eigenvalues. @@ -97,5 +99,8 @@ int main() std::cout << " sigma [" << i+1 << "]: " << svalue[i] << std::endl; } + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/sym/bsymgbkl.cc b/examples/band/sym/bsymgbkl.cc index 047e2c6..7317051 100644 --- a/examples/band/sym/bsymgbkl.cc +++ b/examples/band/sym/bsymgbkl.cc @@ -67,6 +67,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -78,7 +80,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 1.0. - ARluSymGenEig dprob('B', 4L, A, B, 1.0); + ARluSymGenEig dprob('B', nev, A, B, 1.0); // Finding eigenvalues and eigenvectors. @@ -88,5 +90,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/sym/bsymgcay.cc b/examples/band/sym/bsymgcay.cc index 8cd1acd..371d452 100644 --- a/examples/band/sym/bsymgcay.cc +++ b/examples/band/sym/bsymgcay.cc @@ -67,6 +67,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -78,7 +80,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 150.0. - ARluSymGenEig dprob('C', 4L, A, B, 150.0); + ARluSymGenEig dprob('C', nev, A, B, 150.0); // Finding eigenvalues and eigenvectors. @@ -88,5 +90,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/sym/bsymgreg.cc b/examples/band/sym/bsymgreg.cc index 7df5d28..3bcf074 100644 --- a/examples/band/sym/bsymgreg.cc +++ b/examples/band/sym/bsymgreg.cc @@ -67,6 +67,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -78,7 +80,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluSymGenEig dprob(4L, A, B); + ARluSymGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -88,5 +90,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/sym/bsymgshf.cc b/examples/band/sym/bsymgshf.cc index 563726d..2b29f57 100644 --- a/examples/band/sym/bsymgshf.cc +++ b/examples/band/sym/bsymgshf.cc @@ -67,6 +67,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -78,7 +80,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 0.0. - ARluSymGenEig dprob('S', 4L, A, B, 0.0); + ARluSymGenEig dprob('S', nev, A, B, 0.0); // Finding eigenvalues and eigenvectors. @@ -88,5 +90,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/sym/bsymreg.cc b/examples/band/sym/bsymreg.cc index 48cce00..b051364 100644 --- a/examples/band/sym/bsymreg.cc +++ b/examples/band/sym/bsymreg.cc @@ -57,6 +57,8 @@ int main() int nsdiag; // Lower (and upper) bandwidth of A. double* A; // Pointer to an array that stores the elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -65,7 +67,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluSymStdEig dprob(4, matrix); + ARluSymStdEig dprob(nev, matrix); // Finding eigenvalues and eigenvectors. @@ -75,5 +77,8 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/band/sym/bsymshf.cc b/examples/band/sym/bsymshf.cc index 64df590..8ea6386 100644 --- a/examples/band/sym/bsymshf.cc +++ b/examples/band/sym/bsymshf.cc @@ -63,6 +63,8 @@ int main() int nsdiag; // Lower (and upper) bandwidth of A. double* A; // Pointer to an array that stores the elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -71,7 +73,7 @@ int main() // Defining what we need: the four eigenvectors of A nearest to 0.0. - ARluSymStdEig dprob(4L, matrix, 0.0); + ARluSymStdEig dprob(nev, matrix, 0.0); // Finding eigenvalues and eigenvectors. @@ -81,4 +83,7 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/cholmod/sym/csymgreg.cc b/examples/cholmod/sym/csymgreg.cc index 63709e0..f6660c2 100644 --- a/examples/cholmod/sym/csymgreg.cc +++ b/examples/cholmod/sym/csymgreg.cc @@ -72,6 +72,8 @@ int main() double *valA, *valB; // pointer to an array that stores the nonzero // elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -83,7 +85,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluSymGenEig dprob(4L, A, B); + ARluSymGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -93,5 +95,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/cholmod/sym/csymgshf.cc b/examples/cholmod/sym/csymgshf.cc index 9df06e1..49abb25 100644 --- a/examples/cholmod/sym/csymgshf.cc +++ b/examples/cholmod/sym/csymgshf.cc @@ -70,6 +70,8 @@ int main() double *valA, *valB; // pointer to an array that stores the nonzero // elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -81,7 +83,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 0.0. - ARluSymGenEig dprob('S', 4L, A, B, 0.0); + ARluSymGenEig dprob('S', nev, A, B, 0.0); // Finding eigenvalues and eigenvectors. @@ -91,5 +93,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/cholmod/sym/csymreg.cc b/examples/cholmod/sym/csymreg.cc index 232b164..ade76e8 100644 --- a/examples/cholmod/sym/csymreg.cc +++ b/examples/cholmod/sym/csymreg.cc @@ -61,6 +61,8 @@ int main() double* A; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -69,7 +71,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluSymStdEig dprob(4, matrix, "SM"); + ARluSymStdEig dprob(nev, matrix, "SM"); // Finding eigenvalues and eigenvectors. @@ -79,4 +81,7 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/cholmod/sym/csymshf.cc b/examples/cholmod/sym/csymshf.cc index 68e6fd4..4131745 100644 --- a/examples/cholmod/sym/csymshf.cc +++ b/examples/cholmod/sym/csymshf.cc @@ -66,6 +66,8 @@ int main() double* A; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. n = 100; @@ -74,7 +76,7 @@ int main() // Defining what we need: the four eigenvectors of A nearest to 1.0. - ARluSymStdEig dprob(4L, matrix, 1.0); + ARluSymStdEig dprob(nev, matrix, 1.0); // Finding eigenvalues and eigenvectors. @@ -84,4 +86,7 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/dense/complex/dcompgre.cc b/examples/dense/complex/dcompgre.cc index 3556b49..d7a8bd4 100644 --- a/examples/dense/complex/dcompgre.cc +++ b/examples/dense/complex/dcompgre.cc @@ -68,6 +68,8 @@ int main() arcomplex *valA, *valB; // pointers to arrays that store // the elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating complex matrices A and B. n = 100; @@ -80,7 +82,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluCompGenEig dprob(4L, A, B); + ARluCompGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -90,4 +92,7 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/complex/dcompgsh.cc b/examples/dense/complex/dcompgsh.cc index 1c3d36d..0fbb297 100644 --- a/examples/dense/complex/dcompgsh.cc +++ b/examples/dense/complex/dcompgsh.cc @@ -68,6 +68,8 @@ int main() arcomplex *valA, *valB; // pointers to arrays that store // the elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating complex matrices A and B. n = 100; @@ -80,7 +82,7 @@ int main() // Defining what we need: the four eigenvectors nearest to sigma. - ARluCompGenEig dprob(4L, A, B, arcomplex(10.0,0.0)); + ARluCompGenEig dprob(nev, A, B, arcomplex(10.0,0.0)); // Finding eigenvalues and eigenvectors. @@ -90,5 +92,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/complex/dcompreg.cc b/examples/dense/complex/dcompreg.cc index 42f998f..47bfeba 100644 --- a/examples/dense/complex/dcompreg.cc +++ b/examples/dense/complex/dcompreg.cc @@ -60,6 +60,8 @@ int main() arcomplex* valA; // pointer to an array that stores // the elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a complex matrix. nx = 10; @@ -68,7 +70,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluCompStdEig dprob(4L, A); + ARluCompStdEig dprob(nev, A); // Finding eigenvalues and eigenvectors. @@ -78,5 +80,8 @@ int main() Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/dense/complex/dcompshf.cc b/examples/dense/complex/dcompshf.cc index 2f8c06f..94b9bb3 100644 --- a/examples/dense/complex/dcompshf.cc +++ b/examples/dense/complex/dcompshf.cc @@ -66,6 +66,8 @@ int main() arcomplex* valA; // pointer to an array that stores // the elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a complex matrix. nx = 10; @@ -74,7 +76,7 @@ int main() // Defining what we need: the four eigenvectors of F nearest to 0.0. - ARluCompStdEig dprob(4L, A, arcomplex(0.0, 0.0)); + ARluCompStdEig dprob(nev, A, arcomplex(0.0, 0.0)); // Finding eigenvalues and eigenvectors. @@ -84,5 +86,8 @@ int main() Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/nonsym/dnsymgre.cc b/examples/dense/nonsym/dnsymgre.cc index ea35a0c..25e06e8 100644 --- a/examples/dense/nonsym/dnsymgre.cc +++ b/examples/dense/nonsym/dnsymgre.cc @@ -66,6 +66,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -78,7 +80,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluNonSymGenEig dprob(4L, A, B); + ARluNonSymGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -88,5 +90,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/nonsym/dnsymgsc.cc b/examples/dense/nonsym/dnsymgsc.cc index 72eb0fb..4809313 100644 --- a/examples/dense/nonsym/dnsymgsc.cc +++ b/examples/dense/nonsym/dnsymgsc.cc @@ -70,6 +70,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. nx = 10; @@ -82,7 +84,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 0.4+0.6I. - ARluNonSymGenEig dprob(4L, A, B, 'I', 0.4, 0.6); + ARluNonSymGenEig dprob(nev, A, B, 'I', 0.4, 0.6); // Finding eigenvalues and eigenvectors. @@ -92,5 +94,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/nonsym/dnsymgsh.cc b/examples/dense/nonsym/dnsymgsh.cc index 63fad0b..d12daa6 100644 --- a/examples/dense/nonsym/dnsymgsh.cc +++ b/examples/dense/nonsym/dnsymgsh.cc @@ -66,6 +66,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -78,7 +80,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 0.0. - ARluNonSymGenEig dprob(4L, A, B, 0.0); + ARluNonSymGenEig dprob(nev, A, B, 0.0); // Finding eigenvalues and eigenvectors. @@ -88,5 +90,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/nonsym/dnsymreg.cc b/examples/dense/nonsym/dnsymreg.cc index 1a9844b..2655615 100644 --- a/examples/dense/nonsym/dnsymreg.cc +++ b/examples/dense/nonsym/dnsymreg.cc @@ -57,6 +57,8 @@ int main() double rho; // Parameter used to define A. double* A; // Pointer to an array that stores the elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -66,7 +68,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluNonSymStdEig dprob(4, matrix, "SM", 20); + ARluNonSymStdEig dprob(nev, matrix, "SM", 20); // Finding eigenvalues and eigenvectors. @@ -76,5 +78,8 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/nonsym/dnsymshf.cc b/examples/dense/nonsym/dnsymshf.cc index ae9bf4b..fa1d7b1 100644 --- a/examples/dense/nonsym/dnsymshf.cc +++ b/examples/dense/nonsym/dnsymshf.cc @@ -64,6 +64,8 @@ int main() double rho; // Parameter used to define A. double* A; // pointer to an array that stores the elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -73,7 +75,7 @@ int main() // Defining what we need: the four eigenvectors of A nearest to 1000.0. - ARluNonSymStdEig dprob(4L, matrix, 1000.0, "LM", 20); + ARluNonSymStdEig dprob(nev, matrix, 1000.0, "LM", 20); // Finding eigenvalues and eigenvectors. @@ -83,4 +85,7 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/dense/nonsym/dsvd.cc b/examples/dense/nonsym/dsvd.cc index b30bbad..dc45434 100644 --- a/examples/dense/nonsym/dsvd.cc +++ b/examples/dense/nonsym/dsvd.cc @@ -57,6 +57,8 @@ int main() double* valA; // Pointer to an array that stores the elements of A. double* svalue = new double[4]; + int nev = 4; // Number of requested eigenvalues. + // Creating a matrix. m = 500; @@ -71,7 +73,7 @@ int main() // Defining what we need: eigenvalues with largest magnitude. ARSymStdEig > - dprob(n, 4L, &A, &ARdsNonSymMatrix::MultMtMv); + dprob(n, nev, &A, &ARdsNonSymMatrix::MultMtMv); // Finding eigenvalues. @@ -92,4 +94,7 @@ int main() std::cout << " sigma [" << i+1 << "]: " << svalue[i] << std::endl; } + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/nonsym/dsvd2.cc b/examples/dense/nonsym/dsvd2.cc index 88c0a55..9093667 100644 --- a/examples/dense/nonsym/dsvd2.cc +++ b/examples/dense/nonsym/dsvd2.cc @@ -58,6 +58,8 @@ int main() int i; double* svalue = new double[4]; + int nev = 4; // Number of requested eigenvalues. + // Using ARdsNonSymMatrix to store matrix data and to // perform the product A'Ax (LU decomposition is not used). @@ -66,7 +68,7 @@ int main() // Defining what we need: eigenvalues with largest magnitude. ARSymStdEig > - dprob(A.ncols(), 4L, &A, &ARdsNonSymMatrix::MultMtMv); + dprob(A.ncols(), nev, &A, &ARdsNonSymMatrix::MultMtMv); // Finding eigenvalues. @@ -87,4 +89,7 @@ int main() std::cout << " sigma [" << i+1 << "]: " << svalue[i] << std::endl; } + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/nonsym/matrix.dat.gz b/examples/dense/nonsym/matrix.dat.gz deleted file mode 100644 index 5a86479..0000000 Binary files a/examples/dense/nonsym/matrix.dat.gz and /dev/null differ diff --git a/examples/dense/nonsym/matrix.zip b/examples/dense/nonsym/matrix.zip new file mode 100644 index 0000000..8a44a9b Binary files /dev/null and b/examples/dense/nonsym/matrix.zip differ diff --git a/examples/dense/sym/dsymgbkl.cc b/examples/dense/sym/dsymgbkl.cc index c957e88..89aaa1c 100644 --- a/examples/dense/sym/dsymgbkl.cc +++ b/examples/dense/sym/dsymgbkl.cc @@ -65,6 +65,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -76,7 +78,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 1.0. - ARluSymGenEig dprob('B', 4L, A, B, 1.0); + ARluSymGenEig dprob('B', nev, A, B, 1.0); // Finding eigenvalues and eigenvectors. @@ -86,5 +88,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/sym/dsymgcay.cc b/examples/dense/sym/dsymgcay.cc index 5e02804..369182b 100644 --- a/examples/dense/sym/dsymgcay.cc +++ b/examples/dense/sym/dsymgcay.cc @@ -65,6 +65,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -76,7 +78,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 150.0. - ARluSymGenEig dprob('C', 4L, A, B, 150.0); + ARluSymGenEig dprob('C', nev, A, B, 150.0); // Finding eigenvalues and eigenvectors. @@ -86,5 +88,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/sym/dsymgreg.cc b/examples/dense/sym/dsymgreg.cc index 1111f87..214e048 100644 --- a/examples/dense/sym/dsymgreg.cc +++ b/examples/dense/sym/dsymgreg.cc @@ -65,6 +65,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -76,7 +78,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluSymGenEig dprob(4L, A, B); + ARluSymGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -86,5 +88,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/sym/dsymgshf.cc b/examples/dense/sym/dsymgshf.cc index b061ccd..de54a11 100644 --- a/examples/dense/sym/dsymgshf.cc +++ b/examples/dense/sym/dsymgshf.cc @@ -65,6 +65,8 @@ int main() double* valA; // pointer to an array that stores the elements of A. double* valB; // pointer to an array that stores the elements of B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -76,7 +78,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 0.0. - ARluSymGenEig dprob('S', 4L, A, B, 0.0); + ARluSymGenEig dprob('S', nev, A, B, 0.0); // Finding eigenvalues and eigenvectors. @@ -86,5 +88,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/sym/dsymreg.cc b/examples/dense/sym/dsymreg.cc index a137171..18af86f 100644 --- a/examples/dense/sym/dsymreg.cc +++ b/examples/dense/sym/dsymreg.cc @@ -57,6 +57,8 @@ int main() double* A; // Pointer to an array that stores the lower triangular // elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -65,7 +67,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluSymStdEig dprob(4, matrix); + ARluSymStdEig dprob(nev, matrix); // Finding eigenvalues and eigenvectors. @@ -75,4 +77,7 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/dense/sym/dsymshf.cc b/examples/dense/sym/dsymshf.cc index 294abb4..8bf43db 100644 --- a/examples/dense/sym/dsymshf.cc +++ b/examples/dense/sym/dsymshf.cc @@ -62,6 +62,8 @@ int main() int n; // Dimension of the problem. double* A; // Pointer to an array that stores the elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -70,7 +72,7 @@ int main() // Defining what we need: the four eigenvectors of A nearest to 1.0. - ARluSymStdEig dprob(4L, matrix, 1.0); + ARluSymStdEig dprob(nev, matrix, 1.0); // Finding eigenvalues and eigenvectors. @@ -80,4 +82,7 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/harwell/complex/hcompgen.cc b/examples/harwell/complex/hcompgen.cc index 3f6dc73..abffb84 100644 --- a/examples/harwell/complex/hcompgen.cc +++ b/examples/harwell/complex/hcompgen.cc @@ -210,5 +210,8 @@ int main(int argc, char* argv[]) Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/harwell/complex/hcompstd.cc b/examples/harwell/complex/hcompstd.cc index faeab0d..9ae1edd 100644 --- a/examples/harwell/complex/hcompstd.cc +++ b/examples/harwell/complex/hcompstd.cc @@ -206,5 +206,8 @@ int main(int argc, char* argv[]) Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/harwell/complex/mhd1280a.cua.gz b/examples/harwell/complex/mhd1280a.cua.gz deleted file mode 100644 index 1faf54a..0000000 Binary files a/examples/harwell/complex/mhd1280a.cua.gz and /dev/null differ diff --git a/examples/harwell/complex/mhd1280a.zip b/examples/harwell/complex/mhd1280a.zip new file mode 100644 index 0000000..d5d805f Binary files /dev/null and b/examples/harwell/complex/mhd1280a.zip differ diff --git a/examples/harwell/complex/mhd1280b.cua.gz b/examples/harwell/complex/mhd1280b.cua.gz deleted file mode 100644 index f62495e..0000000 Binary files a/examples/harwell/complex/mhd1280b.cua.gz and /dev/null differ diff --git a/examples/harwell/complex/mhd1280b.zip b/examples/harwell/complex/mhd1280b.zip new file mode 100644 index 0000000..5d5815d Binary files /dev/null and b/examples/harwell/complex/mhd1280b.zip differ diff --git a/examples/harwell/nonsym/hnsymgen.cc b/examples/harwell/nonsym/hnsymgen.cc index 4b39b9a..4024c9b 100644 --- a/examples/harwell/nonsym/hnsymgen.cc +++ b/examples/harwell/nonsym/hnsymgen.cc @@ -224,5 +224,8 @@ int main(int argc, char* argv[]) Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/harwell/nonsym/hnsymstd.cc b/examples/harwell/nonsym/hnsymstd.cc index 3270af3..42c125e 100644 --- a/examples/harwell/nonsym/hnsymstd.cc +++ b/examples/harwell/nonsym/hnsymstd.cc @@ -199,4 +199,7 @@ int main(int argc, char* argv[]) Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/harwell/sym/hsymgen.cc b/examples/harwell/sym/hsymgen.cc index 3c27819..eb094cc 100644 --- a/examples/harwell/sym/hsymgen.cc +++ b/examples/harwell/sym/hsymgen.cc @@ -226,5 +226,8 @@ int main(int argc, char* argv[]) Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/harwell/sym/hsymstd.cc b/examples/harwell/sym/hsymstd.cc index a6bd80d..8a0b117 100644 --- a/examples/harwell/sym/hsymstd.cc +++ b/examples/harwell/sym/hsymstd.cc @@ -199,5 +199,8 @@ int main(int argc, char* argv[]) Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/product/complex/compgreg.cc b/examples/product/complex/compgreg.cc index f65bbf7..5b74f63 100644 --- a/examples/product/complex/compgreg.cc +++ b/examples/product/complex/compgreg.cc @@ -53,8 +53,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a complex problem with n = 100. @@ -65,7 +66,7 @@ void Test(T type) // P.B.MultMv is the function that performs the product w <- Bv. ARCompGenEig, ComplexMatrixD > - dprob(P.A.ncols(), 4, &P, &ComplexGenProblemA::MultOPv, + dprob(P.A.ncols(), nev, &P, &ComplexGenProblemA::MultOPv, &P.B, &ComplexMatrixD::MultMv); // Finding eigenvalues and eigenvectors. @@ -76,23 +77,29 @@ void Test(T type) Solution(P.A, P.B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a single precision problem with n = 100. #ifndef __SUNPRO_CC - Test((float)0.0); + ret |= Test((float)0.0); #endif // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); + + return ret; } // main diff --git a/examples/product/complex/compgshf.cc b/examples/product/complex/compgshf.cc index 7d8ed1f..2916f48 100644 --- a/examples/product/complex/compgshf.cc +++ b/examples/product/complex/compgshf.cc @@ -52,8 +52,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a complex problem with n = 100, rho = 10, sigma = 1. @@ -65,7 +66,7 @@ void Test(T type) // P.MultBv is the function that performs the product w <- Bv. ARCompGenEig, ComplexGenProblemB > - dprob(P.A.ncols(), 4, &P, &ComplexGenProblemB::MultOPv, &P, + dprob(P.A.ncols(), nev, &P, &ComplexGenProblemB::MultOPv, &P, &ComplexGenProblemB::MultBv, arcomplex(1.0,0.0)); // Finding eigenvalues and eigenvectors. @@ -76,23 +77,29 @@ void Test(T type) Solution(P.A, P.B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a single precision problem with n = 100. #ifndef __SUNPRO_CC - Test((float)0.0); + ret |= Test((float)0.0); #endif // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); + + return ret; } // main diff --git a/examples/product/complex/compreg.cc b/examples/product/complex/compreg.cc index 02c0d7b..ba70431 100644 --- a/examples/product/complex/compreg.cc +++ b/examples/product/complex/compreg.cc @@ -48,8 +48,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a complex matrix. @@ -59,7 +60,7 @@ void Test(T type) // A.MultMv is the function that performs the product w <- A.v. ARCompStdEig > - dprob(A.ncols(), 4, &A, &CompMatrixA::MultMv); + dprob(A.ncols(), nev, &A, &CompMatrixA::MultMv); // Finding eigenvalues and eigenvectors. @@ -69,24 +70,30 @@ void Test(T type) Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { - - // Solving a double precision problem with n = 100. - - Test((double)0.0); + int ret = 0; // Solving a single precision problem with n = 100. #ifndef __SUNPRO_CC - Test((float)0.0); + ret |= Test((float)0.0); #endif + // Solving a double precision problem with n = 100. + + ret |= Test((double)0.0); + + return ret; + } // main diff --git a/examples/product/complex/compshf.cc b/examples/product/complex/compshf.cc index fb58fa6..70a034b 100644 --- a/examples/product/complex/compshf.cc +++ b/examples/product/complex/compshf.cc @@ -50,8 +50,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a complex matrix (n = 100, shift = 0, rho = 10). @@ -61,7 +62,7 @@ void Test(T type) // A.MultOPv is the function that performs the product w <- OPv. ARCompStdEig > - dprob(A.ncols(), 4, &A, &CompMatrixB::MultOPv, arcomplex(0.0, 0.0)); + dprob(A.ncols(), nev, &A, &CompMatrixB::MultOPv, arcomplex(0.0, 0.0)); // Finding eigenvalues and eigenvectors. @@ -71,23 +72,29 @@ void Test(T type) Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a single precision problem with n = 100. #ifndef __SUNPRO_CC - Test((float)0.0); + ret |= Test((float)0.0); #endif // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); + + return ret; } // main diff --git a/examples/product/nonsym/nsymgreg.cc b/examples/product/nonsym/nsymgreg.cc index 38f4a54..146b9ac 100644 --- a/examples/product/nonsym/nsymgreg.cc +++ b/examples/product/nonsym/nsymgreg.cc @@ -52,8 +52,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating Eig A*x = lambda*B*x. @@ -64,7 +65,7 @@ void Test(T type) // P.B.MultMv is the function that performs the product w <- Bv. ARNonSymGenEig, NonSymMatrixD > - dprob(P.A.ncols(), 4, &P, &NonSymGenProblemA::MultOPv, + dprob(P.A.ncols(), nev, &P, &NonSymGenProblemA::MultOPv, &P.B, &NonSymMatrixD::MultMv); // Finding eigenvalues and eigenvectors. @@ -75,19 +76,25 @@ void Test(T type) Solution(P.A, P.B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/product/nonsym/nsymgsci.cc b/examples/product/nonsym/nsymgsci.cc index fa3ccda..b13d3ec 100644 --- a/examples/product/nonsym/nsymgsci.cc +++ b/examples/product/nonsym/nsymgsci.cc @@ -51,8 +51,9 @@ #include "argnsym.h" template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating Eig A*x = lambda*B*x. @@ -66,7 +67,7 @@ void Test(T type) // the imaginary part of OP*v. ARNonSymGenEig, NonSymGenProblemC > - dprob(P.A.ncols(), 4, &P, &NonSymGenProblemC::MultOPvIm, + dprob(P.A.ncols(), nev, &P, &NonSymGenProblemC::MultOPvIm, &P, &NonSymGenProblemC::MultAv, &P, &NonSymGenProblemC::MultBv, 'I', 0.4, 0.6); @@ -78,23 +79,29 @@ void Test(T type) Solution(P.A, P.B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { - - // Solving a double precision problem with n = 100. - - Test((double)0.0); + int ret = 0; // Solving a single precision problem with n = 100. #ifndef __SUNPRO_CC - Test((float)0.0); + ret |= Test((float)0.0); #endif + // Solving a double precision problem with n = 100. + + ret |= Test((double)0.0); + + return ret; + } // main diff --git a/examples/product/nonsym/nsymgscr.cc b/examples/product/nonsym/nsymgscr.cc index 559321a..a88a927 100644 --- a/examples/product/nonsym/nsymgscr.cc +++ b/examples/product/nonsym/nsymgscr.cc @@ -52,8 +52,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating Eig A*x = lambda*B*x. @@ -67,7 +68,7 @@ void Test(T type) // the real part of OP*v. ARNonSymGenEig, NonSymGenProblemC > - dprob(P.A.ncols(), 4, &P, &NonSymGenProblemC::MultOPvRe, + dprob(P.A.ncols(), nev, &P, &NonSymGenProblemC::MultOPvRe, &P, &NonSymGenProblemC::MultAv, &P, &NonSymGenProblemC::MultBv, 'R', 0.4, 0.6); @@ -79,23 +80,29 @@ void Test(T type) Solution(P.A, P.B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a single precision problem with n = 100. #ifndef __SUNPRO_CC - Test((float)0.0); + ret |= Test((float)0.0); #endif // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); + + return ret; } // main diff --git a/examples/product/nonsym/nsymgshf.cc b/examples/product/nonsym/nsymgshf.cc index e40d739..9865357 100644 --- a/examples/product/nonsym/nsymgshf.cc +++ b/examples/product/nonsym/nsymgshf.cc @@ -51,8 +51,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating Eig A*x = lambda*B*x. @@ -63,7 +64,7 @@ void Test(T type) // P.MultBv is the function that performs the product w <- Bv. ARNonSymGenEig, NonSymGenProblemB > - dprob(P.A.ncols(), 4, &P, &NonSymGenProblemB::MultOPv, + dprob(P.A.ncols(), nev, &P, &NonSymGenProblemB::MultOPv, &P, &NonSymGenProblemB::MultBv, 1.0); // Finding eigenvalues and eigenvectors. @@ -74,19 +75,25 @@ void Test(T type) Solution(P.A, P.B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/product/nonsym/nsymreg.cc b/examples/product/nonsym/nsymreg.cc index 9e074a4..4c24ece 100644 --- a/examples/product/nonsym/nsymreg.cc +++ b/examples/product/nonsym/nsymreg.cc @@ -48,8 +48,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a nonsymetric matrix. @@ -59,7 +60,7 @@ void Test(T type) // A.MultMv is the function that performs the product w <- A.v. ARNonSymStdEig > - dprob(A.ncols(), 4, &A, &NonSymMatrixA::MultMv); + dprob(A.ncols(), nev, &A, &NonSymMatrixA::MultMv); // Finding eigenvalues and eigenvectors. @@ -69,19 +70,25 @@ void Test(T type) Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; - // Solving a single precision problem with n = 100. + // Solving a double precision problem with n = 100. - Test((float)0.0); + ret |= Test((double)0.0); - // Solving a double precision problem with n = 100. + // Solving a single precision problem with n = 100. - Test((double)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/product/nonsym/nsymshf.cc b/examples/product/nonsym/nsymshf.cc index 3e38e49..cd3a4f5 100644 --- a/examples/product/nonsym/nsymshf.cc +++ b/examples/product/nonsym/nsymshf.cc @@ -49,8 +49,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a nonsymmetric matrix. @@ -60,7 +61,7 @@ void Test(T type) // A.MultOPv is the function that performs the product w <- OPv. ARNonSymStdEig > - dprob(A.ncols(), 4, &A, &NonSymMatrixB::MultOPv, 1.0); + dprob(A.ncols(), nev, &A, &NonSymMatrixB::MultOPv, 1.0); // Finding eigenvalues and eigenvectors. @@ -70,19 +71,25 @@ void Test(T type) Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/product/nonsym/svd.cc b/examples/product/nonsym/svd.cc index f24aa8a..fe88992 100644 --- a/examples/product/nonsym/svd.cc +++ b/examples/product/nonsym/svd.cc @@ -49,8 +49,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a nonsymetric matrix. @@ -61,7 +62,7 @@ void Test(T type) // w <- (A'*A).v. ARNonSymStdEig > - dprob(A.ncols(), 4, &A, &NonSymMatrixV::MultOPv); + dprob(A.ncols(), nev, &A, &NonSymMatrixV::MultOPv); // Finding eigenvalues and eigenvectors. @@ -73,19 +74,25 @@ void Test(T type) Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((float)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((double)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/product/simple/symsimp.cc b/examples/product/simple/symsimp.cc index 360874c..89653c4 100644 --- a/examples/product/simple/symsimp.cc +++ b/examples/product/simple/symsimp.cc @@ -187,10 +187,9 @@ void Solution(SymMatrix &A, EIGPROB &Prob) } // Solution -void SimpleTest() +int SimpleTest() { - - int nconv; + int nev = 4; // Number of requested eigenvalues. // Creating a double precision 100x100 matrix. @@ -199,7 +198,7 @@ void SimpleTest() // Defining what we need: the four eigenvectors of A with smallest magnitude. ARSymStdEig > - dprob(A.ncols(), 4, &A, &SymMatrix::MultMv, "SM"); + dprob(A.ncols(), nev, &A, &SymMatrix::MultMv, "SM"); /* It is possible to pass other parameters directly to the constructor @@ -213,7 +212,7 @@ void SimpleTest() // Finding eigenvectors. - nconv = dprob.FindEigenvectors(); + int nconv = dprob.FindEigenvectors(); /* FindEigenvalues, FindArnoldiBasis and FindSchurVectors @@ -228,6 +227,7 @@ void SimpleTest() Solution(A, dprob); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // SimpleTest @@ -236,7 +236,7 @@ int main() // Solving a double precision problem with n = 100. - SimpleTest(); + return SimpleTest(); } // main diff --git a/examples/product/sym/symgbklg.cc b/examples/product/sym/symgbklg.cc index 567a9da..611b639 100644 --- a/examples/product/sym/symgbklg.cc +++ b/examples/product/sym/symgbklg.cc @@ -50,8 +50,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a symmetric generalized problem with n = 100. @@ -64,7 +65,7 @@ void Test(T type) // buckling mode. ARSymGenEig, SymGenProblemB > - dprob('B', P.A.ncols(), 4, &P, &SymGenProblemB::MultOPv, + dprob('B', P.A.ncols(), nev, &P, &SymGenProblemB::MultOPv, &P, &SymGenProblemB::MultAv, 1.0); // Finding eigenvalues and eigenvectors. @@ -75,19 +76,25 @@ void Test(T type) Solution(P.A, P.B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/product/sym/symgcayl.cc b/examples/product/sym/symgcayl.cc index 1908ba4..8c70a62 100644 --- a/examples/product/sym/symgcayl.cc +++ b/examples/product/sym/symgcayl.cc @@ -50,8 +50,9 @@ #include "argsym.h" template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a symmetric generalized problem with n = 100. @@ -65,7 +66,7 @@ void Test(T type) // Cayley mode. ARSymGenEig, SymGenProblemB > - dprob(P.A.ncols(), 4, &P, &SymGenProblemB::MultOPv, &P, + dprob(P.A.ncols(), nev, &P, &SymGenProblemB::MultOPv, &P, &SymGenProblemB::MultAv, &P, &SymGenProblemB::MultBv, 150.0); // Finding eigenvalues and eigenvectors. @@ -76,19 +77,25 @@ void Test(T type) Solution(P.A, P.B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/product/sym/symgreg.cc b/examples/product/sym/symgreg.cc index eaa8668..90ff06f 100644 --- a/examples/product/sym/symgreg.cc +++ b/examples/product/sym/symgreg.cc @@ -51,9 +51,9 @@ #include "argsym.h" template -void Test(T type) +int Test(T type) { - + int nev = 4; // Number of requested eigenvalues. // Creating Eig A*x = lambda*B*x. @@ -64,7 +64,7 @@ void Test(T type) // P.B.MultMv is the function that performs the product w <- Bv. ARSymGenEig, SymMatrixD > - dprob(P.A.ncols(), 4, &P, &SymGenProblemA::MultOPv, + dprob(P.A.ncols(), nev, &P, &SymGenProblemA::MultOPv, &P.B, &SymMatrixD::MultMv); // Finding eigenvalues and eigenvectors. @@ -75,19 +75,25 @@ void Test(T type) Solution(P.A, P.B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/product/sym/symgshft.cc b/examples/product/sym/symgshft.cc index 949d6eb..c944f5d 100644 --- a/examples/product/sym/symgshft.cc +++ b/examples/product/sym/symgshft.cc @@ -50,8 +50,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a symmetric generalized problem with n = 100. @@ -64,7 +65,7 @@ void Test(T type) // shift and invert mode. ARSymGenEig, SymGenProblemB > - dprob('S', P.A.ncols(), 4L, &P, &SymGenProblemB::MultOPv, + dprob('S', P.A.ncols(), nev, &P, &SymGenProblemB::MultOPv, &P, &SymGenProblemB::MultBv, 0.0); // Finding eigenvalues and eigenvectors. @@ -75,19 +76,24 @@ void Test(T type) Solution(P.A, P.B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); - + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/product/sym/symreg.cc b/examples/product/sym/symreg.cc index 2c50cf2..2990df9 100644 --- a/examples/product/sym/symreg.cc +++ b/examples/product/sym/symreg.cc @@ -45,8 +45,9 @@ #include "symsol.h" template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a symmetric matrix. @@ -56,7 +57,7 @@ void Test(T type) // A.MultMv is the function that performs the product w <- A.v. ARSymStdEig > - dprob(A.ncols(), 4L, &A, &SymMatrixA::MultMv, "SM"); + dprob(A.ncols(), nev, &A, &SymMatrixA::MultMv, "SM"); // Finding eigenvalues and eigenvectors. @@ -66,19 +67,25 @@ void Test(T type) Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main. diff --git a/examples/product/sym/symshft.cc b/examples/product/sym/symshft.cc index fd21029..3165535 100644 --- a/examples/product/sym/symshft.cc +++ b/examples/product/sym/symshft.cc @@ -47,8 +47,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a symmetric matrix. @@ -58,7 +59,7 @@ void Test(T type) // A.MultOPv is the function that performs the product w <- OPv. ARSymStdEig > - dprob(A.ncols(), 4, &A, &SymMatrixB::MultOPv, 0.0); + dprob(A.ncols(), nev, &A, &SymMatrixB::MultOPv, 0.0); // Finding eigenvalues and eigenvectors. @@ -68,19 +69,25 @@ void Test(T type) Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/reverse/complex/rcompgre.cc b/examples/reverse/complex/rcompgre.cc index bf5e357..b925b27 100644 --- a/examples/reverse/complex/rcompgre.cc +++ b/examples/reverse/complex/rcompgre.cc @@ -68,8 +68,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Defining a complex pencil with n = 100. @@ -78,7 +79,7 @@ void Test(T type) // Creating a complex eigenvalue problem and defining what we need: // the four eigenvectors with largest magnitude. - ARrcCompGenEig prob(P.A.ncols(), 4L); + ARrcCompGenEig prob(P.A.ncols(), nev); // Finding an Arnoldi basis. @@ -117,23 +118,29 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a single precision problem with n = 100. #ifndef __SUNPRO_CC - Test((float)0.0); + ret |= Test((float)0.0); #endif // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); + + return ret; } // main diff --git a/examples/reverse/complex/rcompgsh.cc b/examples/reverse/complex/rcompgsh.cc index 7b815f5..87db410 100644 --- a/examples/reverse/complex/rcompgsh.cc +++ b/examples/reverse/complex/rcompgsh.cc @@ -67,8 +67,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Defining a temporary vector. @@ -81,7 +82,7 @@ void Test(T type) // Creating a complex eigenvalue problem and defining what we need: // the four eigenvectors nearest to 1.0. - ARrcCompGenEig prob(P.A.ncols(), 4L, arcomplex(1.0,0.0)); + ARrcCompGenEig prob(P.A.ncols(), nev, arcomplex(1.0,0.0)); // Finding an Arnoldi basis. @@ -131,23 +132,29 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a single precision problem with n = 100. #ifndef __SUNPRO_CC - Test((float)0.0); + ret |= Test((float)0.0); #endif // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); + + return ret; } // main diff --git a/examples/reverse/complex/rcompreg.cc b/examples/reverse/complex/rcompreg.cc index 4123fb0..a691511 100644 --- a/examples/reverse/complex/rcompreg.cc +++ b/examples/reverse/complex/rcompreg.cc @@ -64,8 +64,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Defining a complex matrix. @@ -74,7 +75,7 @@ void Test(T type) // Creating a complex eigenvalue problem and defining what we need: // the four eigenvectors of A with largest magnitude. - ARrcCompStdEig prob(A.ncols(), 4L); + ARrcCompStdEig prob(A.ncols(), nev); // Finding an Arnoldi basis. @@ -107,23 +108,29 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a single precision problem with n = 100. #ifndef __SUNPRO_CC - Test((float)0.0); + ret |= Test((float)0.0); #endif // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); + + return ret; } // main diff --git a/examples/reverse/complex/rcompshf.cc b/examples/reverse/complex/rcompshf.cc index e37045f..e4815a6 100644 --- a/examples/reverse/complex/rcompshf.cc +++ b/examples/reverse/complex/rcompshf.cc @@ -63,8 +63,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a complex matrix (n = 100, shift = 0, rho = 10). @@ -73,7 +74,7 @@ void Test(T type) // Creating a complex eigenvalue problem and defining what we need: // the four eigenvectors of A nearest to 0.0. - ARrcCompStdEig prob(A.ncols(), 4, arcomplex(0.0, 0.0)); + ARrcCompStdEig prob(A.ncols(), nev, arcomplex(0.0, 0.0)); // Finding an Arnoldi basis. @@ -105,23 +106,29 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a single precision problem with n = 100. #ifndef __SUNPRO_CC - Test((float)0.0); + ret |= Test((float)0.0); #endif // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); + + return ret; } // main diff --git a/examples/reverse/nonsym/rnsymgre.cc b/examples/reverse/nonsym/rnsymgre.cc index 3190e97..ab27331 100644 --- a/examples/reverse/nonsym/rnsymgre.cc +++ b/examples/reverse/nonsym/rnsymgre.cc @@ -65,8 +65,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a pencil. @@ -75,7 +76,7 @@ void Test(T type) // Creating a nonsymmetric eigenvalue problem and defining what we need: // the four eigenvectors with largest magnitude. - ARrcNonSymGenEig prob(P.A.ncols(), 4L); + ARrcNonSymGenEig prob(P.A.ncols(), nev); // Finding an Arnoldi basis. @@ -114,19 +115,25 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/reverse/nonsym/rnsymgsc.cc b/examples/reverse/nonsym/rnsymgsc.cc index cba8d9d..5deec26 100644 --- a/examples/reverse/nonsym/rnsymgsc.cc +++ b/examples/reverse/nonsym/rnsymgsc.cc @@ -151,10 +151,9 @@ void RecoverEigenvalues(long nconv, NonSymGenProblemC& P, template -void Test(T type) +int Test(T type) { - - long nconv; + int nev = 4; // Number of requested eigenvalues. // Defining a temporary vector. @@ -169,7 +168,7 @@ void Test(T type) // the dimension of the problem. 4 is the number of eigenvalues // sought and 0.4 + 0.6I is the shift. - ARrcNonSymGenEig prob(P.A.ncols(), 4L, 'R', 0.4, 0.6); + ARrcNonSymGenEig prob(P.A.ncols(), nev, 'R', 0.4, 0.6); // Finding an Arnoldi basis. @@ -213,7 +212,7 @@ void Test(T type) // Finding eigenvalues and eigenvectors. - nconv = prob.FindEigenvectors(); + int nconv = prob.FindEigenvectors(); // Recovering eigenvalues of the original problem // using the Rayleigh quotient. @@ -225,23 +224,27 @@ void Test(T type) Solution(prob); + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a single precision problem with n = 100. #ifndef __SUNPRO_CC - Test((float)0.0); + ret |= Test((float)0.0); #endif // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); + + return ret; } // main diff --git a/examples/reverse/nonsym/rnsymgsh.cc b/examples/reverse/nonsym/rnsymgsh.cc index 10cb7f9..6d81a6a 100644 --- a/examples/reverse/nonsym/rnsymgsh.cc +++ b/examples/reverse/nonsym/rnsymgsh.cc @@ -66,8 +66,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Defining a temporary vector. @@ -80,7 +81,7 @@ void Test(T type) // Creating a nonsymmetric eigenvalue problem and defining what we need: // the four eigenvectors with largest magnitude. - ARrcNonSymGenEig prob(P.A.ncols(), 4L, 1.0); + ARrcNonSymGenEig prob(P.A.ncols(), nev, 1.0); // Finding an Arnoldi basis. @@ -130,19 +131,25 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/reverse/nonsym/rnsymreg.cc b/examples/reverse/nonsym/rnsymreg.cc index 15740f3..2037929 100644 --- a/examples/reverse/nonsym/rnsymreg.cc +++ b/examples/reverse/nonsym/rnsymreg.cc @@ -62,8 +62,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Defining a nonsymetric matrix. @@ -72,7 +73,7 @@ void Test(T type) // Creating a nonsymmetric eigenvalue problem and defining what we need: // the four eigenvectors of A with largest magnitude. - ARrcNonSymStdEig prob(A.ncols(), 4L); + ARrcNonSymStdEig prob(A.ncols(), nev); // Finding an Arnoldi basis. @@ -105,19 +106,25 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; - // Solving a single precision problem with n = 100. + // Solving a double precision problem with n = 100. - Test((float)0.0); + ret |= Test((double)0.0); - // Solving a double precision problem with n = 100. + // Solving a single precision problem with n = 100. - Test((double)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/reverse/nonsym/rnsymshf.cc b/examples/reverse/nonsym/rnsymshf.cc index 8b56189..e2a9a32 100644 --- a/examples/reverse/nonsym/rnsymshf.cc +++ b/examples/reverse/nonsym/rnsymshf.cc @@ -62,8 +62,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Defining a nonsymmetric matrix. @@ -72,7 +73,7 @@ void Test(T type) // Creating a nonsymmetric eigenvalue problem and defining what we need: // the four eigenvectors of B nearest to 1.0. - ARrcNonSymStdEig prob(B.ncols(), 4, (T)1.0); + ARrcNonSymStdEig prob(B.ncols(), nev, (T)1.0); // Finding an Arnoldi basis. @@ -105,19 +106,25 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/reverse/nonsym/rsvd.cc b/examples/reverse/nonsym/rsvd.cc index 0212d3a..5104b96 100644 --- a/examples/reverse/nonsym/rsvd.cc +++ b/examples/reverse/nonsym/rsvd.cc @@ -63,8 +63,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Defining a nonsymetric matrix. @@ -73,7 +74,7 @@ void Test(T type) // Creating a nonsymmetric eigenvalue problem and defining what we need: // the four eigenvectors of (A'*A) with largest magnitude. - ARrcNonSymStdEig prob(A.ncols(), 4L); + ARrcNonSymStdEig prob(A.ncols(), nev); // Finding an Arnoldi basis. @@ -106,19 +107,25 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((float)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((double)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/reverse/sym/rsymgbkl.cc b/examples/reverse/sym/rsymgbkl.cc index 56ced31..0c61a68 100644 --- a/examples/reverse/sym/rsymgbkl.cc +++ b/examples/reverse/sym/rsymgbkl.cc @@ -65,8 +65,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Defining a temporary vector. @@ -81,7 +82,7 @@ void Test(T type) // dimension of the problem. 4 is the number of eigenvalues // sought and 1.0 is the shift. - ARrcSymGenEig prob('B', P.A.ncols(), 4L, 1.0); + ARrcSymGenEig prob('B', P.A.ncols(), nev, 1.0); // Finding an Arnoldi basis. @@ -131,19 +132,25 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/reverse/sym/rsymgcay.cc b/examples/reverse/sym/rsymgcay.cc index fff9a4e..b173e6b 100644 --- a/examples/reverse/sym/rsymgcay.cc +++ b/examples/reverse/sym/rsymgcay.cc @@ -68,8 +68,9 @@ #include "arrgsym.h" template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Defining two temporary vectors. @@ -84,7 +85,7 @@ void Test(T type) // the dimension of the problem. 4 is the number of eigenvalues // sought and 150.0 is the shift. - ARrcSymGenEig prob('C', P.A.ncols(), 4L, 150.0); + ARrcSymGenEig prob('C', P.A.ncols(), nev, 150.0); // Finding an Arnoldi basis. @@ -139,19 +140,25 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/reverse/sym/rsymgreg.cc b/examples/reverse/sym/rsymgreg.cc index 29e8d2c..8399a9a 100644 --- a/examples/reverse/sym/rsymgreg.cc +++ b/examples/reverse/sym/rsymgreg.cc @@ -65,8 +65,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a pencil. @@ -75,7 +76,7 @@ void Test(T type) // Creating a symmetric eigenvalue problem and defining what we need: // the four eigenvectors with largest magnitude. - ARrcSymGenEig prob(P.A.ncols(), 4L); + ARrcSymGenEig prob(P.A.ncols(), nev); // Finding an Arnoldi basis. @@ -114,18 +115,24 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test int main() { + int ret = 0; - // Solving a single precision problem with n = 100. + // Solving a double precision problem with n = 100. - Test((float)0.0); + ret |= Test((double)0.0); - // Solving a double precision problem with n = 100. + // Solving a single precision problem with n = 100. - Test((double)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/reverse/sym/rsymgshf.cc b/examples/reverse/sym/rsymgshf.cc index 7298211..a7448cd 100644 --- a/examples/reverse/sym/rsymgshf.cc +++ b/examples/reverse/sym/rsymgshf.cc @@ -65,8 +65,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Defining a temporary vector. @@ -81,7 +82,7 @@ void Test(T type) // the dimension of the problem. 4 is the number of eigenvalues // sought and 0.0 is the shift. - ARrcSymGenEig prob('S', P.A.ncols(), 4L, 0.0); + ARrcSymGenEig prob('S', P.A.ncols(), nev, 0.0); // Finding an Arnoldi basis. @@ -131,18 +132,24 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/reverse/sym/rsymreg.cc b/examples/reverse/sym/rsymreg.cc index cfecf7e..19e53c0 100644 --- a/examples/reverse/sym/rsymreg.cc +++ b/examples/reverse/sym/rsymreg.cc @@ -60,8 +60,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Defining a matrix. @@ -70,7 +71,7 @@ void Test(T type) // Creating a symmetric eigenvalue problem and defining what we need: // the four eigenvectors of A with smallest magnitude. - ARrcSymStdEig prob(A.ncols(), 4L, "SM"); + ARrcSymStdEig prob(A.ncols(), nev, "SM"); // Finding an Arnoldi basis. @@ -103,19 +104,25 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/reverse/sym/rsymshf.cc b/examples/reverse/sym/rsymshf.cc index b3167d0..3c2373f 100644 --- a/examples/reverse/sym/rsymshf.cc +++ b/examples/reverse/sym/rsymshf.cc @@ -60,8 +60,9 @@ template -void Test(T type) +int Test(T type) { + int nev = 4; // Number of requested eigenvalues. // Creating a symmetric matrix. @@ -70,7 +71,7 @@ void Test(T type) // Creating a symmetric eigenvalue problem and defining what we need: // the four eigenvectors of B nearest to 0.0. - ARrcSymStdEig prob(B.ncols(), 4, (T)0.0); + ARrcSymStdEig prob(B.ncols(), nev, (T)0.0); // Finding an Arnoldi basis. @@ -102,19 +103,25 @@ void Test(T type) Solution(prob); + int nconv = prob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // Test. int main() { + int ret = 0; // Solving a double precision problem with n = 100. - Test((double)0.0); + ret |= Test((double)0.0); // Solving a single precision problem with n = 100. - Test((float)0.0); + ret |= Test((float)0.0); + + return ret; } // main diff --git a/examples/superlu/complex/lcompgre.cc b/examples/superlu/complex/lcompgre.cc index 55d0f00..9dca123 100644 --- a/examples/superlu/complex/lcompgre.cc +++ b/examples/superlu/complex/lcompgre.cc @@ -73,6 +73,8 @@ int main() arcomplex *valA, *valB; // pointers to arrays that store the // nonzero elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating complex matrices A and B. n = 100; @@ -85,7 +87,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluCompGenEig dprob(4L, A, B); + ARluCompGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -95,4 +97,7 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/complex/lcompgsh.cc b/examples/superlu/complex/lcompgsh.cc index 9fd2001..517f702 100644 --- a/examples/superlu/complex/lcompgsh.cc +++ b/examples/superlu/complex/lcompgsh.cc @@ -74,6 +74,8 @@ int main() arcomplex *valA, *valB; // pointers to arrays that store the // nonzero elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating complex matrices A and B. n = 100; @@ -86,7 +88,7 @@ int main() // Defining what we need: the four eigenvectors nearest to sigma. - ARluCompGenEig dprob(4L, A, B, arcomplex(1.0,0.0)); + ARluCompGenEig dprob(nev, A, B, arcomplex(1.0,0.0)); // Finding eigenvalues and eigenvectors. @@ -96,5 +98,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/complex/lcompreg.cc b/examples/superlu/complex/lcompreg.cc index 130d46f..5c50856 100644 --- a/examples/superlu/complex/lcompreg.cc +++ b/examples/superlu/complex/lcompreg.cc @@ -63,6 +63,8 @@ int main() arcomplex* valA; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a complex matrix. nx = 10; @@ -72,7 +74,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluCompStdEig dprob(4L, A); + ARluCompStdEig dprob(nev, A); // Finding eigenvalues and eigenvectors. @@ -82,5 +84,8 @@ int main() Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/superlu/complex/lcompshf.cc b/examples/superlu/complex/lcompshf.cc index f865f25..a8f3558 100644 --- a/examples/superlu/complex/lcompshf.cc +++ b/examples/superlu/complex/lcompshf.cc @@ -69,6 +69,8 @@ int main() arcomplex* valA; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a complex matrix. n = 100; @@ -78,7 +80,7 @@ int main() // Defining what we need: the four eigenvectors of F nearest to 0.0. - ARluCompStdEig dprob(4L, A, arcomplex(0.0, 0.0)); + ARluCompStdEig dprob(nev, A, arcomplex(0.0, 0.0)); // Finding eigenvalues and eigenvectors. @@ -88,5 +90,8 @@ int main() Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/nonsym/lnsymgre.cc b/examples/superlu/nonsym/lnsymgre.cc index 272c16f..30c1ebb 100644 --- a/examples/superlu/nonsym/lnsymgre.cc +++ b/examples/superlu/nonsym/lnsymgre.cc @@ -71,6 +71,8 @@ int main() double *valA, *valB; // pointers to arrays that store the // nonzero elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -83,7 +85,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluNonSymGenEig dprob(4L, A, B); + ARluNonSymGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -93,5 +95,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/superlu/nonsym/lnsymgsc.cc b/examples/superlu/nonsym/lnsymgsc.cc index 9c5d8b3..815029b 100644 --- a/examples/superlu/nonsym/lnsymgsc.cc +++ b/examples/superlu/nonsym/lnsymgsc.cc @@ -72,6 +72,8 @@ int main() double *valA, *valB; // pointers to arrays that store the // nonzero elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -83,7 +85,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 0.4 + 0.6i. - ARluNonSymGenEig dprob(4L, A, B, 'R', 0.4, 0.6); + ARluNonSymGenEig dprob(nev, A, B, 'R', 0.4, 0.6); // Finding eigenvalues and eigenvectors. @@ -93,4 +95,7 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/nonsym/lnsymgsh.cc b/examples/superlu/nonsym/lnsymgsh.cc index 1fd54d5..34982fd 100644 --- a/examples/superlu/nonsym/lnsymgsh.cc +++ b/examples/superlu/nonsym/lnsymgsh.cc @@ -73,6 +73,8 @@ int main() double *valA, *valB; // pointers to arrays that store the // nonzero elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -85,7 +87,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 1.0. - ARluNonSymGenEig dprob(4L, A, B, 1.0); + ARluNonSymGenEig dprob(nev, A, B, 1.0); // Finding eigenvalues and eigenvectors. @@ -95,4 +97,7 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/nonsym/lnsymreg.cc b/examples/superlu/nonsym/lnsymreg.cc index e51480f..3cd1813 100644 --- a/examples/superlu/nonsym/lnsymreg.cc +++ b/examples/superlu/nonsym/lnsymreg.cc @@ -61,6 +61,8 @@ int main() double* A; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -69,7 +71,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluNonSymStdEig dprob(4, matrix); + ARluNonSymStdEig dprob(nev, matrix); // Finding eigenvalues and eigenvectors. @@ -79,5 +81,8 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/nonsym/lnsymshf.cc b/examples/superlu/nonsym/lnsymshf.cc index 25a2955..a66dff2 100644 --- a/examples/superlu/nonsym/lnsymshf.cc +++ b/examples/superlu/nonsym/lnsymshf.cc @@ -64,6 +64,8 @@ int main() double* A; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 200x200 matrix. n = 200; @@ -72,7 +74,7 @@ int main() // Defining what we need: the four eigenvectors of BWM nearest to 0.0. - ARluNonSymStdEig dprob(4L, BWM, 0.0, "LM", 30L); + ARluNonSymStdEig dprob(nev, BWM, 0.0, "LM", 30L); // Finding eigenvalues and eigenvectors. @@ -82,5 +84,8 @@ int main() Solution(BWM, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/nonsym/lsvd.cc b/examples/superlu/nonsym/lsvd.cc index e3a9035..4d81811 100644 --- a/examples/superlu/nonsym/lsvd.cc +++ b/examples/superlu/nonsym/lsvd.cc @@ -64,6 +64,8 @@ int main() double cond; // Condition number of A. double* svalue = new double[6]; + int nev = 6; // Number of requested eigenvalues. + // Creating a rectangular matrix with m = 200 and n = 100. n = 100; @@ -77,7 +79,7 @@ int main() // Defining what we need: eigenvalues from both ends of the spectrum. ARSymStdEig > - dprob(n, 6L, &A, &ARluNonSymMatrix::MultMtMv, "BE", 20); + dprob(n, nev, &A, &ARluNonSymMatrix::MultMtMv, "BE", 20); // Finding eigenvalues. @@ -104,5 +106,8 @@ int main() std::cout << " smallest singular value: 1.41683937261247 \n"; std::cout << " condition number of A : 6.98566995906319 \n"; + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/nonsym/lsvd2.cc b/examples/superlu/nonsym/lsvd2.cc index b7ca22c..dc3ed45 100644 --- a/examples/superlu/nonsym/lsvd2.cc +++ b/examples/superlu/nonsym/lsvd2.cc @@ -68,6 +68,8 @@ int main() double* valA; // pointer to an array that stores the // nonzero elements of A. + int nev = 5; // Number of requested eigenvalues. + // Creating a rectangular matrix with m = 200 and n = 100. n = 100; @@ -82,7 +84,7 @@ int main() // algebraic value. ARSymStdEig > - dprob(m+n, 5L, &A, &ARluNonSymMatrix::Mult0MMt0v, + dprob(m+n, nev, &A, &ARluNonSymMatrix::Mult0MMt0v, "LA", 20L); // Finding eigenvalues. @@ -93,5 +95,8 @@ int main() Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/sym/lsymgbkl.cc b/examples/superlu/sym/lsymgbkl.cc index 5f946e0..9b537e5 100644 --- a/examples/superlu/sym/lsymgbkl.cc +++ b/examples/superlu/sym/lsymgbkl.cc @@ -70,6 +70,8 @@ int main() double *valA, *valB; // pointer to an array that stores the nonzero // elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -81,7 +83,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 1.0. - ARluSymGenEig dprob('B', 4L, A, B, 1.0); + ARluSymGenEig dprob('B', nev, A, B, 1.0); // Finding eigenvalues and eigenvectors. @@ -91,5 +93,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/sym/lsymgcay.cc b/examples/superlu/sym/lsymgcay.cc index f78114a..0ce5f59 100644 --- a/examples/superlu/sym/lsymgcay.cc +++ b/examples/superlu/sym/lsymgcay.cc @@ -70,6 +70,8 @@ int main() double *valA, *valB; // pointer to an array that stores the nonzero // elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -81,7 +83,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 150.0. - ARluSymGenEig dprob('C', 4L, A, B, 150.0); + ARluSymGenEig dprob('C', nev, A, B, 150.0); // Finding eigenvalues and eigenvectors. @@ -91,5 +93,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/sym/lsymgreg.cc b/examples/superlu/sym/lsymgreg.cc index 2b6ec2f..77af551 100644 --- a/examples/superlu/sym/lsymgreg.cc +++ b/examples/superlu/sym/lsymgreg.cc @@ -72,6 +72,8 @@ int main() double *valA, *valB; // pointer to an array that stores the nonzero // elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -83,7 +85,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluSymGenEig dprob(4L, A, B); + ARluSymGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -93,5 +95,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/sym/lsymgshf.cc b/examples/superlu/sym/lsymgshf.cc index fba8466..0d3f4d1 100644 --- a/examples/superlu/sym/lsymgshf.cc +++ b/examples/superlu/sym/lsymgshf.cc @@ -74,6 +74,8 @@ cout << "start" << endl; double *valA, *valB; // pointer to an array that stores the nonzero // elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -88,19 +90,22 @@ cout << "start" << endl; // Defining what we need: the four eigenvectors nearest to 0.0. -cout << " Defining LU Problem: " << endl; - ARluSymGenEig dprob('S', 4L, A, B, 0.0); -cout << " ... Done" << endl; + cout << " Defining LU Problem: " << endl; + ARluSymGenEig dprob('S', nev, A, B, 0.0); + cout << " ... Done" << endl; // Finding eigenvalues and eigenvectors. -cout << "Finding Eigenvectors:" << endl; + cout << "Finding Eigenvectors:" << endl; dprob.FindEigenvectors(); -cout << "... Done " << endl; + cout << "... Done " << endl; // Printing solution. Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/sym/lsymreg.cc b/examples/superlu/sym/lsymreg.cc index 81df026..19e0849 100644 --- a/examples/superlu/sym/lsymreg.cc +++ b/examples/superlu/sym/lsymreg.cc @@ -60,6 +60,8 @@ int main() double* A; // pointer to an array that stores the // nonzero elements of A. + int nev = 2; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -68,7 +70,7 @@ int main() // Defining what we need: the four eigenvectors of A with smallest magnitude. - ARluSymStdEig dprob(2, matrix, "SM"); + ARluSymStdEig dprob(nev, matrix, "SM"); // Finding eigenvalues and eigenvectors. @@ -78,4 +80,7 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/superlu/sym/lsymshf.cc b/examples/superlu/sym/lsymshf.cc index 6b13985..09890c4 100644 --- a/examples/superlu/sym/lsymshf.cc +++ b/examples/superlu/sym/lsymshf.cc @@ -66,6 +66,8 @@ int main() double* A; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. n = 100; @@ -74,7 +76,7 @@ int main() // Defining what we need: the four eigenvectors of A nearest to 1.0. - ARluSymStdEig dprob(4L, matrix, 1.0); + ARluSymStdEig dprob(nev, matrix, 1.0); // Finding eigenvalues and eigenvectors. @@ -84,4 +86,7 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/umfpack/complex/ucompgre.cc b/examples/umfpack/complex/ucompgre.cc index efc6d49..7fee9f4 100644 --- a/examples/umfpack/complex/ucompgre.cc +++ b/examples/umfpack/complex/ucompgre.cc @@ -73,6 +73,8 @@ int main() arcomplex *valA, *valB; // pointers to arrays that store the // nonzero elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating double precision complex matrices A and B. n = 100; @@ -85,7 +87,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluCompGenEig dprob(4L, A, B); + ARluCompGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -95,4 +97,7 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/complex/ucompgsh.cc b/examples/umfpack/complex/ucompgsh.cc index f0712e8..863dbff 100644 --- a/examples/umfpack/complex/ucompgsh.cc +++ b/examples/umfpack/complex/ucompgsh.cc @@ -74,6 +74,8 @@ int main() arcomplex *valA, *valB; // pointers to arrays that store the // nonzero elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating complex matrices A and B. n = 100; @@ -86,7 +88,7 @@ int main() // Defining what we need: the four eigenvectors nearest to sigma. - ARluCompGenEig dprob(4L, A, B, arcomplex(1.0,0.0)); + ARluCompGenEig dprob(nev, A, B, arcomplex(1.0,0.0)); // Finding eigenvalues and eigenvectors. @@ -96,5 +98,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/complex/ucompreg.cc b/examples/umfpack/complex/ucompreg.cc index 426ea37..0c25a74 100644 --- a/examples/umfpack/complex/ucompreg.cc +++ b/examples/umfpack/complex/ucompreg.cc @@ -63,6 +63,8 @@ int main() arcomplex* valA; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a complex matrix. nx = 10; @@ -72,7 +74,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluCompStdEig dprob(4L, A); + ARluCompStdEig dprob(nev, A); // Finding eigenvalues and eigenvectors. @@ -82,5 +84,8 @@ int main() Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/umfpack/complex/ucompshf.cc b/examples/umfpack/complex/ucompshf.cc index e96abf4..340747e 100644 --- a/examples/umfpack/complex/ucompshf.cc +++ b/examples/umfpack/complex/ucompshf.cc @@ -69,6 +69,8 @@ int main() arcomplex* valA; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a complex matrix. n = 100; @@ -78,7 +80,7 @@ int main() // Defining what we need: the four eigenvectors of F nearest to 0.0. - ARluCompStdEig dprob(4L, A, arcomplex(0.0, 0.0)); + ARluCompStdEig dprob(nev, A, arcomplex(0.0, 0.0)); // Finding eigenvalues and eigenvectors. @@ -88,5 +90,8 @@ int main() Solution(A, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/nonsym/unsymgre.cc b/examples/umfpack/nonsym/unsymgre.cc index 795d3f7..3041b67 100644 --- a/examples/umfpack/nonsym/unsymgre.cc +++ b/examples/umfpack/nonsym/unsymgre.cc @@ -72,6 +72,8 @@ int main() double *valA, *valB; // pointers to arrays that store the // nonzero elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -85,7 +87,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluNonSymGenEig dprob(4L, A, B); + ARluNonSymGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -95,5 +97,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/nonsym/unsymgsc.cc b/examples/umfpack/nonsym/unsymgsc.cc index dce5163..42eafa9 100644 --- a/examples/umfpack/nonsym/unsymgsc.cc +++ b/examples/umfpack/nonsym/unsymgsc.cc @@ -72,6 +72,8 @@ int main() double *valA, *valB; // pointers to arrays that store the // nonzero elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -84,7 +86,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 0.4 + 0.6i. - ARluNonSymGenEig dprob(4L, A, B, 'R', 0.4, 0.6); + ARluNonSymGenEig dprob(nev, A, B, 'R', 0.4, 0.6); // Finding eigenvalues and eigenvectors. @@ -94,4 +96,7 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/nonsym/unsymgsh.cc b/examples/umfpack/nonsym/unsymgsh.cc index e22a1ad..1a49ff7 100644 --- a/examples/umfpack/nonsym/unsymgsh.cc +++ b/examples/umfpack/nonsym/unsymgsh.cc @@ -74,6 +74,8 @@ int main() double *valA, *valB; // pointers to arrays that store the // nonzero elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -86,7 +88,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 0.0. - ARluNonSymGenEig dprob(4L, A, B, 0.0); + ARluNonSymGenEig dprob(nev, A, B, 0.0); // Finding eigenvalues and eigenvectors. @@ -96,5 +98,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/nonsym/unsymreg.cc b/examples/umfpack/nonsym/unsymreg.cc index 5ad7d55..3c68aba 100644 --- a/examples/umfpack/nonsym/unsymreg.cc +++ b/examples/umfpack/nonsym/unsymreg.cc @@ -61,6 +61,8 @@ int main() double* A; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -69,7 +71,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluNonSymStdEig dprob(4, matrix); + ARluNonSymStdEig dprob(nev, matrix); // Finding eigenvalues and eigenvectors. @@ -79,5 +81,8 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/nonsym/unsymshf.cc b/examples/umfpack/nonsym/unsymshf.cc index c46e7a8..93b4f96 100644 --- a/examples/umfpack/nonsym/unsymshf.cc +++ b/examples/umfpack/nonsym/unsymshf.cc @@ -64,6 +64,8 @@ int main() double* A; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 200x200 matrix. n = 200; @@ -72,7 +74,7 @@ int main() // Defining what we need: the four eigenvectors of BWM nearest to 0.0. - ARluNonSymStdEig dprob(4L, BWM, 0.0, "LM", 30L); + ARluNonSymStdEig dprob(nev, BWM, 0.0, "LM", 30L); // Finding eigenvalues and eigenvectors. @@ -82,4 +84,7 @@ int main() Solution(BWM, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/examples/umfpack/nonsym/usvd.cc b/examples/umfpack/nonsym/usvd.cc index a680c51..eb8314f 100644 --- a/examples/umfpack/nonsym/usvd.cc +++ b/examples/umfpack/nonsym/usvd.cc @@ -64,6 +64,8 @@ int main() double cond; // Condition number of A. double* svalue = new double[6]; + int nev = 6; // Number of requested eigenvalues. + // Creating a rectangular matrix with m = 200 and n = 100. n = 100; @@ -77,7 +79,7 @@ int main() // Defining what we need: eigenvalues from both ends of the spectrum. ARSymStdEig > - dprob(n, 6L, &A, &ARumNonSymMatrix::MultMtMv, "BE", 20L); + dprob(n, nev, &A, &ARumNonSymMatrix::MultMtMv, "BE", 20L); // Finding eigenvalues. @@ -104,5 +106,8 @@ int main() std::cout << " smallest singular value: 1.41683937261247 \n"; std::cout << " condition number of A : 6.98566995906319 \n"; + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/sym/usymgbkl.cc b/examples/umfpack/sym/usymgbkl.cc index aa0b75e..cba55cf 100644 --- a/examples/umfpack/sym/usymgbkl.cc +++ b/examples/umfpack/sym/usymgbkl.cc @@ -70,6 +70,8 @@ int main() double *valA, *valB; // pointer to an array that stores the nonzero // elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -81,7 +83,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 1.0. - ARluSymGenEig dprob('B', 4L, A, B, 1.0); + ARluSymGenEig dprob('B', nev, A, B, 1.0); // Finding eigenvalues and eigenvectors. @@ -91,5 +93,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/sym/usymgcay.cc b/examples/umfpack/sym/usymgcay.cc index e5d6564..a53736d 100644 --- a/examples/umfpack/sym/usymgcay.cc +++ b/examples/umfpack/sym/usymgcay.cc @@ -70,6 +70,8 @@ int main() double *valA, *valB; // pointer to an array that stores the nonzero // elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -81,7 +83,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 150.0. - ARluSymGenEig dprob('C', 4L, A, B, 150.0); + ARluSymGenEig dprob('C', nev, A, B, 150.0); // Finding eigenvalues and eigenvectors. @@ -91,5 +93,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/sym/usymgreg.cc b/examples/umfpack/sym/usymgreg.cc index c13b78c..99b58ee 100644 --- a/examples/umfpack/sym/usymgreg.cc +++ b/examples/umfpack/sym/usymgreg.cc @@ -72,6 +72,8 @@ int main() double *valA, *valB; // pointer to an array that stores the nonzero // elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -83,7 +85,7 @@ int main() // Defining what we need: the four eigenvectors with largest magnitude. - ARluSymGenEig dprob(4L, A, B); + ARluSymGenEig dprob(nev, A, B); // Finding eigenvalues and eigenvectors. @@ -93,5 +95,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/sym/usymgshf.cc b/examples/umfpack/sym/usymgshf.cc index eb721a4..c35fef7 100644 --- a/examples/umfpack/sym/usymgshf.cc +++ b/examples/umfpack/sym/usymgshf.cc @@ -70,6 +70,8 @@ int main() double *valA, *valB; // pointer to an array that stores the nonzero // elements of A and B. + int nev = 4; // Number of requested eigenvalues. + // Creating matrices A and B. n = 100; @@ -81,7 +83,7 @@ int main() // Defining what we need: the four eigenvectors nearest to 0.0. - ARluSymGenEig dprob('S', 4L, A, B, 0.0); + ARluSymGenEig dprob('S', nev, A, B, 0.0); // Finding eigenvalues and eigenvectors. @@ -91,5 +93,8 @@ int main() Solution(A, B, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/sym/usymreg.cc b/examples/umfpack/sym/usymreg.cc index f47d72b..c107681 100644 --- a/examples/umfpack/sym/usymreg.cc +++ b/examples/umfpack/sym/usymreg.cc @@ -61,6 +61,8 @@ int main() double* A; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. nx = 10; @@ -69,7 +71,7 @@ int main() // Defining what we need: the four eigenvectors of A with largest magnitude. - ARluSymStdEig dprob(4, matrix, "SM"); + ARluSymStdEig dprob(nev, matrix, "SM"); // Finding eigenvalues and eigenvectors. @@ -79,4 +81,7 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main. diff --git a/examples/umfpack/sym/usymshf.cc b/examples/umfpack/sym/usymshf.cc index e13d9ce..e5d2e25 100644 --- a/examples/umfpack/sym/usymshf.cc +++ b/examples/umfpack/sym/usymshf.cc @@ -66,6 +66,8 @@ int main() double* A; // pointer to an array that stores the // nonzero elements of A. + int nev = 4; // Number of requested eigenvalues. + // Creating a 100x100 matrix. n = 100; @@ -74,7 +76,7 @@ int main() // Defining what we need: the four eigenvectors of A nearest to 0.0. - ARluSymStdEig dprob(4L, matrix, 0.0); + ARluSymStdEig dprob(nev, matrix, 0.0); // Finding eigenvalues and eigenvectors. @@ -84,4 +86,7 @@ int main() Solution(matrix, dprob); + int nconv = dprob.ConvergedEigenvalues(); + + return nconv < nev ? EXIT_FAILURE : EXIT_SUCCESS; } // main diff --git a/include/arlnsmat.h b/include/arlnsmat.h index 07a547f..2a22d3b 100644 --- a/include/arlnsmat.h +++ b/include/arlnsmat.h @@ -88,10 +88,10 @@ class ARluNonSymMatrix: public ARMatrix { void DefineMatrix(int np, int nnzp, ARTYPE* ap, int* irowp, int* pcolp, double thresholdp = 0.1, - int orderp = 1, bool check = true); // Square matrix. + int orderp = 1, bool check = true); // Square matrix. void DefineMatrix(int mp, int np, int nnzp, ARTYPE* ap, - int* irowp, int* pcolp); // Rectangular matrix. + int* irowp, int* pcolp, bool check = true); // Rectangular matrix. ARluNonSymMatrix(); // Short constructor that does nothing. @@ -100,7 +100,7 @@ class ARluNonSymMatrix: public ARMatrix { double thresholdp = 0.1, int orderp = 1, bool check = true); // Long constructor (square matrix). - ARluNonSymMatrix(int mp, int np, int nnzp, ARTYPE* ap, int* irowp,int* pcolp); + ARluNonSymMatrix(int mp, int np, int nnzp, ARTYPE* ap, int* irowp, int* pcolp, bool check = true); // Long constructor (rectangular matrix). ARluNonSymMatrix(const std::string& name, double thresholdp = 0.1, @@ -141,7 +141,7 @@ bool ARluNonSymMatrix::DataOK() j = pcol[i]; k = pcol[i+1]-1; if (j<=k) { - if ((irow[j]<0)||(irow[k]>=this->n)) return false; + if ((irow[j]<0)||(irow[k]>=this->m)) return false; while ((j!=k)&&(irow[j] inline void ARluNonSymMatrix:: -DefineMatrix(int mp, int np, int nnzp, ARTYPE* ap, int* irowp, int* pcolp) +DefineMatrix(int mp, int np, int nnzp, ARTYPE* ap, int* irowp, int* pcolp, bool check) { this->m = mp; @@ -667,10 +667,23 @@ DefineMatrix(int mp, int np, int nnzp, ARTYPE* ap, int* irowp, int* pcolp) irow = irowp; pcol = pcolp; pcol[this->n] = nnz; - this->defined = true; + + // Checking data. + + if ((check)&&(!DataOK())) { + throw ArpackError(ArpackError::INCONSISTENT_DATA, + "ARluSymMatrix::DefineMatrix"); + } + + // Creating SuperMatrix A. + + Create_CompCol_Matrix(&A, this->n, this->n, nnz, a, irow, pcol, SLU_NC, SLU_GE); + permc = NULL; permr = NULL; + this->defined = true; + } // DefineMatrix (rectangular). @@ -689,7 +702,7 @@ template inline ARluNonSymMatrix:: ARluNonSymMatrix(int np, int nnzp, ARTYPE* ap, int* irowp, int* pcolp, double thresholdp, - int orderp, bool check) : ARMatrix(np) + int orderp, bool check) : ARMatrix(np) { factored = false; @@ -701,13 +714,13 @@ ARluNonSymMatrix(int np, int nnzp, ARTYPE* ap, int* irowp, template inline ARluNonSymMatrix:: ARluNonSymMatrix(int mp, int np, int nnzp, ARTYPE* ap, - int* irowp, int* pcolp) : ARMatrix(mp, np) + int* irowp, int* pcolp, bool check) : ARMatrix(mp, np) { factored = false; - DefineMatrix(mp, np, nnzp, ap, irowp, pcolp); + DefineMatrix(mp, np, nnzp, ap, irowp, pcolp, check); -} // Long constructor (retangular matrix). +} // Long constructor (rectangular matrix). template diff --git a/include/arlnspen.h b/include/arlnspen.h index b479ac6..5ff97cc 100644 --- a/include/arlnspen.h +++ b/include/arlnspen.h @@ -407,9 +407,9 @@ void ARluNonSymPencil::FactorAsB(ARTYPE sigma) // Creating a temporary matrix AsB. nnzi = Astore->nnz+Bstore->nnz; - irowi = new int[nnzi]; - pcoli = new int[A->ncols()+1]; - asb = new ARTYPE[nnzi]; + irowi = (int*)SUPERLU_MALLOC(sizeof(int) * nnzi); + pcoli = (int*)SUPERLU_MALLOC(sizeof(int) * (A->ncols()+1)); + asb = (ARTYPE*)SUPERLU_MALLOC(sizeof(ARTYPE) * nnzi); Create_CompCol_Matrix(&AsB, A->nrows(), A->ncols(), nnzi, asb, irowi, pcoli, SLU_NC, SLU_GE); @@ -541,9 +541,9 @@ FactorAsB(ARFLOAT sigmaR, ARFLOAT sigmaI, char partp) part = partp; nnzi = Astore->nnz+Bstore->nnz; - irowi = new int[nnzi]; - pcoli = new int[A->ncols()+1]; - asb = new arcomplex[nnzi]; + irowi = (int*)SUPERLU_MALLOC(sizeof(int) * nnzi); + pcoli = (int*)SUPERLU_MALLOC(sizeof(int) * (A->ncols()+1)); + asb = (arcomplex*)SUPERLU_MALLOC(sizeof(arcomplex) * nnzi); Create_CompCol_Matrix(&AsB, A->nrows(), A->ncols(), nnzi, asb, irowi, pcoli, SLU_NC, SLU_GE); diff --git a/include/arlspen.h b/include/arlspen.h index 52e2bb1..238ce38 100644 --- a/include/arlspen.h +++ b/include/arlspen.h @@ -515,9 +515,9 @@ void ARluSymPencil::FactorAsB(ARTYPE sigma) // Creating a temporary matrix AsB. nnzi = (Astore->nnz+Bstore->nnz)*2; - irowi = new int[nnzi]; - pcoli = new int[A->ncols()+1]; - asb = new ARTYPE[nnzi]; + irowi = (int*)SUPERLU_MALLOC(sizeof(int) * nnzi); + pcoli = (int*)SUPERLU_MALLOC(sizeof(int) * (A->ncols()+1)); + asb = (ARTYPE*)SUPERLU_MALLOC(sizeof(ARTYPE) * nnzi); Create_CompCol_Matrix(&AsB, A->nrows(), A->ncols(), nnzi, asb, irowi, pcoli, SLU_NC, SLU_GE);