diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000000..dbda62fd09 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,5 @@ +# see https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners + +# default owners +* @AMICI-dev/amici-maintainers + diff --git a/.github/workflows/deploy_protected.yml b/.github/workflows/deploy_protected.yml index 15dcaeade9..ed6032d75c 100644 --- a/.github/workflows/deploy_protected.yml +++ b/.github/workflows/deploy_protected.yml @@ -7,7 +7,7 @@ on: - release** pull_request: paths: - - docker/Dockerfile + - container/Dockerfile workflow_dispatch: jobs: @@ -27,7 +27,7 @@ jobs: with: python-version: ${{ matrix.python-version }} - uses: actions/checkout@v3 - - run: git archive -o docker/amici.tar.gz --format=tar.gz HEAD + - run: git archive -o container/amici.tar.gz --format=tar.gz HEAD - name: Set up QEMU uses: docker/setup-qemu-action@v2 - name: Set up Docker Buildx @@ -38,7 +38,7 @@ jobs: name: dweindl/amici username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - workdir: docker/ + workdir: container/ dockerfile: Dockerfile tag_names: true platforms: linux/amd64,linux/arm64 diff --git a/.github/workflows/test_python_cplusplus.yml b/.github/workflows/test_python_cplusplus.yml index cbe0436db7..1a100ebbdc 100644 --- a/.github/workflows/test_python_cplusplus.yml +++ b/.github/workflows/test_python_cplusplus.yml @@ -162,8 +162,8 @@ jobs: brew install hdf5 swig gcc cppcheck libomp boost \ && brew ls -v boost \ && brew ls -v libomp \ - && echo LDFLAGS="-L/usr/local/lib/ -L/usr/local/Cellar/boost/1.80.0/lib/" >> $GITHUB_ENV \ - && echo CPPFLAGS="-I/usr/local/Cellar/boost/1.80.0/include/" >> $GITHUB_ENV + && echo LDFLAGS="-L/usr/local/lib/ -L/usr/local/Cellar/boost/1.81.0_1/lib/" >> $GITHUB_ENV \ + && echo CPPFLAGS="-I /usr/local/Cellar/boost/1.81.0_1/include/" >> $GITHUB_ENV - name: Build AMICI run: | diff --git a/.github/workflows/test_windows.yml b/.github/workflows/test_windows.yml index d89805ec74..650efee67e 100644 --- a/.github/workflows/test_windows.yml +++ b/.github/workflows/test_windows.yml @@ -15,7 +15,11 @@ jobs: env: AMICI_SKIP_CMAKE_TESTS: "TRUE" openBLAS_version: "0.3.19" - AMICI_DLL_DIRS: "C:\\BLAS\\bin" + AMICI_DLL_DIRS: "C:\\BLAS\\OpenBLAS\\bin" + LIB: "C:/BLAS/OpenBLAS/lib" + CFLAGS: "-nologo" + CXXFLAGS: "-nologo" + LDFLAGS: "-nologo" strategy: matrix: @@ -33,11 +37,11 @@ jobs: - shell: bash run: echo "AMICI_DIR=$(pwd)" >> $GITHUB_ENV - shell: bash - run: echo "C:\\BLAS\\bin" >> $GITHUB_PATH + run: echo "C:\\BLAS\\OpenBLAS\\bin" >> $GITHUB_PATH - shell: bash - run: echo "BLAS_LIBS=/LIBPATH:C:/BLAS/lib openblas.lib" >> $GITHUB_ENV + run: echo "BLAS_LIBS=-LIBPATH:C:/BLAS/OpenBLAS/lib openblas.lib" >> $GITHUB_ENV - shell: bash - run: echo "BLAS_CFLAGS=-IC:/BLAS/OpenBLAS-${openBLAS_version}/OpenBLAS-${openBLAS_version}" >> $GITHUB_ENV + run: echo "BLAS_CFLAGS=-IC:/BLAS/OpenBLAS/include/openblas/" >> $GITHUB_ENV # Developer Command Prompt for Microsoft Visual C++ - uses: ilammy/msvc-dev-cmd@v1 @@ -53,6 +57,11 @@ jobs: shell: powershell run: scripts/installOpenBLAS + - uses: actions/upload-artifact@v3 + with: + name: OpenBLAS + path: C:\BLAS\OpenBLAS + - name: Create sdist working-directory: python/sdist run: pip install build && python -m build --sdist diff --git a/CHANGELOG.md b/CHANGELOG.md index 582a78972a..17af576bd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,86 @@ ## v0.X Series +### v0.16.1 (2023-02-24) + +Fixes: +* Additional package names for finding blas via pkg-config + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1959 +* Changed default interpolation type from hermite to polynomial + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1960 +* PySB import: Change default simplify to work with multiprocessing + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1961 +* Add --no-validate to amici_import_petab + @dweindl in https://github.com/AMICI-dev/AMICI/pull/1963 +* Fix get_model for direct import of swig interface + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1969 +* Fix PytestReturnNotNoneWarning in test_conserved_quantities_demartino.py + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1968 +* Fix MSVC builds / remove -W* flags + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1972 +* Add option to use IDs when plotting trajectories + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1974 +* Fix assignmentRules2observables - skip non-assignment-rule targets + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1973 +* Use std::clock for measuring solver time + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1982 + (*Note that this uses cpu-time consumed by all threads*) +* Fix narrowing-conversion-warning + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1983 +* PEtab import: allow specifying default values for output parameters + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1987 +* Print stacktraces only with debug logging level + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1985 +* Change default ReturnData::status to AMICI_NOT_RUN + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1984 +* Reduce time-tracking overhead + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1988 +* Fix equilibraton status discrepancy + by @plakrisenko in https://github.com/AMICI-dev/AMICI/pull/1991 +* Pass model_name to _create_model_output_dir_name + by @FFroehlich in https://github.com/AMICI-dev/AMICI/pull/1994 +* CMake: Build with OpenMP support if available + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2000 +* Fix SuiteSparse Makefiles for compiler-paths + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2003 +* CMake: Build with HDF5 support if available + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1999 +* CMake: Fix reading version file on Windows + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2001 +* CMake: raise minimum required version to 3.15 + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2002 +* Fix/extend runtime logging + by @FFroehlich in https://github.com/AMICI-dev/AMICI/pull/2005 +* Fix error logging in steadystate solver + by @FFroehlich in https://github.com/AMICI-dev/AMICI/pull/2008 +* Don't pass `-py3` to swig after 4.1.0 + by @FFroehlich in https://github.com/AMICI-dev/AMICI/pull/2010 +* SWIG __repr__s for different templated vector classes + by @FFroehlich in https://github.com/AMICI-dev/AMICI/pull/2009 +* Matlab: If mex fails, print mex arguments + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2013 +* Simplify OpenBLAS installation on Windows + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2016 +* Remove model name prefix in generated model files + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2015 +* ... + +Documentation: +* Restructure sphinx doc + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1978 +* Instructions for AMICI with singularity + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1964 +* Illustrate options for potentially speeding up model import/simulation + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1965 +* ... + +Dependencies: +* Updated SuiteSparse to v7.0.1 + by @dweindl in https://github.com/AMICI-dev/AMICI/pull/2018 + +**Full Changelog**: https://github.com/AMICI-dev/AMICI/compare/v0.16.0...v0.16.1 + + ### v0.16.0 (2023-01-25) Features @@ -453,7 +533,7 @@ https://github.com/AMICI-dev/AMICI/compare/v0.11.22...v0.11.23 ### v0.11.22 (2021-12-02) -* **Require sympy>=1.9,pysb>=1.13.1** by @FFroehlich, @dweindl +* **Require sympy>=1.9,pysb>=1.13.1* by @FFroehlich, @dweindl in https://github.com/AMICI-dev/AMICI/pull/1599 * Fixed sympy deprecation warning by @dweindl in https://github.com/AMICI-dev/AMICI/pull/1600 diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ead4672d4..c91109530e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,15 +1,7 @@ # # Build AMICI library # -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0077) - cmake_policy(SET CMP0077 NEW) -endif(POLICY CMP0077) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(amici) @@ -38,12 +30,21 @@ endforeach(FLAG) # find dependencies include(GNUInstallDirs) -option(ENABLE_HDF5 "Build with HDF5 support?" ON) +find_package(OpenMP) + +option(AMICI_TRY_ENABLE_HDF5 "Build with HDF5 support if available?" ON) +option(ENABLE_HDF5 "Build with HDF5 support?" OFF) + if(ENABLE_HDF5) find_package( HDF5 COMPONENTS C HL CXX REQUIRED) +elseif(AMICI_TRY_ENABLE_HDF5) + find_package(HDF5 COMPONENTS C HL CXX) +endif() + +if(HDF5_FOUND) set(HDF5_LIBRARIES ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${HDF5_CXX_LIBRARIES}) endif() @@ -52,11 +53,11 @@ set(SUITESPARSE_DIR "${CMAKE_SOURCE_DIR}/ThirdParty/SuiteSparse/") set(SUITESPARSE_INCLUDE_DIRS "${SUITESPARSE_DIR}/include" "${CMAKE_SOURCE_DIR}/ThirdParty/sundials/src") set(SUITESPARSE_LIBRARIES - ${SUITESPARSE_DIR}/KLU/Lib/libklu${CMAKE_STATIC_LIBRARY_SUFFIX} - ${SUITESPARSE_DIR}/COLAMD/Lib/libcolamd${CMAKE_STATIC_LIBRARY_SUFFIX} - ${SUITESPARSE_DIR}/BTF/Lib/libbtf${CMAKE_STATIC_LIBRARY_SUFFIX} - ${SUITESPARSE_DIR}/AMD/Lib/libamd${CMAKE_STATIC_LIBRARY_SUFFIX} - ${SUITESPARSE_DIR}/SuiteSparse_config/libsuitesparseconfig${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/lib/libklu${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/lib/libcolamd${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/lib/libbtf${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/lib/libamd${CMAKE_STATIC_LIBRARY_SUFFIX} + ${SUITESPARSE_DIR}/lib/libsuitesparseconfig${CMAKE_STATIC_LIBRARY_SUFFIX} ) find_package( @@ -169,7 +170,7 @@ set(AMICI_SRC_LIST ${CMAKE_SOURCE_DIR}/include/amici/sundials_matrix_wrapper.h ${CMAKE_SOURCE_DIR}/include/amici/symbolic_functions.h ${CMAKE_SOURCE_DIR}/include/amici/vector.h) -if(ENABLE_HDF5) +if(HDF5_FOUND) list(APPEND AMICI_SRC_LIST ${CMAKE_SOURCE_DIR}/src/hdf5.cpp) endif() @@ -216,10 +217,18 @@ target_link_libraries( PUBLIC SUNDIALS::cvodes_static PUBLIC SUNDIALS::idas_static PUBLIC ${SUITESPARSE_LIBRARIES} - PUBLIC ${HDF5_LIBRARIES} PUBLIC ${BLAS_LIBRARIES} PUBLIC ${CMAKE_DL_LIBS}) +if(HDF5_FOUND) + target_include_directories(${PROJECT_NAME} PUBLIC ${HDF5_INCLUDE_DIRS}) + target_link_libraries(${PROJECT_NAME} PUBLIC ${HDF5_LIBRARIES}) +endif() + +if(OpenMP_FOUND) + target_link_libraries(${PROJECT_NAME} PUBLIC OpenMP::OpenMP_CXX) +endif() + option(SUNDIALS_SUPERLUMT_ENABLE "Enable sundials SuperLUMT?" OFF) if(SUNDIALS_SUPERLUMT_ENABLE) set(SUNDIALS_LIBRARIES @@ -328,12 +337,12 @@ endif() option(BUILD_TESTS "Build integration tests?" ON) if(BUILD_TESTS) - if(ENABLE_HDF5) + if(HDF5_FOUND) enable_testing() add_subdirectory(tests/cpp) else() - message(WARNING "Cannot build tests with ENABLE_HDF5=OFF.") + message(WARNING "Cannot build tests without HDF5 support.") endif() endif() diff --git a/README.md b/README.md index f9f1aea0d2..7531627e94 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ forward sensitivity analysis, steady state sensitivity analysis and adjoint sensitivity analysis for likelihood-based output functions. The interface was designed to provide routines for efficient gradient -computation in parameter estimation of biochemical reaction models but +computation in parameter estimation of biochemical reaction models, but it is also applicable to a wider range of differential equation constrained optimization problems. @@ -62,7 +62,6 @@ constrained optimization problems. * Pre-equilibration and pre-simulation conditions * Support for [discrete events and logical operations](https://academic.oup.com/bioinformatics/article/33/7/1049/2769435) - (Matlab-only) ## Interfaces & workflow @@ -125,7 +124,7 @@ with AMICI: There is a list of [publications using AMICI](https://amici.readthedocs.io/en/latest/references.html). If you used AMICI in your work, we are happy to include -your project, please let us know via a Github issue. +your project, please let us know via a GitHub issue. When using AMICI in your project, please cite * Fröhlich, F., Weindl, D., Schälte, Y., Pathirana, D., Paszkowski, Ł., Lines, G.T., Stapor, P. and Hasenauer, J., 2021. diff --git a/ThirdParty/SuiteSparse/.gitattributes b/ThirdParty/SuiteSparse/.gitattributes new file mode 100644 index 0000000000..49e7a27f9a --- /dev/null +++ b/ThirdParty/SuiteSparse/.gitattributes @@ -0,0 +1,2 @@ +# line endings in repository match line endings on disc +* -text diff --git a/ThirdParty/SuiteSparse/.gitignore b/ThirdParty/SuiteSparse/.gitignore new file mode 100644 index 0000000000..d0d4223fd7 --- /dev/null +++ b/ThirdParty/SuiteSparse/.gitignore @@ -0,0 +1,218 @@ +# Ignore these files: +*.o +*.so.* +*.so +*.dylib +*.a +*.obj +*.ln +*.bb +*.bbg +*.da +*.tcov +*.gcov +gmon.out +*.bak +*.d +*.gcda +*.gcno +*.aux +*.bbl +*.blg +*.log +*.toc +*.dvi +*.lof +*.lot +*.dll +*.dSYM +my_*.out +*.gcda +*.gcno +*.mex* +*.profile +*.swp +.DS_Store +.nfs* +.pyc + +# ignore these specific programs in the Package/Demo directories +AMD/Demo/amd_demo +AMD/Demo/amd_demo2 +AMD/Demo/amd_l_demo +AMD/Demo/amd_simple +CAMD/Demo/camd_demo +CAMD/Demo/camd_demo2 +CAMD/Demo/camd_l_demo +CAMD/Demo/camd_simple +CCOLAMD/Demo/ccolamd_example +CCOLAMD/Demo/ccolamd_l_example +CHOLMOD/Demo/cholmod_demo +CHOLMOD/Demo/cholmod_l_demo +CHOLMOD/Demo/cholmod_simple +CHOLMOD/Demo/timelog.m +COLAMD/Demo/colamd_example +COLAMD/Demo/colamd_l_example +CSparse/Demo/cs_demo1 +CSparse/Demo/cs_demo2 +CSparse/Demo/cs_demo3 +CXSparse/Demo/cs_ci_demo1 +CXSparse/Demo/cs_ci_demo2 +CXSparse/Demo/cs_ci_demo3 +CXSparse/Demo/cs_cl_demo1 +CXSparse/Demo/cs_cl_demo2 +CXSparse/Demo/cs_cl_demo3 +CXSparse/Demo/cs_demo1 +CXSparse/Demo/cs_demo2 +CXSparse/Demo/cs_demo3 +CXSparse/Demo/cs_di_demo1 +CXSparse/Demo/cs_di_demo2 +CXSparse/Demo/cs_di_demo3 +CXSparse/Demo/cs_dl_demo1 +CXSparse/Demo/cs_dl_demo2 +CXSparse/Demo/cs_dl_demo3 +CXSparse/Demo/cs_idemo +CXSparse/Demo/cs_ldemo +KLU/Demo/klu_simple +KLU/Demo/kludemo +KLU/Demo/kluldemo +LDL/Demo/ldlamd +LDL/Demo/ldllamd +LDL/Demo/ldllmain +LDL/Demo/ldllsimple +LDL/Demo/ldlmain +LDL/Demo/ldlsimple +RBio/Demo/RBdemo +RBio/Demo/temp.rb +SPQR/Demo/qrdemo +SPQR/Demo/qrsimple +SPQR/Demo/qrsimplec +SPQR/Demo/C.mtx +SPQR/Demo/E.txt +SPQR/Demo/R.mtx +SPQR/Demo/X.mtx +SPQR/Demo/gpu_results.txt +SPQR/Demo/qrdemo_gpu +SPQR/Demo/qrdemo_gpu2 +SPQR/Demo/qrdemo_gpu3 +SPQR/Demo/pfile +SPQR/Demo/tfile +UMFPACK/Demo/numeric.umf +UMFPACK/Demo/symbolic.umf +UMFPACK/Demo/umfpack_di_demo +UMFPACK/Demo/umfpack_dl_demo +UMFPACK/Demo/umfpack_simple +UMFPACK/Demo/umfpack_zi_demo +UMFPACK/Demo/umfpack_zl_demo + +# ignore these specific programs in the Package/Tcov directories +CHOLMOD/Tcov/cl +CHOLMOD/Tcov/clread +CHOLMOD/Tcov/cm +CHOLMOD/Tcov/cmread +CHOLMOD/Tcov/covs.out +CHOLMOD/Tcov/ldemo +CHOLMOD/Tcov/ldemo.c +CHOLMOD/Tcov/temp*.mtx +CHOLMOD/Tcov/timelog.m +CHOLMOD/Tcov/l_*.c +CHOLMOD/Tcov/z_*.c +CHOLMOD/Tcov/zz_*.c +CHOLMOD/Tcov/zl_*.c +CHOLMOD/Tcov/zdemo +CHOLMOD/Tcov/zdemo.c + +CSparse/Tcov/cov.out +CSparse/Tcov/cov.sort +CSparse/Tcov/cover.out +CSparse/Tcov/covs.out +CSparse/Tcov/cs_*.c +CSparse/Tcov/cstcov_test +CSparse/Tcov/*.out +CSparse/Tcov/cs_demo1 +CSparse/Tcov/cs_demo2 +CSparse/Tcov/cs_demo3 + +CXSparse/Tcov/cov.out +CXSparse/Tcov/cov.sort +CXSparse/Tcov/cover.out +CXSparse/Tcov/covs.out +CXSparse/Tcov/cs_*.c +CXSparse/Tcov/*.out +CXSparse/Tcov/cs_demo1_ci +CXSparse/Tcov/cs_demo1_cl +CXSparse/Tcov/cs_demo1_di +CXSparse/Tcov/cs_demo1_dl +CXSparse/Tcov/cs_demo2_ci +CXSparse/Tcov/cs_demo2_cl +CXSparse/Tcov/cs_demo2_di +CXSparse/Tcov/cs_demo2_dl +CXSparse/Tcov/cs_demo3_ci +CXSparse/Tcov/cs_demo3_cl +CXSparse/Tcov/cs_demo3_di +CXSparse/Tcov/cs_demo3_dl +CXSparse/Tcov/cs_idemo +CXSparse/Tcov/cs_ldemo +CXSparse/Tcov/cstcov_test_ci +CXSparse/Tcov/cstcov_test_cl +CXSparse/Tcov/cstcov_test_di +CXSparse/Tcov/cstcov_test_dl + +KLU/Tcov/cov_*.c +KLU/Tcov/klutest +KLU/Tcov/klultest +KLU/Tcov/*.out + +SPQR/Tcov/X.mtx +SPQR/Tcov/gpu_results.txt +SPQR/Tcov/gpuqrengine_demo +SPQR/Tcov/qrdemo_gpu +SPQR/Tcov/qrtest +SPQR/Tcov/qrtest_out.txt +SPQR/Tcov/troll.m +SPQR/Tcov/cov.out + +UMFPACK/Tcov/covall_err.out +UMFPACK/Tcov/cover.out + +# ignore these specific files in the Package/MATLAB directories +MATLAB_Tools/spqr_rank/save_samples_demo_spqr_rank.mat +CXSparse/MATLAB/CSparse/cs_cl_*.c +CXSparse/MATLAB/Test/cs_cl_*.c + +RBio/Tcov/RBdemo +RBio/Tcov/RBdemo.c +RBio/Tcov/RBio.c +RBio/Tcov/RBio.h +RBio/Tcov/RBtest +RBio/Tcov/SuiteSparse_config.c +RBio/Tcov/SuiteSparse_config.h +RBio/Tcov/*.out +RBio/Tcov/*.rb + +# GraphBLAS +GraphBLAS/Demo/bfs_demo.out +GraphBLAS/Demo/complex_demo.m +GraphBLAS/Demo/mis_demo.out +GraphBLAS/Demo/simple_demo.out +GraphBLAS/Demo/wildtype_demo.out +GraphBLAS/Demo/tri_demo.out +GraphBLAS/Test/errlog.txt +GraphBLAS/Test/log.txt +GraphBLAS/Doc/GraphBLAS_UserGuide.out +GraphBLAS/Tcov/errlog.txt +GraphBLAS/Tcov/log.txt +GraphBLAS/Tcov/gbstat.mat + +tri/tri_main +ktruss/allktruss_graphblas_main +ktruss/allktruss_main +ktruss/ktruss_graphblas_main +ktruss/ktruss_main + +ssget/files/ss_index_old.mat +ssget/files/ssstats_old.csv + +# Do not ignore this file +!.gitignore + diff --git a/ThirdParty/SuiteSparse/AMD/CMakeLists.txt b/ThirdParty/SuiteSparse/AMD/CMakeLists.txt new file mode 100644 index 0000000000..4fdf61499f --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/CMakeLists.txt @@ -0,0 +1,195 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/AMD/CMakeLists.txt: cmake for AMD +#------------------------------------------------------------------------------- + +# Copyright (c) 1996-2022, Timothy A. Davis, Patrick Amestoy, Iain Duff. +# All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- +# get the version +#------------------------------------------------------------------------------- + +cmake_minimum_required ( VERSION 3.19 ) + +set ( AMD_DATE "Jan 17, 2023" ) +set ( AMD_VERSION_MAJOR 3 ) +set ( AMD_VERSION_MINOR 0 ) +set ( AMD_VERSION_SUB 3 ) + +message ( STATUS "Building AMD version: v" + ${AMD_VERSION_MAJOR}. + ${AMD_VERSION_MINOR}. + ${AMD_VERSION_SUB} " (" ${AMD_DATE} ")" ) + +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${CMAKE_SOURCE_DIR}/cmake_modules + ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +if ( WIN32 ) + # disable Fortran in AMD when compiling on Windows + set ( NFORTRAN true ) +endif ( ) + +if ( NOT NFORTRAN ) + # Fortan is available and enabled + project ( amd + VERSION "${AMD_VERSION_MAJOR}.${AMD_VERSION_MINOR}.${AMD_VERSION_SUB}" + LANGUAGES C Fortran ) +else ( ) + # no Fortran compiler available; do not compile Source/*.f or Demo/*.f + project ( amd + VERSION "${AMD_VERSION_MAJOR}.${AMD_VERSION_MINOR}.${AMD_VERSION_SUB}" + LANGUAGES C ) +endif ( ) + +#------------------------------------------------------------------------------- +# find library dependencies +#------------------------------------------------------------------------------- + +find_package ( SuiteSparse_config 7.0.0 REQUIRED ) + +#------------------------------------------------------------------------------- +# configure files +#------------------------------------------------------------------------------- + +configure_file ( "Config/amd.h.in" "${PROJECT_SOURCE_DIR}/Include/amd.h" + NEWLINE_STYLE LF ) +configure_file ( "Config/amd_version.tex.in" "${PROJECT_SOURCE_DIR}/Doc/amd_version.tex" + NEWLINE_STYLE LF ) + +#------------------------------------------------------------------------------- +# include directories +#------------------------------------------------------------------------------- + +include_directories ( Source Include ${SUITESPARSE_CONFIG_INCLUDE_DIR} ) + +#------------------------------------------------------------------------------- +# dynamic amd library properties +#------------------------------------------------------------------------------- + +if ( NOT NFORTRAN ) + file ( GLOB AMD_SOURCES "Source/*.c" "Source/*.f" ) +else ( ) + file ( GLOB AMD_SOURCES "Source/*.c" ) +endif ( ) + +add_library ( amd SHARED ${AMD_SOURCES} ) +set_target_properties ( amd PROPERTIES + VERSION ${AMD_VERSION_MAJOR}.${AMD_VERSION_MINOR}.${AMD_VERSION_SUB} + C_STANDARD_REQUIRED 11 + SOVERSION ${AMD_VERSION_MAJOR} + PUBLIC_HEADER "Include/amd.h" + WINDOWS_EXPORT_ALL_SYMBOLS ON ) + +#------------------------------------------------------------------------------- +# static amd library properties +#------------------------------------------------------------------------------- + +if ( NOT NSTATIC ) + add_library ( amd_static STATIC ${AMD_SOURCES} ) + set_target_properties ( amd_static PROPERTIES + VERSION ${AMD_VERSION_MAJOR}.${AMD_VERSION_MINOR}.${AMD_VERSION_SUB} + C_STANDARD_REQUIRED 11 + OUTPUT_NAME amd + SOVERSION ${AMD_VERSION_MAJOR} ) + + if ( MSVC ) + set_target_properties ( amd_static PROPERTIES + OUTPUT_NAME amd_static ) + endif ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# add the library dependencies +#------------------------------------------------------------------------------- + +# suitesparseconfig: +target_link_libraries ( amd PUBLIC ${SUITESPARSE_CONFIG_LIBRARIES} ) +if ( NOT NSTATIC ) + target_link_libraries ( amd_static PUBLIC ${SUITESPARSE_CONFIG_STATIC} ) +endif ( ) + +# libm: +if ( NOT WIN32 ) + target_link_libraries ( amd PUBLIC m ) + if ( NOT NSTATIC ) + target_link_libraries ( amd_static PUBLIC m ) + endif ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# AMD installation location +#------------------------------------------------------------------------------- + +install ( TARGETS amd + LIBRARY DESTINATION ${SUITESPARSE_LIBDIR} + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} + RUNTIME DESTINATION ${SUITESPARSE_BINDIR} + PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} ) +install ( FILES ${CMAKE_SOURCE_DIR}/cmake_modules/FindAMD.cmake + DESTINATION ${SUITESPARSE_LIBDIR}/cmake/SuiteSparse + COMPONENT Development ) +if ( NOT NSTATIC ) + install ( TARGETS amd_static + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} ) +endif ( ) + +#------------------------------------------------------------------------------- +# Demo library and programs +#------------------------------------------------------------------------------- + +option ( DEMO "ON: Build the demo programs. OFF (default): do not build the demo programs." off ) +if ( DEMO ) + + #--------------------------------------------------------------------------- + # demo library + #--------------------------------------------------------------------------- + + message ( STATUS "Also compiling the demos in AMD/Demo" ) + + #--------------------------------------------------------------------------- + # Demo programs + #--------------------------------------------------------------------------- + + add_executable ( amd_demo "Demo/amd_demo.c" ) + add_executable ( amd_l_demo "Demo/amd_l_demo.c" ) + add_executable ( amd_demo2 "Demo/amd_demo2.c" ) + add_executable ( amd_simple "Demo/amd_simple.c" ) + if ( NOT NFORTRAN ) + add_executable ( amd_f77demo "Demo/amd_f77demo.f" ) + add_executable ( amd_f77simple "Demo/amd_f77simple.f" ) + endif ( ) + + # Libraries required for Demo programs + target_link_libraries ( amd_demo PUBLIC amd ) + target_link_libraries ( amd_l_demo PUBLIC amd ) + target_link_libraries ( amd_demo2 PUBLIC amd ) + target_link_libraries ( amd_simple PUBLIC amd ) + if ( NOT NFORTRAN ) + target_link_libraries ( amd_f77demo PUBLIC amd ) + target_link_libraries ( amd_f77simple PUBLIC amd ) + endif ( ) + +else ( ) + + message ( STATUS "Skipping the demos in AMD/Demo" ) + +endif ( ) + +#------------------------------------------------------------------------------- +# report status +#------------------------------------------------------------------------------- + +include ( SuiteSparseReport ) + diff --git a/ThirdParty/SuiteSparse/AMD/Config/amd.h.in b/ThirdParty/SuiteSparse/AMD/Config/amd.h.in new file mode 100644 index 0000000000..f2a6916654 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Config/amd.h.in @@ -0,0 +1,389 @@ +//------------------------------------------------------------------------------ +// AMD/Include/amd.h: approximate minimum degree ordering +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + +/* AMD finds a symmetric ordering P of a matrix A so that the Cholesky + * factorization of P*A*P' has fewer nonzeros and takes less work than the + * Cholesky factorization of A. If A is not symmetric, then it performs its + * ordering on the matrix A+A'. Two sets of user-callable routines are + * provided, one for int32_t integers and the other for int64_t integers. + * + * The method is based on the approximate minimum degree algorithm, discussed + * in Amestoy, Davis, and Duff, "An approximate degree ordering algorithm", + * SIAM Journal of Matrix Analysis and Applications, vol. 17, no. 4, pp. + * 886-905, 1996. This package can perform both the AMD ordering (with + * aggressive absorption), and the AMDBAR ordering (without aggressive + * absorption) discussed in the above paper. This package differs from the + * Fortran codes discussed in the paper: + * + * (1) it can ignore "dense" rows and columns, leading to faster run times + * (2) it computes the ordering of A+A' if A is not symmetric + * (3) it is followed by a depth-first post-ordering of the assembly tree + * (or supernodal elimination tree) + * + * For historical reasons, the Fortran versions, amd.f and amdbar.f, have + * been left (nearly) unchanged. They compute the identical ordering as + * described in the above paper. + */ + +#ifndef AMD_H +#define AMD_H + +/* make it easy for C++ programs to include AMD */ +#ifdef __cplusplus +extern "C" { +#endif + +#include "SuiteSparse_config.h" + +int amd_order /* returns AMD_OK, AMD_OK_BUT_JUMBLED, + * AMD_INVALID, or AMD_OUT_OF_MEMORY */ +( + int32_t n, /* A is n-by-n. n must be >= 0. */ + const int32_t Ap [ ], /* column pointers for A, of size n+1 */ + const int32_t Ai [ ], /* row indices of A, of size nz = Ap [n] */ + int32_t P [ ], /* output permutation, of size n */ + double Control [ ], /* input Control settings, of size AMD_CONTROL */ + double Info [ ] /* output Info statistics, of size AMD_INFO */ +) ; + +int amd_l_order /* see above for description */ +( + int64_t n, + const int64_t Ap [ ], + const int64_t Ai [ ], + int64_t P [ ], + double Control [ ], + double Info [ ] +) ; + +/* Input arguments (not modified): + * + * n: the matrix A is n-by-n. + * Ap: an int32_t/int64_t array of size n+1, containing column + * pointers of A. + * Ai: an int32_t/int64_t array of size nz, containing the row + * indices of A, where nz = Ap [n]. + * Control: a double array of size AMD_CONTROL, containing control + * parameters. Defaults are used if Control is NULL. + * + * Output arguments (not defined on input): + * + * P: an int32_t/int64_t array of size n, containing the output + * permutation. If row i is the kth pivot row, then P [k] = i. In + * MATLAB notation, the reordered matrix is A (P,P). + * Info: a double array of size AMD_INFO, containing statistical + * information. Ignored if Info is NULL. + * + * On input, the matrix A is stored in column-oriented form. The row indices + * of nonzero entries in column j are stored in Ai [Ap [j] ... Ap [j+1]-1]. + * + * If the row indices appear in ascending order in each column, and there + * are no duplicate entries, then amd_order is slightly more efficient in + * terms of time and memory usage. If this condition does not hold, a copy + * of the matrix is created (where these conditions do hold), and the copy is + * ordered. + * + * Row indices must be in the range 0 to + * n-1. Ap [0] must be zero, and thus nz = Ap [n] is the number of nonzeros + * in A. The array Ap is of size n+1, and the array Ai is of size nz = Ap [n]. + * The matrix does not need to be symmetric, and the diagonal does not need to + * be present (if diagonal entries are present, they are ignored except for + * the output statistic Info [AMD_NZDIAG]). The arrays Ai and Ap are not + * modified. This form of the Ap and Ai arrays to represent the nonzero + * pattern of the matrix A is the same as that used internally by MATLAB. + * If you wish to use a more flexible input structure, please see the + * umfpack_*_triplet_to_col routines in the UMFPACK package, at + * http://www.suitesparse.com. + * + * Restrictions: n >= 0. Ap [0] = 0. Ap [j] <= Ap [j+1] for all j in the + * range 0 to n-1. nz = Ap [n] >= 0. Ai [0..nz-1] must be in the range 0 + * to n-1. Finally, Ai, Ap, and P must not be NULL. If any of these + * restrictions are not met, AMD returns AMD_INVALID. + * + * AMD returns: + * + * AMD_OK if the matrix is valid and sufficient memory can be allocated to + * perform the ordering. + * + * AMD_OUT_OF_MEMORY if not enough memory can be allocated. + * + * AMD_INVALID if the input arguments n, Ap, Ai are invalid, or if P is + * NULL. + * + * AMD_OK_BUT_JUMBLED if the matrix had unsorted columns, and/or duplicate + * entries, but was otherwise valid. + * + * The AMD routine first forms the pattern of the matrix A+A', and then + * computes a fill-reducing ordering, P. If P [k] = i, then row/column i of + * the original is the kth pivotal row. In MATLAB notation, the permuted + * matrix is A (P,P), except that 0-based indexing is used instead of the + * 1-based indexing in MATLAB. + * + * The Control array is used to set various parameters for AMD. If a NULL + * pointer is passed, default values are used. The Control array is not + * modified. + * + * Control [AMD_DENSE]: controls the threshold for "dense" rows/columns. + * A dense row/column in A+A' can cause AMD to spend a lot of time in + * ordering the matrix. If Control [AMD_DENSE] >= 0, rows/columns + * with more than Control [AMD_DENSE] * sqrt (n) entries are ignored + * during the ordering, and placed last in the output order. The + * default value of Control [AMD_DENSE] is 10. If negative, no + * rows/columns are treated as "dense". Rows/columns with 16 or + * fewer off-diagonal entries are never considered "dense". + * + * Control [AMD_AGGRESSIVE]: controls whether or not to use aggressive + * absorption, in which a prior element is absorbed into the current + * element if is a subset of the current element, even if it is not + * adjacent to the current pivot element (refer to Amestoy, Davis, + * & Duff, 1996, for more details). The default value is nonzero, + * which means to perform aggressive absorption. This nearly always + * leads to a better ordering (because the approximate degrees are + * more accurate) and a lower execution time. There are cases where + * it can lead to a slightly worse ordering, however. To turn it off, + * set Control [AMD_AGGRESSIVE] to 0. + * + * Control [2..4] are not used in the current version, but may be used in + * future versions. + * + * The Info array provides statistics about the ordering on output. If it is + * not present, the statistics are not returned. This is not an error + * condition. + * + * Info [AMD_STATUS]: the return value of AMD, either AMD_OK, + * AMD_OK_BUT_JUMBLED, AMD_OUT_OF_MEMORY, or AMD_INVALID. + * + * Info [AMD_N]: n, the size of the input matrix + * + * Info [AMD_NZ]: the number of nonzeros in A, nz = Ap [n] + * + * Info [AMD_SYMMETRY]: the symmetry of the matrix A. It is the number + * of "matched" off-diagonal entries divided by the total number of + * off-diagonal entries. An entry A(i,j) is matched if A(j,i) is also + * an entry, for any pair (i,j) for which i != j. In MATLAB notation, + * S = spones (A) ; + * B = tril (S, -1) + triu (S, 1) ; + * symmetry = nnz (B & B') / nnz (B) ; + * + * Info [AMD_NZDIAG]: the number of entries on the diagonal of A. + * + * Info [AMD_NZ_A_PLUS_AT]: the number of nonzeros in A+A', excluding the + * diagonal. If A is perfectly symmetric (Info [AMD_SYMMETRY] = 1) + * with a fully nonzero diagonal, then Info [AMD_NZ_A_PLUS_AT] = nz-n + * (the smallest possible value). If A is perfectly unsymmetric + * (Info [AMD_SYMMETRY] = 0, for an upper triangular matrix, for + * example) with no diagonal, then Info [AMD_NZ_A_PLUS_AT] = 2*nz + * (the largest possible value). + * + * Info [AMD_NDENSE]: the number of "dense" rows/columns of A+A' that were + * removed from A prior to ordering. These are placed last in the + * output order P. + * + * Info [AMD_MEMORY]: the amount of memory used by AMD, in bytes. In the + * current version, this is 1.2 * Info [AMD_NZ_A_PLUS_AT] + 9*n + * times the size of an integer. This is at most 2.4nz + 9n. This + * excludes the size of the input arguments Ai, Ap, and P, which have + * a total size of nz + 2*n + 1 integers. + * + * Info [AMD_NCMPA]: the number of garbage collections performed. + * + * Info [AMD_LNZ]: the number of nonzeros in L (excluding the diagonal). + * This is a slight upper bound because mass elimination is combined + * with the approximate degree update. It is a rough upper bound if + * there are many "dense" rows/columns. The rest of the statistics, + * below, are also slight or rough upper bounds, for the same reasons. + * The post-ordering of the assembly tree might also not exactly + * correspond to a true elimination tree postordering. + * + * Info [AMD_NDIV]: the number of divide operations for a subsequent LDL' + * or LU factorization of the permuted matrix A (P,P). + * + * Info [AMD_NMULTSUBS_LDL]: the number of multiply-subtract pairs for a + * subsequent LDL' factorization of A (P,P). + * + * Info [AMD_NMULTSUBS_LU]: the number of multiply-subtract pairs for a + * subsequent LU factorization of A (P,P), assuming that no numerical + * pivoting is required. + * + * Info [AMD_DMAX]: the maximum number of nonzeros in any column of L, + * including the diagonal. + * + * Info [14..19] are not used in the current version, but may be used in + * future versions. + */ + +/* ------------------------------------------------------------------------- */ +/* direct interface to AMD */ +/* ------------------------------------------------------------------------- */ + +/* amd_2 is the primary AMD ordering routine. It is not meant to be + * user-callable because of its restrictive inputs and because it destroys + * the user's input matrix. It does not check its inputs for errors, either. + * However, if you can work with these restrictions it can be faster than + * amd_order and use less memory (assuming that you can create your own copy + * of the matrix for AMD to destroy). Refer to AMD/Source/amd_2.c for a + * description of each parameter. */ + +void amd_2 +( + int32_t n, + int32_t Pe [ ], + int32_t Iw [ ], + int32_t Len [ ], + int32_t iwlen, + int32_t pfree, + int32_t Nv [ ], + int32_t Next [ ], + int32_t Last [ ], + int32_t Head [ ], + int32_t Elen [ ], + int32_t Degree [ ], + int32_t W [ ], + double Control [ ], + double Info [ ] +) ; + +void amd_l2 +( + int64_t n, + int64_t Pe [ ], + int64_t Iw [ ], + int64_t Len [ ], + int64_t iwlen, + int64_t pfree, + int64_t Nv [ ], + int64_t Next [ ], + int64_t Last [ ], + int64_t Head [ ], + int64_t Elen [ ], + int64_t Degree [ ], + int64_t W [ ], + double Control [ ], + double Info [ ] +) ; + +/* ------------------------------------------------------------------------- */ +/* amd_valid */ +/* ------------------------------------------------------------------------- */ + +/* Returns AMD_OK or AMD_OK_BUT_JUMBLED if the matrix is valid as input to + * amd_order; the latter is returned if the matrix has unsorted and/or + * duplicate row indices in one or more columns. Returns AMD_INVALID if the + * matrix cannot be passed to amd_order. For amd_order, the matrix must also + * be square. The first two arguments are the number of rows and the number + * of columns of the matrix. For its use in AMD, these must both equal n. + */ + +int amd_valid +( + int32_t n_row, /* # of rows */ + int32_t n_col, /* # of columns */ + const int32_t Ap [ ], /* column pointers, of size n_col+1 */ + const int32_t Ai [ ] /* row indices, of size Ap [n_col] */ +) ; + +int amd_l_valid +( + int64_t n_row, + int64_t n_col, + const int64_t Ap [ ], + const int64_t Ai [ ] +) ; + +/* ------------------------------------------------------------------------- */ +/* AMD Control and Info arrays */ +/* ------------------------------------------------------------------------- */ + +/* amd_defaults: sets the default control settings */ +void amd_defaults (double Control [ ]) ; +void amd_l_defaults (double Control [ ]) ; + +/* amd_control: prints the control settings */ +void amd_control (double Control [ ]) ; +void amd_l_control (double Control [ ]) ; + +/* amd_info: prints the statistics */ +void amd_info (double Info [ ]) ; +void amd_l_info (double Info [ ]) ; + +#define AMD_CONTROL 5 /* size of Control array */ +#define AMD_INFO 20 /* size of Info array */ + +/* contents of Control */ +#define AMD_DENSE 0 /* "dense" if degree > Control [0] * sqrt (n) */ +#define AMD_AGGRESSIVE 1 /* do aggressive absorption if Control [1] != 0 */ + +/* default Control settings */ +#define AMD_DEFAULT_DENSE 10.0 /* default "dense" degree 10*sqrt(n) */ +#define AMD_DEFAULT_AGGRESSIVE 1 /* do aggressive absorption by default */ + +/* contents of Info */ +#define AMD_STATUS 0 /* return value of amd_order and amd_l_order */ +#define AMD_N 1 /* A is n-by-n */ +#define AMD_NZ 2 /* number of nonzeros in A */ +#define AMD_SYMMETRY 3 /* symmetry of pattern (1 is sym., 0 is unsym.) */ +#define AMD_NZDIAG 4 /* # of entries on diagonal */ +#define AMD_NZ_A_PLUS_AT 5 /* nz in A+A' */ +#define AMD_NDENSE 6 /* number of "dense" rows/columns in A */ +#define AMD_MEMORY 7 /* amount of memory used by AMD */ +#define AMD_NCMPA 8 /* number of garbage collections in AMD */ +#define AMD_LNZ 9 /* approx. nz in L, excluding the diagonal */ +#define AMD_NDIV 10 /* number of fl. point divides for LU and LDL' */ +#define AMD_NMULTSUBS_LDL 11 /* number of fl. point (*,-) pairs for LDL' */ +#define AMD_NMULTSUBS_LU 12 /* number of fl. point (*,-) pairs for LU */ +#define AMD_DMAX 13 /* max nz. in any column of L, incl. diagonal */ + +/* ------------------------------------------------------------------------- */ +/* return values of AMD */ +/* ------------------------------------------------------------------------- */ + +#define AMD_OK 0 /* success */ +#define AMD_OUT_OF_MEMORY -1 /* malloc failed, or problem too large */ +#define AMD_INVALID -2 /* input arguments are not valid */ +#define AMD_OK_BUT_JUMBLED 1 /* input matrix is OK for amd_order, but + * columns were not sorted, and/or duplicate entries were present. AMD had + * to do extra work before ordering the matrix. This is a warning, not an + * error. */ + +/* ========================================================================== */ +/* === AMD version ========================================================== */ +/* ========================================================================== */ + +/* AMD Version 1.2 and later include the following definitions. + * As an example, to test if the version you are using is 1.2 or later: + * + * #ifdef AMD_VERSION + * if (AMD_VERSION >= AMD_VERSION_CODE (1,2)) ... + * #endif + * + * This also works during compile-time: + * + * #if defined(AMD_VERSION) && (AMD_VERSION >= AMD_VERSION_CODE (1,2)) + * printf ("This is version 1.2 or later\n") ; + * #else + * printf ("This is an early version\n") ; + * #endif + * + * Versions 1.1 and earlier of AMD do not include a #define'd version number. + */ + +#define AMD_DATE "@AMD_DATE@" +#define AMD_MAIN_VERSION @AMD_VERSION_MAJOR@ +#define AMD_SUB_VERSION @AMD_VERSION_MINOR@ +#define AMD_SUBSUB_VERSION @AMD_VERSION_SUB@ + +#define AMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) +#define AMD_VERSION AMD_VERSION_CODE(AMD_MAIN_VERSION,AMD_SUB_VERSION) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/ThirdParty/SuiteSparse/AMD/Config/amd_version.tex.in b/ThirdParty/SuiteSparse/AMD/Config/amd_version.tex.in new file mode 100644 index 0000000000..1e47eb8598 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Config/amd_version.tex.in @@ -0,0 +1,2 @@ +% version of SuiteSparse/AMD +\date{VERSION @AMD_VERSION_MAJOR@.@AMD_VERSION_MINOR@.@AMD_VERSION_SUB@, @AMD_DATE@} diff --git a/ThirdParty/SuiteSparse/AMD/Demo/Makefile b/ThirdParty/SuiteSparse/AMD/Demo/Makefile deleted file mode 100644 index 452e0e34c1..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/Makefile +++ /dev/null @@ -1,97 +0,0 @@ -#----------------------------------------------------------------------------- -# compile the AMD demo -#----------------------------------------------------------------------------- - -default: amd_simple amd_demo amd_demo2 amd_l_demo - -gak: - echo $(SUITESPARSE) - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -C = $(CC) $(CF) -I../../include - -LIB2 = $(LDFLAGS) -L../../lib -lamd -lsuitesparseconfig $(LDLIBS) - -library: - ( cd ../../SuiteSparse_config ; $(MAKE) ) - ( cd ../Lib ; $(MAKE) ) - -f77lib: - ( cd ../Lib ; $(MAKE) fortran ) - -#------------------------------------------------------------------------------ -# Create the demo program, run it, and compare the output -#------------------------------------------------------------------------------ - -dist: - -amd_demo: amd_demo.c library - $(C) -o amd_demo amd_demo.c $(LIB2) - ./amd_demo > my_amd_demo.out - - diff amd_demo.out my_amd_demo.out - -amd_l_demo: amd_l_demo.c library - $(C) -o amd_l_demo amd_l_demo.c $(LIB2) - ./amd_l_demo > my_amd_l_demo.out - - diff amd_l_demo.out my_amd_l_demo.out - -amd_demo2: amd_demo2.c library - $(C) -o amd_demo2 amd_demo2.c $(LIB2) - ./amd_demo2 > my_amd_demo2.out - - diff amd_demo2.out my_amd_demo2.out - -amd_simple: amd_simple.c library - echo $(LD_LIBRARY_PATH) - $(C) -o amd_simple amd_simple.c $(LIB2) - ./amd_simple > my_amd_simple.out - - diff amd_simple.out my_amd_simple.out - -#------------------------------------------------------------------------------ -# compile the Fortran demo -#------------------------------------------------------------------------------ - -fortran: amd_f77demo amd_f77simple - -cross: amd_f77cross - -amd_f77demo: amd_f77demo.f f77lib - $(F77) $(F77FLAGS) -o amd_f77demo amd_f77demo.f ../Lib/libamdf77.a \ - $(F77LIB) - ./amd_f77demo > my_amd_f77demo.out - - diff amd_f77demo.out my_amd_f77demo.out - -amd_f77simple: amd_f77simple.f f77lib - $(F77) $(F77FLAGS) -o amd_f77simple amd_f77simple.f \ - ../Lib/libamdf77.a $(F77LIB) - ./amd_f77simple > my_amd_f77simple.out - - diff amd_f77simple.out my_amd_f77simple.out - -amd_f77wrapper.o: amd_f77wrapper.c - $(C) -DDINT -c amd_f77wrapper.c - -amd_f77cross: amd_f77cross.f amd_f77wrapper.o ../Lib/libamd.a - $(F77) $(F77FLAGS) -o amd_f77cross amd_f77cross.f amd_f77wrapper.o \ - ../Lib/libamd.a $(F77LIB) - ./amd_f77cross > my_amd_f77cross.out - - diff amd_f77cross.out my_amd_f77cross.out - -#------------------------------------------------------------------------------ -# Remove all but the files in the original distribution -#------------------------------------------------------------------------------ - -clean: - - $(RM) -r $(CLEAN) - -purge: distclean - -distclean: clean - - $(RM) amd_demo my_amd_demo.out - - $(RM) amd_l_demo my_amd_l_demo.out - - $(RM) amd_demo2 my_amd_demo2.out - - $(RM) amd_simple my_amd_simple.out - - $(RM) amd_f77demo my_amd_f77demo.out - - $(RM) amd_f77simple my_amd_f77simple.out - - $(RM) amd_f77cross my_amd_f77cross.out - - $(RM) -r $(PURGE) - diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_demo.c b/ThirdParty/SuiteSparse/AMD/Demo/amd_demo.c deleted file mode 100644 index 70d90070a8..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_demo.c +++ /dev/null @@ -1,177 +0,0 @@ -/* ========================================================================= */ -/* === AMD demo main program =============================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* AMD Copyright (c) by Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* DrTimothyAldenDavis@gmail.com, http://www.suitesparse.com */ -/* ------------------------------------------------------------------------- */ - -/* A simple C main program that illustrates the use of the ANSI C interface - * to AMD. - */ - -#include "amd.h" -#include -#include - -int main (void) -{ - /* The symmetric can_24 Harwell/Boeing matrix, including upper and lower - * triangular parts, and the diagonal entries. Note that this matrix is - * 0-based, with row and column indices in the range 0 to n-1. */ - int n = 24, nz, - Ap [ ] = { 0, 9, 15, 21, 27, 33, 39, 48, 57, 61, 70, 76, 82, 88, 94, 100, - 106, 110, 119, 128, 137, 143, 152, 156, 160 }, - Ai [ ] = { - /* column 0: */ 0, 5, 6, 12, 13, 17, 18, 19, 21, - /* column 1: */ 1, 8, 9, 13, 14, 17, - /* column 2: */ 2, 6, 11, 20, 21, 22, - /* column 3: */ 3, 7, 10, 15, 18, 19, - /* column 4: */ 4, 7, 9, 14, 15, 16, - /* column 5: */ 0, 5, 6, 12, 13, 17, - /* column 6: */ 0, 2, 5, 6, 11, 12, 19, 21, 23, - /* column 7: */ 3, 4, 7, 9, 14, 15, 16, 17, 18, - /* column 8: */ 1, 8, 9, 14, - /* column 9: */ 1, 4, 7, 8, 9, 13, 14, 17, 18, - /* column 10: */ 3, 10, 18, 19, 20, 21, - /* column 11: */ 2, 6, 11, 12, 21, 23, - /* column 12: */ 0, 5, 6, 11, 12, 23, - /* column 13: */ 0, 1, 5, 9, 13, 17, - /* column 14: */ 1, 4, 7, 8, 9, 14, - /* column 15: */ 3, 4, 7, 15, 16, 18, - /* column 16: */ 4, 7, 15, 16, - /* column 17: */ 0, 1, 5, 7, 9, 13, 17, 18, 19, - /* column 18: */ 0, 3, 7, 9, 10, 15, 17, 18, 19, - /* column 19: */ 0, 3, 6, 10, 17, 18, 19, 20, 21, - /* column 20: */ 2, 10, 19, 20, 21, 22, - /* column 21: */ 0, 2, 6, 10, 11, 19, 20, 21, 22, - /* column 22: */ 2, 20, 21, 22, - /* column 23: */ 6, 11, 12, 23 } ; - - int P [24], Pinv [24], i, j, k, jnew, p, inew, result ; - double Control [AMD_CONTROL], Info [AMD_INFO] ; - char A [24][24] ; - - /* here is an example of how to use AMD_VERSION. This code will work in - * any version of AMD. */ -#if defined(AMD_VERSION) && (AMD_VERSION >= AMD_VERSION_CODE(1,2)) - printf ("AMD version %d.%d.%d, date: %s\n", - AMD_MAIN_VERSION, AMD_SUB_VERSION, AMD_SUBSUB_VERSION, AMD_DATE) ; -#else - printf ("AMD version: 1.1 or earlier\n") ; -#endif - - printf ("AMD demo, with the 24-by-24 Harwell/Boeing matrix, can_24:\n") ; - - /* get the default parameters, and print them */ - amd_defaults (Control) ; - amd_control (Control) ; - - /* print the input matrix */ - nz = Ap [n] ; - printf ("\nInput matrix: %d-by-%d, with %d entries.\n" - " Note that for a symmetric matrix such as this one, only the\n" - " strictly lower or upper triangular parts would need to be\n" - " passed to AMD, since AMD computes the ordering of A+A'. The\n" - " diagonal entries are also not needed, since AMD ignores them.\n" - , n, n, nz) ; - for (j = 0 ; j < n ; j++) - { - printf ("\nColumn: %d, number of entries: %d, with row indices in" - " Ai [%d ... %d]:\n row indices:", - j, Ap [j+1] - Ap [j], Ap [j], Ap [j+1]-1) ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - printf (" %d", i) ; - } - printf ("\n") ; - } - - /* print a character plot of the input matrix. This is only reasonable - * because the matrix is small. */ - printf ("\nPlot of input matrix pattern:\n") ; - for (j = 0 ; j < n ; j++) - { - for (i = 0 ; i < n ; i++) A [i][j] = '.' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - A [i][j] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1d", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2d: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - /* order the matrix */ - result = amd_order (n, Ap, Ai, P, Control, Info) ; - printf ("return value from amd_order: %d (should be %d)\n", - result, AMD_OK) ; - - /* print the statistics */ - amd_info (Info) ; - - if (result != AMD_OK) - { - printf ("AMD failed\n") ; - exit (1) ; - } - - /* print the permutation vector, P, and compute the inverse permutation */ - printf ("Permutation vector:\n") ; - for (k = 0 ; k < n ; k++) - { - /* row/column j is the kth row/column in the permuted matrix */ - j = P [k] ; - Pinv [j] = k ; - printf (" %2d", j) ; - } - printf ("\n\n") ; - - printf ("Inverse permutation vector:\n") ; - for (j = 0 ; j < n ; j++) - { - k = Pinv [j] ; - printf (" %2d", k) ; - } - printf ("\n\n") ; - - /* print a character plot of the permuted matrix. */ - printf ("\nPlot of permuted matrix pattern:\n") ; - for (jnew = 0 ; jnew < n ; jnew++) - { - j = P [jnew] ; - for (inew = 0 ; inew < n ; inew++) A [inew][jnew] = '.' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - inew = Pinv [Ai [p]] ; - A [inew][jnew] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1d", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2d: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - return (0) ; -} diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_demo.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_demo.out deleted file mode 100644 index 9f44f24f57..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_demo.out +++ /dev/null @@ -1,179 +0,0 @@ -AMD version 2.4.6, date: May 4, 2016 -AMD demo, with the 24-by-24 Harwell/Boeing matrix, can_24: - -AMD version 2.4.6, May 4, 2016: approximate minimum degree ordering - dense row parameter: 10 - (rows with more than max (10 * sqrt (n), 16) entries are - considered "dense", and placed last in output permutation) - aggressive absorption: yes - size of AMD integer: 4 - - -Input matrix: 24-by-24, with 160 entries. - Note that for a symmetric matrix such as this one, only the - strictly lower or upper triangular parts would need to be - passed to AMD, since AMD computes the ordering of A+A'. The - diagonal entries are also not needed, since AMD ignores them. - -Column: 0, number of entries: 9, with row indices in Ai [0 ... 8]: - row indices: 0 5 6 12 13 17 18 19 21 - -Column: 1, number of entries: 6, with row indices in Ai [9 ... 14]: - row indices: 1 8 9 13 14 17 - -Column: 2, number of entries: 6, with row indices in Ai [15 ... 20]: - row indices: 2 6 11 20 21 22 - -Column: 3, number of entries: 6, with row indices in Ai [21 ... 26]: - row indices: 3 7 10 15 18 19 - -Column: 4, number of entries: 6, with row indices in Ai [27 ... 32]: - row indices: 4 7 9 14 15 16 - -Column: 5, number of entries: 6, with row indices in Ai [33 ... 38]: - row indices: 0 5 6 12 13 17 - -Column: 6, number of entries: 9, with row indices in Ai [39 ... 47]: - row indices: 0 2 5 6 11 12 19 21 23 - -Column: 7, number of entries: 9, with row indices in Ai [48 ... 56]: - row indices: 3 4 7 9 14 15 16 17 18 - -Column: 8, number of entries: 4, with row indices in Ai [57 ... 60]: - row indices: 1 8 9 14 - -Column: 9, number of entries: 9, with row indices in Ai [61 ... 69]: - row indices: 1 4 7 8 9 13 14 17 18 - -Column: 10, number of entries: 6, with row indices in Ai [70 ... 75]: - row indices: 3 10 18 19 20 21 - -Column: 11, number of entries: 6, with row indices in Ai [76 ... 81]: - row indices: 2 6 11 12 21 23 - -Column: 12, number of entries: 6, with row indices in Ai [82 ... 87]: - row indices: 0 5 6 11 12 23 - -Column: 13, number of entries: 6, with row indices in Ai [88 ... 93]: - row indices: 0 1 5 9 13 17 - -Column: 14, number of entries: 6, with row indices in Ai [94 ... 99]: - row indices: 1 4 7 8 9 14 - -Column: 15, number of entries: 6, with row indices in Ai [100 ... 105]: - row indices: 3 4 7 15 16 18 - -Column: 16, number of entries: 4, with row indices in Ai [106 ... 109]: - row indices: 4 7 15 16 - -Column: 17, number of entries: 9, with row indices in Ai [110 ... 118]: - row indices: 0 1 5 7 9 13 17 18 19 - -Column: 18, number of entries: 9, with row indices in Ai [119 ... 127]: - row indices: 0 3 7 9 10 15 17 18 19 - -Column: 19, number of entries: 9, with row indices in Ai [128 ... 136]: - row indices: 0 3 6 10 17 18 19 20 21 - -Column: 20, number of entries: 6, with row indices in Ai [137 ... 142]: - row indices: 2 10 19 20 21 22 - -Column: 21, number of entries: 9, with row indices in Ai [143 ... 151]: - row indices: 0 2 6 10 11 19 20 21 22 - -Column: 22, number of entries: 4, with row indices in Ai [152 ... 155]: - row indices: 2 20 21 22 - -Column: 23, number of entries: 4, with row indices in Ai [156 ... 159]: - row indices: 6 11 12 23 - -Plot of input matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X . . . . X X . . . . . X X . . . X X X . X . . - 1: . X . . . . . . X X . . . X X . . X . . . . . . - 2: . . X . . . X . . . . X . . . . . . . . X X X . - 3: . . . X . . . X . . X . . . . X . . X X . . . . - 4: . . . . X . . X . X . . . . X X X . . . . . . . - 5: X . . . . X X . . . . . X X . . . X . . . . . . - 6: X . X . . X X . . . . X X . . . . . . X . X . X - 7: . . . X X . . X . X . . . . X X X X X . . . . . - 8: . X . . . . . . X X . . . . X . . . . . . . . . - 9: . X . . X . . X X X . . . X X . . X X . . . . . -10: . . . X . . . . . . X . . . . . . . X X X X . . -11: . . X . . . X . . . . X X . . . . . . . . X . X -12: X . . . . X X . . . . X X . . . . . . . . . . X -13: X X . . . X . . . X . . . X . . . X . . . . . . -14: . X . . X . . X X X . . . . X . . . . . . . . . -15: . . . X X . . X . . . . . . . X X . X . . . . . -16: . . . . X . . X . . . . . . . X X . . . . . . . -17: X X . . . X . X . X . . . X . . . X X X . . . . -18: X . . X . . . X . X X . . . . X . X X X . . . . -19: X . . X . . X . . . X . . . . . . X X X X X . . -20: . . X . . . . . . . X . . . . . . . . X X X X . -21: X . X . . . X . . . X X . . . . . . . X X X X . -22: . . X . . . . . . . . . . . . . . . . . X X X . -23: . . . . . . X . . . . X X . . . . . . . . . . X -return value from amd_order: 0 (should be 0) - -AMD version 2.4.6, May 4, 2016, results: - status: OK - n, dimension of A: 24 - nz, number of nonzeros in A: 160 - symmetry of A: 1.0000 - number of nonzeros on diagonal: 24 - nonzeros in pattern of A+A' (excl. diagonal): 136 - # dense rows/columns of A+A': 0 - memory used, in bytes: 1516 - # of memory compactions: 0 - - The following approximate statistics are for a subsequent - factorization of A(P,P) + A(P,P)'. They are slight upper - bounds if there are no dense rows/columns in A+A', and become - looser if dense rows/columns exist. - - nonzeros in L (excluding diagonal): 97 - nonzeros in L (including diagonal): 121 - # divide operations for LDL' or LU: 97 - # multiply-subtract operations for LDL': 275 - # multiply-subtract operations for LU: 453 - max nz. in any column of L (incl. diagonal): 8 - - chol flop count for real A, sqrt counted as 1 flop: 671 - LDL' flop count for real A: 647 - LDL' flop count for complex A: 3073 - LU flop count for real A (with no pivoting): 1003 - LU flop count for complex A (with no pivoting): 4497 - -Permutation vector: - 22 20 10 23 12 5 16 8 14 4 15 7 1 9 13 17 0 2 3 6 11 18 21 19 - -Inverse permutation vector: - 16 12 17 18 9 5 19 11 7 13 2 20 4 14 8 10 6 15 21 23 1 22 0 3 - - -Plot of permuted matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X X . . . . . . . . . . . . . . . X . . . . X . - 1: X X X . . . . . . . . . . . . . . X . . . . X X - 2: . X X . . . . . . . . . . . . . . . X . . X X X - 3: . . . X X . . . . . . . . . . . . . . X X . . . - 4: . . . X X X . . . . . . . . . . X . . X X . . . - 5: . . . . X X . . . . . . . . X X X . . X . . . . - 6: . . . . . . X . . X X X . . . . . . . . . . . . - 7: . . . . . . . X X . . . X X . . . . . . . . . . - 8: . . . . . . . X X X . X X X . . . . . . . . . . - 9: . . . . . . X . X X X X . X . . . . . . . . . . -10: . . . . . . X . . X X X . . . . . . X . . X . . -11: . . . . . . X . X X X X . X . X . . X . . X . . -12: . . . . . . . X X . . . X X X X . . . . . . . . -13: . . . . . . . X X X . X X X X X . . . . . X . . -14: . . . . . X . . . . . . X X X X X . . . . . . . -15: . . . . . X . . . . . X X X X X X . . . . X . X -16: . . . . X X . . . . . . . . X X X . . X . X X X -17: X X . . . . . . . . . . . . . . . X . X X . X . -18: . . X . . . . . . . X X . . . . . . X . . X . X -19: . . . X X X . . . . . . . . . . X X . X X . X X -20: . . . X X . . . . . . . . . . . . X . X X . X . -21: . . X . . . . . . . X X . X . X X . X . . X . X -22: X X X . . . . . . . . . . . . . X X . X X . X X -23: . X X . . . . . . . . . . . . X X . X X . X X X diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_demo2.c b/ThirdParty/SuiteSparse/AMD/Demo/amd_demo2.c deleted file mode 100644 index 68c1e9e8fd..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_demo2.c +++ /dev/null @@ -1,208 +0,0 @@ -/* ========================================================================= */ -/* === AMD demo main program (jumbled matrix version) ====================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* AMD Copyright (c) by Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* DrTimothyAldenDavis@gmail.com, http://www.suitesparse.com */ -/* ------------------------------------------------------------------------- */ - -/* A simple C main program that illustrates the use of the ANSI C interface - * to AMD. - * - * Identical to amd_demo.c, except that it operates on an input matrix that has - * unsorted columns and duplicate entries. - */ - -#include "amd.h" -#include -#include - -int main (void) -{ - /* The symmetric can_24 Harwell/Boeing matrix (jumbled, and not symmetric). - * Since AMD operates on A+A', only A(i,j) or A(j,i) need to be specified, - * or both. The diagonal entries are optional (some are missing). - * There are many duplicate entries, which must be removed. */ - int n = 24, nz, - Ap [ ] = { 0, 9, 14, 20, 28, 33, 37, 44, 53, 58, 63, 63, 66, 69, 72, 75, - 78, 82, 86, 91, 97, 101, 112, 112, 116 }, - Ai [ ] = { - /* column 0: */ 0, 17, 18, 21, 5, 12, 5, 0, 13, - /* column 1: */ 14, 1, 8, 13, 17, - /* column 2: */ 2, 20, 11, 6, 11, 22, - /* column 3: */ 3, 3, 10, 7, 18, 18, 15, 19, - /* column 4: */ 7, 9, 15, 14, 16, - /* column 5: */ 5, 13, 6, 17, - /* column 6: */ 5, 0, 11, 6, 12, 6, 23, - /* column 7: */ 3, 4, 9, 7, 14, 16, 15, 17, 18, - /* column 8: */ 1, 9, 14, 14, 14, - /* column 9: */ 7, 13, 8, 1, 17, - /* column 10: */ - /* column 11: */ 2, 12, 23, - /* column 12: */ 5, 11, 12, - /* column 13: */ 0, 13, 17, - /* column 14: */ 1, 9, 14, - /* column 15: */ 3, 15, 16, - /* column 16: */ 16, 4, 4, 15, - /* column 17: */ 13, 17, 19, 17, - /* column 18: */ 15, 17, 19, 9, 10, - /* column 19: */ 17, 19, 20, 0, 6, 10, - /* column 20: */ 22, 10, 20, 21, - /* column 21: */ 6, 2, 10, 19, 20, 11, 21, 22, 22, 22, 22, - /* column 22: */ - /* column 23: */ 12, 11, 12, 23 } ; - - int P [24], Pinv [24], i, j, k, jnew, p, inew, result ; - double Control [AMD_CONTROL], Info [AMD_INFO] ; - char A [24][24] ; - - printf ("AMD demo, with a jumbled version of the 24-by-24\n") ; - printf ("Harwell/Boeing matrix, can_24:\n") ; - - /* get the default parameters, and print them */ - amd_defaults (Control) ; - amd_control (Control) ; - - /* print the input matrix */ - nz = Ap [n] ; - printf ("\nJumbled input matrix: %d-by-%d, with %d entries.\n" - " Note that for a symmetric matrix such as this one, only the\n" - " strictly lower or upper triangular parts would need to be\n" - " passed to AMD, since AMD computes the ordering of A+A'. The\n" - " diagonal entries are also not needed, since AMD ignores them.\n" - " This version of the matrix has jumbled columns and duplicate\n" - " row indices.\n", n, n, nz) ; - for (j = 0 ; j < n ; j++) - { - printf ("\nColumn: %d, number of entries: %d, with row indices in" - " Ai [%d ... %d]:\n row indices:", - j, Ap [j+1] - Ap [j], Ap [j], Ap [j+1]-1) ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - printf (" %d", i) ; - } - printf ("\n") ; - } - - /* print a character plot of the input matrix. This is only reasonable - * because the matrix is small. */ - printf ("\nPlot of (jumbled) input matrix pattern:\n") ; - for (j = 0 ; j < n ; j++) - { - for (i = 0 ; i < n ; i++) A [i][j] = '.' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - A [i][j] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1d", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2d: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - /* print a character plot of the matrix A+A'. */ - printf ("\nPlot of symmetric matrix to be ordered by amd_order:\n") ; - for (j = 0 ; j < n ; j++) - { - for (i = 0 ; i < n ; i++) A [i][j] = '.' ; - } - for (j = 0 ; j < n ; j++) - { - A [j][j] = 'X' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - A [i][j] = 'X' ; - A [j][i] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1d", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2d: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - /* order the matrix */ - result = amd_order (n, Ap, Ai, P, Control, Info) ; - printf ("return value from amd_order: %d (should be %d)\n", - result, AMD_OK_BUT_JUMBLED) ; - - /* print the statistics */ - amd_info (Info) ; - - if (result != AMD_OK_BUT_JUMBLED) - { - printf ("AMD failed\n") ; - exit (1) ; - } - - /* print the permutation vector, P, and compute the inverse permutation */ - printf ("Permutation vector:\n") ; - for (k = 0 ; k < n ; k++) - { - /* row/column j is the kth row/column in the permuted matrix */ - j = P [k] ; - Pinv [j] = k ; - printf (" %2d", j) ; - } - printf ("\n\n") ; - - printf ("Inverse permutation vector:\n") ; - for (j = 0 ; j < n ; j++) - { - k = Pinv [j] ; - printf (" %2d", k) ; - } - printf ("\n\n") ; - - /* print a character plot of the permuted matrix. */ - printf ("\nPlot of (symmetrized) permuted matrix pattern:\n") ; - for (j = 0 ; j < n ; j++) - { - for (i = 0 ; i < n ; i++) A [i][j] = '.' ; - } - for (jnew = 0 ; jnew < n ; jnew++) - { - j = P [jnew] ; - A [jnew][jnew] = 'X' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - inew = Pinv [Ai [p]] ; - A [inew][jnew] = 'X' ; - A [jnew][inew] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1d", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2d: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - return (0) ; -} diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_demo2.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_demo2.out deleted file mode 100644 index bd65055fdb..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_demo2.out +++ /dev/null @@ -1,208 +0,0 @@ -AMD demo, with a jumbled version of the 24-by-24 -Harwell/Boeing matrix, can_24: - -AMD version 2.4.6, May 4, 2016: approximate minimum degree ordering - dense row parameter: 10 - (rows with more than max (10 * sqrt (n), 16) entries are - considered "dense", and placed last in output permutation) - aggressive absorption: yes - size of AMD integer: 4 - - -Jumbled input matrix: 24-by-24, with 116 entries. - Note that for a symmetric matrix such as this one, only the - strictly lower or upper triangular parts would need to be - passed to AMD, since AMD computes the ordering of A+A'. The - diagonal entries are also not needed, since AMD ignores them. - This version of the matrix has jumbled columns and duplicate - row indices. - -Column: 0, number of entries: 9, with row indices in Ai [0 ... 8]: - row indices: 0 17 18 21 5 12 5 0 13 - -Column: 1, number of entries: 5, with row indices in Ai [9 ... 13]: - row indices: 14 1 8 13 17 - -Column: 2, number of entries: 6, with row indices in Ai [14 ... 19]: - row indices: 2 20 11 6 11 22 - -Column: 3, number of entries: 8, with row indices in Ai [20 ... 27]: - row indices: 3 3 10 7 18 18 15 19 - -Column: 4, number of entries: 5, with row indices in Ai [28 ... 32]: - row indices: 7 9 15 14 16 - -Column: 5, number of entries: 4, with row indices in Ai [33 ... 36]: - row indices: 5 13 6 17 - -Column: 6, number of entries: 7, with row indices in Ai [37 ... 43]: - row indices: 5 0 11 6 12 6 23 - -Column: 7, number of entries: 9, with row indices in Ai [44 ... 52]: - row indices: 3 4 9 7 14 16 15 17 18 - -Column: 8, number of entries: 5, with row indices in Ai [53 ... 57]: - row indices: 1 9 14 14 14 - -Column: 9, number of entries: 5, with row indices in Ai [58 ... 62]: - row indices: 7 13 8 1 17 - -Column: 10, number of entries: 0, with row indices in Ai [63 ... 62]: - row indices: - -Column: 11, number of entries: 3, with row indices in Ai [63 ... 65]: - row indices: 2 12 23 - -Column: 12, number of entries: 3, with row indices in Ai [66 ... 68]: - row indices: 5 11 12 - -Column: 13, number of entries: 3, with row indices in Ai [69 ... 71]: - row indices: 0 13 17 - -Column: 14, number of entries: 3, with row indices in Ai [72 ... 74]: - row indices: 1 9 14 - -Column: 15, number of entries: 3, with row indices in Ai [75 ... 77]: - row indices: 3 15 16 - -Column: 16, number of entries: 4, with row indices in Ai [78 ... 81]: - row indices: 16 4 4 15 - -Column: 17, number of entries: 4, with row indices in Ai [82 ... 85]: - row indices: 13 17 19 17 - -Column: 18, number of entries: 5, with row indices in Ai [86 ... 90]: - row indices: 15 17 19 9 10 - -Column: 19, number of entries: 6, with row indices in Ai [91 ... 96]: - row indices: 17 19 20 0 6 10 - -Column: 20, number of entries: 4, with row indices in Ai [97 ... 100]: - row indices: 22 10 20 21 - -Column: 21, number of entries: 11, with row indices in Ai [101 ... 111]: - row indices: 6 2 10 19 20 11 21 22 22 22 22 - -Column: 22, number of entries: 0, with row indices in Ai [112 ... 111]: - row indices: - -Column: 23, number of entries: 4, with row indices in Ai [112 ... 115]: - row indices: 12 11 12 23 - -Plot of (jumbled) input matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X . . . . . X . . . . . . X . . . . . X . . . . - 1: . X . . . . . . X X . . . . X . . . . . . . . . - 2: . . X . . . . . . . . X . . . . . . . . . X . . - 3: . . . X . . . X . . . . . . . X . . . . . . . . - 4: . . . . . . . X . . . . . . . . X . . . . . . . - 5: X . . . . X X . . . . . X . . . . . . . . . . . - 6: . . X . . X X . . . . . . . . . . . . X . X . . - 7: . . . X X . . X . X . . . . . . . . . . . . . . - 8: . X . . . . . . . X . . . . . . . . . . . . . . - 9: . . . . X . . X X . . . . . X . . . X . . . . . -10: . . . X . . . . . . . . . . . . . . X X X X . . -11: . . X . . . X . . . . . X . . . . . . . . X . X -12: X . . . . . X . . . . X X . . . . . . . . . . X -13: X X . . . X . . . X . . . X . . . X . . . . . . -14: . X . . X . . X X . . . . . X . . . . . . . . . -15: . . . X X . . X . . . . . . . X X . X . . . . . -16: . . . . X . . X . . . . . . . X X . . . . . . . -17: X X . . . X . X . X . . . X . . . X X X . . . . -18: X . . X . . . X . . . . . . . . . . . . . . . . -19: . . . X . . . . . . . . . . . . . X X X . X . . -20: . . X . . . . . . . . . . . . . . . . X X X . . -21: X . . . . . . . . . . . . . . . . . . . X X . . -22: . . X . . . . . . . . . . . . . . . . . X X . . -23: . . . . . . X . . . . X . . . . . . . . . . . X - -Plot of symmetric matrix to be ordered by amd_order: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X . . . . X X . . . . . X X . . . X X X . X . . - 1: . X . . . . . . X X . . . X X . . X . . . . . . - 2: . . X . . . X . . . . X . . . . . . . . X X X . - 3: . . . X . . . X . . X . . . . X . . X X . . . . - 4: . . . . X . . X . X . . . . X X X . . . . . . . - 5: X . . . . X X . . . . . X X . . . X . . . . . . - 6: X . X . . X X . . . . X X . . . . . . X . X . X - 7: . . . X X . . X . X . . . . X X X X X . . . . . - 8: . X . . . . . . X X . . . . X . . . . . . . . . - 9: . X . . X . . X X X . . . X X . . X X . . . . . -10: . . . X . . . . . . X . . . . . . . X X X X . . -11: . . X . . . X . . . . X X . . . . . . . . X . X -12: X . . . . X X . . . . X X . . . . . . . . . . X -13: X X . . . X . . . X . . . X . . . X . . . . . . -14: . X . . X . . X X X . . . . X . . . . . . . . . -15: . . . X X . . X . . . . . . . X X . X . . . . . -16: . . . . X . . X . . . . . . . X X . . . . . . . -17: X X . . . X . X . X . . . X . . . X X X . . . . -18: X . . X . . . X . X X . . . . X . X X X . . . . -19: X . . X . . X . . . X . . . . . . X X X X X . . -20: . . X . . . . . . . X . . . . . . . . X X X X . -21: X . X . . . X . . . X X . . . . . . . X X X X . -22: . . X . . . . . . . . . . . . . . . . . X X X . -23: . . . . . . X . . . . X X . . . . . . . . . . X -return value from amd_order: 1 (should be 1) - -AMD version 2.4.6, May 4, 2016, results: - status: OK, but jumbled - n, dimension of A: 24 - nz, number of nonzeros in A: 102 - symmetry of A: 0.4000 - number of nonzeros on diagonal: 17 - nonzeros in pattern of A+A' (excl. diagonal): 136 - # dense rows/columns of A+A': 0 - memory used, in bytes: 2080 - # of memory compactions: 0 - - The following approximate statistics are for a subsequent - factorization of A(P,P) + A(P,P)'. They are slight upper - bounds if there are no dense rows/columns in A+A', and become - looser if dense rows/columns exist. - - nonzeros in L (excluding diagonal): 97 - nonzeros in L (including diagonal): 121 - # divide operations for LDL' or LU: 97 - # multiply-subtract operations for LDL': 275 - # multiply-subtract operations for LU: 453 - max nz. in any column of L (incl. diagonal): 8 - - chol flop count for real A, sqrt counted as 1 flop: 671 - LDL' flop count for real A: 647 - LDL' flop count for complex A: 3073 - LU flop count for real A (with no pivoting): 1003 - LU flop count for complex A (with no pivoting): 4497 - -Permutation vector: - 22 20 10 23 12 5 16 8 14 4 15 7 1 9 13 17 0 2 3 6 11 18 21 19 - -Inverse permutation vector: - 16 12 17 18 9 5 19 11 7 13 2 20 4 14 8 10 6 15 21 23 1 22 0 3 - - -Plot of (symmetrized) permuted matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X X . . . . . . . . . . . . . . . X . . . . X . - 1: X X X . . . . . . . . . . . . . . X . . . . X X - 2: . X X . . . . . . . . . . . . . . . X . . X X X - 3: . . . X X . . . . . . . . . . . . . . X X . . . - 4: . . . X X X . . . . . . . . . . X . . X X . . . - 5: . . . . X X . . . . . . . . X X X . . X . . . . - 6: . . . . . . X . . X X X . . . . . . . . . . . . - 7: . . . . . . . X X . . . X X . . . . . . . . . . - 8: . . . . . . . X X X . X X X . . . . . . . . . . - 9: . . . . . . X . X X X X . X . . . . . . . . . . -10: . . . . . . X . . X X X . . . . . . X . . X . . -11: . . . . . . X . X X X X . X . X . . X . . X . . -12: . . . . . . . X X . . . X X X X . . . . . . . . -13: . . . . . . . X X X . X X X X X . . . . . X . . -14: . . . . . X . . . . . . X X X X X . . . . . . . -15: . . . . . X . . . . . X X X X X X . . . . X . X -16: . . . . X X . . . . . . . . X X X . . X . X X X -17: X X . . . . . . . . . . . . . . . X . X X . X . -18: . . X . . . . . . . X X . . . . . . X . . X . X -19: . . . X X X . . . . . . . . . . X X . X X . X X -20: . . . X X . . . . . . . . . . . . X . X X . X . -21: . . X . . . . . . . X X . X . X X . X . . X . X -22: X X X . . . . . . . . . . . . . X X . X X . X X -23: . X X . . . . . . . . . . . . X X . X X . X X X diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77cross.f b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77cross.f deleted file mode 100644 index b79920d802..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77cross.f +++ /dev/null @@ -1,50 +0,0 @@ -C ====================================================================== -C === AMD_cross ======================================================== -C ====================================================================== - -C ---------------------------------------------------------------------- -C AMD, Copyright (c) by Timothy A. Davis, Patrick R. -C Amestoy, and Iain S. Duff. See ../README.txt for License. -C email: DrTimothyAldenDavis@gmail.com -C ---------------------------------------------------------------------- - -C This program provides an example of how to call the C version of AMD -C from a Fortran program. It is HIGHLY non-portable. - -C The amd_order routine returns PERM (1) < 0 if an error occurs. -C (-1: out of memory, -2: invalid matrix) - -C Note that the input matrix is 0-based. From Fortran, column j of the -C matrix is in AI (AP (I)+1 ... AP (I+1)). The row indices in this -C set are in the range 0 to N-1. To demonstrate this translation, -C the input matrix is printed in 1-based form. This program uses -C the same 5-by-5 test matrix as amd_simple.c. - - INTEGER N, NZ, K, P - PARAMETER (N = 5, NZ = 14) - INTEGER AP (N+1), AI (NZ), PERM (N) - DATA AP / 0, 2, 6, 10, 12, 14 / - DATA AI / 0,1, 0,1,2,4, 1,2,3,4, 2,3, 1,4 / - DOUBLE PRECISION CONTROL (5), INFO (20) - -C print the input matrix - PRINT 10, N, N, NZ -10 FORMAT ('Input matrix:', I2, '-by-', I2, ' with',I3,' entries') - DO 40 J = 1, N - PRINT 20, J, AP (J+1) - AP (J), AP (J)+1, AP (J+1) -20 FORMAT ( /, 'Column: ', I2, ' number of entries: ', I2, - $ ' with row indices in AI (', I3, ' ... ', I3, ')') - PRINT 30, ((AI (P) + 1), P = AP (J) + 1, AP (J+1)) -30 FORMAT (' row indices: ', 24I3) -40 CONTINUE - - CALL AMDDEFAULTS (CONTROL) - CALL AMDORDER (N, AP, AI, PERM, CONTROL, INFO) - CALL AMDINFO (INFO) - - DO 60 K = 1, N - PRINT 50, K, PERM (K) + 1 -50 FORMAT ('PERM (',I2,') = ', I2) -60 CONTINUE - END - diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77cross.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77cross.out deleted file mode 100644 index 6d8a670da5..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77cross.out +++ /dev/null @@ -1,51 +0,0 @@ -Input matrix: 5-by- 5 with 14 entries - -Column: 1 number of entries: 2 with row indices in AI ( 1 ... 2) - row indices: 1 2 - -Column: 2 number of entries: 4 with row indices in AI ( 3 ... 6) - row indices: 1 2 3 5 - -Column: 3 number of entries: 4 with row indices in AI ( 7 ... 10) - row indices: 2 3 4 5 - -Column: 4 number of entries: 2 with row indices in AI ( 11 ... 12) - row indices: 3 4 - -Column: 5 number of entries: 2 with row indices in AI ( 13 ... 14) - row indices: 2 5 - -amd: approximate minimum degree ordering, results: - status: OK - n, dimension of A: 5 - nz, number of nonzeros in A: 14 - symmetry of A: 0.8889 - number of nonzeros on diagonal: 5 - nonzeros in pattern of A+A' (excl. diagonal): 10 - # dense rows/columns of A+A': 0 - memory used, in bytes: 228 - # of memory compactions: 0 - - The following approximate statistics are for a subsequent - factorization of A(P,P) + A(P,P)'. They are slight upper - bounds if there are no dense rows/columns in A+A', and become - looser if dense rows/columns exist. - - nonzeros in L (excluding diagonal): 5 - nonzeros in L (including diagonal): 10 - # divide operations for LDL' or LU: 5 - # multiply-subtract operations for LDL': 6 - # multiply-subtract operations for LU: 7 - max nz. in any column of L (incl. diagonal): 3 - - chol flop count for real A, sqrt counted as 1 flop: 22 - LDL' flop count for real A: 17 - LDL' flop count for complex A: 93 - LU flop count for real A (with no pivoting): 19 - LU flop count for complex A (with no pivoting): 101 - -PERM ( 1) = 1 -PERM ( 2) = 4 -PERM ( 3) = 3 -PERM ( 4) = 5 -PERM ( 5) = 2 diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77demo.f b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77demo.f deleted file mode 100644 index 6aa6296a2e..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77demo.f +++ /dev/null @@ -1,160 +0,0 @@ -C ====================================================================== -C === Fortran AMD demo main program ==================================== -C ====================================================================== - -C ---------------------------------------------------------------------- -C AMD, Copyright (c) by Timothy A. Davis, Patrick R. -C Amestoy, and Iain S. Duff. See ../README.txt for License. -C email: DrTimothyAldenDavis@gmail.com -C ---------------------------------------------------------------------- - -C A simple Fortran 77 main program that illustrates the use of the -C Fortran version of AMD (both the AMD and AMDBAR routines). Note -C that aggressive absorption has no effect on this particular matrix. - -C AP and AI contain the symmetric can_24 Harwell/Boeing matrix, -C including upper and lower triangular parts, but excluding the -C diagonal entries. Note that this matrix is 1-based, with row -C and column indices in the range 1 to N. - - INTEGER N, NZ, IWLEN, PFREE, I, J, K, JNEW, P, INEW, - $ METHOD, NCMPA - PARAMETER (N = 24, NZ = 136, IWLEN = 200) - INTEGER PE (N), DEGREE (N), NV (N), NEXT (N), PERM (N), W (N), - $ HEAD (N), PINV (N), LEN (N), AP (N+1), AI (NZ), IW (IWLEN) - CHARACTER A (24,24) - - DATA AP - $ / 1, 9, 14, 19, 24, 29, 34, 42, 50, 53, 61, 66, 71, - $ 76, 81, 86, 91, 94, 102, 110, 118, 123, 131, 134, 137 / - DATA AI / - $ 6, 7, 13, 14, 18, 19, 20, 22, - $ 9, 10, 14, 15, 18, - $ 7, 12, 21, 22, 23, - $ 8, 11, 16, 19, 20, - $ 8, 10, 15, 16, 17, - $ 1, 7, 13, 14, 18, - $ 1, 3, 6, 12, 13, 20, 22, 24, - $ 4, 5, 10, 15, 16, 17, 18, 19, - $ 2, 10, 15, - $ 2, 5, 8, 9, 14, 15, 18, 19, - $ 4, 19, 20, 21, 22, - $ 3, 7, 13, 22, 24, - $ 1, 6, 7, 12, 24, - $ 1, 2, 6, 10, 18, - $ 2, 5, 8, 9, 10, - $ 4, 5, 8, 17, 19, - $ 5, 8, 16, - $ 1, 2, 6, 8, 10, 14, 19, 20, - $ 1, 4, 8, 10, 11, 16, 18, 20, - $ 1, 4, 7, 11, 18, 19, 21, 22, - $ 3, 11, 20, 22, 23, - $ 1, 3, 7, 11, 12, 20, 21, 23, - $ 3, 21, 22, - $ 7, 12, 13 / - -C print the input matrix - PRINT 11, N, N, NZ -11 FORMAT ('AMD Fortran 77 demo, with the 24-by-24', - $ ' Harwell/Boeing matrix, can_24:' - $ /, 'Input matrix: ', I2, '-by-', I2,' with ',I3,' entries', - $ /, 'Note that the Fortran version of AMD requires that' - $ /, 'no diagonal entries be present.') - DO 20 J = 1, N - PRINT 21, J, AP (J+1) - AP (J), AP (J), AP (J+1)-1 -21 FORMAT ( /, 'Column: ', I2, ' number of entries: ', I2, - $ ' with row indices in AI (', I3, ' ... ', I3, ')') - PRINT 10, ((AI (P)), P = AP (J), AP (J+1) - 1) -10 FORMAT (' row indices: ', 24I3) -20 CONTINUE - -C print a character plot of the input matrix. This is only -C reasonable because the matrix is small. - PRINT 31 -31 FORMAT ('Plot of input matrix pattern:') - DO 50 J = 1,N - DO 30 I = 1,N - A (I, J) = '.' -30 CONTINUE -C add the diagonal entry to the plot - A (J, J) = 'X' - DO 40 P = AP (J), AP (J+1) - 1 - I = AI (P) - A (I, J) = 'X' -40 CONTINUE -50 CONTINUE - PRINT 60, ((MOD (J, 10)), J = 1,N) -60 FORMAT (' ', 24I2) - DO 80 I = 1,N - PRINT 70, I, (A (I, J), J = 1,N) -70 FORMAT (' ', I2, ': ', 24A2) -80 CONTINUE - - DO 190 METHOD = 1,2 - -C load the matrix into AMD's workspace - DO 90 J = 1,N - PE (J) = AP (J) - LEN (J) = AP (J+1) - AP (J) -90 CONTINUE - DO 100 P = 1,NZ - IW (P) = AI (P) -100 CONTINUE - PFREE = NZ + 1 - -C order the matrix using AMD or AMDBAR - IF (METHOD .EQ. 1) THEN - PRINT 101 -101 FORMAT (/, '------------------------------------------', - $ /, 'ordering the matrix with AMD', - $ /, '------------------------------------------') - CALL AMD (N, PE, IW, LEN, IWLEN, PFREE, NV, NEXT, - $ PERM, HEAD, PINV, DEGREE, NCMPA, W) - ELSE - PRINT 102 -102 FORMAT (/, '------------------------------------------', - $ /, 'ordering the matrix with AMDBAR', - $ /, '------------------------------------------') - CALL AMDBAR (N, PE, IW, LEN, IWLEN, PFREE, NV, NEXT, - $ PERM, HEAD, PINV, DEGREE, NCMPA, W) - ENDIF - -C print the permutation vector, PERM, and its inverse, PINV. -C row/column J = PERM (K) is the Kth row/column in the -C permuted matrix. - PRINT 110, (PERM (K), K = 1,N) -110 FORMAT (/, 'Permutation vector: ', /, 24I3) - PRINT 120, (PINV (J), J = 1,N) -120 FORMAT (/, 'Inverse permutation vector: ', /, 24I3) - -C print a character plot of the permuted matrix. - PRINT 121 -121 FORMAT ('Plot of permuted matrix pattern:') - DO 150 JNEW = 1,N - J = PERM (JNEW) - DO 130 INEW = 1,N - A (INEW, JNEW) = '.' -130 CONTINUE -C add the diagonal entry to the plot - A (JNEW, JNEW) = 'X' - DO 140 P = AP (J), AP (J+1) - 1 - INEW = PINV (AI (P)) - A (INEW, JNEW) = 'X' -140 CONTINUE -150 CONTINUE - PRINT 60, ((MOD (J, 10)), J = 1,N) - DO 160 I = 1,N - PRINT 70, I, (A (I, J), J = 1,N) -160 CONTINUE - -C print the permuted matrix, PERM*A*PERM' - DO 180 JNEW = 1,N - J = PERM (JNEW) - PRINT 171, JNEW, J, AP (J+1) - AP (J) -171 FORMAT (/, 'New column: ', I2, ' old column: ', I2, - $ ' number of entries: ', I2) - PRINT 170, (PINV (AI (P)), P = AP (J), AP (J+1) - 1) -170 FORMAT (' new row indices: ', 24I3) -180 CONTINUE -190 CONTINUE - END diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77demo.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77demo.out deleted file mode 100644 index 10758dd511..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77demo.out +++ /dev/null @@ -1,318 +0,0 @@ -AMD Fortran 77 demo, with the 24-by-24 Harwell/Boeing matrix, can_24: -Input matrix: 24-by-24 with 136 entries -Note that the Fortran version of AMD requires that -no diagonal entries be present. - -Column: 1 number of entries: 8 with row indices in AI ( 1 ... 8) - row indices: 6 7 13 14 18 19 20 22 - -Column: 2 number of entries: 5 with row indices in AI ( 9 ... 13) - row indices: 9 10 14 15 18 - -Column: 3 number of entries: 5 with row indices in AI ( 14 ... 18) - row indices: 7 12 21 22 23 - -Column: 4 number of entries: 5 with row indices in AI ( 19 ... 23) - row indices: 8 11 16 19 20 - -Column: 5 number of entries: 5 with row indices in AI ( 24 ... 28) - row indices: 8 10 15 16 17 - -Column: 6 number of entries: 5 with row indices in AI ( 29 ... 33) - row indices: 1 7 13 14 18 - -Column: 7 number of entries: 8 with row indices in AI ( 34 ... 41) - row indices: 1 3 6 12 13 20 22 24 - -Column: 8 number of entries: 8 with row indices in AI ( 42 ... 49) - row indices: 4 5 10 15 16 17 18 19 - -Column: 9 number of entries: 3 with row indices in AI ( 50 ... 52) - row indices: 2 10 15 - -Column: 10 number of entries: 8 with row indices in AI ( 53 ... 60) - row indices: 2 5 8 9 14 15 18 19 - -Column: 11 number of entries: 5 with row indices in AI ( 61 ... 65) - row indices: 4 19 20 21 22 - -Column: 12 number of entries: 5 with row indices in AI ( 66 ... 70) - row indices: 3 7 13 22 24 - -Column: 13 number of entries: 5 with row indices in AI ( 71 ... 75) - row indices: 1 6 7 12 24 - -Column: 14 number of entries: 5 with row indices in AI ( 76 ... 80) - row indices: 1 2 6 10 18 - -Column: 15 number of entries: 5 with row indices in AI ( 81 ... 85) - row indices: 2 5 8 9 10 - -Column: 16 number of entries: 5 with row indices in AI ( 86 ... 90) - row indices: 4 5 8 17 19 - -Column: 17 number of entries: 3 with row indices in AI ( 91 ... 93) - row indices: 5 8 16 - -Column: 18 number of entries: 8 with row indices in AI ( 94 ... 101) - row indices: 1 2 6 8 10 14 19 20 - -Column: 19 number of entries: 8 with row indices in AI (102 ... 109) - row indices: 1 4 8 10 11 16 18 20 - -Column: 20 number of entries: 8 with row indices in AI (110 ... 117) - row indices: 1 4 7 11 18 19 21 22 - -Column: 21 number of entries: 5 with row indices in AI (118 ... 122) - row indices: 3 11 20 22 23 - -Column: 22 number of entries: 8 with row indices in AI (123 ... 130) - row indices: 1 3 7 11 12 20 21 23 - -Column: 23 number of entries: 3 with row indices in AI (131 ... 133) - row indices: 3 21 22 - -Column: 24 number of entries: 3 with row indices in AI (134 ... 136) - row indices: 7 12 13 -Plot of input matrix pattern: - 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 - 1: X . . . . X X . . . . . X X . . . X X X . X . . - 2: . X . . . . . . X X . . . X X . . X . . . . . . - 3: . . X . . . X . . . . X . . . . . . . . X X X . - 4: . . . X . . . X . . X . . . . X . . X X . . . . - 5: . . . . X . . X . X . . . . X X X . . . . . . . - 6: X . . . . X X . . . . . X X . . . X . . . . . . - 7: X . X . . X X . . . . X X . . . . . . X . X . X - 8: . . . X X . . X . X . . . . X X X X X . . . . . - 9: . X . . . . . . X X . . . . X . . . . . . . . . - 10: . X . . X . . X X X . . . X X . . X X . . . . . - 11: . . . X . . . . . . X . . . . . . . X X X X . . - 12: . . X . . . X . . . . X X . . . . . . . . X . X - 13: X . . . . X X . . . . X X . . . . . . . . . . X - 14: X X . . . X . . . X . . . X . . . X . . . . . . - 15: . X . . X . . X X X . . . . X . . . . . . . . . - 16: . . . X X . . X . . . . . . . X X . X . . . . . - 17: . . . . X . . X . . . . . . . X X . . . . . . . - 18: X X . . . X . X . X . . . X . . . X X X . . . . - 19: X . . X . . . X . X X . . . . X . X X X . . . . - 20: X . . X . . X . . . X . . . . . . X X X X X . . - 21: . . X . . . . . . . X . . . . . . . . X X X X . - 22: X . X . . . X . . . X X . . . . . . . X X X X . - 23: . . X . . . . . . . . . . . . . . . . . X X X . - 24: . . . . . . X . . . . X X . . . . . . . . . . X - ------------------------------------------- -ordering the matrix with AMD ------------------------------------------- - -Permutation vector: - 24 23 17 9 15 5 21 13 6 11 16 8 2 10 14 18 1 3 4 19 7 12 22 20 - -Inverse permutation vector: - 17 13 18 19 6 9 21 12 4 14 10 22 8 15 5 11 3 16 20 24 7 23 2 1 -Plot of permuted matrix pattern: - 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 - 1: X . . . . . . X . . . . . . . . . . . . X X . . - 2: . X . . . . X . . . . . . . . . . X . . . . X . - 3: . . X . . X . . . . X X . . . . . . . . . . . . - 4: . . . X X . . . . . . . X X . . . . . . . . . . - 5: . . . X X X . . . . . X X X . . . . . . . . . . - 6: . . X . X X . . . . X X . X . . . . . . . . . . - 7: . X . . . . X . . X . . . . . . . X . . . . X X - 8: X . . . . . . X X . . . . . . . X . . . X X . . - 9: . . . . . . . X X . . . . . X X X . . . X . . . - 10: . . . . . . X . . X . . . . . . . . X X . . X X - 11: . . X . . X . . . . X X . . . . . . X X . . . . - 12: . . X . X X . . . . X X . X . X . . X X . . . . - 13: . . . X X . . . . . . . X X X X . . . . . . . . - 14: . . . X X X . . . . . X X X X X . . . X . . . . - 15: . . . . . . . . X . . . X X X X X . . . . . . . - 16: . . . . . . . . X . . X X X X X X . . X . . . X - 17: . . . . . . . X X . . . . . X X X . . X X . X X - 18: . X . . . . X . . . . . . . . . . X . . X X X . - 19: . . . . . . . . . X X X . . . . . . X X . . . X - 20: . . . . . . . . . X X X . X . X X . X X . . . X - 21: X . . . . . . X X . . . . . . . X X . . X X X X - 22: X . . . . . . X . . . . . . . . . X . . X X X . - 23: . X . . . . X . . X . . . . . . X X . . X X X X - 24: . . . . . . X . . X . . . . . X X . X X X . X X - -New column: 1 old column: 24 number of entries: 3 - new row indices: 21 22 8 - -New column: 2 old column: 23 number of entries: 3 - new row indices: 18 7 23 - -New column: 3 old column: 17 number of entries: 3 - new row indices: 6 12 11 - -New column: 4 old column: 9 number of entries: 3 - new row indices: 13 14 5 - -New column: 5 old column: 15 number of entries: 5 - new row indices: 13 6 12 4 14 - -New column: 6 old column: 5 number of entries: 5 - new row indices: 12 14 5 11 3 - -New column: 7 old column: 21 number of entries: 5 - new row indices: 18 10 24 23 2 - -New column: 8 old column: 13 number of entries: 5 - new row indices: 17 9 21 22 1 - -New column: 9 old column: 6 number of entries: 5 - new row indices: 17 21 8 15 16 - -New column: 10 old column: 11 number of entries: 5 - new row indices: 19 20 24 7 23 - -New column: 11 old column: 16 number of entries: 5 - new row indices: 19 6 12 3 20 - -New column: 12 old column: 8 number of entries: 8 - new row indices: 19 6 14 5 11 3 16 20 - -New column: 13 old column: 2 number of entries: 5 - new row indices: 4 14 15 5 16 - -New column: 14 old column: 10 number of entries: 8 - new row indices: 13 6 12 4 15 5 16 20 - -New column: 15 old column: 14 number of entries: 5 - new row indices: 17 13 9 14 16 - -New column: 16 old column: 18 number of entries: 8 - new row indices: 17 13 9 12 14 15 20 24 - -New column: 17 old column: 1 number of entries: 8 - new row indices: 9 21 8 15 16 20 24 23 - -New column: 18 old column: 3 number of entries: 5 - new row indices: 21 22 7 23 2 - -New column: 19 old column: 4 number of entries: 5 - new row indices: 12 10 11 20 24 - -New column: 20 old column: 19 number of entries: 8 - new row indices: 17 19 12 14 10 11 16 24 - -New column: 21 old column: 7 number of entries: 8 - new row indices: 17 18 9 22 8 24 23 1 - -New column: 22 old column: 12 number of entries: 5 - new row indices: 18 21 8 23 1 - -New column: 23 old column: 22 number of entries: 8 - new row indices: 17 18 21 10 22 24 7 2 - -New column: 24 old column: 20 number of entries: 8 - new row indices: 17 19 21 10 16 20 7 23 - ------------------------------------------- -ordering the matrix with AMDBAR ------------------------------------------- - -Permutation vector: - 24 23 17 9 15 5 21 13 6 11 16 8 2 10 14 18 1 3 4 19 7 12 22 20 - -Inverse permutation vector: - 17 13 18 19 6 9 21 12 4 14 10 22 8 15 5 11 3 16 20 24 7 23 2 1 -Plot of permuted matrix pattern: - 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 - 1: X . . . . . . X . . . . . . . . . . . . X X . . - 2: . X . . . . X . . . . . . . . . . X . . . . X . - 3: . . X . . X . . . . X X . . . . . . . . . . . . - 4: . . . X X . . . . . . . X X . . . . . . . . . . - 5: . . . X X X . . . . . X X X . . . . . . . . . . - 6: . . X . X X . . . . X X . X . . . . . . . . . . - 7: . X . . . . X . . X . . . . . . . X . . . . X X - 8: X . . . . . . X X . . . . . . . X . . . X X . . - 9: . . . . . . . X X . . . . . X X X . . . X . . . - 10: . . . . . . X . . X . . . . . . . . X X . . X X - 11: . . X . . X . . . . X X . . . . . . X X . . . . - 12: . . X . X X . . . . X X . X . X . . X X . . . . - 13: . . . X X . . . . . . . X X X X . . . . . . . . - 14: . . . X X X . . . . . X X X X X . . . X . . . . - 15: . . . . . . . . X . . . X X X X X . . . . . . . - 16: . . . . . . . . X . . X X X X X X . . X . . . X - 17: . . . . . . . X X . . . . . X X X . . X X . X X - 18: . X . . . . X . . . . . . . . . . X . . X X X . - 19: . . . . . . . . . X X X . . . . . . X X . . . X - 20: . . . . . . . . . X X X . X . X X . X X . . . X - 21: X . . . . . . X X . . . . . . . X X . . X X X X - 22: X . . . . . . X . . . . . . . . . X . . X X X . - 23: . X . . . . X . . X . . . . . . X X . . X X X X - 24: . . . . . . X . . X . . . . . X X . X X X . X X - -New column: 1 old column: 24 number of entries: 3 - new row indices: 21 22 8 - -New column: 2 old column: 23 number of entries: 3 - new row indices: 18 7 23 - -New column: 3 old column: 17 number of entries: 3 - new row indices: 6 12 11 - -New column: 4 old column: 9 number of entries: 3 - new row indices: 13 14 5 - -New column: 5 old column: 15 number of entries: 5 - new row indices: 13 6 12 4 14 - -New column: 6 old column: 5 number of entries: 5 - new row indices: 12 14 5 11 3 - -New column: 7 old column: 21 number of entries: 5 - new row indices: 18 10 24 23 2 - -New column: 8 old column: 13 number of entries: 5 - new row indices: 17 9 21 22 1 - -New column: 9 old column: 6 number of entries: 5 - new row indices: 17 21 8 15 16 - -New column: 10 old column: 11 number of entries: 5 - new row indices: 19 20 24 7 23 - -New column: 11 old column: 16 number of entries: 5 - new row indices: 19 6 12 3 20 - -New column: 12 old column: 8 number of entries: 8 - new row indices: 19 6 14 5 11 3 16 20 - -New column: 13 old column: 2 number of entries: 5 - new row indices: 4 14 15 5 16 - -New column: 14 old column: 10 number of entries: 8 - new row indices: 13 6 12 4 15 5 16 20 - -New column: 15 old column: 14 number of entries: 5 - new row indices: 17 13 9 14 16 - -New column: 16 old column: 18 number of entries: 8 - new row indices: 17 13 9 12 14 15 20 24 - -New column: 17 old column: 1 number of entries: 8 - new row indices: 9 21 8 15 16 20 24 23 - -New column: 18 old column: 3 number of entries: 5 - new row indices: 21 22 7 23 2 - -New column: 19 old column: 4 number of entries: 5 - new row indices: 12 10 11 20 24 - -New column: 20 old column: 19 number of entries: 8 - new row indices: 17 19 12 14 10 11 16 24 - -New column: 21 old column: 7 number of entries: 8 - new row indices: 17 18 9 22 8 24 23 1 - -New column: 22 old column: 12 number of entries: 5 - new row indices: 18 21 8 23 1 - -New column: 23 old column: 22 number of entries: 8 - new row indices: 17 18 21 10 22 24 7 2 - -New column: 24 old column: 20 number of entries: 8 - new row indices: 17 19 21 10 16 20 7 23 diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77simple.f b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77simple.f deleted file mode 100644 index 8f39606e6e..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77simple.f +++ /dev/null @@ -1,37 +0,0 @@ -C ---------------------------------------------------------------------- -C AMD, Copyright (c) by Timothy A. Davis, Patrick R. -C Amestoy, and Iain S. Duff. See ../README.txt for License. -C email: DrTimothyAldenDavis@gmail.com -C ---------------------------------------------------------------------- - -C This program provides an example of how to call the Fortran version -C of AMD. It uses the same matrix as the amd_simple.c demo (in C). -C Note that the diagonal entries are not present, and the matrix is -C symmetric. - - INTEGER N, NZ, J, K, P, IWLEN, PFREE, NCMPA - PARAMETER (N = 5, NZ = 10, IWLEN = 17) - INTEGER AP (N+1), AI (NZ), LAST (N), PE (N), LEN (N), ELEN (N), - $ IW (IWLEN), DEGREE (N), NV (N), NEXT (N), HEAD (N), W (N) - DATA AP / 1, 2, 5, 8, 9, 11/ - DATA AI / 2, 1,3,5, 2,4,5, 3, 2,3 / - -C load the matrix into the AMD workspace - DO 10 J = 1,N - PE (J) = AP (J) - LEN (J) = AP (J+1) - AP (J) -10 CONTINUE - DO 20 P = 1,NZ - IW (P) = AI (P) -20 CONTINUE - PFREE = NZ + 1 - -C order the matrix (destroys the copy of A in IW, PE, and LEN) - CALL AMD (N, PE, IW, LEN, IWLEN, PFREE, NV, NEXT, LAST, HEAD, - $ ELEN, DEGREE, NCMPA, W) - - DO 60 K = 1, N - PRINT 50, K, LAST (K) -50 FORMAT ('P (',I2,') = ', I2) -60 CONTINUE - END diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77simple.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77simple.out deleted file mode 100644 index c7f902e0a4..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77simple.out +++ /dev/null @@ -1,5 +0,0 @@ -P ( 1) = 4 -P ( 2) = 1 -P ( 3) = 3 -P ( 4) = 5 -P ( 5) = 2 diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77wrapper.c b/ThirdParty/SuiteSparse/AMD/Demo/amd_f77wrapper.c deleted file mode 100644 index d918845aa5..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_f77wrapper.c +++ /dev/null @@ -1,87 +0,0 @@ -/* ========================================================================= */ -/* === amd_f77wrapper ====================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* AMD Copyright (c) by Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* Fortran interface for the C-callable AMD library (int version only). This - * is HIGHLY non-portable. You will need to modify this depending on how your - * Fortran and C compilers behave. Two examples are provided. - * - * To avoid using I/O, and to avoid the extra porting step of a Fortran - * function, the status code is returned as the first entry in P (P [0] in C - * and P (1) in Fortran) if an error occurs. The error codes are negative - * (-1: out of memory, -2: invalid matrix). - * - * For some C and Fortran compilers, the Fortran compiler appends a single "_" - * after each routine name. C doesn't do this, so the translation is made - * here. Some Fortran compilers don't append an underscore (xlf on IBM AIX, - * for * example). - */ - -#include "amd.h" -#include - -/* ------------------------------------------------------------------------- */ -/* Linux, Solaris, SGI */ -/* ------------------------------------------------------------------------- */ - -void amdorder_ (int *n, const int *Ap, const int *Ai, int *P, - double *Control, double *Info) -{ - int result = amd_order (*n, Ap, Ai, P, Control, Info) ; - if (result != AMD_OK && P) P [0] = result ; -} - -void amddefaults_ (double *Control) -{ - amd_defaults (Control) ; -} - -void amdcontrol_ (double *Control) -{ - fflush (stdout) ; - amd_control (Control) ; - fflush (stdout) ; -} - -void amdinfo_ (double *Info) -{ - fflush (stdout) ; - amd_info (Info) ; - fflush (stdout) ; -} - -/* ------------------------------------------------------------------------- */ -/* IBM AIX. Probably Windows, Compaq Alpha, and HP Unix as well. */ -/* ------------------------------------------------------------------------- */ - -void amdorder (int *n, const int *Ap, const int *Ai, int *P, - double *Control, double *Info) -{ - int result = amd_order (*n, Ap, Ai, P, Control, Info) ; - if (result != AMD_OK && P) P [0] = result ; -} - -void amddefaults (double *Control) -{ - amd_defaults (Control) ; -} - -void amdcontrol (double *Control) -{ - fflush (stdout) ; - amd_control (Control) ; - fflush (stdout) ; -} - -void amdinfo (double *Info) -{ - fflush (stdout) ; - amd_info (Info) ; - fflush (stdout) ; -} diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_l_demo.c b/ThirdParty/SuiteSparse/AMD/Demo/amd_l_demo.c deleted file mode 100644 index 62a05913ee..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_l_demo.c +++ /dev/null @@ -1,178 +0,0 @@ -/* ========================================================================= */ -/* === AMD demo main program (long integer version) ======================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* AMD Copyright (c) by Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* A simple C main program that illustrates the use of the ANSI C interface - * to AMD. - */ - -#include "amd.h" -#include -#include -#define Long SuiteSparse_long - -int main (void) -{ - /* The symmetric can_24 Harwell/Boeing matrix, including upper and lower - * triangular parts, and the diagonal entries. Note that this matrix is - * 0-based, with row and column indices in the range 0 to n-1. */ - Long n = 24, nz, - Ap [ ] = { 0, 9, 15, 21, 27, 33, 39, 48, 57, 61, 70, 76, 82, 88, 94, 100, - 106, 110, 119, 128, 137, 143, 152, 156, 160 }, - Ai [ ] = { - /* column 0: */ 0, 5, 6, 12, 13, 17, 18, 19, 21, - /* column 1: */ 1, 8, 9, 13, 14, 17, - /* column 2: */ 2, 6, 11, 20, 21, 22, - /* column 3: */ 3, 7, 10, 15, 18, 19, - /* column 4: */ 4, 7, 9, 14, 15, 16, - /* column 5: */ 0, 5, 6, 12, 13, 17, - /* column 6: */ 0, 2, 5, 6, 11, 12, 19, 21, 23, - /* column 7: */ 3, 4, 7, 9, 14, 15, 16, 17, 18, - /* column 8: */ 1, 8, 9, 14, - /* column 9: */ 1, 4, 7, 8, 9, 13, 14, 17, 18, - /* column 10: */ 3, 10, 18, 19, 20, 21, - /* column 11: */ 2, 6, 11, 12, 21, 23, - /* column 12: */ 0, 5, 6, 11, 12, 23, - /* column 13: */ 0, 1, 5, 9, 13, 17, - /* column 14: */ 1, 4, 7, 8, 9, 14, - /* column 15: */ 3, 4, 7, 15, 16, 18, - /* column 16: */ 4, 7, 15, 16, - /* column 17: */ 0, 1, 5, 7, 9, 13, 17, 18, 19, - /* column 18: */ 0, 3, 7, 9, 10, 15, 17, 18, 19, - /* column 19: */ 0, 3, 6, 10, 17, 18, 19, 20, 21, - /* column 20: */ 2, 10, 19, 20, 21, 22, - /* column 21: */ 0, 2, 6, 10, 11, 19, 20, 21, 22, - /* column 22: */ 2, 20, 21, 22, - /* column 23: */ 6, 11, 12, 23 } ; - - Long P [24], Pinv [24], i, j, k, jnew, p, inew, result ; - double Control [AMD_CONTROL], Info [AMD_INFO] ; - char A [24][24] ; - - /* here is an example of how to use AMD_VERSION. This code will work in - * any version of AMD. */ -#if defined(AMD_VERSION) && (AMD_VERSION >= AMD_VERSION_CODE(1,2)) - printf ("AMD version %d.%d.%d, date: %s\n", - AMD_MAIN_VERSION, AMD_SUB_VERSION, AMD_SUBSUB_VERSION, AMD_DATE) ; -#else - printf ("AMD version: 1.1 or earlier\n") ; -#endif - - printf ("AMD demo, with the 24-by-24 Harwell/Boeing matrix, can_24:\n") ; - - /* get the default parameters, and print them */ - amd_l_defaults (Control) ; - amd_l_control (Control) ; - - /* print the input matrix */ - nz = Ap [n] ; - printf ("\nInput matrix: %ld-by-%ld, with %ld entries.\n" - " Note that for a symmetric matrix such as this one, only the\n" - " strictly lower or upper triangular parts would need to be\n" - " passed to AMD, since AMD computes the ordering of A+A'. The\n" - " diagonal entries are also not needed, since AMD ignores them.\n" - , n, n, nz) ; - for (j = 0 ; j < n ; j++) - { - printf ("\nColumn: %ld, number of entries: %ld, with row indices in" - " Ai [%ld ... %ld]:\n row indices:", - j, Ap [j+1] - Ap [j], Ap [j], Ap [j+1]-1) ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - printf (" %ld", i) ; - } - printf ("\n") ; - } - - /* print a character plot of the input matrix. This is only reasonable - * because the matrix is small. */ - printf ("\nPlot of input matrix pattern:\n") ; - for (j = 0 ; j < n ; j++) - { - for (i = 0 ; i < n ; i++) A [i][j] = '.' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - A [i][j] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1ld", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2ld: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - /* order the matrix */ - result = amd_l_order (n, Ap, Ai, P, Control, Info) ; - printf ("return value from amd_l_order: %ld (should be %d)\n", - result, AMD_OK) ; - - /* print the statistics */ - amd_l_info (Info) ; - - if (result != AMD_OK) - { - printf ("AMD failed\n") ; - exit (1) ; - } - - /* print the permutation vector, P, and compute the inverse permutation */ - printf ("Permutation vector:\n") ; - for (k = 0 ; k < n ; k++) - { - /* row/column j is the kth row/column in the permuted matrix */ - j = P [k] ; - Pinv [j] = k ; - printf (" %2ld", j) ; - } - printf ("\n\n") ; - - printf ("Inverse permutation vector:\n") ; - for (j = 0 ; j < n ; j++) - { - k = Pinv [j] ; - printf (" %2ld", k) ; - } - printf ("\n\n") ; - - /* print a character plot of the permuted matrix. */ - printf ("\nPlot of permuted matrix pattern:\n") ; - for (jnew = 0 ; jnew < n ; jnew++) - { - j = P [jnew] ; - for (inew = 0 ; inew < n ; inew++) A [inew][jnew] = '.' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - inew = Pinv [Ai [p]] ; - A [inew][jnew] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1ld", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2ld: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - return (0) ; -} diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_l_demo.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_l_demo.out deleted file mode 100644 index 83f4ae955d..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_l_demo.out +++ /dev/null @@ -1,179 +0,0 @@ -AMD version 2.4.6, date: May 4, 2016 -AMD demo, with the 24-by-24 Harwell/Boeing matrix, can_24: - -AMD version 2.4.6, May 4, 2016: approximate minimum degree ordering - dense row parameter: 10 - (rows with more than max (10 * sqrt (n), 16) entries are - considered "dense", and placed last in output permutation) - aggressive absorption: yes - size of AMD integer: 8 - - -Input matrix: 24-by-24, with 160 entries. - Note that for a symmetric matrix such as this one, only the - strictly lower or upper triangular parts would need to be - passed to AMD, since AMD computes the ordering of A+A'. The - diagonal entries are also not needed, since AMD ignores them. - -Column: 0, number of entries: 9, with row indices in Ai [0 ... 8]: - row indices: 0 5 6 12 13 17 18 19 21 - -Column: 1, number of entries: 6, with row indices in Ai [9 ... 14]: - row indices: 1 8 9 13 14 17 - -Column: 2, number of entries: 6, with row indices in Ai [15 ... 20]: - row indices: 2 6 11 20 21 22 - -Column: 3, number of entries: 6, with row indices in Ai [21 ... 26]: - row indices: 3 7 10 15 18 19 - -Column: 4, number of entries: 6, with row indices in Ai [27 ... 32]: - row indices: 4 7 9 14 15 16 - -Column: 5, number of entries: 6, with row indices in Ai [33 ... 38]: - row indices: 0 5 6 12 13 17 - -Column: 6, number of entries: 9, with row indices in Ai [39 ... 47]: - row indices: 0 2 5 6 11 12 19 21 23 - -Column: 7, number of entries: 9, with row indices in Ai [48 ... 56]: - row indices: 3 4 7 9 14 15 16 17 18 - -Column: 8, number of entries: 4, with row indices in Ai [57 ... 60]: - row indices: 1 8 9 14 - -Column: 9, number of entries: 9, with row indices in Ai [61 ... 69]: - row indices: 1 4 7 8 9 13 14 17 18 - -Column: 10, number of entries: 6, with row indices in Ai [70 ... 75]: - row indices: 3 10 18 19 20 21 - -Column: 11, number of entries: 6, with row indices in Ai [76 ... 81]: - row indices: 2 6 11 12 21 23 - -Column: 12, number of entries: 6, with row indices in Ai [82 ... 87]: - row indices: 0 5 6 11 12 23 - -Column: 13, number of entries: 6, with row indices in Ai [88 ... 93]: - row indices: 0 1 5 9 13 17 - -Column: 14, number of entries: 6, with row indices in Ai [94 ... 99]: - row indices: 1 4 7 8 9 14 - -Column: 15, number of entries: 6, with row indices in Ai [100 ... 105]: - row indices: 3 4 7 15 16 18 - -Column: 16, number of entries: 4, with row indices in Ai [106 ... 109]: - row indices: 4 7 15 16 - -Column: 17, number of entries: 9, with row indices in Ai [110 ... 118]: - row indices: 0 1 5 7 9 13 17 18 19 - -Column: 18, number of entries: 9, with row indices in Ai [119 ... 127]: - row indices: 0 3 7 9 10 15 17 18 19 - -Column: 19, number of entries: 9, with row indices in Ai [128 ... 136]: - row indices: 0 3 6 10 17 18 19 20 21 - -Column: 20, number of entries: 6, with row indices in Ai [137 ... 142]: - row indices: 2 10 19 20 21 22 - -Column: 21, number of entries: 9, with row indices in Ai [143 ... 151]: - row indices: 0 2 6 10 11 19 20 21 22 - -Column: 22, number of entries: 4, with row indices in Ai [152 ... 155]: - row indices: 2 20 21 22 - -Column: 23, number of entries: 4, with row indices in Ai [156 ... 159]: - row indices: 6 11 12 23 - -Plot of input matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X . . . . X X . . . . . X X . . . X X X . X . . - 1: . X . . . . . . X X . . . X X . . X . . . . . . - 2: . . X . . . X . . . . X . . . . . . . . X X X . - 3: . . . X . . . X . . X . . . . X . . X X . . . . - 4: . . . . X . . X . X . . . . X X X . . . . . . . - 5: X . . . . X X . . . . . X X . . . X . . . . . . - 6: X . X . . X X . . . . X X . . . . . . X . X . X - 7: . . . X X . . X . X . . . . X X X X X . . . . . - 8: . X . . . . . . X X . . . . X . . . . . . . . . - 9: . X . . X . . X X X . . . X X . . X X . . . . . -10: . . . X . . . . . . X . . . . . . . X X X X . . -11: . . X . . . X . . . . X X . . . . . . . . X . X -12: X . . . . X X . . . . X X . . . . . . . . . . X -13: X X . . . X . . . X . . . X . . . X . . . . . . -14: . X . . X . . X X X . . . . X . . . . . . . . . -15: . . . X X . . X . . . . . . . X X . X . . . . . -16: . . . . X . . X . . . . . . . X X . . . . . . . -17: X X . . . X . X . X . . . X . . . X X X . . . . -18: X . . X . . . X . X X . . . . X . X X X . . . . -19: X . . X . . X . . . X . . . . . . X X X X X . . -20: . . X . . . . . . . X . . . . . . . . X X X X . -21: X . X . . . X . . . X X . . . . . . . X X X X . -22: . . X . . . . . . . . . . . . . . . . . X X X . -23: . . . . . . X . . . . X X . . . . . . . . . . X -return value from amd_l_order: 0 (should be 0) - -AMD version 2.4.6, May 4, 2016, results: - status: OK - n, dimension of A: 24 - nz, number of nonzeros in A: 160 - symmetry of A: 1.0000 - number of nonzeros on diagonal: 24 - nonzeros in pattern of A+A' (excl. diagonal): 136 - # dense rows/columns of A+A': 0 - memory used, in bytes: 3032 - # of memory compactions: 0 - - The following approximate statistics are for a subsequent - factorization of A(P,P) + A(P,P)'. They are slight upper - bounds if there are no dense rows/columns in A+A', and become - looser if dense rows/columns exist. - - nonzeros in L (excluding diagonal): 97 - nonzeros in L (including diagonal): 121 - # divide operations for LDL' or LU: 97 - # multiply-subtract operations for LDL': 275 - # multiply-subtract operations for LU: 453 - max nz. in any column of L (incl. diagonal): 8 - - chol flop count for real A, sqrt counted as 1 flop: 671 - LDL' flop count for real A: 647 - LDL' flop count for complex A: 3073 - LU flop count for real A (with no pivoting): 1003 - LU flop count for complex A (with no pivoting): 4497 - -Permutation vector: - 22 20 10 23 12 5 16 8 14 4 15 7 1 9 13 17 0 2 3 6 11 18 21 19 - -Inverse permutation vector: - 16 12 17 18 9 5 19 11 7 13 2 20 4 14 8 10 6 15 21 23 1 22 0 3 - - -Plot of permuted matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X X . . . . . . . . . . . . . . . X . . . . X . - 1: X X X . . . . . . . . . . . . . . X . . . . X X - 2: . X X . . . . . . . . . . . . . . . X . . X X X - 3: . . . X X . . . . . . . . . . . . . . X X . . . - 4: . . . X X X . . . . . . . . . . X . . X X . . . - 5: . . . . X X . . . . . . . . X X X . . X . . . . - 6: . . . . . . X . . X X X . . . . . . . . . . . . - 7: . . . . . . . X X . . . X X . . . . . . . . . . - 8: . . . . . . . X X X . X X X . . . . . . . . . . - 9: . . . . . . X . X X X X . X . . . . . . . . . . -10: . . . . . . X . . X X X . . . . . . X . . X . . -11: . . . . . . X . X X X X . X . X . . X . . X . . -12: . . . . . . . X X . . . X X X X . . . . . . . . -13: . . . . . . . X X X . X X X X X . . . . . X . . -14: . . . . . X . . . . . . X X X X X . . . . . . . -15: . . . . . X . . . . . X X X X X X . . . . X . X -16: . . . . X X . . . . . . . . X X X . . X . X X X -17: X X . . . . . . . . . . . . . . . X . X X . X . -18: . . X . . . . . . . X X . . . . . . X . . X . X -19: . . . X X X . . . . . . . . . . X X . X X . X X -20: . . . X X . . . . . . . . . . . . X . X X . X . -21: . . X . . . . . . . X X . X . X X . X . . X . X -22: X X X . . . . . . . . . . . . . X X . X X . X X -23: . X X . . . . . . . . . . . . X X . X X . X X X diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_simple.c b/ThirdParty/SuiteSparse/AMD/Demo/amd_simple.c deleted file mode 100644 index 5241fb1500..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_simple.c +++ /dev/null @@ -1,22 +0,0 @@ -/* ------------------------------------------------------------------------- */ -/* AMD Copyright (c) by Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -#include -#include "amd.h" - -int n = 5 ; -int Ap [ ] = { 0, 2, 6, 10, 12, 14} ; -int Ai [ ] = { 0,1, 0,1,2,4, 1,2,3,4, 2,3, 1,4 } ; -int P [5] ; - -int main (void) -{ - int k ; - (void) amd_order (n, Ap, Ai, P, (double *) NULL, (double *) NULL) ; - for (k = 0 ; k < n ; k++) printf ("P [%d] = %d\n", k, P [k]) ; - return (0) ; -} - diff --git a/ThirdParty/SuiteSparse/AMD/Demo/amd_simple.out b/ThirdParty/SuiteSparse/AMD/Demo/amd_simple.out deleted file mode 100644 index 08a04e0b9f..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Demo/amd_simple.out +++ /dev/null @@ -1,5 +0,0 @@ -P [0] = 0 -P [1] = 3 -P [2] = 2 -P [3] = 4 -P [4] = 1 diff --git a/ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.pdf b/ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.pdf deleted file mode 100644 index a0e7a6c691..0000000000 Binary files a/ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.pdf and /dev/null differ diff --git a/ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.tex b/ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.tex index 862ad69c87..2e5e1edef3 100644 --- a/ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.tex +++ b/ThirdParty/SuiteSparse/AMD/Doc/AMD_UserGuide.tex @@ -1,4 +1,5 @@ \documentclass[11pt]{article} +\batchmode \newcommand{\m}[1]{{\bf{#1}}} % for matrices and vectors \newcommand{\tr}{^{\sf T}} % transpose @@ -32,7 +33,7 @@ This work was supported by the EPSRC under grant GR/R46441. }} -\date{VERSION 2.4.6, May 4, 2016} +\input{amd_version.tex} \maketitle %------------------------------------------------------------------------------ @@ -45,7 +46,7 @@ \end{abstract} %------------------------------------------------------------------------------ -AMD Copyright\copyright 2013 by Timothy A. +AMD Copyright\copyright 1996-2022 by Timothy A. Davis, Patrick R. Amestoy, and Iain S. Duff. All Rights Reserved. AMD is available under alternate licences; contact T. Davis for details. @@ -53,7 +54,7 @@ for your particular copy of AMD. {\bf Availability:} - http://www.suitesparse.com + http://www.suitesparse.com. {\bf Acknowledgments:} @@ -203,25 +204,20 @@ \section{Using AMD in a C program} The C-callable AMD library consists of seven user-callable routines and one include file. There are two versions of each of the routines, with -{\tt int} and {\tt long} integers. +\verb'int32_t' and \verb'int64_t' integers. The routines with prefix -{\tt amd\_l\_} use {\tt long} integer arguments; the others use -{\tt int} integer arguments. If you compile AMD in the standard -ILP32 mode (32-bit {\tt int}'s, {\tt long}'s, and pointers) then the versions -are essentially identical. You will be able to solve problems using up to 2GB -of memory. If you compile AMD in the standard LP64 mode, the size of an -{\tt int} remains 32-bits, but the size of a {\tt long} and a pointer both get -promoted to 64-bits. +{\tt amd\_l\_} use \verb'int64_t' integer arguments; the others use +\verb'int32_t' integer arguments. The following routines are fully described in Section~\ref{Primary}: \begin{itemize} \item {\tt amd\_order} -({\tt long} version: {\tt amd\_l\_order}) +(\verb'int64_t' version: {\tt amd\_l\_order}) {\footnotesize \begin{verbatim} #include "amd.h" - int n, Ap [n+1], Ai [nz], P [n] ; + int32_t n, Ap [n+1], Ai [nz], P [n] ; double Control [AMD_CONTROL], Info [AMD_INFO] ; int result = amd_order (n, Ap, Ai, P, Control, Info) ; \end{verbatim} @@ -244,7 +240,7 @@ \section{Using AMD in a C program} {\tt AMD\_OUT\_OF\_MEMORY} if out of memory. \item {\tt amd\_defaults} -({\tt long} version: {\tt amd\_l\_defaults}) +(\verb'int64_t' version: {\tt amd\_l\_defaults}) {\footnotesize \begin{verbatim} #include "amd.h" @@ -257,7 +253,7 @@ \section{Using AMD in a C program} routines. \item {\tt amd\_control} -({\tt long} version: {\tt amd\_l\_control}) +(\verb'int64_t' version: {\tt amd\_l\_control}) {\footnotesize \begin{verbatim} #include "amd.h" @@ -268,7 +264,7 @@ \section{Using AMD in a C program} Prints a description of the control parameters, and their values. \item {\tt amd\_info} -({\tt long} version: {\tt amd\_l\_info}) +(\verb'int64_t' version: {\tt amd\_l\_info}) {\footnotesize \begin{verbatim} #include "amd.h" @@ -279,11 +275,11 @@ \section{Using AMD in a C program} Prints a description of the statistics computed by AMD, and their values. \item {\tt amd\_valid} -({\tt long} version: {\tt amd\_valid}) +(\verb'int64_t' version: {\tt amd\_l\_valid}) {\footnotesize \begin{verbatim} #include "amd.h" - int n, Ap [n+1], Ai [nz] ; + int32_t n, Ap [n+1], Ai [nz] ; int result = amd_valid (n, n, Ap, Ai) ; \end{verbatim} } @@ -299,7 +295,7 @@ \section{Using AMD in a C program} equal {\tt n}. \item {\tt amd\_2} -({\tt long} version: {\tt amd\_l2}) +(\verb'int64_t' version: {\tt amd\_l2}) AMD ordering kernel. It is faster than {\tt amd\_order}, and can be called by the user, but it is difficult to use. It does not check its inputs for errors. @@ -390,17 +386,16 @@ \subsection{Sample C program} {\footnotesize \begin{verbatim} -#include #include "amd.h" -int n = 5 ; -int Ap [ ] = { 0, 2, 6, 10, 12, 14} ; -int Ai [ ] = { 0,1, 0,1,2,4, 1,2,3,4, 2,3, 1,4 } ; -int P [5] ; +int32_t n = 5 ; +int32_t Ap [ ] = { 0, 2, 6, 10, 12, 14} ; +int32_t Ai [ ] = { 0,1, 0,1,2,4, 1,2,3,4, 2,3, 1,4 } ; +int32_t P [5] ; int main (void) { - int k ; + int32_t k ; (void) amd_order (n, Ap, Ai, P, (double *) NULL, (double *) NULL) ; for (k = 0 ; k < n ; k++) printf ("P [%d] = %d\n", k, P [k]) ; return (0) ; @@ -459,7 +454,7 @@ \section{Synopsis of C-callable routines} {\footnotesize \begin{verbatim} #include "amd.h" -int n, status, Ap [n+1], Ai [nz], P [n] ; +int32_t n, status, Ap [n+1], Ai [nz], P [n] ; double Control [AMD_CONTROL], Info [AMD_INFO] ; amd_defaults (Control) ; status = amd_order (n, Ap, Ai, P, Control, Info) ; @@ -469,13 +464,13 @@ \section{Synopsis of C-callable routines} \end{verbatim} } -The {\tt amd\_l\_*} routines are identical, except that all {\tt int} -arguments become {\tt long}: +The {\tt amd\_l\_*} routines are identical, except that all \verb'int32_t' +arguments become \verb'int64_t': {\footnotesize \begin{verbatim} #include "amd.h" -long n, status, Ap [n+1], Ai [nz], P [n] ; +int64_t n, status, Ap [n+1], Ai [nz], P [n] ; double Control [AMD_CONTROL], Info [AMD_INFO] ; amd_l_defaults (Control) ; status = amd_l_order (n, Ap, Ai, P, Control, Info) ; @@ -656,92 +651,45 @@ \section{Installation} \label{Install} %------------------------------------------------------------------------------ -The following discussion assumes you have the {\tt make} program, either in -Unix, or in Windows with Cygwin. - -System-dependent configurations are in the -{\tt ../SuiteSparse\_config/SuiteSparse\_config.mk} -file. You can edit that file to customize the compilation. The default -settings will work on most systems. -Sample configuration files are provided -for Mac, Linux, Sun Solaris, and IBM AIX. -The system you are on is detected automatically. - -To compile and install the C-callable AMD library, -go to the {\tt AMD} directory and type {\tt make}. -A dynamic library is placed in -in {\tt AMD/Lib/libamd.so.*}, ({\tt *.dylib} for the Mac). -Three demo programs of the AMD ordering routine will be compiled and tested in -the {\tt AMD/Demo} directory. -The outputs of these demo programs will then be compared with output -files in the distribution. - -To compile and install the Fortran-callable AMD library, -go to the {\tt AMD} directory and type {\tt make fortran}. -The library will be placed in {\tt AMD/Lib/libamdf77.a}. -A demo program will be compiled and tested in the {\tt AMD/Demo} directory. -The output will be compared with an output file in the distribution. - -Typing {\tt make clean} will remove all but the final compiled libraries -and demo programs. Typing {\tt make purge} or {\tt make distclean} -removes all files not in the original distribution. -If you compile AMD and then later change the -{\tt ../SuiteSparse\_config/SuiteSparse\_config.mk} file -then you should type {\tt make purge} and then {\tt make} to recompile. - -When you compile your program that uses the C-callable AMD library, -you need to add the {\tt AMD/Lib/libamd.*} library -and you need to tell your compiler to look in the -{\tt AMD/Include} directory for include -files. To compile a Fortran program that calls the Fortran AMD library, -you need to add the {\tt AMD/Lib/libamdf77.a} library. -See {\tt AMD/Demo/Makefile} for an example. - -By doing {\tt make}, all compiled dynamic libraries are also copied into {\tt -SuiteSparse/lib} the include files are coped into {\tt SuiteSparse/include}, -and documentation is copied into {\tt SuiteSparse/doc}. - -Alternatively, you can install the shared library -and include files in /usr/local/lib and /usr/local/include, and -the documenation in /usr/local/doc. -Just do {\tt make} then {\tt make install}. -Now you can simply use {\tt -lamd} when you compile your own program. - -If all you want to use is the AMD2 mexFunction in MATLAB, you can skip -the use of the {\tt make} command entirely. Simply type -{\tt amd\_make} in MATLAB while in the {\tt AMD/MATLAB} directory. -This works on any system with MATLAB, including Windows. -Alternately, type {\tt make} in the {\tt AMD/MATLAB} directory, -or just use the built-in {\tt amd} in MATLAB 7.3 or later. - -If you are including AMD as a subset of a larger library and do not want -to link the C standard I/O library, or if you simply do not need to use -them, you can safely remove the {\tt amd\_control.c} and {\tt amd\_info.c} -files. Similarly, if you use default parameters (or define your -own {\tt Control} array), then you can exclude the {\tt amd\_defaults.c} -file. -Each of these files contains the user-callable routines of the same -name. None of these auxiliary routines are directly called by -{\tt amd\_order}. -The {\tt amd\_dump.c} file contains debugging routines -that are neither used nor compiled unless debugging is enabled. -The {\tt amd\_internal.h} file must be edited to enable debugging; -refer to the instructions in that file. -The bare minimum files required to use just {\tt amd\_order} are -{\tt amd.h} and {\tt amd\_internal.h} -in the {\tt Include} directory, -and -{\tt amd\_1.c}, -{\tt amd\_2.c}, -{\tt amd\_aat.c}, -{\tt amd\_global.c}, -{\tt and\_order.c}, -{\tt amd\_postorder.c}, -{\tt amd\_post\_tree.c}, -{\tt amd\_preprocess.c}, -and -{\tt amd\_valid.c} -in the {\tt Source} directory. +AMD now relies primarily on CMake to build the library. It also includes +a simple \verb'AMD/Makefile' which uses cmake to do the actual build. +The use of this \verb'AMD/Makefile' is optional; for Windows, just import +the CMakeLists.txt into MS Visual Studio. + +To compile and install the library for both system-wide usage and local +usage: + + \begin{verbatim} + make + sudo make install + \end{verbatim} + +To compile/install for just local usage (SuiteSparse/lib and +SuiteSparse/include): + + \begin{verbatim} + make local + make install + \end{verbatim} + +To run the demos + + \begin{verbatim} + make demos + \end{verbatim} + +To remove all files in \verb'AMD/' not in the original distribution (leaves +SuiteSparse/lib and SuiteSparse/include unchanged): + + \begin{verbatim} + make clean + \end{verbatim} + +To use the AMD2 mexFunction in MATLAB, simply type {\tt amd\_make} in MATLAB +while in the {\tt AMD/MATLAB} directory. This works on any system with MATLAB, +including Windows. +Alternatively, just use the built-in {\tt amd} in MATLAB 7.3 or later, +which is the same as this package. %------------------------------------------------------------------------------ \newpage diff --git a/ThirdParty/SuiteSparse/AMD/Doc/ChangeLog b/ThirdParty/SuiteSparse/AMD/Doc/ChangeLog index 27868a7b65..97dbc0d871 100644 --- a/ThirdParty/SuiteSparse/AMD/Doc/ChangeLog +++ b/ThirdParty/SuiteSparse/AMD/Doc/ChangeLog @@ -1,3 +1,21 @@ +Jan 17, 2023: version 3.0.3 + + * NFORTRAN: option added to disable Fortran entirely + * SuiteSparse_config: now v7.0.0 + +Dec 9, 2022: version 3.0.2 + + * minor changes to build system + * Fortran: allow AMD to be compiled if no Fortran compiler is available. + The Fortran source codes (Source/amd.f, Source/amdbar.f) and Demo/*.f + are skipped. + +Nov 12, 2022: version 3.0.0 + + * using CMake build system + * integers: int (32-bit) and SuiteSparse_long (nominally 64-bit) replaced + with int32_t and int64_t. + May 4, 2016: version 2.4.6 * minor changes to Makefile diff --git a/ThirdParty/SuiteSparse/AMD/Doc/License.txt b/ThirdParty/SuiteSparse/AMD/Doc/License.txt index 7a2bce91ea..561b865579 100644 --- a/ThirdParty/SuiteSparse/AMD/Doc/License.txt +++ b/ThirdParty/SuiteSparse/AMD/Doc/License.txt @@ -1,4 +1,4 @@ -AMD, Copyright (c), 1996-2015, Timothy A. Davis, +AMD, Copyright (c), 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and Iain S. Duff. All Rights Reserved. Availability: diff --git a/ThirdParty/SuiteSparse/AMD/Doc/Makefile b/ThirdParty/SuiteSparse/AMD/Doc/Makefile index 4769bf1af2..73140a65ec 100644 --- a/ThirdParty/SuiteSparse/AMD/Doc/Makefile +++ b/ThirdParty/SuiteSparse/AMD/Doc/Makefile @@ -1,36 +1,29 @@ #------------------------------------------------------------------------------ -# AMD Makefile for compiling on Unix systems +# AMD/Doc/Makefile: Create the User Guide and Quick Start Guide #------------------------------------------------------------------------------ -default: dist +# Copyright (c) 1996-2022, Timothy A. Davis, Patrick Amestoy, Iain Duff. +# All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause -include ../../SuiteSparse_config/SuiteSparse_config.mk - -#------------------------------------------------------------------------------ -# Remove all but the files in the original distribution -#------------------------------------------------------------------------------ - -clean: - - $(RM) -r $(CLEAN) - -purge: distclean - -distclean: clean - - $(RM) -r $(PURGE) - -#------------------------------------------------------------------------------ -# Create the User Guide and Quick Start Guide -#------------------------------------------------------------------------------ +default: AMD_UserGuide.pdf + - $(RM) *.aux *.bbl *.blg *.log *.toc amd_h.tex -AMD_UserGuide.pdf: AMD_UserGuide.tex AMD_UserGuide.bib ../Include/amd.h - echo '\\begin{verbatim}' > amd_h.tex +AMD_UserGuide.pdf: AMD_UserGuide.tex AMD_UserGuide.bib ../Include/amd.h \ + amd_version.tex + printf '\\begin{verbatim}\n' > amd_h.tex expand -8 ../Include/amd.h >> amd_h.tex - echo '\\end{verbatim}' >> amd_h.tex + printf '\\end{verbatim}\n' >> amd_h.tex pdflatex AMD_UserGuide bibtex AMD_UserGuide pdflatex AMD_UserGuide pdflatex AMD_UserGuide -dist: AMD_UserGuide.pdf - - $(RM) *.aux *.bbl *.blg *.log *.toc amd_h.tex +# Remove all but the files in the original distribution +clean: + - $(RM) -r *.out *.aux *.log *.bbl *.blg *.toc amd_h.tex + +purge: distclean + +distclean: clean diff --git a/ThirdParty/SuiteSparse/AMD/Doc/amd_version.tex b/ThirdParty/SuiteSparse/AMD/Doc/amd_version.tex new file mode 100644 index 0000000000..e24c8cda6a --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Doc/amd_version.tex @@ -0,0 +1,2 @@ +% version of SuiteSparse/AMD +\date{VERSION 3.0.3, Jan 17, 2023} diff --git a/ThirdParty/SuiteSparse/AMD/Doc/lesser.txt b/ThirdParty/SuiteSparse/AMD/Doc/lesser.txt deleted file mode 100644 index 8add30ad59..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Doc/lesser.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/ThirdParty/SuiteSparse/AMD/Include/amd.h b/ThirdParty/SuiteSparse/AMD/Include/amd.h index a72851fcf4..94aa96f113 100644 --- a/ThirdParty/SuiteSparse/AMD/Include/amd.h +++ b/ThirdParty/SuiteSparse/AMD/Include/amd.h @@ -1,18 +1,18 @@ -/* ========================================================================= */ -/* === AMD: approximate minimum degree ordering =========================== */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Include/amd.h: approximate minimum degree ordering +//------------------------------------------------------------------------------ -/* ------------------------------------------------------------------------- */ -/* AMD Version 2.4, Copyright (c) 1996-2013 by Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* AMD finds a symmetric ordering P of a matrix A so that the Cholesky * factorization of P*A*P' has fewer nonzeros and takes less work than the * Cholesky factorization of A. If A is not symmetric, then it performs its * ordering on the matrix A+A'. Two sets of user-callable routines are - * provided, one for int integers and the other for SuiteSparse_long integers. + * provided, one for int32_t integers and the other for int64_t integers. * * The method is based on the approximate minimum degree algorithm, discussed * in Amestoy, Davis, and Duff, "An approximate degree ordering algorithm", @@ -40,49 +40,46 @@ extern "C" { #endif -/* get the definition of size_t: */ -#include - #include "SuiteSparse_config.h" -int amd_order /* returns AMD_OK, AMD_OK_BUT_JUMBLED, - * AMD_INVALID, or AMD_OUT_OF_MEMORY */ +int amd_order /* returns AMD_OK, AMD_OK_BUT_JUMBLED, + * AMD_INVALID, or AMD_OUT_OF_MEMORY */ ( - int n, /* A is n-by-n. n must be >= 0. */ - const int Ap [ ], /* column pointers for A, of size n+1 */ - const int Ai [ ], /* row indices of A, of size nz = Ap [n] */ - int P [ ], /* output permutation, of size n */ - double Control [ ], /* input Control settings, of size AMD_CONTROL */ - double Info [ ] /* output Info statistics, of size AMD_INFO */ + int32_t n, /* A is n-by-n. n must be >= 0. */ + const int32_t Ap [ ], /* column pointers for A, of size n+1 */ + const int32_t Ai [ ], /* row indices of A, of size nz = Ap [n] */ + int32_t P [ ], /* output permutation, of size n */ + double Control [ ], /* input Control settings, of size AMD_CONTROL */ + double Info [ ] /* output Info statistics, of size AMD_INFO */ ) ; -SuiteSparse_long amd_l_order /* see above for description of arguments */ +int amd_l_order /* see above for description */ ( - SuiteSparse_long n, - const SuiteSparse_long Ap [ ], - const SuiteSparse_long Ai [ ], - SuiteSparse_long P [ ], + int64_t n, + const int64_t Ap [ ], + const int64_t Ai [ ], + int64_t P [ ], double Control [ ], double Info [ ] ) ; /* Input arguments (not modified): * - * n: the matrix A is n-by-n. - * Ap: an int/SuiteSparse_long array of size n+1, containing column - * pointers of A. - * Ai: an int/SuiteSparse_long array of size nz, containing the row - * indices of A, where nz = Ap [n]. - * Control: a double array of size AMD_CONTROL, containing control - * parameters. Defaults are used if Control is NULL. + * n: the matrix A is n-by-n. + * Ap: an int32_t/int64_t array of size n+1, containing column + * pointers of A. + * Ai: an int32_t/int64_t array of size nz, containing the row + * indices of A, where nz = Ap [n]. + * Control: a double array of size AMD_CONTROL, containing control + * parameters. Defaults are used if Control is NULL. * * Output arguments (not defined on input): * - * P: an int/SuiteSparse_long array of size n, containing the output - * permutation. If row i is the kth pivot row, then P [k] = i. In - * MATLAB notation, the reordered matrix is A (P,P). - * Info: a double array of size AMD_INFO, containing statistical - * information. Ignored if Info is NULL. + * P: an int32_t/int64_t array of size n, containing the output + * permutation. If row i is the kth pivot row, then P [k] = i. In + * MATLAB notation, the reordered matrix is A (P,P). + * Info: a double array of size AMD_INFO, containing statistical + * information. Ignored if Info is NULL. * * On input, the matrix A is stored in column-oriented form. The row indices * of nonzero entries in column j are stored in Ai [Ap [j] ... Ap [j+1]-1]. @@ -91,8 +88,7 @@ SuiteSparse_long amd_l_order /* see above for description of arguments */ * are no duplicate entries, then amd_order is slightly more efficient in * terms of time and memory usage. If this condition does not hold, a copy * of the matrix is created (where these conditions do hold), and the copy is - * ordered. This feature is new to v2.0 (v1.2 and earlier required this - * condition to hold for the input matrix). + * ordered. * * Row indices must be in the range 0 to * n-1. Ap [0] must be zero, and thus nz = Ap [n] is the number of nonzeros @@ -107,22 +103,22 @@ SuiteSparse_long amd_l_order /* see above for description of arguments */ * http://www.suitesparse.com. * * Restrictions: n >= 0. Ap [0] = 0. Ap [j] <= Ap [j+1] for all j in the - * range 0 to n-1. nz = Ap [n] >= 0. Ai [0..nz-1] must be in the range 0 - * to n-1. Finally, Ai, Ap, and P must not be NULL. If any of these - * restrictions are not met, AMD returns AMD_INVALID. + * range 0 to n-1. nz = Ap [n] >= 0. Ai [0..nz-1] must be in the range 0 + * to n-1. Finally, Ai, Ap, and P must not be NULL. If any of these + * restrictions are not met, AMD returns AMD_INVALID. * * AMD returns: * - * AMD_OK if the matrix is valid and sufficient memory can be allocated to - * perform the ordering. + * AMD_OK if the matrix is valid and sufficient memory can be allocated to + * perform the ordering. * - * AMD_OUT_OF_MEMORY if not enough memory can be allocated. + * AMD_OUT_OF_MEMORY if not enough memory can be allocated. * - * AMD_INVALID if the input arguments n, Ap, Ai are invalid, or if P is - * NULL. + * AMD_INVALID if the input arguments n, Ap, Ai are invalid, or if P is + * NULL. * - * AMD_OK_BUT_JUMBLED if the matrix had unsorted columns, and/or duplicate - * entries, but was otherwise valid. + * AMD_OK_BUT_JUMBLED if the matrix had unsorted columns, and/or duplicate + * entries, but was otherwise valid. * * The AMD routine first forms the pattern of the matrix A+A', and then * computes a fill-reducing ordering, P. If P [k] = i, then row/column i of @@ -134,93 +130,93 @@ SuiteSparse_long amd_l_order /* see above for description of arguments */ * pointer is passed, default values are used. The Control array is not * modified. * - * Control [AMD_DENSE]: controls the threshold for "dense" rows/columns. - * A dense row/column in A+A' can cause AMD to spend a lot of time in - * ordering the matrix. If Control [AMD_DENSE] >= 0, rows/columns - * with more than Control [AMD_DENSE] * sqrt (n) entries are ignored - * during the ordering, and placed last in the output order. The - * default value of Control [AMD_DENSE] is 10. If negative, no - * rows/columns are treated as "dense". Rows/columns with 16 or - * fewer off-diagonal entries are never considered "dense". - * - * Control [AMD_AGGRESSIVE]: controls whether or not to use aggressive - * absorption, in which a prior element is absorbed into the current - * element if is a subset of the current element, even if it is not - * adjacent to the current pivot element (refer to Amestoy, Davis, - * & Duff, 1996, for more details). The default value is nonzero, - * which means to perform aggressive absorption. This nearly always - * leads to a better ordering (because the approximate degrees are - * more accurate) and a lower execution time. There are cases where - * it can lead to a slightly worse ordering, however. To turn it off, - * set Control [AMD_AGGRESSIVE] to 0. - * - * Control [2..4] are not used in the current version, but may be used in - * future versions. + * Control [AMD_DENSE]: controls the threshold for "dense" rows/columns. + * A dense row/column in A+A' can cause AMD to spend a lot of time in + * ordering the matrix. If Control [AMD_DENSE] >= 0, rows/columns + * with more than Control [AMD_DENSE] * sqrt (n) entries are ignored + * during the ordering, and placed last in the output order. The + * default value of Control [AMD_DENSE] is 10. If negative, no + * rows/columns are treated as "dense". Rows/columns with 16 or + * fewer off-diagonal entries are never considered "dense". + * + * Control [AMD_AGGRESSIVE]: controls whether or not to use aggressive + * absorption, in which a prior element is absorbed into the current + * element if is a subset of the current element, even if it is not + * adjacent to the current pivot element (refer to Amestoy, Davis, + * & Duff, 1996, for more details). The default value is nonzero, + * which means to perform aggressive absorption. This nearly always + * leads to a better ordering (because the approximate degrees are + * more accurate) and a lower execution time. There are cases where + * it can lead to a slightly worse ordering, however. To turn it off, + * set Control [AMD_AGGRESSIVE] to 0. + * + * Control [2..4] are not used in the current version, but may be used in + * future versions. * * The Info array provides statistics about the ordering on output. If it is * not present, the statistics are not returned. This is not an error * condition. * - * Info [AMD_STATUS]: the return value of AMD, either AMD_OK, - * AMD_OK_BUT_JUMBLED, AMD_OUT_OF_MEMORY, or AMD_INVALID. - * - * Info [AMD_N]: n, the size of the input matrix - * - * Info [AMD_NZ]: the number of nonzeros in A, nz = Ap [n] - * - * Info [AMD_SYMMETRY]: the symmetry of the matrix A. It is the number - * of "matched" off-diagonal entries divided by the total number of - * off-diagonal entries. An entry A(i,j) is matched if A(j,i) is also - * an entry, for any pair (i,j) for which i != j. In MATLAB notation, - * S = spones (A) ; - * B = tril (S, -1) + triu (S, 1) ; - * symmetry = nnz (B & B') / nnz (B) ; - * - * Info [AMD_NZDIAG]: the number of entries on the diagonal of A. - * - * Info [AMD_NZ_A_PLUS_AT]: the number of nonzeros in A+A', excluding the - * diagonal. If A is perfectly symmetric (Info [AMD_SYMMETRY] = 1) - * with a fully nonzero diagonal, then Info [AMD_NZ_A_PLUS_AT] = nz-n - * (the smallest possible value). If A is perfectly unsymmetric - * (Info [AMD_SYMMETRY] = 0, for an upper triangular matrix, for - * example) with no diagonal, then Info [AMD_NZ_A_PLUS_AT] = 2*nz - * (the largest possible value). - * - * Info [AMD_NDENSE]: the number of "dense" rows/columns of A+A' that were - * removed from A prior to ordering. These are placed last in the - * output order P. - * - * Info [AMD_MEMORY]: the amount of memory used by AMD, in bytes. In the - * current version, this is 1.2 * Info [AMD_NZ_A_PLUS_AT] + 9*n - * times the size of an integer. This is at most 2.4nz + 9n. This - * excludes the size of the input arguments Ai, Ap, and P, which have - * a total size of nz + 2*n + 1 integers. - * - * Info [AMD_NCMPA]: the number of garbage collections performed. - * - * Info [AMD_LNZ]: the number of nonzeros in L (excluding the diagonal). - * This is a slight upper bound because mass elimination is combined - * with the approximate degree update. It is a rough upper bound if - * there are many "dense" rows/columns. The rest of the statistics, - * below, are also slight or rough upper bounds, for the same reasons. - * The post-ordering of the assembly tree might also not exactly - * correspond to a true elimination tree postordering. - * - * Info [AMD_NDIV]: the number of divide operations for a subsequent LDL' - * or LU factorization of the permuted matrix A (P,P). - * - * Info [AMD_NMULTSUBS_LDL]: the number of multiply-subtract pairs for a - * subsequent LDL' factorization of A (P,P). - * - * Info [AMD_NMULTSUBS_LU]: the number of multiply-subtract pairs for a - * subsequent LU factorization of A (P,P), assuming that no numerical - * pivoting is required. - * - * Info [AMD_DMAX]: the maximum number of nonzeros in any column of L, - * including the diagonal. - * - * Info [14..19] are not used in the current version, but may be used in - * future versions. + * Info [AMD_STATUS]: the return value of AMD, either AMD_OK, + * AMD_OK_BUT_JUMBLED, AMD_OUT_OF_MEMORY, or AMD_INVALID. + * + * Info [AMD_N]: n, the size of the input matrix + * + * Info [AMD_NZ]: the number of nonzeros in A, nz = Ap [n] + * + * Info [AMD_SYMMETRY]: the symmetry of the matrix A. It is the number + * of "matched" off-diagonal entries divided by the total number of + * off-diagonal entries. An entry A(i,j) is matched if A(j,i) is also + * an entry, for any pair (i,j) for which i != j. In MATLAB notation, + * S = spones (A) ; + * B = tril (S, -1) + triu (S, 1) ; + * symmetry = nnz (B & B') / nnz (B) ; + * + * Info [AMD_NZDIAG]: the number of entries on the diagonal of A. + * + * Info [AMD_NZ_A_PLUS_AT]: the number of nonzeros in A+A', excluding the + * diagonal. If A is perfectly symmetric (Info [AMD_SYMMETRY] = 1) + * with a fully nonzero diagonal, then Info [AMD_NZ_A_PLUS_AT] = nz-n + * (the smallest possible value). If A is perfectly unsymmetric + * (Info [AMD_SYMMETRY] = 0, for an upper triangular matrix, for + * example) with no diagonal, then Info [AMD_NZ_A_PLUS_AT] = 2*nz + * (the largest possible value). + * + * Info [AMD_NDENSE]: the number of "dense" rows/columns of A+A' that were + * removed from A prior to ordering. These are placed last in the + * output order P. + * + * Info [AMD_MEMORY]: the amount of memory used by AMD, in bytes. In the + * current version, this is 1.2 * Info [AMD_NZ_A_PLUS_AT] + 9*n + * times the size of an integer. This is at most 2.4nz + 9n. This + * excludes the size of the input arguments Ai, Ap, and P, which have + * a total size of nz + 2*n + 1 integers. + * + * Info [AMD_NCMPA]: the number of garbage collections performed. + * + * Info [AMD_LNZ]: the number of nonzeros in L (excluding the diagonal). + * This is a slight upper bound because mass elimination is combined + * with the approximate degree update. It is a rough upper bound if + * there are many "dense" rows/columns. The rest of the statistics, + * below, are also slight or rough upper bounds, for the same reasons. + * The post-ordering of the assembly tree might also not exactly + * correspond to a true elimination tree postordering. + * + * Info [AMD_NDIV]: the number of divide operations for a subsequent LDL' + * or LU factorization of the permuted matrix A (P,P). + * + * Info [AMD_NMULTSUBS_LDL]: the number of multiply-subtract pairs for a + * subsequent LDL' factorization of A (P,P). + * + * Info [AMD_NMULTSUBS_LU]: the number of multiply-subtract pairs for a + * subsequent LU factorization of A (P,P), assuming that no numerical + * pivoting is required. + * + * Info [AMD_DMAX]: the maximum number of nonzeros in any column of L, + * including the diagonal. + * + * Info [14..19] are not used in the current version, but may be used in + * future versions. */ /* ------------------------------------------------------------------------- */ @@ -237,38 +233,38 @@ SuiteSparse_long amd_l_order /* see above for description of arguments */ void amd_2 ( - int n, - int Pe [ ], - int Iw [ ], - int Len [ ], - int iwlen, - int pfree, - int Nv [ ], - int Next [ ], - int Last [ ], - int Head [ ], - int Elen [ ], - int Degree [ ], - int W [ ], + int32_t n, + int32_t Pe [ ], + int32_t Iw [ ], + int32_t Len [ ], + int32_t iwlen, + int32_t pfree, + int32_t Nv [ ], + int32_t Next [ ], + int32_t Last [ ], + int32_t Head [ ], + int32_t Elen [ ], + int32_t Degree [ ], + int32_t W [ ], double Control [ ], double Info [ ] ) ; void amd_l2 ( - SuiteSparse_long n, - SuiteSparse_long Pe [ ], - SuiteSparse_long Iw [ ], - SuiteSparse_long Len [ ], - SuiteSparse_long iwlen, - SuiteSparse_long pfree, - SuiteSparse_long Nv [ ], - SuiteSparse_long Next [ ], - SuiteSparse_long Last [ ], - SuiteSparse_long Head [ ], - SuiteSparse_long Elen [ ], - SuiteSparse_long Degree [ ], - SuiteSparse_long W [ ], + int64_t n, + int64_t Pe [ ], + int64_t Iw [ ], + int64_t Len [ ], + int64_t iwlen, + int64_t pfree, + int64_t Nv [ ], + int64_t Next [ ], + int64_t Last [ ], + int64_t Head [ ], + int64_t Elen [ ], + int64_t Degree [ ], + int64_t W [ ], double Control [ ], double Info [ ] ) ; @@ -283,32 +279,24 @@ void amd_l2 * matrix cannot be passed to amd_order. For amd_order, the matrix must also * be square. The first two arguments are the number of rows and the number * of columns of the matrix. For its use in AMD, these must both equal n. - * - * NOTE: this routine returned TRUE/FALSE in v1.2 and earlier. */ int amd_valid ( - int n_row, /* # of rows */ - int n_col, /* # of columns */ - const int Ap [ ], /* column pointers, of size n_col+1 */ - const int Ai [ ] /* row indices, of size Ap [n_col] */ + int32_t n_row, /* # of rows */ + int32_t n_col, /* # of columns */ + const int32_t Ap [ ], /* column pointers, of size n_col+1 */ + const int32_t Ai [ ] /* row indices, of size Ap [n_col] */ ) ; -SuiteSparse_long amd_l_valid +int amd_l_valid ( - SuiteSparse_long n_row, - SuiteSparse_long n_col, - const SuiteSparse_long Ap [ ], - const SuiteSparse_long Ai [ ] + int64_t n_row, + int64_t n_col, + const int64_t Ap [ ], + const int64_t Ai [ ] ) ; -/* ------------------------------------------------------------------------- */ -/* AMD memory manager and printf routines */ -/* ------------------------------------------------------------------------- */ - - /* moved to SuiteSparse_config.c */ - /* ------------------------------------------------------------------------- */ /* AMD Control and Info arrays */ /* ------------------------------------------------------------------------- */ @@ -386,11 +374,12 @@ void amd_l_info (double Info [ ]) ; * Versions 1.1 and earlier of AMD do not include a #define'd version number. */ -#define AMD_DATE "May 4, 2016" +#define AMD_DATE "Jan 17, 2023" +#define AMD_MAIN_VERSION 3 +#define AMD_SUB_VERSION 0 +#define AMD_SUBSUB_VERSION 3 + #define AMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) -#define AMD_MAIN_VERSION 2 -#define AMD_SUB_VERSION 4 -#define AMD_SUBSUB_VERSION 6 #define AMD_VERSION AMD_VERSION_CODE(AMD_MAIN_VERSION,AMD_SUB_VERSION) #ifdef __cplusplus diff --git a/ThirdParty/SuiteSparse/AMD/Include/amd_internal.h b/ThirdParty/SuiteSparse/AMD/Include/amd_internal.h index 937d61ab83..85d43930b6 100644 --- a/ThirdParty/SuiteSparse/AMD/Include/amd_internal.h +++ b/ThirdParty/SuiteSparse/AMD/Include/amd_internal.h @@ -1,12 +1,12 @@ -/* ========================================================================= */ -/* === amd_internal.h ====================================================== */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Include/amd_internal.h: internal definitions for AMD +//------------------------------------------------------------------------------ -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* This file is for internal use in AMD itself, and does not normally need to * be included in user code (it is included in UMFPACK, however). All others @@ -42,33 +42,8 @@ #undef NDEBUG */ -/* ------------------------------------------------------------------------- */ -/* ANSI include files */ -/* ------------------------------------------------------------------------- */ - -/* from stdlib.h: size_t, malloc, free, realloc, and calloc */ -#include - -#if !defined(NPRINT) || !defined(NDEBUG) -/* from stdio.h: printf. Not included if NPRINT is defined at compile time. - * fopen and fscanf are used when debugging. */ -#include -#endif - -/* from limits.h: INT_MAX and LONG_MAX */ -#include - -/* from math.h: sqrt */ -#include - -/* ------------------------------------------------------------------------- */ -/* MATLAB include files (only if being used in or via MATLAB) */ -/* ------------------------------------------------------------------------- */ - -#ifdef MATLAB_MEX_FILE -#include "matrix.h" -#include "mex.h" -#endif +#define SUITESPARSE_LIBRARY +#include "amd.h" /* ------------------------------------------------------------------------- */ /* basic definitions */ @@ -90,13 +65,7 @@ #undef EMPTY #endif -#ifdef GLOBAL -#undef GLOBAL -#endif - -#ifdef PRIVATE -#undef PRIVATE -#endif +#define PRIVATE static /* FLIP is a "negation about -1", and is used to mark an integer i that is * normally non-negative. FLIP (EMPTY) is EMPTY. FLIP of a number > EMPTY @@ -124,19 +93,8 @@ #define TRUE (1) #define FALSE (0) -#define PRIVATE static -#define GLOBAL #define EMPTY (-1) -/* Note that Linux's gcc 2.96 defines NULL as ((void *) 0), but other */ -/* compilers (even gcc 2.95.2 on Solaris) define NULL as 0 or (0). We */ -/* need to use the ANSI standard value of 0. */ -#ifdef NULL -#undef NULL -#endif - -#define NULL 0 - /* largest value of size_t */ #ifndef SIZE_T_MAX #ifdef SIZE_MAX @@ -148,18 +106,15 @@ #endif /* ------------------------------------------------------------------------- */ -/* integer type for AMD: int or SuiteSparse_long */ +/* integer type for AMD: int32_t or int64_t */ /* ------------------------------------------------------------------------- */ -#include "amd.h" - #if defined (DLONG) || defined (ZLONG) -#define Int SuiteSparse_long -#define ID SuiteSparse_long_id -#define Int_MAX SuiteSparse_long_max - -#define UnsignedInt SuiteSparse_unsigned_long +#define Int int64_t +#define UInt uint64_t +#define ID "%" PRId64 +#define Int_MAX INT64_MAX #define AMD_order amd_l_order #define AMD_defaults amd_l_defaults @@ -178,11 +133,10 @@ #else -#define Int int +#define Int int32_t +#define UInt uint32_t #define ID "%d" -#define Int_MAX INT_MAX - -#define UnsignedInt unsigned int +#define Int_MAX INT32_MAX #define AMD_order amd_order #define AMD_defaults amd_defaults @@ -205,7 +159,7 @@ /* AMD routine definitions (not user-callable) */ /* ------------------------------------------------------------------------- */ -GLOBAL size_t AMD_aat +size_t AMD_aat ( Int n, const Int Ap [ ], @@ -215,7 +169,7 @@ GLOBAL size_t AMD_aat double Info [ ] ) ; -GLOBAL void AMD_1 +void AMD_1 ( Int n, const Int Ap [ ], @@ -229,7 +183,7 @@ GLOBAL void AMD_1 double Info [ ] ) ; -GLOBAL void AMD_postorder +void AMD_postorder ( Int nn, Int Parent [ ], @@ -241,7 +195,7 @@ GLOBAL void AMD_postorder Int Stack [ ] ) ; -GLOBAL Int AMD_post_tree +Int AMD_post_tree ( Int root, Int k, @@ -254,7 +208,7 @@ GLOBAL Int AMD_post_tree #endif ) ; -GLOBAL void AMD_preprocess +void AMD_preprocess ( Int n, const Int Ap [ ], @@ -274,15 +228,11 @@ GLOBAL void AMD_preprocess /* from assert.h: assert macro */ #include -#ifndef EXTERN -#define EXTERN extern -#endif - -EXTERN Int AMD_debug ; +extern Int AMD_debug ; -GLOBAL void AMD_debug_init ( char *s ) ; +void AMD_debug_init ( char *s ) ; -GLOBAL void AMD_dump +void AMD_dump ( Int n, Int Pe [ ], diff --git a/ThirdParty/SuiteSparse/AMD/Lib/Makefile b/ThirdParty/SuiteSparse/AMD/Lib/Makefile deleted file mode 100644 index 3b92f6a075..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Lib/Makefile +++ /dev/null @@ -1,121 +0,0 @@ -#------------------------------------------------------------------------------- -# AMD Lib/Makefile -#------------------------------------------------------------------------------- - -LIBRARY = libamd -VERSION = 2.4.6 -SO_VERSION = 2 - -default: library - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -# AMD depends on SuiteSparse_config -LDLIBS += -lsuitesparseconfig - -# compile and install in SuiteSparse/lib -library: - $(MAKE) install INSTALL=$(SUITESPARSE) - -C = $(CC) $(CF) -I../Include -I../../SuiteSparse_config - -#------------------------------------------------------------------------------- -# source files -#------------------------------------------------------------------------------- - -AMD = amd_aat amd_1 amd_2 amd_dump amd_postorder amd_defaults \ - amd_post_tree \ - amd_order amd_control amd_info amd_valid amd_preprocess - -INC = ../Include/amd.h ../Include/amd_internal.h \ - ../../SuiteSparse_config/SuiteSparse_config.h - -#------------------------------------------------------------------------------- -# object files for each version -#------------------------------------------------------------------------------- - -AMDI = $(addsuffix .o, $(subst amd_,amd_i_,$(AMD))) -AMDL = $(addsuffix .o, $(subst amd_,amd_l_,$(AMD))) -OBJ = $(AMDI) $(AMDL) - -#------------------------------------------------------------------------------- -# compile each int and long routine (with no real/complex version) -#------------------------------------------------------------------------------- - -amd_i_%.o: ../Source/amd_%.c $(INC) - $(C) -DDINT -c $< -o $@ - -amd_l_%.o: ../Source/amd_%.c $(INC) - $(C) -DDLONG -c $< -o $@ - -#------------------------------------------------------------------------------- -# Create the static library (C versions only) -#------------------------------------------------------------------------------- - -static: $(AR_TARGET) - -$(AR_TARGET): $(OBJ) - $(ARCHIVE) $@ $^ - - $(RANLIB) $@ - -#------------------------------------------------------------------------------- -# compile the Fortran versions and the libamdf77.a library (static only) -#------------------------------------------------------------------------------- - -fortran: libamdf77.a - -AMDF77 = amd.o amdbar.o - -amd.o: ../Source/amd.f - $(F77) $(F77FLAGS) -c ../Source/amd.f -o amd.o - -amdbar.o: ../Source/amdbar.f - $(F77) $(F77FLAGS) -c ../Source/amdbar.f -o amdbar.o - -libamdf77.a: $(AMDF77) - $(ARCHIVE) libamdf77.a $^ - - $(RANLIB) libamdf77.a - -#------------------------------------------------------------------------------- -# install (shared C version only) -#------------------------------------------------------------------------------- - -# install AMD -install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET) - -$(INSTALL_LIB)/$(SO_TARGET): $(OBJ) - @mkdir -p $(INSTALL_LIB) - @mkdir -p $(INSTALL_INCLUDE) - @mkdir -p $(INSTALL_DOC) - $(CC) $(SO_OPTS) $^ -o $@ $(LDLIBS) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) ) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) ) - $(CP) ../Include/amd.h $(INSTALL_INCLUDE) - $(CP) ../Doc/AMD_UserGuide.pdf $(INSTALL_DOC) - $(CP) ../README.txt $(INSTALL_DOC)/AMD_README.txt - chmod 755 $(INSTALL_LIB)/$(SO_TARGET) - chmod 644 $(INSTALL_INCLUDE)/amd.h - chmod 644 $(INSTALL_DOC)/AMD_UserGuide.pdf - chmod 644 $(INSTALL_DOC)/AMD_README.txt - -# uninstall AMD -uninstall: - $(RM) $(INSTALL_LIB)/$(SO_TARGET) - $(RM) $(INSTALL_LIB)/$(SO_PLAIN) - $(RM) $(INSTALL_LIB)/$(SO_MAIN) - $(RM) $(INSTALL_INCLUDE)/amd.h - $(RM) $(INSTALL_DOC)/AMD_UserGuide.pdf - $(RM) $(INSTALL_DOC)/AMD_README.txt - -#------------------------------------------------------------------------------- -# Remove all but the files in the original distribution -#------------------------------------------------------------------------------- - -clean: - - $(RM) -r $(CLEAN) - -purge: distclean - -distclean: clean - - $(RM) -r $(PURGE) - diff --git a/ThirdParty/SuiteSparse/AMD/MATLAB/Contents.m b/ThirdParty/SuiteSparse/AMD/MATLAB/Contents.m deleted file mode 100644 index c9c5eec4e7..0000000000 --- a/ThirdParty/SuiteSparse/AMD/MATLAB/Contents.m +++ /dev/null @@ -1,18 +0,0 @@ -%Contents of the AMD sparse matrix ordering package: -% -% amd2 - p = amd2 (A), the approximate minimum degree ordering of A -% amd_demo - a demo of amd2, using the can_24 matrix -% amd_make - to compile amd2 for use in MATLAB -% amd_install - compile and install amd2 for use in MATLAB -% -% See also: amd, amd2, colamd, symamd, colmmd, symmmd, umfpack -% -% Note that amd2 and the built-in amd function in MATLAB 7.3 and later are one -% and the same. -% -% Example: -% p = amd2 (A) ; - -% Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, and Iain S. Duff. - -help Contents diff --git a/ThirdParty/SuiteSparse/AMD/MATLAB/amd2.m b/ThirdParty/SuiteSparse/AMD/MATLAB/amd2.m deleted file mode 100644 index 60e09d5e55..0000000000 --- a/ThirdParty/SuiteSparse/AMD/MATLAB/amd2.m +++ /dev/null @@ -1,72 +0,0 @@ -function [p, Info] = amd2 (A, Control) %#ok -%AMD2 p = amd2 (A), the approximate minimum degree ordering of A -% P = AMD2 (S) returns the approximate minimum degree permutation vector for -% the sparse matrix C = S+S'. The Cholesky factorization of C (P,P), or -% S (P,P), tends to be sparser than that of C or S. AMD tends to be faster -% than SYMMMD and SYMAMD, and tends to return better orderings than SYMMMD. -% S must be square. If S is full, amd(S) is equivalent to amd(sparse(S)). -% -% Note that the built-in AMD routine in MATLAB is identical to AMD2, -% except that AMD in MATLAB allows for a struct input to set the parameters. -% -% Usage: P = amd2 (S) ; % finds the ordering -% [P, Info] = amd2 (S, Control) ; % optional parameters & statistics -% Control = amd2 ; % returns default parameters -% amd2 ; % prints default parameters. -% -% Control (1); If S is n-by-n, then rows/columns with more than -% max (16, (Control (1))* sqrt(n)) entries in S+S' are considered -% "dense", and ignored during ordering. They are placed last in the -% output permutation. The default is 10.0 if Control is not present. -% Control (2): If nonzero, then aggressive absorption is performed. -% This is the default if Control is not present. -% Control (3): If nonzero, print statistics about the ordering. -% -% Info (1): status (0: ok, -1: out of memory, -2: matrix invalid) -% Info (2): n = size (A,1) -% Info (3): nnz (A) -% Info (4): the symmetry of the matrix S (0.0 means purely unsymmetric, -% 1.0 means purely symmetric). Computed as: -% B = tril (S, -1) + triu (S, 1) ; symmetry = nnz (B & B') / nnz (B); -% Info (5): nnz (diag (S)) -% Info (6): nnz in S+S', excluding the diagonal (= nnz (B+B')) -% Info (7): number "dense" rows/columns in S+S' -% Info (8): the amount of memory used by AMD, in bytes -% Info (9): the number of memory compactions performed by AMD -% -% The following statistics are slight upper bounds because of the -% approximate degree in AMD. The bounds are looser if "dense" rows/columns -% are ignored during ordering (Info (7) > 0). The statistics are for a -% subsequent factorization of the matrix C (P,P). The LU factorization -% statistics assume no pivoting. -% -% Info (10): the number of nonzeros in L, excluding the diagonal -% Info (11): the number of divide operations for LL', LDL', or LU -% Info (12): the number of multiply-subtract pairs for LL' or LDL' -% Info (13): the number of multiply-subtract pairs for LU -% Info (14): the max # of nonzeros in any column of L (incl. diagonal) -% Info (15:20): unused, reserved for future use -% -% An assembly tree post-ordering is performed, which is typically the same -% as an elimination tree post-ordering. It is not always identical because -% of the approximate degree update used, and because "dense" rows/columns -% do not take part in the post-order. It well-suited for a subsequent -% "chol", however. If you require a precise elimination tree post-ordering, -% then see the example below: -% -% Example: -% -% P = amd2 (S) ; -% C = spones (S) + spones (S') ; % skip this if S already symmetric -% [ignore, Q] = etree (C (P,P)) ; -% P = P (Q) ; -% -% See also AMD, COLMMD, COLAMD, COLPERM, SYMAMD, SYMMMD, SYMRCM. - -% Copyright 1994-2012, Timothy A. Davis, http://www.suitesparse.com, -% Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. -% -% Acknowledgements: This work was supported by the National Science -% Foundation, under grants ASC-9111263, DMS-9223088, and CCR-0203270. - -error ('amd2 mexFunction not found') ; diff --git a/ThirdParty/SuiteSparse/AMD/MATLAB/amd_demo.m b/ThirdParty/SuiteSparse/AMD/MATLAB/amd_demo.m deleted file mode 100644 index 06deba2212..0000000000 --- a/ThirdParty/SuiteSparse/AMD/MATLAB/amd_demo.m +++ /dev/null @@ -1,80 +0,0 @@ -function amd_demo -%AMD_DEMO a demo of amd2, using the can_24 matrix -% -% A demo of AMD for MATLAB. -% -% Example: -% amd_demo -% -% See also: amd, amd2, amd_make - -% Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, and Iain S. Duff. - -% This orders the same matrix as the ANSI C demo, amd_demo.c. It includes an -% additional analysis of the matrix via MATLAB's symbfact routine. - -% First, print the help information for AMD -help amd2 - -% Get the Harwell/Boeing can_24 matrix. - -load can_24 -A = spconvert (can_24) ; - -n = size (A,1) ; - -clf -subplot (2,2,1) ; -spy (A) -title ('HB/can24 matrix') ; - -% order the matrix. Note that the Info argument is optional. -fprintf ('\nIf the next step fails, then you have\n') ; -fprintf ('not yet compiled the AMD mexFunction.\n') ; -[p, Info] = amd2 (A) ; %#ok - -% order again, but this time print some statistics -[p, Info] = amd2 (A, [10 1 1]) ; - -fprintf ('Permutation vector:\n') ; -fprintf (' %2d', p) ; -fprintf ('\n\n') ; - -subplot (2,2,2) ; -spy (A (p,p)) ; -title ('Permuted matrix') ; - -% The amd_demo.c program stops here. - -fprintf ('Analyze A(p,p) with MATLAB''s symbfact routine:\n') ; -[cn, height, parent, post, R] = symbfact (A (p,p)) ; - -subplot (2,2,3) ; -spy (R') ; -title ('Cholesky factor, L') ; - -subplot (2,2,4) ; -treeplot (parent) ; -title ('elimination tree') ; - -% results from symbfact -lnz = sum (cn) ; % number of nonzeros in L, incl. diagonal -cn = cn - 1 ; % get the count of off-diagonal entries -fl = n + sum (cn.^2 + 2*cn) ; % flop count for chol (A (p,p) -fprintf ('number of nonzeros in L (including diagonal): %d\n', lnz) ; -fprintf ('floating point operation count for chol (A (p,p)): %d\n', fl) ; - -% approximations from amd: -lnz2 = n + Info (10) ; -fl2 = n + Info (11) + 2 * Info (12) ; -fprintf ('\nResults from AMD''s approximate analysis:\n') ; -fprintf ('number of nonzeros in L (including diagonal): %d\n', lnz2) ; -fprintf ('floating point operation count for chol (A (p,p)): %d\n\n', fl2) ; - -if (lnz2 ~= lnz | fl ~= fl2) %#ok - fprintf ('Note that the nonzero and flop counts from AMD are slight\n') ; - fprintf ('upper bounds. This is due to the approximate minimum degree\n'); - fprintf ('method used, in conjunction with "mass elimination".\n') ; - fprintf ('See the discussion about mass elimination in amd.h and\n') ; - fprintf ('amd_2.c for more details.\n') ; -end diff --git a/ThirdParty/SuiteSparse/AMD/MATLAB/amd_demo.m.out b/ThirdParty/SuiteSparse/AMD/MATLAB/amd_demo.m.out deleted file mode 100644 index 4e644826d1..0000000000 --- a/ThirdParty/SuiteSparse/AMD/MATLAB/amd_demo.m.out +++ /dev/null @@ -1,125 +0,0 @@ -amd_demo - AMD2 p = amd2 (A), the approximate minimum degree ordering of A - P = AMD2 (S) returns the approximate minimum degree permutation vector for - the sparse matrix C = S+S'. The Cholesky factorization of C (P,P), or - S (P,P), tends to be sparser than that of C or S. AMD tends to be faster - than SYMMMD and SYMAMD, and tends to return better orderings than SYMMMD. - S must be square. If S is full, amd(S) is equivalent to amd(sparse(S)). - - Note that the built-in AMD routine in MATLAB is identical to AMD2, - except that AMD in MATLAB allows for a struct input to set the parameters. - - Usage: P = amd2 (S) ; % finds the ordering - [P, Info] = amd2 (S, Control) ; % optional parameters & statistics - Control = amd2 ; % returns default parameters - amd2 ; % prints default parameters. - - Control (1); If S is n-by-n, then rows/columns with more than - max (16, (Control (1))* sqrt(n)) entries in S+S' are considered - "dense", and ignored during ordering. They are placed last in the - output permutation. The default is 10.0 if Control is not present. - Control (2): If nonzero, then aggressive absorption is performed. - This is the default if Control is not present. - Control (3): If nonzero, print statistics about the ordering. - - Info (1): status (0: ok, -1: out of memory, -2: matrix invalid) - Info (2): n = size (A,1) - Info (3): nnz (A) - Info (4): the symmetry of the matrix S (0.0 means purely unsymmetric, - 1.0 means purely symmetric). Computed as: - B = tril (S, -1) + triu (S, 1) ; symmetry = nnz (B & B') / nnz (B); - Info (5): nnz (diag (S)) - Info (6): nnz in S+S', excluding the diagonal (= nnz (B+B')) - Info (7): number "dense" rows/columns in S+S' - Info (8): the amount of memory used by AMD, in bytes - Info (9): the number of memory compactions performed by AMD - - The following statistics are slight upper bounds because of the - approximate degree in AMD. The bounds are looser if "dense" rows/columns - are ignored during ordering (Info (7) > 0). The statistics are for a - subsequent factorization of the matrix C (P,P). The LU factorization - statistics assume no pivoting. - - Info (10): the number of nonzeros in L, excluding the diagonal - Info (11): the number of divide operations for LL', LDL', or LU - Info (12): the number of multiply-subtract pairs for LL' or LDL' - Info (13): the number of multiply-subtract pairs for LU - Info (14): the max # of nonzeros in any column of L (incl. diagonal) - Info (15:20): unused, reserved for future use - - An assembly tree post-ordering is performed, which is typically the same - as an elimination tree post-ordering. It is not always identical because - of the approximate degree update used, and because "dense" rows/columns - do not take part in the post-order. It well-suited for a subsequent - "chol", however. If you require a precise elimination tree post-ordering, - then see the example below: - - Example: - - P = amd2 (S) ; - C = spones (S) + spones (S') ; % skip this if S already symmetric - [ignore, Q] = etree (C (P,P)) ; - P = P (Q) ; - - See also AMD, COLMMD, COLAMD, COLPERM, SYMAMD, SYMMMD, SYMRCM. - - -If the next step fails, then you have -not yet compiled the AMD mexFunction. - -AMD version 2.2.0, May 31, 2007: approximate minimum degree ordering - dense row parameter: 10 - (rows with more than max (10 * sqrt (n), 16) entries are - considered "dense", and placed last in output permutation) - aggressive absorption: yes - size of AMD integer: 4 - - input matrix A is 24-by-24 - input matrix A has 160 nonzero entries - -AMD version 2.2.0, May 31, 2007, results: - status: OK - n, dimension of A: 24 - nz, number of nonzeros in A: 160 - symmetry of A: 1.0000 - number of nonzeros on diagonal: 24 - nonzeros in pattern of A+A' (excl. diagonal): 136 - # dense rows/columns of A+A': 0 - memory used, in bytes: 1516 - # of memory compactions: 0 - - The following approximate statistics are for a subsequent - factorization of A(P,P) + A(P,P)'. They are slight upper - bounds if there are no dense rows/columns in A+A', and become - looser if dense rows/columns exist. - - nonzeros in L (excluding diagonal): 97 - nonzeros in L (including diagonal): 121 - # divide operations for LDL' or LU: 97 - # multiply-subtract operations for LDL': 275 - # multiply-subtract operations for LU: 453 - max nz. in any column of L (incl. diagonal): 8 - - chol flop count for real A, sqrt counted as 1 flop: 671 - LDL' flop count for real A: 647 - LDL' flop count for complex A: 3073 - LU flop count for real A (with no pivoting): 1003 - LU flop count for complex A (with no pivoting): 4497 - -Permutation vector: - 23 21 11 24 13 6 17 9 15 5 16 8 2 10 14 18 1 3 4 7 12 19 22 20 - -Analyze A(p,p) with MATLAB's symbfact routine: -number of nonzeros in L (including diagonal): 120 -floating point operation count for chol (A (p,p)): 656 - -Results from AMD's approximate analysis: -number of nonzeros in L (including diagonal): 121 -floating point operation count for chol (A (p,p)): 671 - -Note that the nonzero and flop counts from AMD are slight -upper bounds. This is due to the approximate minimum degree -method used, in conjunction with "mass elimination". -See the discussion about mass elimination in amd.h and -amd_2.c for more details. -diary off diff --git a/ThirdParty/SuiteSparse/AMD/MATLAB/amd_install.m b/ThirdParty/SuiteSparse/AMD/MATLAB/amd_install.m deleted file mode 100644 index 6b9f3628d9..0000000000 --- a/ThirdParty/SuiteSparse/AMD/MATLAB/amd_install.m +++ /dev/null @@ -1,19 +0,0 @@ -function amd_install -%AMD_INSTALL compile and install amd2 for use in MATLAB -% Your current directory must be AMD/MATLAB for this function to work. -% -% Example: -% amd_install -% -% See also amd, amd2. - -% Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, and Iain S. Duff. - -% This orders the same matrix as the ANSI C demo, amd_demo.c. It includes an - -amd_make -addpath (pwd) -fprintf ('\nThe following path has been added. You may wish to add it\n') ; -fprintf ('permanently, using the MATLAB pathtool command.\n') ; -fprintf ('%s\n\n', pwd) ; -amd_demo diff --git a/ThirdParty/SuiteSparse/AMD/MATLAB/amd_make.m b/ThirdParty/SuiteSparse/AMD/MATLAB/amd_make.m deleted file mode 100644 index e43ec87b30..0000000000 --- a/ThirdParty/SuiteSparse/AMD/MATLAB/amd_make.m +++ /dev/null @@ -1,43 +0,0 @@ -function amd_make -%AMD_MAKE to compile amd2 for use in MATLAB -% -% Example: -% amd_make -% -% See also amd, amd2. - -% Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, and Iain S. Duff. - -details = 0 ; % 1 if details of each command are to be printed - -d = '' ; -if (~isempty (strfind (computer, '64'))) - d = '-largeArrayDims' ; -end - -% MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much -if (~verLessThan ('matlab', '8.3.0')) - d = ['-silent ' d] ; -end - -i = sprintf ('-I../Include -I../../SuiteSparse_config') ; -cmd = sprintf ('mex -O %s -DDLONG -output amd2 %s amd_mex.c %s', d, i, ... - '../../SuiteSparse_config/SuiteSparse_config.c') ; -files = {'amd_order', 'amd_dump', 'amd_postorder', 'amd_post_tree', ... - 'amd_aat', 'amd_2', 'amd_1', 'amd_defaults', 'amd_control', ... - 'amd_info', 'amd_valid', 'amd_preprocess' } ; -for i = 1 : length (files) - cmd = sprintf ('%s ../Source/%s.c', cmd, files {i}) ; -end -if (details) - fprintf ('%s\n', cmd) ; -end - -if (~(ispc || ismac)) - % for POSIX timing routine - cmd = [cmd ' -lrt'] ; -end - -eval (cmd) ; - -fprintf ('AMD successfully compiled.\n') ; diff --git a/ThirdParty/SuiteSparse/AMD/MATLAB/amd_mex.c b/ThirdParty/SuiteSparse/AMD/MATLAB/amd_mex.c deleted file mode 100644 index 89fdc9b7cd..0000000000 --- a/ThirdParty/SuiteSparse/AMD/MATLAB/amd_mex.c +++ /dev/null @@ -1,192 +0,0 @@ -/* ========================================================================= */ -/* === AMD mexFunction ===================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* - * Usage: - * p = amd (A) - * p = amd (A, Control) - * [p, Info] = amd (A) - * [p, Info] = amd (A, Control) - * Control = amd ; % return the default Control settings for AMD - * amd ; % print the default Control settings for AMD - * - * Given a square matrix A, compute a permutation P suitable for a Cholesky - * factorization of the matrix B (P,P), where B = spones (A) + spones (A'). - * The method used is the approximate minimum degree ordering method. See - * amd.m and amd.h for more information. - * - * The input matrix need not have sorted columns, and can have duplicate - * entries. - */ - -#include "amd.h" -#include "mex.h" -#include "matrix.h" -#define Long SuiteSparse_long - -void mexFunction -( - int nargout, - mxArray *pargout [ ], - int nargin, - const mxArray *pargin [ ] -) -{ - Long i, m, n, *Ap, *Ai, *P, nc, result, spumoni, full ; - double *Pout, *InfoOut, Control [AMD_CONTROL], Info [AMD_INFO], *ControlIn ; - mxArray *A ; - - /* --------------------------------------------------------------------- */ - /* get control parameters */ - /* --------------------------------------------------------------------- */ - - spumoni = 0 ; - if (nargin == 0) - { - /* get the default control parameters, and return */ - pargout [0] = mxCreateDoubleMatrix (AMD_CONTROL, 1, mxREAL) ; - amd_l_defaults (mxGetPr (pargout [0])) ; - if (nargout == 0) - { - amd_l_control (mxGetPr (pargout [0])) ; - } - return ; - } - - amd_l_defaults (Control) ; - if (nargin > 1) - { - ControlIn = mxGetPr (pargin [1]) ; - nc = mxGetM (pargin [1]) * mxGetN (pargin [1]) ; - Control [AMD_DENSE] - = (nc > 0) ? ControlIn [AMD_DENSE] : AMD_DEFAULT_DENSE ; - Control [AMD_AGGRESSIVE] - = (nc > 1) ? ControlIn [AMD_AGGRESSIVE] : AMD_DEFAULT_AGGRESSIVE ; - spumoni = (nc > 2) ? (ControlIn [2] != 0) : 0 ; - } - - if (spumoni > 0) - { - amd_l_control (Control) ; - } - - /* --------------------------------------------------------------------- */ - /* get inputs */ - /* --------------------------------------------------------------------- */ - - if (nargout > 2 || nargin > 2) - { - mexErrMsgTxt ("Usage: p = amd (A)\nor [p, Info] = amd (A, Control)") ; - } - - A = (mxArray *) pargin [0] ; - n = mxGetN (A) ; - m = mxGetM (A) ; - if (spumoni > 0) - { - mexPrintf (" input matrix A is %d-by-%d\n", m, n) ; - } - if (mxGetNumberOfDimensions (A) != 2) - { - mexErrMsgTxt ("amd: A must be 2-dimensional") ; - } - if (m != n) - { - mexErrMsgTxt ("amd: A must be square") ; - } - - /* --------------------------------------------------------------------- */ - /* allocate workspace for output permutation */ - /* --------------------------------------------------------------------- */ - - P = mxMalloc ((n+1) * sizeof (Long)) ; - - /* --------------------------------------------------------------------- */ - /* if A is full, convert to a sparse matrix */ - /* --------------------------------------------------------------------- */ - - full = !mxIsSparse (A) ; - if (full) - { - if (spumoni > 0) - { - mexPrintf ( - " input matrix A is full (sparse copy of A will be created)\n"); - } - mexCallMATLAB (1, &A, 1, (mxArray **) pargin, "sparse") ; - } - Ap = (Long *) mxGetJc (A) ; - Ai = (Long *) mxGetIr (A) ; - if (spumoni > 0) - { - mexPrintf (" input matrix A has %d nonzero entries\n", Ap [n]) ; - } - - /* --------------------------------------------------------------------- */ - /* order the matrix */ - /* --------------------------------------------------------------------- */ - - result = amd_l_order (n, Ap, Ai, P, Control, Info) ; - - /* --------------------------------------------------------------------- */ - /* if A is full, free the sparse copy of A */ - /* --------------------------------------------------------------------- */ - - if (full) - { - mxDestroyArray (A) ; - } - - /* --------------------------------------------------------------------- */ - /* print results (including return value) */ - /* --------------------------------------------------------------------- */ - - if (spumoni > 0) - { - amd_l_info (Info) ; - } - - /* --------------------------------------------------------------------- */ - /* check error conditions */ - /* --------------------------------------------------------------------- */ - - if (result == AMD_OUT_OF_MEMORY) - { - mexErrMsgTxt ("amd: out of memory") ; - } - else if (result == AMD_INVALID) - { - mexErrMsgTxt ("amd: input matrix A is corrupted") ; - } - - /* --------------------------------------------------------------------- */ - /* copy the outputs to MATLAB */ - /* --------------------------------------------------------------------- */ - - /* output permutation, P */ - pargout [0] = mxCreateDoubleMatrix (1, n, mxREAL) ; - Pout = mxGetPr (pargout [0]) ; - for (i = 0 ; i < n ; i++) - { - Pout [i] = P [i] + 1 ; /* change to 1-based indexing for MATLAB */ - } - mxFree (P) ; - - /* Info */ - if (nargout > 1) - { - pargout [1] = mxCreateDoubleMatrix (AMD_INFO, 1, mxREAL) ; - InfoOut = mxGetPr (pargout [1]) ; - for (i = 0 ; i < AMD_INFO ; i++) - { - InfoOut [i] = Info [i] ; - } - } -} diff --git a/ThirdParty/SuiteSparse/AMD/MATLAB/can_24 b/ThirdParty/SuiteSparse/AMD/MATLAB/can_24 deleted file mode 100644 index 38158a159a..0000000000 --- a/ThirdParty/SuiteSparse/AMD/MATLAB/can_24 +++ /dev/null @@ -1,160 +0,0 @@ - 1 1 1 - 6 1 1 - 7 1 1 -13 1 1 -14 1 1 -18 1 1 -19 1 1 -20 1 1 -22 1 1 - 2 2 1 - 9 2 1 -10 2 1 -14 2 1 -15 2 1 -18 2 1 - 3 3 1 - 7 3 1 -12 3 1 -21 3 1 -22 3 1 -23 3 1 - 4 4 1 - 8 4 1 -11 4 1 -16 4 1 -19 4 1 -20 4 1 - 5 5 1 - 8 5 1 -10 5 1 -15 5 1 -16 5 1 -17 5 1 - 1 6 1 - 6 6 1 - 7 6 1 -13 6 1 -14 6 1 -18 6 1 - 1 7 1 - 3 7 1 - 6 7 1 - 7 7 1 -12 7 1 -13 7 1 -20 7 1 -22 7 1 -24 7 1 - 4 8 1 - 5 8 1 - 8 8 1 -10 8 1 -15 8 1 -16 8 1 -17 8 1 -18 8 1 -19 8 1 - 2 9 1 - 9 9 1 -10 9 1 -15 9 1 - 2 10 1 - 5 10 1 - 8 10 1 - 9 10 1 -10 10 1 -14 10 1 -15 10 1 -18 10 1 -19 10 1 - 4 11 1 -11 11 1 -19 11 1 -20 11 1 -21 11 1 -22 11 1 - 3 12 1 - 7 12 1 -12 12 1 -13 12 1 -22 12 1 -24 12 1 - 1 13 1 - 6 13 1 - 7 13 1 -12 13 1 -13 13 1 -24 13 1 - 1 14 1 - 2 14 1 - 6 14 1 -10 14 1 -14 14 1 -18 14 1 - 2 15 1 - 5 15 1 - 8 15 1 - 9 15 1 -10 15 1 -15 15 1 - 4 16 1 - 5 16 1 - 8 16 1 -16 16 1 -17 16 1 -19 16 1 - 5 17 1 - 8 17 1 -16 17 1 -17 17 1 - 1 18 1 - 2 18 1 - 6 18 1 - 8 18 1 -10 18 1 -14 18 1 -18 18 1 -19 18 1 -20 18 1 - 1 19 1 - 4 19 1 - 8 19 1 -10 19 1 -11 19 1 -16 19 1 -18 19 1 -19 19 1 -20 19 1 - 1 20 1 - 4 20 1 - 7 20 1 -11 20 1 -18 20 1 -19 20 1 -20 20 1 -21 20 1 -22 20 1 - 3 21 1 -11 21 1 -20 21 1 -21 21 1 -22 21 1 -23 21 1 - 1 22 1 - 3 22 1 - 7 22 1 -11 22 1 -12 22 1 -20 22 1 -21 22 1 -22 22 1 -23 22 1 - 3 23 1 -21 23 1 -22 23 1 -23 23 1 - 7 24 1 -12 24 1 -13 24 1 -24 24 1 diff --git a/ThirdParty/SuiteSparse/AMD/Makefile b/ThirdParty/SuiteSparse/AMD/Makefile index b9bfbb588e..ad08cc1d1a 100644 --- a/ThirdParty/SuiteSparse/AMD/Makefile +++ b/ThirdParty/SuiteSparse/AMD/Makefile @@ -1,73 +1,94 @@ -#------------------------------------------------------------------------------ -# AMD Makefile -#------------------------------------------------------------------------------ - -SUITESPARSE ?= $(realpath $(CURDIR)/..) -export SUITESPARSE - -default: all - -include ../SuiteSparse_config/SuiteSparse_config.mk - -demos: all - -# Compile all C code. Do not compile the FORTRAN versions. -all: - ( cd Lib ; $(MAKE) ) - ( cd Demo ; $(MAKE) ) - -# compile just the C-callable libraries (not Demos) +#------------------------------------------------------------------------------- +# SuiteSparse/AMD/Makefile +#------------------------------------------------------------------------------- + +# AMD: Copyright (c) 2009-2022, Timothy A. Davis, Patrick Amestoy, Iain Duff. +# All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# A simple Makefile for AMD, which relies on cmake to do the +# actual build. All the work is done in cmake so this Makefile is just for +# convenience. + +# To compile with an alternate compiler: +# +# make CC=gcc CXX=g++ +# +# To compile/install for system-wide usage: +# +# make +# sudo make install +# +# To compile/install for local usage (SuiteSparse/lib and SuiteSparse/include): +# +# make local +# make install +# +# To clean up the files: +# +# make clean + +JOBS ?= 8 + +default: library + +# default is to install only in /usr/local library: - ( cd Lib ; $(MAKE) ) - -# compile the static libraries only -static: - ( cd Lib ; $(MAKE) static ) + ( cd build && cmake $(CMAKE_OPTIONS) .. && cmake --build . -j${JOBS} ) + +# install only in SuiteSparse/lib and SuiteSparse/include +local: + ( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=1 .. && cmake --build . -j${JOBS} ) + +# install only in /usr/local (default) +global: + ( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=0 .. && cmake --build . -j${JOBS} ) + +debug: + ( cd build && cmake $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug .. && cmake --build . -j${JOBS} ) + +all: library + +demos: library + ( cd build && cmake $(CMAKE_OPTIONS) -DDEMO=1 .. && cmake --build . -j${JOBS} ) + ./build/amd_demo > build/amd_demo.out + - diff --strip-trailing-cr Demo/amd_demo.out build/amd_demo.out + ./build/amd_l_demo > build/amd_l_demo.out + - diff --strip-trailing-cr Demo/amd_l_demo.out build/amd_l_demo.out + ./build/amd_demo2 > build/amd_demo2.out + - diff --strip-trailing-cr Demo/amd_demo2.out build/amd_demo2.out + ./build/amd_simple > build/amd_simple.out + - diff --strip-trailing-cr Demo/amd_simple.out build/amd_simple.out + # Fortran demos will fail if no Fortran compiler is available + - ./build/amd_f77simple > build/amd_f77simple.out + - diff --strip-trailing-cr Demo/amd_f77simple.out build/amd_f77simple.out + - ./build/amd_f77demo > build/amd_f77demo.out + - diff --strip-trailing-cr Demo/amd_f77demo.out build/amd_f77demo.out + +# just compile after running cmake; do not run cmake again +remake: + ( cd build && cmake --build . -j${JOBS} ) + +# just run cmake to set things up +setup: + ( cd build && cmake $(CMAKE_OPTIONS) .. ) -# compile the FORTRAN libraries and demo programs (not compiled by "make all") -fortran: - ( cd Lib ; $(MAKE) fortran ) - ( cd Demo ; $(MAKE) fortran ) +install: + ( cd build && cmake --install . ) -# compile a FORTRAN demo program that calls the C version of AMD -# (not compiled by "make all") -cross: - ( cd Demo ; $(MAKE) cross ) +# remove any installed libraries and #include files +uninstall: + - xargs rm < build/install_manifest.txt -# remove object files, but keep the compiled programs and library archives +# remove all files not in the distribution clean: - ( cd Lib ; $(MAKE) clean ) - ( cd Demo ; $(MAKE) clean ) - ( cd MATLAB ; $(RM) $(CLEAN) ) - ( cd Doc ; $(MAKE) clean ) + - $(RM) -rf build/* Config/*.tmp MATLAB/*.o MATLAB/*.mex* -# clean, and then remove compiled programs and library archives -purge: - ( cd Lib ; $(MAKE) purge ) - ( cd Demo ; $(MAKE) purge ) - ( cd MATLAB ; $(RM) $(CLEAN) ; $(RM) *.mex* ) - ( cd Doc ; $(MAKE) purge ) +purge: clean -distclean: purge +distclean: clean -# create PDF documents for the original distribution docs: - ( cd Doc ; $(MAKE) ) - -# get ready for distribution -dist: purge - ( cd Demo ; $(MAKE) dist ) - ( cd Doc ; $(MAKE) ) - -ccode: library - -lib: library - -# install AMD -install: - ( cd Lib ; $(MAKE) install ) - -# uninstall AMD -uninstall: - ( cd Lib ; $(MAKE) uninstall ) - + ( cd Doc && $(MAKE) ) diff --git a/ThirdParty/SuiteSparse/AMD/README.txt b/ThirdParty/SuiteSparse/AMD/README.txt index 5aa64c473c..e4696d593e 100644 --- a/ThirdParty/SuiteSparse/AMD/README.txt +++ b/ThirdParty/SuiteSparse/AMD/README.txt @@ -1,4 +1,4 @@ -AMD, Copyright (c) 2009-2013 by Timothy A. Davis (http://www.suitesparse.com), +AMD, Copyright (c) 1996-2022 by Timothy A. Davis (http://www.suitesparse.com), Patrick R. Amestoy, and Iain S. Duff. All Rights Reserved. AMD is available under alternate licences; contact T. Davis for details. @@ -9,17 +9,21 @@ AMD: a set of routines for permuting sparse matrices prior to Requires SuiteSparse_config, in the ../SuiteSparse_config directory relative to this directory. -Quick start (Unix, or Windows with Cygwin): +Quick start (Linux or MacOSX): - To compile, test, and install AMD, you may wish to first configure the - installation by editting the ../SuiteSparse_config/SuiteSparse_config.mk - file. Next, cd to this directory (AMD) and type "make" (or "make lib" if - you do not have MATLAB). To compile and run a demo program for the Fortran - version, type "make fortran". When done, type "make clean" to remove - unused *.o files (keeps the compiled libraries and demo programs). See the - User Guide (Doc/AMD_UserGuide.pdf), or - ../SuiteSparse_config/SuiteSparse_config.mk for more details. - To install do "make install" + To compile and install the library for system-wide usage: + + make + sudo make install + + To compile/install for local usage (SuiteSparse/lib and SuiteSparse/include) + + make local + make install + + To run the demos + + make demos Quick start (for MATLAB users); @@ -76,16 +80,15 @@ Files and directories in the AMD distribution: Include include file for use in your code that calls AMD Demo demo programs. also serves as test of the AMD installation. MATLAB AMD mexFunction for MATLAB, and supporting m-files - Lib where the compiled C-callable and Fortran-callable - AMD libraries placed. + build where the compiled libraries and demos are placed + Config source file to construct amd.h --------------------------------------------------------------------------- Files in the AMD directory: --------------------------------------------------------------------------- - Makefile top-level Makefile - Windows users would require Cygwin to use "make" - + Makefile a very simple Makefile (optional); just for simplifying cmake + CMakeLists.txt cmake script for building AMD README.txt this file --------------------------------------------------------------------------- @@ -119,6 +122,8 @@ Files and directories in the AMD distribution: amd_valid.c non-user-callable, verifies a matrix amd_preprocess.c non-user-callable, computes A', removes duplic + amd_l* same as above, but with int64_t integers + amd.f user-callable Fortran 77 version amdbar.f user-callable Fortran 77 version @@ -127,20 +132,20 @@ Files and directories in the AMD distribution: --------------------------------------------------------------------------- amd.h include file for C programs that use AMD + constructed by cmake from Config/amd.h.in amd_internal.h non-user-callable, include file for AMD --------------------------------------------------------------------------- Demo directory: --------------------------------------------------------------------------- - Makefile to compile the demos amd_demo.c C demo program for AMD amd_demo.out output of amd_demo.c amd_demo2.c C demo program for AMD, jumbled matrix amd_demo2.out output of amd_demo2.c - amd_l_demo.c C demo program for AMD (long integer version) + amd_l_demo.c C demo program for AMD (int64_t version) amd_l_demo.out output of amd_l_demo.c amd_simple.c simple C demo program for AMD @@ -173,8 +178,8 @@ Files and directories in the AMD distribution: can_24.mat input file for AMD demo --------------------------------------------------------------------------- - Lib directory: libamd.a and libamd.so library placed here + build directory: libamd.a and libamd.so library placed here --------------------------------------------------------------------------- - Makefile Makefile for both shared and static libraries + .gitignore only file in the original distribution diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd.f b/ThirdParty/SuiteSparse/AMD/Source/amd.f index ccfe3e8c9f..0378073648 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd.f +++ b/ThirdParty/SuiteSparse/AMD/Source/amd.f @@ -1,5 +1,11 @@ C----------------------------------------------------------------------- -C AMD: approximate minimum degree, with aggressive absorption +C AMD/Source/amd.f: Fortran version of AMD +C----------------------------------------------------------------------- + +C AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, +C and C Iain S. Duff. All Rights Reserved. +C SPDX-License-Identifier: BSD-3-clause + C----------------------------------------------------------------------- SUBROUTINE AMD diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_1.c b/ThirdParty/SuiteSparse/AMD/Source/amd_1.c index 2be486e011..81c7d5d02d 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_1.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_1.c @@ -1,12 +1,12 @@ -/* ========================================================================= */ -/* === AMD_1 =============================================================== */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_1: construct input matrix and then order with amd_2 +//------------------------------------------------------------------------------ -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* AMD_1: Construct A+A' for a sparse matrix A and perform the AMD ordering. * @@ -26,7 +26,7 @@ #include "amd_internal.h" -GLOBAL void AMD_1 +void AMD_1 ( Int n, /* n > 0 */ const Int Ap [ ], /* input of size n+1, not modified */ diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_2.c b/ThirdParty/SuiteSparse/AMD/Source/amd_2.c index 85557090bc..d0294fd43c 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_2.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_2.c @@ -1,12 +1,12 @@ -/* ========================================================================= */ -/* === AMD_2 =============================================================== */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_2: AMD ordering +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +//------------------------------------------------------------------------------ /* AMD_2: performs the AMD ordering on a symmetric sparse matrix A, followed * by a postordering (via depth-first search) of the assembly tree using the @@ -39,7 +39,7 @@ static Int clear_flag (Int wflg, Int wbig, Int W [ ], Int n) /* === AMD_2 =============================================================== */ /* ========================================================================= */ -GLOBAL void AMD_2 +void AMD_2 ( Int n, /* A is n-by-n, where n > 0 */ Int Pe [ ], /* Pe [0..n-1]: index in Iw of row i on input */ @@ -119,8 +119,8 @@ GLOBAL void AMD_2 * ouput. Many of these functions are also provided by the Fortran * Harwell Subroutine Library routine MC47A. * - * (6) both int and SuiteSparse_long versions are provided. In the - * descriptions below and integer is and int or SuiteSparse_long depending + * (6) both int32_t and int64_t versions are provided. In the + * descriptions below an integer is int32_t or int64_t depending * on which version is being used. ********************************************************************** @@ -462,7 +462,7 @@ GLOBAL void AMD_2 nvi, nvj, nvpiv, slenme, wbig, we, wflg, wnvi, ok, ndense, ncmpa, dense, aggressive ; - UnsignedInt hash ; /* unsigned, so that hash % n is well defined.*/ + UInt hash ; /* unsigned, so that hash % n is well defined.*/ /* * deg: the degree of a variable or element @@ -494,8 +494,8 @@ GLOBAL void AMD_2 * nvj: the number of variables in a supervariable j (= Nv [j]) * nvpiv: number of pivots in current element * slenme: number of variables in variable list of pivotal variable - * wbig: = (INT_MAX - n) for the int version, (SuiteSparse_long_max - n) - * for the SuiteSparse_long version. wflg is not allowed to + * wbig: = (INT32_MAX - n) for the int32_t version, (INT64_MAX - n) + * for the int64_t version. wflg is not allowed to * be >= wbig. * we: W [e] * wflg: used for flagging the W array. See description of Iw. diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_aat.c b/ThirdParty/SuiteSparse/AMD/Source/amd_aat.c index 67c03f7a4c..2f7b547711 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_aat.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_aat.c @@ -1,12 +1,12 @@ -/* ========================================================================= */ -/* === AMD_aat ============================================================= */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_aat: compute symmetry of A and nnz in each column of A+A' +//------------------------------------------------------------------------------ -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* AMD_aat: compute the symmetry of the pattern of A, and count the number of * nonzeros each column of A+A' (excluding the diagonal). Assumes the input @@ -17,7 +17,7 @@ #include "amd_internal.h" -GLOBAL size_t AMD_aat /* returns nz in A+A' */ +size_t AMD_aat /* returns nz in A+A' */ ( Int n, const Int Ap [ ], diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_control.c b/ThirdParty/SuiteSparse/AMD/Source/amd_control.c index f6a5e9a540..cf47294a0a 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_control.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_control.c @@ -1,12 +1,12 @@ -/* ========================================================================= */ -/* === AMD_control ========================================================= */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_control: print control parameters for AMD +//------------------------------------------------------------------------------ -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* User-callable. Prints the control parameters for AMD. See amd.h * for details. If the Control array is not present, the defaults are @@ -15,7 +15,7 @@ #include "amd_internal.h" -GLOBAL void AMD_control +void AMD_control ( double Control [ ] ) diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_defaults.c b/ThirdParty/SuiteSparse/AMD/Source/amd_defaults.c index b9a9079a03..3fb470a113 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_defaults.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_defaults.c @@ -1,12 +1,12 @@ -/* ========================================================================= */ -/* === AMD_defaults ======================================================== */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_defaults: set defaults for AMD +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +//------------------------------------------------------------------------------ /* User-callable. Sets default control parameters for AMD. See amd.h * for details. @@ -18,7 +18,7 @@ /* === AMD defaults ======================================================== */ /* ========================================================================= */ -GLOBAL void AMD_defaults +void AMD_defaults ( double Control [ ] ) diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_dump.c b/ThirdParty/SuiteSparse/AMD/Source/amd_dump.c index e58aaf5552..03e11651d9 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_dump.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_dump.c @@ -1,12 +1,12 @@ -/* ========================================================================= */ -/* === AMD_dump ============================================================ */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_dump: debug routines for AMD +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +//------------------------------------------------------------------------------ /* Debugging routines for AMD. Not used if NDEBUG is not defined at compile- * time (the default). See comments in amd_internal.h on how to enable @@ -18,7 +18,7 @@ #ifndef NDEBUG /* This global variable is present only when debugging */ -GLOBAL Int AMD_debug = -999 ; /* default is no debug printing */ +Int AMD_debug = -999 ; /* default is no debug printing */ /* ========================================================================= */ /* === AMD_debug_init ====================================================== */ @@ -26,7 +26,7 @@ GLOBAL Int AMD_debug = -999 ; /* default is no debug printing */ /* Sets the debug print level, by reading the file debug.amd (if it exists) */ -GLOBAL void AMD_debug_init ( char *s ) +void AMD_debug_init ( char *s ) { FILE *f ; f = fopen ("debug.amd", "r") ; @@ -53,7 +53,7 @@ GLOBAL void AMD_debug_init ( char *s ) * cannot be called when the hash buckets are non-empty. */ -GLOBAL void AMD_dump ( +void AMD_dump ( Int n, /* A is n-by-n */ Int Pe [ ], /* pe [0..n-1]: index in iw of start of row i */ Int Iw [ ], /* workspace of size iwlen, iwlen [0..pfree-1] diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_global.c b/ThirdParty/SuiteSparse/AMD/Source/amd_global.c deleted file mode 100644 index 453e970e40..0000000000 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_global.c +++ /dev/null @@ -1,14 +0,0 @@ -/* ========================================================================= */ -/* === amd_global ========================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* In prior versions of AMD, this file declared the amd_malloc, amd_free, - amd_realloc, amd_calloc, and amd_printf functions. They are now replaced - by functions defined in SuiteSparse_config/SuiteSparse_config.c. - */ diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_info.c b/ThirdParty/SuiteSparse/AMD/Source/amd_info.c index 062651f496..2443f78057 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_info.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_info.c @@ -1,12 +1,12 @@ -/* ========================================================================= */ -/* === AMD_info ============================================================ */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_info: print output statistics for AMD +//------------------------------------------------------------------------------ -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* User-callable. Prints the output statistics for AMD. See amd.h * for details. If the Info array is not present, nothing is printed. @@ -16,7 +16,7 @@ #define PRI(format,x) { if (x >= 0) { SUITESPARSE_PRINTF ((format, x)) ; }} -GLOBAL void AMD_info +void AMD_info ( double Info [ ] ) diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l1.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l1.c new file mode 100644 index 0000000000..feb9ef7db7 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l1.c @@ -0,0 +1,13 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l1: int64_t version of amd_1 +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + +#define DLONG +#include "amd_1.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l2.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l2.c new file mode 100644 index 0000000000..ebdbe20628 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l2.c @@ -0,0 +1,13 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l2.c: int64_t version of amd_2 +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + +#define DLONG +#include "amd_2.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l_aat.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l_aat.c new file mode 100644 index 0000000000..d4d3e074cd --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l_aat.c @@ -0,0 +1,14 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l_aat.c: int64_t version of amd_aat +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + + +#define DLONG +#include "amd_aat.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l_control.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l_control.c new file mode 100644 index 0000000000..b14835186c --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l_control.c @@ -0,0 +1,14 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l_control.c: int64_t version of amd_control +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + + +#define DLONG +#include "amd_control.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l_defaults.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l_defaults.c new file mode 100644 index 0000000000..4a7f472f08 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l_defaults.c @@ -0,0 +1,14 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l_defaults.c: int64_t version of amd_defaults +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + + +#define DLONG +#include "amd_defaults.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l_dump.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l_dump.c new file mode 100644 index 0000000000..e14a8a59f3 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l_dump.c @@ -0,0 +1,14 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l_dump.c: int64_t version of amd_dump +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + + +#define DLONG +#include "amd_dump.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l_info.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l_info.c new file mode 100644 index 0000000000..955d4360a2 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l_info.c @@ -0,0 +1,14 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l_info.c: int64_t version of amd_info +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + + +#define DLONG +#include "amd_info.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l_order.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l_order.c new file mode 100644 index 0000000000..da8f826ab9 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l_order.c @@ -0,0 +1,14 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l_order.c: int64_t version of amd_order +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + + +#define DLONG +#include "amd_order.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l_post_tree.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l_post_tree.c new file mode 100644 index 0000000000..0169c34440 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l_post_tree.c @@ -0,0 +1,13 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l_post_tree.c: int64_t version of amd_post_tree +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + +#define DLONG +#include "amd_post_tree.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l_postorder.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l_postorder.c new file mode 100644 index 0000000000..2053c606d1 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l_postorder.c @@ -0,0 +1,13 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l_postorder.c: int64_t version of amd_postorder +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + +#define DLONG +#include "amd_postorder.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l_preprocess.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l_preprocess.c new file mode 100644 index 0000000000..96df6ab49b --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l_preprocess.c @@ -0,0 +1,13 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l_preprocess.c: int64_t version of amd_preprocess +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + +#define DLONG +#include "amd_preprocess.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_l_valid.c b/ThirdParty/SuiteSparse/AMD/Source/amd_l_valid.c new file mode 100644 index 0000000000..345168cbe7 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_l_valid.c @@ -0,0 +1,13 @@ +//------------------------------------------------------------------------------ +// AMD/Source/amd_l_valid.c: int64_t version of amd_valid +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + +#define DLONG +#include "amd_valid.c" + diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_order.c b/ThirdParty/SuiteSparse/AMD/Source/amd_order.c index 7f199aea66..1dcc15a009 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_order.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_order.c @@ -1,12 +1,12 @@ -/* ========================================================================= */ -/* === AMD_order =========================================================== */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_order: user-callable AMD ordering method +//------------------------------------------------------------------------------ + +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +//------------------------------------------------------------------------------ /* User-callable AMD minimum degree ordering routine. See amd.h for * documentation. @@ -18,7 +18,7 @@ /* === AMD_order =========================================================== */ /* ========================================================================= */ -GLOBAL Int AMD_order +int AMD_order ( Int n, const Int Ap [ ], @@ -157,7 +157,6 @@ GLOBAL Int AMD_order } mem += slen ; ok = ok && (slen < SIZE_T_MAX / sizeof (Int)) ; /* check for overflow */ - ok = ok && (slen < Int_MAX) ; /* S[i] for Int i must be OK */ if (ok) { S = SuiteSparse_malloc (slen, sizeof (Int)) ; diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_post_tree.c b/ThirdParty/SuiteSparse/AMD/Source/amd_post_tree.c index 516c95c9ad..d486732d48 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_post_tree.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_post_tree.c @@ -1,18 +1,18 @@ -/* ========================================================================= */ -/* === AMD_post_tree ======================================================= */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_post_tree: post-ordering of a single etree +//------------------------------------------------------------------------------ -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* Post-ordering of a supernodal elimination tree. */ #include "amd_internal.h" -GLOBAL Int AMD_post_tree +Int AMD_post_tree ( Int root, /* root of the tree */ Int k, /* start numbering at k */ @@ -41,7 +41,7 @@ GLOBAL Int AMD_post_tree /* recursive version (Stack [ ] is not used): */ /* --------------------------------------------------------------------- */ - /* this is simple, but can caouse stack overflow if nn is large */ + /* this is simple, but can cause stack overflow if nn is large */ i = root ; for (f = Child [i] ; f != EMPTY ; f = Sibling [f]) { diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_postorder.c b/ThirdParty/SuiteSparse/AMD/Source/amd_postorder.c index e5aea7b7b9..7abe2ff08b 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_postorder.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_postorder.c @@ -1,18 +1,18 @@ -/* ========================================================================= */ -/* === AMD_postorder ======================================================= */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_postorder: post-order the assembly tree from AMD +//------------------------------------------------------------------------------ -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* Perform a postordering (via depth-first search) of an assembly tree. */ #include "amd_internal.h" -GLOBAL void AMD_postorder +void AMD_postorder ( /* inputs, not modified on output: */ Int nn, /* nodes are in the range 0..nn-1 */ diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_preprocess.c b/ThirdParty/SuiteSparse/AMD/Source/amd_preprocess.c index a8139c300c..0480765072 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_preprocess.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_preprocess.c @@ -1,12 +1,12 @@ -/* ========================================================================= */ -/* === AMD_preprocess ====================================================== */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_preprocess: sort, remove duplicates, transpose a matrix +//------------------------------------------------------------------------------ -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* Sorts, removes duplicate entries, and transposes from the nonzero pattern of * a column-form matrix A, to obtain the matrix R. The input matrix can have @@ -18,15 +18,11 @@ #include "amd_internal.h" -/* ========================================================================= */ -/* === AMD_preprocess ====================================================== */ -/* ========================================================================= */ - /* AMD_preprocess does not check its input for errors or allocate workspace. * On input, the condition (AMD_valid (n,n,Ap,Ai) != AMD_INVALID) must hold. */ -GLOBAL void AMD_preprocess +void AMD_preprocess ( Int n, /* input matrix: A is n-by-n */ const Int Ap [ ], /* size n+1 */ diff --git a/ThirdParty/SuiteSparse/AMD/Source/amd_valid.c b/ThirdParty/SuiteSparse/AMD/Source/amd_valid.c index 609abcaa4d..03c5c320be 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amd_valid.c +++ b/ThirdParty/SuiteSparse/AMD/Source/amd_valid.c @@ -1,12 +1,12 @@ -/* ========================================================================= */ -/* === AMD_valid =========================================================== */ -/* ========================================================================= */ +//------------------------------------------------------------------------------ +// AMD/Source/amd_valid: check if a matrix is valid for AMD +//------------------------------------------------------------------------------ -/* ------------------------------------------------------------------------- */ -/* AMD, Copyright (c) Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ +// AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and +// Iain S. Duff. All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* Check if a column-form matrix is valid or not. The matrix A is * n_row-by-n_col. The row indices of entries in column j are in @@ -35,7 +35,7 @@ #include "amd_internal.h" -GLOBAL Int AMD_valid +int AMD_valid ( /* inputs, not modified on output: */ Int n_row, /* A is n_row-by-n_col */ @@ -44,7 +44,8 @@ GLOBAL Int AMD_valid const Int Ai [ ] /* row indices of A, of size nz = Ap [n_col] */ ) { - Int nz, j, p1, p2, ilast, i, p, result = AMD_OK ; + Int nz, j, p1, p2, ilast, i, p ; + int result = AMD_OK ; if (n_row < 0 || n_col < 0 || Ap == NULL || Ai == NULL) { diff --git a/ThirdParty/SuiteSparse/AMD/Source/amdbar.f b/ThirdParty/SuiteSparse/AMD/Source/amdbar.f index 13843928ba..45b829743f 100644 --- a/ThirdParty/SuiteSparse/AMD/Source/amdbar.f +++ b/ThirdParty/SuiteSparse/AMD/Source/amdbar.f @@ -1,5 +1,11 @@ C----------------------------------------------------------------------- -C AMDBAR: approximate minimum degree, without aggressive absorption +C AMD/Source/amdbar.f: Fortran version of AMD, no aggress absorption +C----------------------------------------------------------------------- + +C AMD, Copyright (c) 1996-2022, Timothy A. Davis, Patrick R. Amestoy, +C and C Iain S. Duff. All Rights Reserved. +C SPDX-License-Identifier: BSD-3-clause + C----------------------------------------------------------------------- SUBROUTINE AMDBAR diff --git a/ThirdParty/SuiteSparse/AMD/build/.gitignore b/ThirdParty/SuiteSparse/AMD/build/.gitignore new file mode 100644 index 0000000000..52e15321b7 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/build/.gitignore @@ -0,0 +1,4 @@ +# Ignore all files except this file. +* +*/ +!.gitignore diff --git a/ThirdParty/SuiteSparse/AMD/cmake_modules/FindAMD.cmake b/ThirdParty/SuiteSparse/AMD/cmake_modules/FindAMD.cmake new file mode 100644 index 0000000000..1b135e05a7 --- /dev/null +++ b/ThirdParty/SuiteSparse/AMD/cmake_modules/FindAMD.cmake @@ -0,0 +1,129 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/AMD/cmake_modules/FindAMD.cmake +#------------------------------------------------------------------------------- + +# The following copyright and license applies to just this file only, not to +# the library itself: +# FindAMD.cmake, Copyright (c) 2022-2023, Timothy A. Davis. All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# Finds the AMD include file and compiled library and sets: + +# AMD_INCLUDE_DIR - where to find amd.h +# AMD_LIBRARY - dynamic AMD library +# AMD_STATIC - static AMD library +# AMD_LIBRARIES - libraries when using AMD +# AMD_FOUND - true if AMD found + +# set ``AMD_ROOT`` to an AMD installation root to +# tell this module where to look. + +# All the Find*.cmake files in SuiteSparse are installed by 'make install' into +# /usr/local/lib/cmake/SuiteSparse (where '/usr/local' is the +# ${CMAKE_INSTALL_PREFIX}). To access this file, place the following commands +# in your CMakeLists.txt file. See also SuiteSparse/Example/CMakeLists.txt: +# +# set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} +# ${CMAKE_INSTALL_PREFIX}/lib/cmake/SuiteSparse ) + +#------------------------------------------------------------------------------- + +# include files for AMD +find_path ( AMD_INCLUDE_DIR + NAMES amd.h + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/AMD + HINTS ${CMAKE_SOURCE_DIR}/../AMD + PATH_SUFFIXES include Include +) + +# dynamic AMD library (or static if no dynamic library was built) +find_library ( AMD_LIBRARY + NAMES amd amd_static + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/AMD + HINTS ${CMAKE_SOURCE_DIR}/../AMD + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( MSVC ) + set ( STATIC_NAME amd_static ) +else ( ) + set ( STATIC_NAME amd ) + set ( save ${CMAKE_FIND_LIBRARY_SUFFIXES} ) + set ( CMAKE_FIND_LIBRARY_SUFFIXES + ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES} ) +endif ( ) + +# static AMD library +find_library ( AMD_STATIC + NAMES ${STATIC_NAME} + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/AMD + HINTS ${CMAKE_SOURCE_DIR}/../AMD + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( NOT MSVC ) + # restore the CMAKE_FIND_LIBRARY_SUFFIXES variable + set ( CMAKE_FIND_LIBRARY_SUFFIXES ${save} ) +endif ( ) + +# get version of the library from the dynamic library name +get_filename_component ( AMD_LIBRARY ${AMD_LIBRARY} REALPATH ) +get_filename_component ( AMD_FILENAME ${AMD_LIBRARY} NAME ) +string ( + REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" + AMD_VERSION + ${AMD_FILENAME} +) + +# set ( AMD_VERSION "" ) +if ( EXISTS "${AMD_INCLUDE_DIR}" AND NOT AMD_VERSION ) + # if the version does not appear in the filename, read the include file + file ( STRINGS ${AMD_INCLUDE_DIR}/amd.h AMD_MAJOR_STR + REGEX "define AMD_MAIN_VERSION" ) + file ( STRINGS ${AMD_INCLUDE_DIR}/amd.h AMD_MINOR_STR + REGEX "define AMD_SUB_VERSION" ) + file ( STRINGS ${AMD_INCLUDE_DIR}/amd.h AMD_PATCH_STR + REGEX "define AMD_SUBSUB_VERSION" ) + message ( STATUS "major: ${AMD_MAJOR_STR}" ) + message ( STATUS "minor: ${AMD_MINOR_STR}" ) + message ( STATUS "patch: ${AMD_PATCH_STR}" ) + string ( REGEX MATCH "[0-9]+" AMD_MAJOR ${AMD_MAJOR_STR} ) + string ( REGEX MATCH "[0-9]+" AMD_MINOR ${AMD_MINOR_STR} ) + string ( REGEX MATCH "[0-9]+" AMD_PATCH ${AMD_PATCH_STR} ) + set (AMD_VERSION "${AMD_MAJOR}.${AMD_MINOR}.${AMD_PATCH}") +endif ( ) + +set ( AMD_LIBRARIES ${AMD_LIBRARY} ) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args ( AMD + REQUIRED_VARS AMD_LIBRARY AMD_INCLUDE_DIR + VERSION_VAR AMD_VERSION +) + +mark_as_advanced ( + AMD_INCLUDE_DIR + AMD_LIBRARY + AMD_STATIC + AMD_LIBRARIES +) + +if ( AMD_FOUND ) + message ( STATUS "AMD version: ${AMD_VERSION}" ) + message ( STATUS "AMD include: ${AMD_INCLUDE_DIR}") + message ( STATUS "AMD library: ${AMD_LIBRARY}") + message ( STATUS "AMD static: ${AMD_STATIC}") +else ( ) + message ( STATUS "AMD not found" ) + set ( AMD_INCLUDE_DIR "" ) + set ( AMD_LIBRARIES "" ) + set ( AMD_LIBRARY "" ) + set ( AMD_STATIC "" ) +endif ( ) + diff --git a/ThirdParty/SuiteSparse/BTF/CMakeLists.txt b/ThirdParty/SuiteSparse/BTF/CMakeLists.txt new file mode 100644 index 0000000000..ce4ecf45a9 --- /dev/null +++ b/ThirdParty/SuiteSparse/BTF/CMakeLists.txt @@ -0,0 +1,136 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/BTF/CMakeLists.txt: cmake for BTF +#------------------------------------------------------------------------------- + +# BTF, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +# Author: Timothy A. Davis. +# SPDX-License-Identifier: LGPL-2.1+ + +#------------------------------------------------------------------------------- +# get the version +#------------------------------------------------------------------------------- + +cmake_minimum_required ( VERSION 3.19 ) + +set ( BTF_DATE "Jan 17, 2023" ) +set ( BTF_VERSION_MAJOR 2 ) +set ( BTF_VERSION_MINOR 0 ) +set ( BTF_VERSION_SUB 3 ) + +message ( STATUS "Building BTF version: v" + ${BTF_VERSION_MAJOR}. + ${BTF_VERSION_MINOR}. + ${BTF_VERSION_SUB} " (" ${BTF_DATE} ")" ) + +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${CMAKE_SOURCE_DIR}/cmake_modules + ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( btf + VERSION "${BTF_VERSION_MAJOR}.${BTF_VERSION_MINOR}.${BTF_VERSION_SUB}" + LANGUAGES C ) + +#------------------------------------------------------------------------------- +# find library dependencies +#------------------------------------------------------------------------------- + +find_package ( SuiteSparse_config 7.0.0 REQUIRED ) + +#------------------------------------------------------------------------------- +# configure files +#------------------------------------------------------------------------------- + +configure_file ( "Config/btf.h.in" "${PROJECT_SOURCE_DIR}/Include/btf.h" + NEWLINE_STYLE LF ) + +#------------------------------------------------------------------------------- +# include directories +#------------------------------------------------------------------------------- + +include_directories ( Source Include ${SUITESPARSE_CONFIG_INCLUDE_DIR} ) + +#------------------------------------------------------------------------------- +# dynamic btf library properties +#------------------------------------------------------------------------------- + +file ( GLOB BTF_SOURCES "Source/*.c" ) + +add_library ( btf SHARED ${BTF_SOURCES} ) + +set_target_properties ( btf PROPERTIES + VERSION ${BTF_VERSION_MAJOR}.${BTF_VERSION_MINOR}.${BTF_VERSION_SUB} + C_STANDARD_REQUIRED 11 + SOVERSION ${BTF_VERSION_MAJOR} + PUBLIC_HEADER "Include/btf.h" + WINDOWS_EXPORT_ALL_SYMBOLS ON) + +#------------------------------------------------------------------------------- +# static btf library properties +#------------------------------------------------------------------------------- + +if ( NOT NSTATIC ) + add_library ( btf_static STATIC ${BTF_SOURCES} ) + + set_target_properties ( btf_static PROPERTIES + VERSION ${BTF_VERSION_MAJOR}.${BTF_VERSION_MINOR}.${BTF_VERSION_SUB} + C_STANDARD_REQUIRED 11 + OUTPUT_NAME btf + SOVERSION ${BTF_VERSION_MAJOR} ) + + if ( MSVC ) + set_target_properties ( btf_static PROPERTIES + OUTPUT_NAME btf_static ) + endif ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# add the library dependencies +#------------------------------------------------------------------------------- + +# suitesparseconfig: +target_link_libraries ( btf PUBLIC ${SUITESPARSE_CONFIG_LIBRARIES} ) +if ( NOT NSTATIC ) + target_link_libraries ( btf_static PUBLIC ${SUITESPARSE_CONFIG_STATIC} ) +endif ( ) + +# libm: +if ( NOT WIN32 ) + target_link_libraries ( btf PUBLIC m ) + if ( NOT NSTATIC ) + target_link_libraries ( btf_static PUBLIC m ) + endif ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# BTF installation location +#------------------------------------------------------------------------------- + +install ( TARGETS btf + LIBRARY DESTINATION ${SUITESPARSE_LIBDIR} + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} + RUNTIME DESTINATION ${SUITESPARSE_BINDIR} + PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} ) +install ( FILES ${CMAKE_SOURCE_DIR}/cmake_modules/FindBTF.cmake + DESTINATION ${SUITESPARSE_LIBDIR}/cmake/SuiteSparse + COMPONENT Development ) +if ( NOT NSTATIC ) + install ( TARGETS btf_static + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} ) +endif ( ) + +#------------------------------------------------------------------------------- +# report status +#------------------------------------------------------------------------------- + +include ( SuiteSparseReport ) + diff --git a/ThirdParty/SuiteSparse/include/btf.h b/ThirdParty/SuiteSparse/BTF/Config/btf.h.in similarity index 80% rename from ThirdParty/SuiteSparse/include/btf.h rename to ThirdParty/SuiteSparse/BTF/Config/btf.h.in index c36de946a1..01fda8fd8d 100644 --- a/ThirdParty/SuiteSparse/include/btf.h +++ b/ThirdParty/SuiteSparse/BTF/Config/btf.h.in @@ -1,17 +1,19 @@ -/* ========================================================================== */ -/* === BTF package ========================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// BTF/Include/btf.h: include file for BTF +//------------------------------------------------------------------------------ + +// BTF, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Author: Timothy A. Davis. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* BTF_MAXTRANS: find a column permutation Q to give A*Q a zero-free diagonal * BTF_STRONGCOMP: find a symmetric permutation P to put P*A*P' into block * upper triangular form. * BTF_ORDER: do both of the above (btf_maxtrans then btf_strongcomp). - * - * By Tim Davis. Copyright (c) 2004-2007, University of Florida. - * with support from Sandia National Laboratories. All Rights Reserved. */ - /* ========================================================================== */ /* === BTF_MAXTRANS ========================================================= */ /* ========================================================================== */ @@ -95,13 +97,13 @@ extern "C" { #include "SuiteSparse_config.h" -int btf_maxtrans /* returns # of columns matched */ +int32_t btf_maxtrans /* returns # of columns matched */ ( /* --- input, not modified: --- */ - int nrow, /* A is nrow-by-ncol in compressed column form */ - int ncol, - int Ap [ ], /* size ncol+1 */ - int Ai [ ], /* size nz = Ap [ncol] */ + int32_t nrow, /* A is nrow-by-ncol in compressed column form */ + int32_t ncol, + int32_t Ap [ ], /* size ncol+1 */ + int32_t Ai [ ], /* size nz = Ap [ncol] */ double maxwork, /* maximum amount of work to do is maxwork*nnz(A); no limit * if <= 0 */ @@ -110,17 +112,17 @@ int btf_maxtrans /* returns # of columns matched */ * reached the maximum of maxwork*nnz(A). * Otherwise, work = the total work performed. */ - int Match [ ], /* size nrow. Match [i] = j if column j matched to row i + int32_t Match [ ], /* size nrow. Match [i] = j if column j matched to row i * (see above for the singular-matrix case) */ /* --- workspace, not defined on input or output --- */ - int Work [ ] /* size 5*ncol */ + int32_t Work [ ] /* size 5*ncol */ ) ; -/* long integer version (all "int" parameters become "SuiteSparse_long") */ -SuiteSparse_long btf_l_maxtrans (SuiteSparse_long, SuiteSparse_long, - SuiteSparse_long *, SuiteSparse_long *, double, double *, - SuiteSparse_long *, SuiteSparse_long *) ; +/* int64_t integer version */ +int64_t btf_l_maxtrans (int64_t, int64_t, + int64_t *, int64_t *, double, double *, + int64_t *, int64_t *) ; /* ========================================================================== */ @@ -145,29 +147,29 @@ SuiteSparse_long btf_l_maxtrans (SuiteSparse_long, SuiteSparse_long, * number of strongly connected components found. */ -int btf_strongcomp /* return # of strongly connected components */ +int32_t btf_strongcomp /* return # of strongly connected components */ ( /* input, not modified: */ - int n, /* A is n-by-n in compressed column form */ - int Ap [ ], /* size n+1 */ - int Ai [ ], /* size nz = Ap [n] */ + int32_t n, /* A is n-by-n in compressed column form */ + int32_t Ap [ ], /* size n+1 */ + int32_t Ai [ ], /* size nz = Ap [n] */ /* optional input, modified (if present) on output: */ - int Q [ ], /* size n, input column permutation */ + int32_t Q [ ], /* size n, input column permutation */ /* output, not defined on input */ - int P [ ], /* size n. P [k] = j if row and column j are kth row/col + int32_t P [ ], /* size n. P [k] = j if row and column j are kth row/col * in permuted matrix. */ - int R [ ], /* size n+1. block b is in rows/cols R[b] ... R[b+1]-1 */ + int32_t R [ ], /* size n+1. block b is in rows/cols R[b] ... R[b+1]-1 */ /* workspace, not defined on input or output */ - int Work [ ] /* size 4n */ + int32_t Work [ ] /* size 4n */ ) ; -SuiteSparse_long btf_l_strongcomp (SuiteSparse_long, SuiteSparse_long *, - SuiteSparse_long *, SuiteSparse_long *, SuiteSparse_long *, - SuiteSparse_long *, SuiteSparse_long *) ; +int64_t btf_l_strongcomp (int64_t, int64_t *, + int64_t *, int64_t *, int64_t *, + int64_t *, int64_t *) ; /* ========================================================================== */ @@ -193,30 +195,28 @@ SuiteSparse_long btf_l_strongcomp (SuiteSparse_long, SuiteSparse_long *, * number of strongly connected components found. */ -int btf_order /* returns number of blocks found */ +int32_t btf_order /* returns number of blocks found */ ( /* --- input, not modified: --- */ - int n, /* A is n-by-n in compressed column form */ - int Ap [ ], /* size n+1 */ - int Ai [ ], /* size nz = Ap [n] */ + int32_t n, /* A is n-by-n in compressed column form */ + int32_t Ap [ ], /* size n+1 */ + int32_t Ai [ ], /* size nz = Ap [n] */ double maxwork, /* do at most maxwork*nnz(A) work in the maximum * transversal; no limit if <= 0 */ /* --- output, not defined on input --- */ double *work, /* return value from btf_maxtrans */ - int P [ ], /* size n, row permutation */ - int Q [ ], /* size n, column permutation */ - int R [ ], /* size n+1. block b is in rows/cols R[b] ... R[b+1]-1 */ - int *nmatch, /* # nonzeros on diagonal of P*A*Q */ + int32_t P [ ], /* size n, row permutation */ + int32_t Q [ ], /* size n, column permutation */ + int32_t R [ ], /* size n+1. block b is in rows/cols R[b] ... R[b+1]-1 */ + int32_t *nmatch, /* # nonzeros on diagonal of P*A*Q */ /* --- workspace, not defined on input or output --- */ - int Work [ ] /* size 5n */ + int32_t Work [ ] /* size 5n */ ) ; -SuiteSparse_long btf_l_order (SuiteSparse_long, SuiteSparse_long *, - SuiteSparse_long *, double , double *, SuiteSparse_long *, - SuiteSparse_long *, SuiteSparse_long *, SuiteSparse_long *, - SuiteSparse_long *) ; +int64_t btf_l_order (int64_t, int64_t *, int64_t *, double , double *, + int64_t *, int64_t *, int64_t *, int64_t *, int64_t *) ; /* ========================================================================== */ @@ -254,11 +254,12 @@ SuiteSparse_long btf_l_order (SuiteSparse_long, SuiteSparse_long *, * #endif */ -#define BTF_DATE "May 4, 2016" +#define BTF_DATE "@BTF_DATE@" +#define BTF_MAIN_VERSION @BTF_VERSION_MAJOR@ +#define BTF_SUB_VERSION @BTF_VERSION_MINOR@ +#define BTF_SUBSUB_VERSION @BTF_VERSION_SUB@ + #define BTF_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) -#define BTF_MAIN_VERSION 1 -#define BTF_SUB_VERSION 2 -#define BTF_SUBSUB_VERSION 6 #define BTF_VERSION BTF_VERSION_CODE(BTF_MAIN_VERSION,BTF_SUB_VERSION) #ifdef __cplusplus diff --git a/ThirdParty/SuiteSparse/BTF/Doc/ChangeLog b/ThirdParty/SuiteSparse/BTF/Doc/ChangeLog index f454b151e6..d984d8a694 100644 --- a/ThirdParty/SuiteSparse/BTF/Doc/ChangeLog +++ b/ThirdParty/SuiteSparse/BTF/Doc/ChangeLog @@ -1,3 +1,17 @@ +Jan 17, 2023: version 2.0.3 + + * SuiteSparse_config: now v7.0.0 + +Dec 9, 2022: version 2.0.2 + + * minor changes to build system + +Nov 12, 2022: version 2.0.0 + + * using CMake build system + * integers: int (32-bit) and SuiteSparse_long (nominally 64-bit) replaced + with int32_t and int64_t. + May 4, 2016: version 1.2.6 * minor changes to Makefile diff --git a/ThirdParty/SuiteSparse/BTF/Include/btf.h b/ThirdParty/SuiteSparse/BTF/Include/btf.h index c36de946a1..58cb94d7e3 100644 --- a/ThirdParty/SuiteSparse/BTF/Include/btf.h +++ b/ThirdParty/SuiteSparse/BTF/Include/btf.h @@ -1,17 +1,19 @@ -/* ========================================================================== */ -/* === BTF package ========================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// BTF/Include/btf.h: include file for BTF +//------------------------------------------------------------------------------ + +// BTF, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Author: Timothy A. Davis. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* BTF_MAXTRANS: find a column permutation Q to give A*Q a zero-free diagonal * BTF_STRONGCOMP: find a symmetric permutation P to put P*A*P' into block * upper triangular form. * BTF_ORDER: do both of the above (btf_maxtrans then btf_strongcomp). - * - * By Tim Davis. Copyright (c) 2004-2007, University of Florida. - * with support from Sandia National Laboratories. All Rights Reserved. */ - /* ========================================================================== */ /* === BTF_MAXTRANS ========================================================= */ /* ========================================================================== */ @@ -95,13 +97,13 @@ extern "C" { #include "SuiteSparse_config.h" -int btf_maxtrans /* returns # of columns matched */ +int32_t btf_maxtrans /* returns # of columns matched */ ( /* --- input, not modified: --- */ - int nrow, /* A is nrow-by-ncol in compressed column form */ - int ncol, - int Ap [ ], /* size ncol+1 */ - int Ai [ ], /* size nz = Ap [ncol] */ + int32_t nrow, /* A is nrow-by-ncol in compressed column form */ + int32_t ncol, + int32_t Ap [ ], /* size ncol+1 */ + int32_t Ai [ ], /* size nz = Ap [ncol] */ double maxwork, /* maximum amount of work to do is maxwork*nnz(A); no limit * if <= 0 */ @@ -110,17 +112,17 @@ int btf_maxtrans /* returns # of columns matched */ * reached the maximum of maxwork*nnz(A). * Otherwise, work = the total work performed. */ - int Match [ ], /* size nrow. Match [i] = j if column j matched to row i + int32_t Match [ ], /* size nrow. Match [i] = j if column j matched to row i * (see above for the singular-matrix case) */ /* --- workspace, not defined on input or output --- */ - int Work [ ] /* size 5*ncol */ + int32_t Work [ ] /* size 5*ncol */ ) ; -/* long integer version (all "int" parameters become "SuiteSparse_long") */ -SuiteSparse_long btf_l_maxtrans (SuiteSparse_long, SuiteSparse_long, - SuiteSparse_long *, SuiteSparse_long *, double, double *, - SuiteSparse_long *, SuiteSparse_long *) ; +/* int64_t integer version */ +int64_t btf_l_maxtrans (int64_t, int64_t, + int64_t *, int64_t *, double, double *, + int64_t *, int64_t *) ; /* ========================================================================== */ @@ -145,29 +147,29 @@ SuiteSparse_long btf_l_maxtrans (SuiteSparse_long, SuiteSparse_long, * number of strongly connected components found. */ -int btf_strongcomp /* return # of strongly connected components */ +int32_t btf_strongcomp /* return # of strongly connected components */ ( /* input, not modified: */ - int n, /* A is n-by-n in compressed column form */ - int Ap [ ], /* size n+1 */ - int Ai [ ], /* size nz = Ap [n] */ + int32_t n, /* A is n-by-n in compressed column form */ + int32_t Ap [ ], /* size n+1 */ + int32_t Ai [ ], /* size nz = Ap [n] */ /* optional input, modified (if present) on output: */ - int Q [ ], /* size n, input column permutation */ + int32_t Q [ ], /* size n, input column permutation */ /* output, not defined on input */ - int P [ ], /* size n. P [k] = j if row and column j are kth row/col + int32_t P [ ], /* size n. P [k] = j if row and column j are kth row/col * in permuted matrix. */ - int R [ ], /* size n+1. block b is in rows/cols R[b] ... R[b+1]-1 */ + int32_t R [ ], /* size n+1. block b is in rows/cols R[b] ... R[b+1]-1 */ /* workspace, not defined on input or output */ - int Work [ ] /* size 4n */ + int32_t Work [ ] /* size 4n */ ) ; -SuiteSparse_long btf_l_strongcomp (SuiteSparse_long, SuiteSparse_long *, - SuiteSparse_long *, SuiteSparse_long *, SuiteSparse_long *, - SuiteSparse_long *, SuiteSparse_long *) ; +int64_t btf_l_strongcomp (int64_t, int64_t *, + int64_t *, int64_t *, int64_t *, + int64_t *, int64_t *) ; /* ========================================================================== */ @@ -193,30 +195,28 @@ SuiteSparse_long btf_l_strongcomp (SuiteSparse_long, SuiteSparse_long *, * number of strongly connected components found. */ -int btf_order /* returns number of blocks found */ +int32_t btf_order /* returns number of blocks found */ ( /* --- input, not modified: --- */ - int n, /* A is n-by-n in compressed column form */ - int Ap [ ], /* size n+1 */ - int Ai [ ], /* size nz = Ap [n] */ + int32_t n, /* A is n-by-n in compressed column form */ + int32_t Ap [ ], /* size n+1 */ + int32_t Ai [ ], /* size nz = Ap [n] */ double maxwork, /* do at most maxwork*nnz(A) work in the maximum * transversal; no limit if <= 0 */ /* --- output, not defined on input --- */ double *work, /* return value from btf_maxtrans */ - int P [ ], /* size n, row permutation */ - int Q [ ], /* size n, column permutation */ - int R [ ], /* size n+1. block b is in rows/cols R[b] ... R[b+1]-1 */ - int *nmatch, /* # nonzeros on diagonal of P*A*Q */ + int32_t P [ ], /* size n, row permutation */ + int32_t Q [ ], /* size n, column permutation */ + int32_t R [ ], /* size n+1. block b is in rows/cols R[b] ... R[b+1]-1 */ + int32_t *nmatch, /* # nonzeros on diagonal of P*A*Q */ /* --- workspace, not defined on input or output --- */ - int Work [ ] /* size 5n */ + int32_t Work [ ] /* size 5n */ ) ; -SuiteSparse_long btf_l_order (SuiteSparse_long, SuiteSparse_long *, - SuiteSparse_long *, double , double *, SuiteSparse_long *, - SuiteSparse_long *, SuiteSparse_long *, SuiteSparse_long *, - SuiteSparse_long *) ; +int64_t btf_l_order (int64_t, int64_t *, int64_t *, double , double *, + int64_t *, int64_t *, int64_t *, int64_t *, int64_t *) ; /* ========================================================================== */ @@ -254,11 +254,12 @@ SuiteSparse_long btf_l_order (SuiteSparse_long, SuiteSparse_long *, * #endif */ -#define BTF_DATE "May 4, 2016" +#define BTF_DATE "Jan 17, 2023" +#define BTF_MAIN_VERSION 2 +#define BTF_SUB_VERSION 0 +#define BTF_SUBSUB_VERSION 3 + #define BTF_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) -#define BTF_MAIN_VERSION 1 -#define BTF_SUB_VERSION 2 -#define BTF_SUBSUB_VERSION 6 #define BTF_VERSION BTF_VERSION_CODE(BTF_MAIN_VERSION,BTF_SUB_VERSION) #ifdef __cplusplus diff --git a/ThirdParty/SuiteSparse/BTF/Include/btf_internal.h b/ThirdParty/SuiteSparse/BTF/Include/btf_internal.h index fc0426dd63..15b1b04452 100644 --- a/ThirdParty/SuiteSparse/BTF/Include/btf_internal.h +++ b/ThirdParty/SuiteSparse/BTF/Include/btf_internal.h @@ -1,23 +1,24 @@ -/* ========================================================================== */ -/* === btf_internal include file ============================================ */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// BTF/Include/btf_internsl.h: internal include file for BTF +//------------------------------------------------------------------------------ + +// BTF, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Author: Timothy A. Davis. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ #ifndef _BTF_INTERNAL_H #define _BTF_INTERNAL_H -/* - * By Tim Davis. Copyright (c) 2004-2007, University of Florida. - * with support from Sandia National Laboratories. All Rights Reserved. - */ - /* Not to be included in any user program. */ #ifdef DLONG -#define Int SuiteSparse_long -#define Int_id SuiteSparse_long_id +#define Int int64_t +#define Int_id "%" PRId64 #define BTF(name) btf_l_ ## name #else -#define Int int +#define Int int32_t #define Int_id "%d" #define BTF(name) btf_ ## name #endif diff --git a/ThirdParty/SuiteSparse/BTF/Lib/Makefile b/ThirdParty/SuiteSparse/BTF/Lib/Makefile deleted file mode 100644 index 85b7a26465..0000000000 --- a/ThirdParty/SuiteSparse/BTF/Lib/Makefile +++ /dev/null @@ -1,99 +0,0 @@ -#------------------------------------------------------------------------------- -# BTF Lib/Makefile -#------------------------------------------------------------------------------- - -LIBRARY = libbtf -VERSION = 1.2.6 -SO_VERSION = 1 - -default: library - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -# BTF depends on SuiteSparse_config -LDLIBS += -lsuitesparseconfig - -ccode: all - -# compile and install in SuiteSparse/lib -library: - $(MAKE) install INSTALL=$(SUITESPARSE) - -# for testing only: -# TEST = -DTESTING - -C = $(CC) $(CF) - -INC = ../Include/btf.h ../Include/btf_internal.h - -I = -I../Include -I../../SuiteSparse_config - -all: library - -OBJ = btf_order.o btf_maxtrans.o btf_strongcomp.o \ - btf_l_order.o btf_l_maxtrans.o btf_l_strongcomp.o - -static: $(AR_TARGET) - -$(AR_TARGET): $(OBJ) - $(ARCHIVE) $@ $^ - - $(RANLIB) $@ - -$(OBJ): $(INC) - -#------------------------------------------------------------------------------- - -btf_order.o: ../Source/btf_order.c - $(C) -c $(I) $< -o $@ - -btf_maxtrans.o: ../Source/btf_maxtrans.c - $(C) -c $(I) $< -o $@ - -btf_strongcomp.o: ../Source/btf_strongcomp.c - $(C) -c $(I) $< -o $@ - -#------------------------------------------------------------------------------- - -btf_l_order.o: ../Source/btf_order.c - $(C) -c $(I) -DDLONG $< -o $@ - -btf_l_maxtrans.o: ../Source/btf_maxtrans.c - $(C) -c $(I) -DDLONG $< -o $@ - -btf_l_strongcomp.o: ../Source/btf_strongcomp.c - $(C) -c $(I) -DDLONG $< -o $@ - -#------------------------------------------------------------------------------- - -# install BTF -install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET) - -$(INSTALL_LIB)/$(SO_TARGET): $(OBJ) - @mkdir -p $(INSTALL_LIB) - @mkdir -p $(INSTALL_INCLUDE) - @mkdir -p $(INSTALL_DOC) - $(CC) $(SO_OPTS) $^ -o $@ $(LDLIBS) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) ) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) ) - $(CP) ../Include/btf.h $(INSTALL_INCLUDE) - $(CP) ../README.txt $(INSTALL_DOC)/BTF_README.txt - chmod 755 $(INSTALL_LIB)/$(SO_TARGET) - chmod 644 $(INSTALL_INCLUDE)/btf.h - chmod 644 $(INSTALL_DOC)/BTF_README.txt - -uninstall: - $(RM) $(INSTALL_LIB)/$(SO_TARGET) - $(RM) $(INSTALL_LIB)/$(SO_PLAIN) - $(RM) $(INSTALL_LIB)/$(SO_MAIN) - $(RM) $(INSTALL_INCLUDE)/btf.h - $(RM) $(INSTALL_DOC)/BTF_README.txt - -#------------------------------------------------------------------------------- - -purge: distclean - -distclean: clean - - $(RM) -r $(PURGE) - -clean: - - $(RM) -r $(CLEAN) diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/Contents.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Contents.m deleted file mode 100644 index bc535b049e..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/Contents.m +++ /dev/null @@ -1,20 +0,0 @@ -% BTF ordering toolbox: -% -% Primary functions: -% -% btf - permute a square sparse matrix into upper block triangular form -% maxtrans - permute the columns of a sparse matrix so it has a zero-free diagonal -% strongcomp - symmetric permutation to upper block triangular form -% -% Other: -% btf_install - compile and install BTF for use in MATLAB. -% btf_demo - demo for BTF -% drawbtf - plot the BTF form of a matrix -% btf_make - compile BTF for use in MATLAB -% -% Example: -% q = maxtrans (A) -% [p,q,r] = btf (A) -% [p,r] = strongcomp (A) - -% Copyright 2004-2007, University of Florida diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/btf_test.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/btf_test.m deleted file mode 100644 index c0ede02b7c..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/btf_test.m +++ /dev/null @@ -1,19 +0,0 @@ -function btf_test (nmat) -%BTF_TEST test for BTF -% Requires CSparse (or CXSparse) and UFget -% Example: -% btf_test -% See also btf, maxtrans, strongcomp, dmperm, UFget, -% test1, test2, test3, test4, test5, test6. - -if (nargin < 1) - nmat = 200 ; -end - -test1 (nmat) ; -test2 (nmat) ; -test3 (nmat) ; -test4 (nmat) ; -test5 (nmat) ; -test6 ; - diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/checkbtf.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/checkbtf.m deleted file mode 100644 index 1ba99dfd75..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/checkbtf.m +++ /dev/null @@ -1,46 +0,0 @@ -function checkbtf (A, p, q, r) -%CHECKBTF ensure A(p,q) is in BTF form -% -% A(p,q) is in BTF form, r the block boundaries -% -% Example: -% [p,q,r] = dmperm (A) -% checkbtf (A, p, q, r) -% -% See also drawbtf, maxtrans, strongcomp. - -% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com - -[m n] = size (A) ; -if (m ~= n) - error ('A must be square') ; -end - -if (any (sort (p) ~= 1:n)) - error ('p not a permutation') ; -end - -if (any (sort (q) ~= 1:n)) - error ('q not a permutation') ; -end - -nblocks = length (r) - 1 ; - -if (r (1) ~= 1) - error ('r(1) not one') ; -end - -if (r (end) ~= n+1) - error ('r(end) not n+1') ; -end - -if (nblocks < 1 | nblocks > n) %#ok - error ('nblocks wrong') ; -end - -nblocks = length (r) - 1 ; -rdiff = r (2:(nblocks+1)) - r (1:nblocks) ; -if (any (rdiff < 1) | any (rdiff > n)) %#ok - error ('r bad') -end - diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test1.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test1.m deleted file mode 100644 index e97d178596..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test1.m +++ /dev/null @@ -1,141 +0,0 @@ -function test1 (nmat) -%TEST1 test for BTF -% Requires CSparse and UFget -% Example: -% test1 -% See also btf, maxtrans, strongcomp, dmperm, UFget, -% test1, test2, test3, test4, test5. - -% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com - -index = UFget ; -% f = find (index.sprank < min (index.nrows, index.ncols)) ; -f = 1:length (index.nrows) ; - -% too much time: -skip = [1514 1297 1876 1301] ; - -f = setdiff (f, skip) ; - -[ignore i] = sort (index.nnz (f)) ; -f = f (i) ; - -if (nargin < 1) - nmat = 1000 ; -end -nmat = min (nmat, length (f)) ; -f = f (1:nmat) ; - -T0 = zeros (nmat,1) ; -T1 = zeros (nmat,1) ; -Anz = zeros (nmat,1) ; -MN = zeros (nmat, 2) ; -Nzdiag = zeros (nmat,1) ; -clf - -% warmup -p = maxtrans (sparse (1)) ; %#ok -p = cs_dmperm (sparse (1)) ; %#ok -a = cs_transpose (sparse (1)) ; %#ok - -h = waitbar (0, 'BTF test 1 of 6') ; - -try - - for k = 1:nmat - - Prob = UFget (f (k), index) ; - A = Prob.A ; - clear Prob - t = 0 ; - - waitbar (k/nmat, h) ; - - r = full (sum (spones (A), 2)) ; - c = full (sum (spones (A))) ; - m2 = length (find (r > 0)) ; - n2 = length (find (c > 0)) ; - - if (m2 < n2) - tic - A = cs_transpose (A) ; - t = toc ; - end - - Nzdiag (k) = nnz (diag (A)) ; - - [m n] = size (A) ; - Anz (k) = nnz (A) ; - MN (k,:) = [m n] ; - - tic - q = maxtrans (A) ; - t0 = toc ; - s0 = sum (q > 0) ; - T0 (k) = max (1e-9, t0) ; - - tic - p = cs_dmperm (A) ; - t1 = toc ; - s1 = sum (p > 0) ; - T1 (k) = max (1e-9, t1) ; - - fprintf (... - '%4d maxtrans %10.6f %10.6f cs_dmperm %10.6f m/n %8.2f', ... - f(k), t, t0, t1, m/n) ; - if (t1 ~= 0) - fprintf (' rel: %8.4f', t0 / t1) ; - end - fprintf ('\n') ; - if (s0 ~= s1) - error ('!') ; - end - - if (s0 == n & m == n) %#ok - B = A (:, q) ; - subplot (2,2,1) ; - cspy (B) ; - if (nnz (diag (B)) ~= n) - error ('?') - end - clear B - else - cspy (0) ; - end - - maxnz = nnz (A) ; - - zfree = find (MN (1:k,1) == MN (1:k,2) & Nzdiag (1:k) == MN(1:k,1)) ; - square = find (MN (1:k,1) == MN (1:k,2) & Nzdiag (1:k) ~= MN(1:k,1)) ; - tall = find (MN (1:k,1) > MN (1:k,2)) ; - squat = find (MN (1:k,1) < MN (1:k,2)) ; - - subplot (2,2,2) ; - loglog (Anz (square), T0 (square) ./ T1 (square), ... - 'o', [1 maxnz], [1 1], 'r-') ; - title ('square') ; - subplot (2,2,3) ; - loglog (Anz (tall), T0 (tall) ./ T1 (tall), ... - 'o', [1 maxnz], [1 1], 'r-') ; - title ('tall') ; - subplot (2,2,4) ; - title ('square, intially zero-free') ; - loglog (Anz (zfree), T0 (zfree) ./ T1 (zfree), ... - 'o', [1 maxnz], [1 1], 'r-') ; - title ('square, zero-free diag') ; - - drawnow - - end - -catch - % out-of-memory is OK, other errors are not - disp (lasterr) ; - if (isempty (strfind (lasterr, 'Out of memory'))) - error (lasterr) ; %#ok - else - fprintf ('test terminated early, but otherwise OK\n') ; - end -end - -close (h) ; diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test2.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test2.m deleted file mode 100644 index 20e1ad68c8..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test2.m +++ /dev/null @@ -1,108 +0,0 @@ -function test2 (nmat) -%TEST2 test for BTF -% Requires CSparse and UFget -% Example: -% test2 -% See also btf, maxtrans, strongcomp, dmperm, UFget, -% test1, test2, test3, test4, test5. - -% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com - -index = UFget ; -f = find (index.nrows == index.ncols) ; - -% too much time: -skip = [1514 1297 1876 1301] ; -f = setdiff (f, skip) ; - -[ignore i] = sort (index.nnz (f)) ; -f = f (i) ; - -if (nargin < 1) - nmat = 1000 ; -end -nmat = min (nmat, length (f)) ; -f = f (1:nmat) ; - -T0 = zeros (nmat,1) ; -T1 = zeros (nmat,1) ; -Anz = zeros (nmat,1) ; -MN = zeros (nmat, 2) ; -Nzdiag = zeros (nmat,1) ; -clf - -% warmup -p = maxtrans (sparse (1)) ; %#ok -p = btf (sparse (1)) ; %#ok -p = cs_dmperm (sparse (1)) ; %#ok -a = cs_transpose (sparse (1)) ; %#ok - -h = waitbar (0, 'BTF test 2 of 6') ; - -try - for k = 1:nmat - - Prob = UFget (f (k), index) ; - A = Prob.A ; - - waitbar (k/nmat, h) ; - - Nzdiag (k) = nnz (diag (A)) ; - - [m n] = size (A) ; - Anz (k) = nnz (A) ; - MN (k,:) = [m n] ; - - tic - [p,q,r] = btf (A) ; - t0 = toc ; - s0 = sum (q > 0) ; - T0 (k) = max (1e-9, t0) ; - - tic - [p2,q2,r2] = cs_dmperm (A) ; - t1 = toc ; - s1 = sum (dmperm (A) > 0) ; - T1 (k) = max (1e-9, t1) ; - - fprintf ('%4d btf %10.6f cs_dmperm %10.6f', f(k), t0, t1) ; - if (t1 ~= 0) - fprintf (' rel: %8.4f', t0 / t1) ; - end - fprintf ('\n') ; - - if (s0 ~= s1) - error ('!') ; - end - - C = A (p, abs (q)) ; - subplot (1,2,1) ; - cspy (C) ; - z = find (q < 0) ; - zd = nnz (diag (C (z,z))) ; - if (zd > 0) - error ('?') ; - end - - minnz = Anz (1) ; - maxnz = nnz (A) ; - - subplot (1,2,2) ; - loglog (Anz (1:k), T0 (1:k) ./ T1 (1:k), ... - 'o', [minnz maxnz], [1 1], 'r-') ; - drawnow - - clear C A Prob - end - -catch - % out-of-memory is OK, other errors are not - disp (lasterr) ; - if (isempty (strfind (lasterr, 'Out of memory'))) - error (lasterr) ; %#ok - else - fprintf ('test terminated early, but otherwise OK\n') ; - end -end - -close (h) ; diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test3.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test3.m deleted file mode 100644 index 408033aabf..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test3.m +++ /dev/null @@ -1,527 +0,0 @@ -function test3 (nmat) -%TEST3 test for BTF -% Requires UFget -% Example: -% test3 -% See also btf, maxtrans, strongcomp, dmperm, UFget, -% test1, test2, test3, test4, test5. - -% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com - -doplot = 1 ; -dopause = 0 ; -dostrong = 1 ; - -index = UFget ; -f = find (index.nrows == index.ncols) ; -[ignore i] = sort (index.nnz (f)) ; -f = f (i) ; -clear i - -% short test set: seg faults, lots of blocks, lots of work, and so on: -nasty = [ - % --- various test matrices (no seg fault, quick run time) - -(1:8)' % generated matrices - 904 % vanHeukelum/cage3 (5-by-5) - 819 % Simon/raefsky6 (permuted triangular matrix) - % - % --- older seg faults: - 264 % HB/west0156, causes older strongcomp_recursive to fail - 824 % TOKAMAK/utm300 (300-by-300), causes older code to fail - 868 % Pothen/bodyy4 - % - % --- seg faults in old MATLAB dmperm - 290 % Averous/epb3 - 983 % Sanghavi/ecl32 - 885 % Pothen/tandem_dual - 879 % Pothen/onera_dual - 955 % Schenk_IBMSDS/2D_54019_highK - 957 % Schenk_IBMSDS/3D_51448_3D - 958 % Schenk_IBMSDS/ibm_matrix_2 - 912 % vanHeukelum/cage11 - 924 % Andrews/Andrews - 960 % Schenk_IBMSDS/matrix-new_3 - 862 % Kim/kim1 - 544 % Hamm/scircuit - 897 % Norris/torso2 - 801 % Ronis/xenon1 - 53 % HB/bcsstk31 - 958 % Schenk_IBMSDS/matrix_9 - 844 % Cunningham/qa8fk - 845 % Cunningham/qa8fk - 821 % Simon/venkat25 - 822 % Simon/venkat50 - 820 % Simon/venkat01 - 812 % Simon/bbmat - 804 % Rothberg/cfd1 - 54 % HB/bcsstk32 - 913 % vanHeukelum/cage12 - 846 % Boeing/bcsstk39 - 972 % Schenk_IBMSDS/para-10 - 974 % Schenk_IBMSDS/para-5 - 975 % Schenk_IBMSDS/para-6 - 976 % Schenk_IBMSDS/para-7 - 977 % Schenk_IBMSDS/para-8 - 978 % Schenk_IBMSDS/para-9 - 961 % Schenk_ISEI/barrier2-10 - 962 % Schenk_ISEI/barrier2-11 - 963 % Schenk_ISEI/barrier2-12 - 964 % Schenk_ISEI/barrier2-1 - 965 % Schenk_ISEI/barrier2-2 - 966 % Schenk_ISEI/barrier2-3 - 967 % Schenk_ISEI/barrier2-4 - 968 % Schenk_ISEI/barrier2-9 - 851 % Chen/pkustk05 - 979 % Kamvar/Stanford - 374 % Bova/rma10 - % - % --- lots of time: - 395 % DRIVCAV/cavity16 - 396 % DRIVCAV/cavity17 - 397 % DRIVCAV/cavity18 - 398 % DRIVCAV/cavity19 - 399 % DRIVCAV/cavity20 - 400 % DRIVCAV/cavity21 - 401 % DRIVCAV/cavity22 - 402 % DRIVCAV/cavity23 - 403 % DRIVCAV/cavity24 - 404 % DRIVCAV/cavity25 - 405 % DRIVCAV/cavity26 - 1109 % Sandia/mult_dcop_01 - 1110 % Sandia/mult_dcop_02 - 1111 % Sandia/mult_dcop_03 - 376 % Brethour/coater2 - 284 % ATandT/onetone2 - 588 % Hollinger/mark3jac100 - 589 % Hollinger/mark3jac100sc - 452 % Grund/bayer01 - 920 % Hohn/sinc12 - 590 % Hollinger/mark3jac120 - 591 % Hollinger/mark3jac120sc - 809 % Shyy/shyy161 - 448 % Graham/graham1 - 283 % ATandT/onetone1 - 445 % Garon/garon2 - 541 % Hamm/bcircuit - 592 % Hollinger/mark3jac140 - 593 % Hollinger/mark3jac140sc - 435 % FIDAP/ex40 - 912 % Hohn/sinc15 - 894 % Norris/lung2 - 542 % Hamm/hcircuit - 752 % Mulvey/finan512 - 753 % Mulvey/pfinan512 - 564 % Hollinger/g7jac180 - 565 % Hollinger/g7jac180sc - 566 % Hollinger/g7jac200 - 567 % Hollinger/g7jac200sc - 748 % Mallya/lhr34 - 749 % Mallya/lhr34c - 922 % Hohn/sinc18 - 447 % Goodwin/rim - 807 % Rothberg/struct3 - 286 % ATandT/twotone - 982 % Tromble/language - 953 % Schenk_IBMNA/c-73 - 890 % Norris/heart1 - 750 % Mallya/lhr71 - 751 % Mallya/lhr71c - 925 % FEMLAB/ns3Da - 827 % Vavasis/av41092 - 931 % FEMLAB/sme3Db - 1297 % GHS_index/boyd2 - 1301 % GHS_indef/cont-300 - % - % --- lots of time, and seg faults: - 285 % ATandT/pre2 - % --- huge matrix, turn off plotting - 940 % Shenk/af_shell1, memory leak in plot, after call to btf, once. - % ---- -]' ; - -% maxtrans_recursive causes a seg fault on these matrices, because of -% stack overflow (this is expected) -skip_list_maxtrans_recursive = 285 ; - -% p = dmperm (A) in MATLAB 7.4 causes a seg fault on these matrices: -skip_list_dmperm = [285 1301 1231 1251 1232 1241] ; - -% [p,q,r] = dmperm (A) in MATLAB 7.4 causes a seg fault on these matrices: -skip_list_dmperm_btf = ... -[ 285 879 885 290 955 957 958 924 960 897 959 844 845 ... - 821 822 820 804 913 846 972 974:978 961:968 979 940 ... - 1422 1513 1412 1510 1301 1231 1251 1434 1213 1232 1241 1357 1579 1431 1281] ; -% length(skip_list_dmperm_btf) - -% time intensive -skip_costly = [1514 1297 1876 1301] ; - -% strongcomp (recursive) causes a seg fault on these matrices because of -% stack overflow (this is expected). -skip_list_strongcomp_recursive = ... -[983 285 879 885 290 955 957 958 912 924 960 862 544 897 801 53 959 844 845 ... - 821 822 820 812 804 54 913 846 972 974:978 961:968 851 374 940] ; -skip_list_strongcomp_recursive = ... -[ skip_list_strongcomp_recursive 592 593 752 753 807 286 982 855 566 567 ] ; - -% matrices with the largest # of nonzeros in the set (untested) -toobig = [ -928 853 852 356 761 368 973 895 805 849 932 ... -803 854 936 802 850 537 856 898 857 859 971 937 ... -914 858 980 896 806 538 863 369 938 860 941 942 ... -943 944 945 946 947 948 915 939 916 ] ; - -f = [ -(1:8) f ] ; -% f = nasty ; - -h = waitbar (0, 'BTF test 3 of 6') ; - -if (nargin < 1) - nmat = 1000 ; -end -nmat = min (nmat, length (f)) ; -f = f (1:nmat) ; - -try - - for matnum = 1:nmat - - waitbar (matnum/nmat, h) ; - - j = f (matnum) ; - - if (any (j == toobig) | any (j == skip_costly)) %#ok - fprintf ('\n%4d: %3d %s/%s too big\n', ... - matnum, j, index.Group{j}, index.Name{j}) ; - continue ; - end - - rand ('state', 0) ; - - % clear all unused variables. - % nothing here is left that is proportional to the matrix size - clear A p1 p2 p3 q3 r3 match1 match2 match4 pa ra sa qa B C pb rb pc rc - clear jumble B11 B12 B13 B21 B22 B23 B31 B32 B33 pjumble qjumble ans - clear c kbad kgood - % whos - % pause - - if (j > 0) - Problem = UFget (j, index) ; - name = Problem.name ; - A = Problem.A ; - clear Problem - else - % construct the jth test matrix - j = -j ; - if (j == 1 | j == 2) %#ok - B11 = UFget ('Grund/b1_ss') ; % 7-by-7 diagonal block - B11 = B11.A ; - B12 = sparse (zeros (7,2)) ; - B12 (3,2) = 1 ; - B13 = sparse (ones (7,5)) ; - B21 = sparse (zeros (2,7)) ; - B22 = sparse (ones (2,2)) ; % 2-by-2 diagonal block - B23 = sparse (ones (2,5)) ; - B31 = sparse (zeros (5,7)) ; - B32 = sparse (zeros (5,2)) ; - B33 = UFget ('vanHeukelum/cage3') ; % 5-by-5 diagonal block - B33 = B33.A ; - A = [ B11 B12 B13 ; B21 B22 B23 ; B31 B32 B33 ] ; - name = '(j=1 test matrix)' ; - end - if (j == 2) - pjumble = [ 10 7 11 1 13 12 8 2 5 14 9 6 4 3 ] ; - qjumble = [ 3 14 2 11 1 8 5 7 10 12 4 13 9 6 ] ; - A = A (pjumble, qjumble) ; - name = '(j=2 test matrix)' ; - elseif (j == 3) - A = sparse (1) ; - elseif (j == 4) - A = sparse (0) ; - elseif (j == 5) - A = sparse (ones (2)) ; - elseif (j == 6) - A = sparse (2,2) ; - elseif (j == 7) - A = speye (2) ; - elseif (j == 8) - A = sparse (2,2) ; - A (2,1) = 1 ; - end - if (j > 2) - full (A) - end - end - - [m n] = size (A) ; - if (m ~= n) - continue ; - end - fprintf ('\n%4d: ', matnum) ; - fprintf (' =========================== Matrix: %3d %s\n', j, name) ; - fprintf ('n: %d nz: %d\n', n, nnz (A)) ; - - if (nnz (A) > 6e6) - doplot = 0 ; - end - - %----------------------------------------------------------------------- - % now try maxtrans - tic - match1 = maxtrans (A) ; - t = toc ; - s1 = sum (match1 > 0) ; - fprintf ('n-sprank: %d\n', n-s1) ; - fprintf ('maxtrans: %8.2f seconds\n', t) ; - singular = s1 < n ; - - if (doplot) - clf - subplot (2,4,1) - spy (A) - title (name) ; - end - - p1 = match1 ; - if (any (p1 <= 0)) - % complete the permutation - badrow = find (p1 <= 0) ; - - badcol = ones (1,n) ; - badcol (p1 (p1 > 0)) = 0 ; - badcol = find (badcol) ; - - p1 (badrow) = badcol ; - - % construct the older form of match1 - match1 (badrow) = -p1 (badrow) ; - end - if (any (sort (p1) ~= 1:n)) - error ('!!') ; - end - - B = A (:,p1) ; - - if (doplot) - subplot (2,4,2) - hold off - spy (B) - hold on - badcol = find (match1 < 0) ; - Junk = sparse (badcol, badcol, ones (length (badcol), 1), n, n) ; - % if (~isempty (A)) - % spy (Junk, 'ro') ; - % end - title ('maxtrans') ; - end - - d = nnz (diag (B)) ; - if (d ~= s1) - error ('bad sprank') ; - end - clear B - - %----------------------------------------------------------------------- - % try p = dmperm(A) - skip_dmperm = any (j == skip_list_dmperm) ; - - if (~skip_dmperm) - tic - match4 = dmperm (A) ; - t = toc ; - fprintf ('p=dmperm(A): %8.2f seconds\n', t) ; - s4 = sum (match4 > 0) ; - singular4 = (s4 < n) ; - - if (doplot) - if (~singular4) - subplot (2,4,3) - spy (A (match4,:)) - title ('dmperm') ; - end - end - if (singular ~= singular4) - error ('s4?') ; - end - if (s1 ~= s4) - error ('bad sprank') ; - end - else - fprintf ('p=dmperm(A): skip\n') ; - end - - %----------------------------------------------------------------------- - nblocks = -1 ; - skip_dmperm_btf = any (j == skip_list_dmperm_btf) ; - if (~skip_dmperm_btf) - % get btf form - tic - [pa,qa,ra,sa] = dmperm (A) ; - t = toc ; - fprintf ('[p,q,r,s]=dmperm(A): %8.2f seconds\n', t) ; - nblocks = length (ra) - 1 ; - fprintf ('nblocks: %d\n', nblocks) ; - if (~singular4) - checkbtf (A, pa, qa, ra) ; - if (doplot) - subplot (2,4,4) - drawbtf (A, pa, qa, ra) - title ('dmperm blocks') - end - end - else - fprintf ('[p,q,r,s]=dmperm(A): skip\n') ; - end - - jumble = randperm (n) ; - - %----------------------------------------------------------------------- - % try strongcomp, non-recursive version - - %------------------------------------------------------------------- - % try strongcomp on original matrix - B = A (:,p1) ; - tic ; - [pb,rb] = strongcomp (B) ; - t = toc ; - fprintf ('strongcomp %8.2f seconds\n', t) ; - if (~singular & ~skip_dmperm_btf & (length (rb) ~= nblocks+1)) %#ok - error ('BTF:invalid (rb)') ; - end - checkbtf (B, pb, pb, rb) ; - if (doplot) - subplot (2,4,5) - drawbtf (B, pb, pb, rb) ; - title ('strongcomp') ; - end - - %------------------------------------------------------------------- - % try btf on original matrix - tic ; - [pw,qw,rw] = btf (A) ; - t = toc ; - fprintf ('btf %8.2f seconds nblocks %d\n', ... - t, length (rw)-1) ; - - if (any (pw ~= pb)) - error ('pw') ; - end - if (any (rw ~= rb)) - error ('rw') ; - end - if (any (abs (qw) ~= p1 (pw))) - error ('qw') ; - end - c = diag (A (pw,abs (qw))) ; - if (~singular & ~skip_dmperm_btf & (length (rw) ~= nblocks+1)) %#ok - error ('BTF:invalid (rw)') ; - end - checkbtf (A, pw, abs (qw), rw) ; - - kbad = find (qw < 0) ; - kgood = find (qw > 0) ; - if (any (c (kbad) ~= 0)) - error ('kbad') ; - end - if (any (c (kgood) == 0)) %#ok - error ('kgood') ; - end - - if (doplot) - subplot (2,4,6) - drawbtf (A, pw, abs (qw), rw) ; - if (n < 500) - for k = kbad - plot ([k (k+1) (k+1) k k]-.5, ... - [k k (k+1) (k+1) k]-.5, 'r') ; - end - end - title ('btf') ; - end - - %------------------------------------------------------------------- - % try [p,q,r] = strongcomp (A, qin) form - tic - [pz,qz,rz] = strongcomp (A, match1) ; - t = toc ; - fprintf ('[p,q,r]=strongcomp(A,qin)%8.2f seconds\n', t) ; - if (any (pz ~= pb)) - error ('pz') ; - end - if (any (rz ~= rb)) - error ('rz') ; - end - if (any (abs (qz) ~= p1 (pz))) - error ('qz') ; - end - c = diag (A (pz,abs (qz))) ; - if (~singular & ~skip_dmperm_btf & (length (rz) ~= nblocks+1)) %#ok - error ('BTF:invalid (rz)') ; - end - checkbtf (A, pz, abs (qz), rz) ; - - kbad = find (qz < 0) ; - kgood = find (qz > 0) ; - if (any (c (kbad) ~= 0)) - error ('kbad') ; - end - if (any (c (kgood) == 0)) %#ok - error ('kgood') ; - end - - if (doplot) - subplot (2,4,7) - drawbtf (A, pz, abs (qz), rz) ; - if (n < 500) - for k = kbad - plot ([k (k+1) (k+1) k k]-.5, ... - [k k (k+1) (k+1) k]-.5, 'r') ; - end - end - title ('strongcomp(A,qin)') ; - end - - %------------------------------------------------------------------- - % try strongcomp again, on a randomly jumbled matrix - C = sparse (B (jumble, jumble)) ; - tic ; - [pc,rc] = strongcomp (C) ; - t = toc ; - fprintf ('strongcomp (rand) %8.2f seconds\n', t) ; - if (~singular & ~skip_dmperm_btf & (length (rc) ~= nblocks+1)) %#ok - error ('BTF:invalid (rc)') ; - end - checkbtf (C, pc, pc, rc) ; - if (doplot) - subplot (2,4,8) - drawbtf (C, pc, pc, rc) ; - title ('strongcomp(rand)') ; - end - - if (length (rc) ~= length (rb)) - error ('strongcomp random mismatch') ; - end - - %----------------------------------------------------------------------- - if (doplot) - drawnow - end - - if (matnum ~= nmat & dopause) %#ok - input ('Hit enter: ') ; - end - - end - -catch - % out-of-memory is OK, other errors are not - disp (lasterr) ; - if (isempty (strfind (lasterr, 'Out of memory'))) - error (lasterr) ; %#ok - else - fprintf ('test terminated early, but otherwise OK\n') ; - end -end - -close (h) ; diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test4.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test4.m deleted file mode 100644 index c67273ad53..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test4.m +++ /dev/null @@ -1,86 +0,0 @@ -function test4 (nmat) -%TEST4 test for BTF -% Requires UFget -% Example: -% test4 -% See also btf, maxtrans, strongcomp, dmperm, UFget, -% test1, test2, test3, test4, test5. - -% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com - -index = UFget ; -f = find (index.nrows == index.ncols) ; -[ignore i] = sort (index.nnz (f)) ; -f = f (i) ; - -% time intensive -skip_costly = [1514 1297 1876 1301] ; -f = setdiff (f, skip_costly) ; - -if (nargin < 1) - nmat = 1000 ; -end -nmat = min (nmat, length (f)) ; -f = f (1:nmat) ; - -h = waitbar (0, 'BTF test 4 of 6') ; - -try - for k = 1:nmat - - Prob = UFget (f (k), index) ; - A = Prob.A ; - - waitbar (k/nmat, h) ; - - for tr = [1 -1] - - if (tr == -1) - AT = A' ; - [m n] = size (A) ; - if (m == n) - if (nnz (spones (AT) - spones (A)) == 0) - fprintf ('skip transpose\n') ; - continue ; - end - end - A = AT ; - end - - tic - [p1,q1,r1,work1] = btf (A) ; - t1 = toc ; - n1 = length (r1) - 1 ; - - tic - [p2,q2,r2,work2] = btf (A, 10) ; - t2 = toc ; - n2 = length (r2) - 1 ; - - fprintf (... - '%4d %4d : %10.4f %8d %8g : %10.4f %8d %8g :', ... - k, f(k), t1, n1, work1, t2, n2, work2) ; - if (t2 ~= 0) - fprintf (' rel %8.4f %8.4f' , t1 / t2, n2 / (max (1, n1))) ; - end - fprintf ('\n') ; - - if (n1 ~= n2 | work1 ~= work2) %#ok - disp (Prob) ; - fprintf ('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n') ; - end - - end - end - -catch - % out-of-memory is OK, other errors are not - disp (lasterr) ; - if (isempty (strfind (lasterr, 'Out of memory'))) - error (lasterr) ; %#ok - else - fprintf ('test terminated early, but otherwise OK\n') ; - end -end - -close (h) ; diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test5.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test5.m deleted file mode 100644 index 0118ed4235..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test5.m +++ /dev/null @@ -1,86 +0,0 @@ -function test5 (nmat) -%TEST5 test for BTF -% Requires UFget -% Example: -% test5 -% See also btf, maxtrans, strongcomp, dmperm, UFget, -% test1, test2, test3, test4, test5. - -% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com - -index = UFget ; - -[ignore f] = sort (index.nnz) ; - -% time intensive -skip_costly = [1514 1297 1876 1301] ; -f = setdiff (f, skip_costly) ; - -if (nargin < 1) - nmat = 1000 ; -end -nmat = min (nmat, length (f)) ; -f = f (1:nmat) ; - -h = waitbar (0, 'BTF test 5 of 6') ; - -try - for k = 1:nmat - - i = f(k) ; - Prob = UFget (i, index) ; - A = Prob.A ; - - waitbar (k/nmat, h) ; - - for tr = [1 -1] - - if (tr == -1) - AT = A' ; - [m n] = size (A) ; - if (m == n) - if (nnz (spones (AT) - spones (A)) == 0) - fprintf ('skip test with transpose\n') ; - continue ; - end - end - A = AT ; - end - - tic - q1 = maxtrans (A) ; - t1 = toc ; - r1 = sum (q1 > 0) ; - - tic - q2 = maxtrans (A, 10) ; - t2 = toc ; - r2 = sum (q2 > 0) ; - - fprintf (... - '%4d %4d : %10.4f %8d : %10.4f %8d', k, f(k), t1, r1, t2, r2) ; - fprintf (' rel sprank %8.4f', r2 / (max (1, r1))) ; - if (t2 ~= 0) - fprintf (': rel time %8.4f', t1 / t2) ; - end - fprintf ('\n') ; - - if (r1 ~= r2) - disp (Prob) ; - fprintf ('^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n') ; - end - - end - end - -catch - % out-of-memory is OK, other errors are not - disp (lasterr) ; - if (isempty (strfind (lasterr, 'Out of memory'))) - error (lasterr) ; %#ok - else - fprintf ('test terminated early, but otherwise OK\n') ; - end -end - -close (h) ; diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test6.m b/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test6.m deleted file mode 100644 index 0a643ec775..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/Test/test6.m +++ /dev/null @@ -1,138 +0,0 @@ -function test6 -%TEST6 test for BTF -% Requires UFget -% Example: -% test6 -% See also btf, maxtrans, strongcomp, dmperm, UFget, -% test1, test2, test3, test4, test5. - -% Copyright 2007, Timothy A. Davis, http://www.suitesparse.com - -quick2 = [ ... - 1522 -272 1463 1521 460 1507 -838 1533 -1533 -1456 -1512 734 211 ... - -385 -735 394 -397 1109 -744 ... - -734 -375 -1200 -1536 -837 519 -519 520 -520 189 -189 454 385 ... - 387 -387 384 -384 386 -386 388 -388 525 -525 526 -526 735 ... - 1508 209 210 1243 -1243 1534 -840 1234 -1234 390 -390 392 -392 ... - -394 1472 1242 -1242 389 -389 391 -391 393 -393 1215 -1215 1216 ... --1216 736 -736 737 -737 455 -455 -224 -839 1426 -1426 -1473 396 ... - -396 398 -398 400 -400 402 -402 404 -404 -1531 395 -395 397 ... - 399 -399 401 -401 403 -403 405 -405 -738 -739 1459 -1459 1111 ... - 1110 376 -376 284 -284 -740 -742 -741 -743 1293 -1293 452 920 ... - -745 -446 1462 -1461 448 -448 283 -283 1502 -1502 1292 -1292 1503 ... --1503 1291 -1291 445 -445 -746 -747 1300 -1300 435 -435 -1343 -1345 ... --1344 1305 -1305 921 -1513 1307 -1307 1369 -1369 1374 -1374 1377 ... --1377 748 -748 -749 1510 922 -922 ] ; - -index = UFget ; -nmat = length (quick2) ; -dopause = 0 ; - -h = waitbar (0, 'BTF test 6 of 6') ; - -try - - for k = 1:nmat - - waitbar (k/nmat, h) ; - - i = quick2 (k) ; - Prob = UFget (abs (i), index) ; - disp (Prob) ; - if (i < 0) - fprintf ('transposed\n') ; - A = Prob.A' ; - [m n] = size (A) ; - if (m == n) - if (nnz (spones (A) - spones (Prob.A)) == 0) - fprintf ('skip...\n') ; - continue ; - end - end - else - A = Prob.A ; - end - - tic - [p1,q1,r1,work1] = btf (A) ; - t1 = toc ; - n1 = length (r1) - 1 ; - m1 = nnz (diag (A (p1, abs (q1)))) ; - - limit = work1/nnz(A) ; - - fprintf ('full search: %g * nnz(A)\n', limit) ; - - works = linspace(0,limit,9) ; - works (1) = eps ; - nw = length (works) ; - - T2 = zeros (nw, 1) ; - N2 = zeros (nw, 1) ; - M2 = zeros (nw, 1) ; - - T2 (end) = t1 ; - N2 (end) = n1 ; - M2 (end) = m1 ; - - fprintf ('full time %10.4f blocks %8d nnz(diag) %8d\n\n', t1, n1, m1) ; - - subplot (3,4,4) ; - drawbtf (A, p1, abs (q1), r1) ; - title (Prob.name, 'Interpreter', 'none') ; - - for j = 1:nw-1 - - maxwork = works (j) ; - - tic - [p2,q2,r2,work2] = btf (A, maxwork) ; - t2 = toc ; - n2 = length (r2) - 1 ; - m2 = nnz (diag (A (p2, abs (q2)))) ; - T2 (j) = t2 ; - N2 (j) = n2 ; - M2 (j) = m2 ; - - fprintf ('%9.1f %10.4f blocks %8d nnz(diag) %8d\n', ... - maxwork, t2, n2, m2) ; - - subplot (3,4,4+j) ; - drawbtf (A, p2, abs (q2), r2) ; - title (sprintf ('%g', maxwork)) ; - - ss = [1:j nw] ; - - subplot (3,4,1) ; - plot (works(ss), T2(ss), 'o-') ; title ('time vs work') ; - axis ([0 limit 0 max(0.1,max(T2))]) ; - - subplot (3,4,2) ; - plot (works(ss), N2(ss), 'o-') ; title ('blocks vs work') ; - axis ([0 limit 0 n1]) ; - - subplot (3,4,3) ; - plot (works(ss), M2(ss), 'o-') ; title ('nnz(diag) vs work') ; - axis ([0 limit 0 m1]) ; - drawnow - - end - fprintf ('full time %10.4f blocks %8d nnz(diag) %8d\n', t1, n1, m1) ; - - if (dopause) - input ('hit enter: ') ; - end - - end - -catch - % out-of-memory is OK, other errors are not - disp (lasterr) ; - if (isempty (strfind (lasterr, 'Out of memory'))) - error (lasterr) ; %#ok - else - fprintf ('test terminated early, but otherwise OK\n') ; - end -end - -close (h) ; diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/btf.c b/ThirdParty/SuiteSparse/BTF/MATLAB/btf.c deleted file mode 100644 index 45dcf75d88..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/btf.c +++ /dev/null @@ -1,145 +0,0 @@ -/* ========================================================================== */ -/* === btf mexFunction ====================================================== */ -/* ========================================================================== */ - -/* BTF: Permute a square matrix to upper block triangular form with a zero-free - * diagonal, or with a maximum number of nonzeros along the diagonal if a - * zero-free permutation does not exist. - * - * Usage: - * - * [p,q,r] = btf (A) ; - * [p,q,r] = btf (A, maxwork) ; - * - * If the matrix has structural full rank, this is essentially identical to - * - * [p,q,r] = dmperm (A) - * - * except that p, q, and r will differ in trivial ways. Both return an upper - * block triangular form with a zero-free diagonal, if the matrix is - * structurally non-singular. The number and sizes of the blocks will be - * identical, but the order of the blocks, and the ordering within the blocks, - * can be different. - * - * If the matrix is structurally singular, q will contain negative entries. - * The permuted matrix is C = A(p,abs(q)), and find(q<0) gives a list of - * indices of the diagonal of C that are equal to zero. This differs from - * dmperm, which does not place the maximum matching along the main diagonal - * of C=A(p,q), but places it above the diagonal instead. - * - * See maxtrans, or btf.m, for a description of maxwork. - * - * An optional fourth output [p,q,r,work] = btf (...) returns the amount of - * work performed, or -1 if the maximum work limit is reached (in which case - * the maximum matching might not have been found). - * - * By Tim Davis. Copyright (c) 2004-2007, University of Florida. - * with support from Sandia National Laboratories. All Rights Reserved. - * - * See also maxtrans, strongcomp, dmperm - */ - -/* ========================================================================== */ - -#include "mex.h" -#include "btf.h" -#define Long SuiteSparse_long - -void mexFunction -( - int nargout, - mxArray *pargout [ ], - int nargin, - const mxArray *pargin [ ] -) -{ - double work, maxwork ; - Long b, n, k, *Ap, *Ai, *P, *R, nblocks, *Work, *Q, nmatch ; - double *Px, *Rx, *Qx, *w ; - - /* ---------------------------------------------------------------------- */ - /* get inputs and allocate workspace */ - /* ---------------------------------------------------------------------- */ - - if (nargin < 1 || nargin > 2 || nargout > 4) - { - mexErrMsgTxt ("Usage: [p,q,r] = btf (A)") ; - } - n = mxGetM (pargin [0]) ; - if (!mxIsSparse (pargin [0]) || n != mxGetN (pargin [0])) - { - mexErrMsgTxt ("btf: A must be sparse, square, and non-empty") ; - } - - /* get sparse matrix A */ - Ap = (Long *) mxGetJc (pargin [0]) ; - Ai = (Long *) mxGetIr (pargin [0]) ; - - /* get output arrays */ - Q = mxMalloc (n * sizeof (Long)) ; - P = mxMalloc (n * sizeof (Long)) ; - R = mxMalloc ((n+1) * sizeof (Long)) ; - - /* get workspace */ - Work = mxMalloc (5*n * sizeof (Long)) ; - - maxwork = 0 ; - if (nargin > 1) - { - maxwork = mxGetScalar (pargin [1]) ; - } - work = 0 ; - - /* ---------------------------------------------------------------------- */ - /* find the permutation to BTF */ - /* ---------------------------------------------------------------------- */ - - nblocks = btf_l_order (n, Ap, Ai, maxwork, &work, P, Q, R, &nmatch, Work) ; - - /* ---------------------------------------------------------------------- */ - /* create outputs and free workspace */ - /* ---------------------------------------------------------------------- */ - - /* create P */ - pargout [0] = mxCreateDoubleMatrix (1, n, mxREAL) ; - Px = mxGetPr (pargout [0]) ; - for (k = 0 ; k < n ; k++) - { - Px [k] = P [k] + 1 ; /* convert to 1-based */ - } - - /* create Q */ - if (nargout > 1) - { - pargout [1] = mxCreateDoubleMatrix (1, n, mxREAL) ; - Qx = mxGetPr (pargout [1]) ; - for (k = 0 ; k < n ; k++) - { - Qx [k] = Q [k] + 1 ; /* convert to 1-based */ - } - } - - /* create R */ - if (nargout > 2) - { - pargout [2] = mxCreateDoubleMatrix (1, nblocks+1, mxREAL) ; - Rx = mxGetPr (pargout [2]) ; - for (b = 0 ; b <= nblocks ; b++) - { - Rx [b] = R [b] + 1 ; /* convert to 1-based */ - } - } - - /* create work output */ - if (nargout > 3) - { - pargout [3] = mxCreateDoubleMatrix (1, 1, mxREAL) ; - w = mxGetPr (pargout [3]) ; - w [0] = work ; - } - - mxFree (P) ; - mxFree (R) ; - mxFree (Work) ; - mxFree (Q) ; -} diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/btf.m b/ThirdParty/SuiteSparse/BTF/MATLAB/btf.m deleted file mode 100644 index a4d1c11389..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/btf.m +++ /dev/null @@ -1,38 +0,0 @@ -function [p,q,r] = btf (A) %#ok -%BTF permute a square sparse matrix into upper block triangular form -% with a zero-free diagonal, or with a maximum number of nonzeros along the -% diagonal if a zero-free permutation does not exist. -% -% Example: -% [p,q,r] = btf (A) ; -% [p,q,r] = btf (A,maxwork) ; -% -% If the matrix has structural full rank, this is essentially identical to -% -% [p,q,r] = dmperm (A) -% -% except that p, q, and r will differ in trivial ways. Both return an upper -% block triangular form with a zero-free diagonal, if the matrix is -% structurally non-singular. The number and sizes of the blocks will be -% identical, but the order of the blocks, and the ordering within the blocks, -% can be different. -% -% If the matrix is structurally singular, the q from btf will contain negative -% entries. The permuted matrix is C = A(p,abs(q)), and find(q<0) gives a list -% of indices of the diagonal of C that are equal to zero. This differs from -% dmperm, which does not place the maximum matching along the main diagonal -% of C=A(p,q), but places it above the diagonal instead. -% -% The second input limits the maximum amount of work the function does to -% be maxwork*nnz(A), or no limit at all if maxwork <= 0. If the function -% terminates early as a result, a maximum matching may not be found, and the -% diagonal of A(p,abs(q)) might not have the maximum number of nonzeros -% possible. Also, the number of blocks (length(r)-1) may be larger than -% what btf(A) or dmperm(A) would compute. -% -% See also maxtrans, strongcomp, dmperm, sprank - -% Copyright 2004-2007, University of Florida -% with support from Sandia National Laboratories. All Rights Reserved. - -error ('btf mexFunction not found') ; diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/btf_demo.m b/ThirdParty/SuiteSparse/BTF/MATLAB/btf_demo.m deleted file mode 100644 index 6f0901dcf4..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/btf_demo.m +++ /dev/null @@ -1,47 +0,0 @@ -%BTF_DEMO demo for BTF -% -% Example: -% btf_demo -% -% See also btf, dmperm, strongcomp, maxtrans - -% Copyright 2004-2007, University of Florida - -load west0479 ; -A = west0479 ; - -clf - -subplot (2,3,1) ; -spy (A) -title ('west0479') ; - -subplot (2,3,2) ; -[p, q, r] = btf (A) ; -% spy (A (p, abs(q))) ; -drawbtf (A, p, q, r) ; -title ('btf') ; - -fprintf ('\nbtf_demo: n %d nnz(A) %d # of blocks %d\n', ... - size (A,1), nnz (A), length (r) - 1) ; - -subplot (2,3,3) ; -[p, q, r, s] = dmperm (A) ; -drawbtf (A, p, q, r) ; -title ('dmperm btf') - -subplot (2,3,4) ; -[p, r] = strongcomp (A) ; -% spy (A (p, abs(q))) ; -drawbtf (A, p, p, r) ; -title ('strongly conn. comp.') ; - -subplot (2,3,5) ; -q = maxtrans (A) ; -spy (A (:,q)) -title ('max transversal') ; - -subplot (2,3,6) ; -p = dmperm (A) ; -spy (A (p,:)) -title ('dmperm maxtrans') ; diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/btf_install.m b/ThirdParty/SuiteSparse/BTF/MATLAB/btf_install.m deleted file mode 100644 index d0b8b0fffe..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/btf_install.m +++ /dev/null @@ -1,17 +0,0 @@ -function btf_install -%BTF_INSTALL compile and install BTF for use in MATLAB. -% Your current working directory must be BTF/MATLAB for this function to work. -% -% Example: -% btf_install -% -% See also btf, maxtrans, stroncomp, dmperm. - -% Copyright 2004-2007, University of Florida - -btf_make -addpath (pwd) ; -fprintf ('BTF has been compiled and installed. The path:\n') ; -disp (pwd) ; -fprintf ('has been added to your path. Use pathtool to add it permanently.\n'); -btf_demo diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/btf_make.m b/ThirdParty/SuiteSparse/BTF/MATLAB/btf_make.m deleted file mode 100644 index a222bbb3ff..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/btf_make.m +++ /dev/null @@ -1,42 +0,0 @@ -function btf_make -%BTF_MAKE compile BTF for use in MATLAB -% Your current working directory must be BTF/MATLAB for this function to work. -% -% Example: -% btf_make -% -% See also btf, maxtrans, stroncomp, dmperm. - -% Copyright 2004-2007, University of Florida - -details = 0 ; % if 1, print details of each command - -mexcmd = 'mex -O -DDLONG -I../Include -I../../SuiteSparse_config ' ; -if (~isempty (strfind (computer, '64'))) - mexcmd = [mexcmd '-largeArrayDims '] ; -end - -% MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much -if (~verLessThan ('matlab', '8.3.0')) - mexcmd = [mexcmd ' -silent '] ; -end - -s = [mexcmd 'maxtrans.c ../Source/btf_maxtrans.c'] ; -if (details) - fprintf ('%s\n', s) ; -end -eval (s) ; - -s = [mexcmd 'strongcomp.c ../Source/btf_strongcomp.c'] ; -if (details) - fprintf ('%s\n', s) ; -end -eval (s) ; - -s = [mexcmd 'btf.c ../Source/btf_maxtrans.c ../Source/btf_strongcomp.c ../Source/btf_order.c'] ; -if (details) - fprintf ('%s\n', s) ; -end -eval (s) ; - -fprintf ('BTF successfully compiled.\n') ; diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/drawbtf.m b/ThirdParty/SuiteSparse/BTF/MATLAB/drawbtf.m deleted file mode 100644 index 96a7bc5247..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/drawbtf.m +++ /dev/null @@ -1,27 +0,0 @@ -function drawbtf (A, p, q, r) -%DRAWBTF plot the BTF form of a matrix -% -% A(p,q) is in BTF form, r the block boundaries -% -% Example: -% [p,q,r] = dmperm (A) -% drawbtf (A, p, q, r) -% -% See also btf, maxtrans, strongcomp, dmperm. - -% Copyright 2004-2007, University of Florida - -nblocks = length (r) - 1 ; - -hold off -spy (A (p,abs(q))) -hold on - -for k = 1:nblocks - k1 = r (k) ; - k2 = r (k+1) ; - nk = k2 - k1 ; - if (nk > 1) - plot ([k1 k2 k2 k1 k1]-.5, [k1 k1 k2 k2 k1]-.5, 'r') ; - end -end diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/maxtrans.c b/ThirdParty/SuiteSparse/BTF/MATLAB/maxtrans.c deleted file mode 100644 index 8219981d5b..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/maxtrans.c +++ /dev/null @@ -1,102 +0,0 @@ -/* ========================================================================== */ -/* === maxtrans mexFunction ================================================= */ -/* ========================================================================== */ - -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) - -/* MAXTRANS: Find a column permutation for a zero-free diagonal. - * - * Usage: - * - * q = maxtrans (A) ; - * q = maxtrans (A,maxwork) ; - * - * A (:,q) has a zero-free diagonal if sprank(A) == n. - * If the matrix is structurally singular, q will contain zeros. Similar - * to p = dmperm (A), except that dmperm returns a row permutation. - * - * An optional second output [q,work] = maxtrans (...) returns the amount of - * work performed, or -1 if the maximum work limit is reached (in which case - * the maximum matching might not have been found). - * - * By Tim Davis. Copyright (c) 2004-2007, University of Florida. - * with support from Sandia National Laboratories. All Rights Reserved. - */ - -/* ========================================================================== */ - -#include "mex.h" -#include "btf.h" -#define Long SuiteSparse_long - -void mexFunction -( - int nargout, - mxArray *pargout [ ], - int nargin, - const mxArray *pargin [ ] -) -{ - double maxwork, work ; - Long nrow, ncol, i, *Ap, *Ai, *Match, nmatch, *Work ; - double *Matchx, *w ; - - /* ---------------------------------------------------------------------- */ - /* get inputs and allocate workspace */ - /* ---------------------------------------------------------------------- */ - - if (nargin < 1 || nargin > 2 || nargout > 2) - { - mexErrMsgTxt ("Usage: q = maxtrans (A)") ; - } - nrow = mxGetM (pargin [0]) ; - ncol = mxGetN (pargin [0]) ; - if (!mxIsSparse (pargin [0])) - { - mexErrMsgTxt ("maxtrans: A must be sparse, and non-empty") ; - } - - /* get sparse matrix A */ - Ap = (Long *) mxGetJc (pargin [0]) ; - Ai = (Long *) mxGetIr (pargin [0]) ; - - /* get output array */ - Match = mxMalloc (nrow * sizeof (Long)) ; - - /* get workspace of size 5n (recursive version needs only 2n) */ - Work = mxMalloc (5*ncol * sizeof (Long)) ; - - maxwork = 0 ; - if (nargin > 1) - { - maxwork = mxGetScalar (pargin [1]) ; - } - work = 0 ; - - /* ---------------------------------------------------------------------- */ - /* perform the maximum transversal */ - /* ---------------------------------------------------------------------- */ - - nmatch = btf_l_maxtrans (nrow, ncol, Ap, Ai, maxwork, &work, Match, Work) ; - - /* ---------------------------------------------------------------------- */ - /* create outputs and free workspace */ - /* ---------------------------------------------------------------------- */ - - pargout [0] = mxCreateDoubleMatrix (1, nrow, mxREAL) ; - Matchx = mxGetPr (pargout [0]) ; - for (i = 0 ; i < nrow ; i++) - { - Matchx [i] = Match [i] + 1 ; /* convert to 1-based */ - } - - if (nargout > 1) - { - pargout [1] = mxCreateDoubleMatrix (1, 1, mxREAL) ; - w = mxGetPr (pargout [1]) ; - w [0] = work ; - } - - mxFree (Work) ; - mxFree (Match) ; -} diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/maxtrans.m b/ThirdParty/SuiteSparse/BTF/MATLAB/maxtrans.m deleted file mode 100644 index aba591a41e..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/maxtrans.m +++ /dev/null @@ -1,30 +0,0 @@ -function q = maxtrans (A) %#ok -%MAXTRANS permute the columns of a sparse matrix so it has a zero-free diagonal -% (if it exists). If no zero-free diagonal exists, then a maximum matching is -% found. Note that this differs from p=dmperm(A), which returns a row -% permutation. -% -% Example: -% q = maxtrans (A) -% q = maxtrans (A,maxwork) -% -% If row i and column j are matched, then q(i) = j. Otherwise, if row is -% unmatched, then q(i) = 0. This is similar to dmperm, except that -% p = dmperm(A) returns p(j)=i if row i and column j are matched, or p(j)=0 if -% column j is unmatched. -% -% If A is structurally nonsingular, then A(:,maxtrans(A)) has a zero-free -% diagonal, as does A (dmperm(A),:). -% -% The second input limits the maximum amount of work the function does -% (excluding the O(nnz(A)) cheap match phase) to be maxwork*nnz(A), or no limit -% at all if maxwork <= 0. If the function terminates early as a result, a -% maximum matching may not be found. An optional second output -% [q,work] = maxtrans (...) returns the amount of work performed, or -1 if the -% maximum work limit is reached. -% -% See also: btf, strongcomp, dmperm, sprank - -% Copyright 2004-2007, University of Florida - -error ('maxtrans mexfunction not found') ; diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/strongcomp.c b/ThirdParty/SuiteSparse/BTF/MATLAB/strongcomp.c deleted file mode 100644 index 0e15735801..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/strongcomp.c +++ /dev/null @@ -1,180 +0,0 @@ -/* ========================================================================== */ -/* === stongcomp mexFunction ================================================ */ -/* ========================================================================== */ - -/* STRONGCOMP: Find a symmetric permutation to upper block triangular form of - * a sparse square matrix. - * - * Usage: - * - * [p,r] = strongcomp (A) ; - * - * [p,q,r] = strongcomp (A,qin) ; - * - * In the first usage, the permuted matrix is C = A (p,p). In the second usage, - * the matrix A (:,qin) is symmetrically permuted to upper block triangular - * form, where qin is an input column permutation, and the final permuted - * matrix is C = A (p,q). This second usage is equivalent to - * - * [p,r] = strongcomp (A (:,qin)) ; - * q = qin (p) ; - * - * That is, if qin is not present it is assumed to be qin = 1:n. - * - * C is the permuted matrix, with a number of blocks equal to length(r)-1. - * The kth block is from row/col r(k) to row/col r(k+1)-1 of C. - * r(1) is one and the last entry in r is equal to n+1. - * The diagonal of A (or A (:,qin)) is ignored. - * - * strongcomp is normally proceeded by a maximum transversal: - * - * [p,q,r] = strongcomp (A, maxtrans (A)) - * - * if the matrix has full structural rank. This is identical to - * - * [p,q,r] = btf (A) - * - * (except that btf handles the case when A is structurally rank-deficient). - * It essentially the same as - * - * [p,q,r] = dmperm (A) - * - * except that p, q, and r will differ between btf and dmperm. Both return an - * upper block triangular form with a zero-free diagonal. The number and sizes - * of the blocks will be identical, but the order of the blocks, and the - * ordering within the blocks, can be different. For structurally rank - * deficient matrices, dmpmerm returns the maximum matching as a zero-free - * diagonal that is above the main diagonal; btf always returns the matching as - * the main diagonal (which will thus contain zeros). - * - * By Tim Davis. Copyright (c) 2004-2007, University of Florida. - * with support from Sandia National Laboratories. All Rights Reserved. - * - * See also maxtrans, btf, dmperm - */ - -/* ========================================================================== */ - -#include "mex.h" -#include "btf.h" -#define Long SuiteSparse_long - -void mexFunction -( - int nargout, - mxArray *pargout[], - int nargin, - const mxArray *pargin[] -) -{ - Long b, n, i, k, j, *Ap, *Ai, *P, *R, nblocks, *Work, *Q, jj ; - double *Px, *Rx, *Qx ; - - /* ---------------------------------------------------------------------- */ - /* get inputs and allocate workspace */ - /* ---------------------------------------------------------------------- */ - - if (!((nargin == 1 && nargout <= 2) || (nargin == 2 && nargout <= 3))) - { - mexErrMsgTxt ("Usage: [p,r] = strongcomp (A)" - " or [p,q,r] = strongcomp (A,qin)") ; - } - n = mxGetM (pargin [0]) ; - if (!mxIsSparse (pargin [0]) || n != mxGetN (pargin [0])) - { - mexErrMsgTxt ("strongcomp: A must be sparse, square, and non-empty") ; - } - - /* get sparse matrix A */ - Ap = (Long *) mxGetJc (pargin [0]) ; - Ai = (Long *) mxGetIr (pargin [0]) ; - - /* get output arrays */ - P = mxMalloc (n * sizeof (Long)) ; - R = mxMalloc ((n+1) * sizeof (Long)) ; - - /* get workspace of size 4n (recursive code only needs 2n) */ - Work = mxMalloc (4*n * sizeof (Long)) ; - - /* get the input column permutation Q */ - if (nargin == 2) - { - if (mxGetNumberOfElements (pargin [1]) != n) - { - mexErrMsgTxt - ("strongcomp: qin must be a permutation vector of size n") ; - } - Qx = mxGetPr (pargin [1]) ; - Q = mxMalloc (n * sizeof (Long)) ; - /* connvert Qin to 0-based and check validity */ - for (i = 0 ; i < n ; i++) - { - Work [i] = 0 ; - } - for (k = 0 ; k < n ; k++) - { - j = Qx [k] - 1 ; /* convert to 0-based */ - jj = BTF_UNFLIP (j) ; - if (jj < 0 || jj >= n || Work [jj] == 1) - { - mexErrMsgTxt - ("strongcomp: qin must be a permutation vector of size n") ; - } - Work [jj] = 1 ; - Q [k] = j ; - } - } - else - { - /* no input column permutation */ - Q = (Long *) NULL ; - } - - /* ---------------------------------------------------------------------- */ - /* find the strongly-connected components of A */ - /* ---------------------------------------------------------------------- */ - - nblocks = btf_l_strongcomp (n, Ap, Ai, Q, P, R, Work) ; - - /* ---------------------------------------------------------------------- */ - /* create outputs and free workspace */ - /* ---------------------------------------------------------------------- */ - - /* create P */ - pargout [0] = mxCreateDoubleMatrix (1, n, mxREAL) ; - Px = mxGetPr (pargout [0]) ; - for (k = 0 ; k < n ; k++) - { - Px [k] = P [k] + 1 ; /* convert to 1-based */ - } - - /* create Q */ - if (nargin == 2 && nargout > 1) - { - pargout [1] = mxCreateDoubleMatrix (1, n, mxREAL) ; - Qx = mxGetPr (pargout [1]) ; - for (k = 0 ; k < n ; k++) - { - Qx [k] = Q [k] + 1 ; /* convert to 1-based */ - } - } - - /* create R */ - if (nargout == nargin + 1) - { - pargout [nargin] = mxCreateDoubleMatrix (1, nblocks+1, mxREAL) ; - Rx = mxGetPr (pargout [nargin]) ; - for (b = 0 ; b <= nblocks ; b++) - { - Rx [b] = R [b] + 1 ; /* convert to 1-based */ - } - } - - mxFree (P) ; - mxFree (R) ; - mxFree (Work) ; - if (nargin == 2) - { - mxFree (Q) ; - } -} diff --git a/ThirdParty/SuiteSparse/BTF/MATLAB/strongcomp.m b/ThirdParty/SuiteSparse/BTF/MATLAB/strongcomp.m deleted file mode 100644 index b20f1b87eb..0000000000 --- a/ThirdParty/SuiteSparse/BTF/MATLAB/strongcomp.m +++ /dev/null @@ -1,45 +0,0 @@ -function [p,q,r] = strongcomp (A, qin) %#ok -%STRONGCOMP symmetric permutation to upper block triangular form -% The matrix must be sparse and square. -% -% Example: -% [p,r] = strongcomp (A) ; -% [p,q,r] = strongcomp (A,qin) ; -% -% In the first usage, the permuted matrix is C = A (p,p). In the second usage, -% the matrix A (:,qin) is symmetrically permuted to upper block triangular -% form, where qin is an input column permutation, and the final permuted -% matrix is C = A (p,q). This second usage is equivalent to -% -% [p,r] = strongcomp (A (:,qin)) ; -% q = qin (p) ; -% -% That is, if qin is not present it is assumed to be qin = 1:n. -% -% C is the permuted matrix, with a number of blocks equal to length(r)-1. -% The kth block is from row/col r(k) to row/col r(k+1)-1 of C. -% r(1) is one and the last entry in r is equal to n+1. -% The diagonal of A (or A (:,qin)) is ignored. -% -% strongcomp is normally proceeded by a maximum transversal. -% Assuming A is square and structurally nonsingular, -% -% [p,q,r] = strongcomp (A, maxtrans (A)) -% -% is essentially identical to -% -% [p,q,r] = dmperm (A) -% -% except that p, q, and r will differ. Both return an upper block triangular -% form with a zero-free diagonal. The number and sizes of the blocks will be -% identical, but the order of the blocks, and the ordering within the blocks, -% can be different. If the matrix is structurally singular, both strongcomp -% and maxtrans return a vector q containing negative entries. abs(q) is a -% permutation of 1:n, and find(q<0) gives a list of the indices of the -% diagonal of A(p,q) that are zero. -% -% See also btf, maxtrans, dmperm - -% Copyright 2004-2007, University of Florida - -error ('strongcomp mexFunction not found') ; diff --git a/ThirdParty/SuiteSparse/BTF/Makefile b/ThirdParty/SuiteSparse/BTF/Makefile index 8cff0a1a86..f86ddabfde 100644 --- a/ThirdParty/SuiteSparse/BTF/Makefile +++ b/ThirdParty/SuiteSparse/BTF/Makefile @@ -1,35 +1,82 @@ -#------------------------------------------------------------------------------ -# BTF Makefile -#------------------------------------------------------------------------------ +#------------------------------------------------------------------------------- +# SuiteSparse/BTF/Makefile +#------------------------------------------------------------------------------- -SUITESPARSE ?= $(realpath $(CURDIR)/..) -export SUITESPARSE +# BTF: Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +# Authors: Timothy A. Davis and Ekanathan Palamadai. +# SPDX-License-Identifier: LGPL-2.1+ -default: library +#------------------------------------------------------------------------------- + +# A simple Makefile for BTF, which relies on cmake to do the +# actual build. All the work is done in cmake so this Makefile is just for +# convenience. + +# To compile with an alternate compiler: +# +# make CC=gcc CXX=g++ +# +# To compile/install for system-wide usage: +# +# make +# sudo make install +# +# To compile/install for local usage (SuiteSparse/lib and SuiteSparse/include): +# +# make local +# make install +# +# To clean up the files: +# +# make clean + +JOBS ?= 8 -include ../SuiteSparse_config/SuiteSparse_config.mk +default: library +# default is to install only in /usr/local library: - ( cd Lib ; $(MAKE) ) + ( cd build && cmake $(CMAKE_OPTIONS) .. && cmake --build . -j${JOBS} ) -# compile the static libraries only -static: - ( cd Lib ; $(MAKE) static ) +# install only in SuiteSparse/lib and SuiteSparse/include +local: + ( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=1 .. && cmake --build . -j${JOBS} ) -clean: - ( cd Lib ; $(MAKE) clean ) - ( cd MATLAB ; $(RM) $(CLEAN) ) +# install only in /usr/local (default) +global: + ( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=0 .. && cmake --build . -j${JOBS} ) + +debug: + ( cd build && cmake $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug .. && cmake --build . -j${JOBS} ) + +all: library -distclean: - ( cd Lib ; $(MAKE) distclean ) - ( cd MATLAB ; $(RM) $(CLEAN) ; $(RM) *.mex* ) +# there is no BTF demo +demos: library -purge: distclean +# just compile after running cmake; do not run cmake again +remake: + ( cd build && cmake --build . -j${JOBS} ) + +# just run cmake to set things up +setup: + ( cd build && cmake $(CMAKE_OPTIONS) .. ) -# install BTF install: - ( cd Lib ; $(MAKE) install ) + ( cd build && cmake --install . ) -# uninstall BTF +# remove any installed libraries and #include files uninstall: - ( cd Lib ; $(MAKE) uninstall ) + - xargs rm < build/install_manifest.txt + +# remove all files not in the distribution +clean: + - $(RM) -rf build/* Config/*.tmp MATLAB/*.o MATLAB/*.mex* + +purge: clean + +distclean: clean + +docs: + + diff --git a/ThirdParty/SuiteSparse/BTF/README.txt b/ThirdParty/SuiteSparse/BTF/README.txt index e1032544ee..110db4bb1f 100644 --- a/ThirdParty/SuiteSparse/BTF/README.txt +++ b/ThirdParty/SuiteSparse/BTF/README.txt @@ -17,9 +17,10 @@ this directory. KLU relies on the BTF package to permute the matrix prior to factorization. To compile the libbtf.a and libbtf.so library (*.dylib on the Mac), type -"make". The compiled library is located in BTF/Lib. Compile code that uses -BTF with -IBTF/Include. Type "make install" to install the library in -/usr/local/lib and /usr/local/include, and "make uninstall" to remove it. +"make". Type "make install" to install the library in /usr/local/lib and +/usr/local/include, and "make uninstall" to remove it. +"make local ; make install" will install only in SuiteSparse/lib and +SuiteSparse/include. Type "make clean" to remove all but the compiled library, and "make distclean" to remove all files not in the original distribution. @@ -41,11 +42,12 @@ Files and directories in the BTF package: Doc documentation and license Include include files - Lib compiled BTF library Makefile Makefile for C and MATLAB versions MATLAB MATLAB interface README.txt this file Source BTF source code + CMakeLists.txt cmake script for compiling BTF + Config source for bft.h ./Doc: diff --git a/ThirdParty/SuiteSparse/BTF/Source/btf_l_maxtrans.c b/ThirdParty/SuiteSparse/BTF/Source/btf_l_maxtrans.c new file mode 100644 index 0000000000..8cdddf2508 --- /dev/null +++ b/ThirdParty/SuiteSparse/BTF/Source/btf_l_maxtrans.c @@ -0,0 +1,13 @@ +//------------------------------------------------------------------------------ +// BTF/Source/btf_l_maxtrans.c: int64_t version of btf_maxtrans +//------------------------------------------------------------------------------ + +// BTF, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Author: Timothy A. Davis. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ + +#define DLONG +#include "btf_maxtrans.c" + diff --git a/ThirdParty/SuiteSparse/BTF/Source/btf_l_order.c b/ThirdParty/SuiteSparse/BTF/Source/btf_l_order.c new file mode 100644 index 0000000000..1f9e0bfd11 --- /dev/null +++ b/ThirdParty/SuiteSparse/BTF/Source/btf_l_order.c @@ -0,0 +1,13 @@ +//------------------------------------------------------------------------------ +// BTF/Source/btf_l_order.c: int64_t version of btf_order +//------------------------------------------------------------------------------ + +// BTF, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Author: Timothy A. Davis. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ + +#define DLONG +#include "btf_order.c" + diff --git a/ThirdParty/SuiteSparse/BTF/Source/btf_l_strongcomp.c b/ThirdParty/SuiteSparse/BTF/Source/btf_l_strongcomp.c new file mode 100644 index 0000000000..b08d0ec39f --- /dev/null +++ b/ThirdParty/SuiteSparse/BTF/Source/btf_l_strongcomp.c @@ -0,0 +1,13 @@ +//------------------------------------------------------------------------------ +// BTF/Source/btf_l_strongcomp.c: int64_t version of btf_strongcomp +//------------------------------------------------------------------------------ + +// BTF, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Author: Timothy A. Davis. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ + +#define DLONG +#include "btf_strongcomp.c" + diff --git a/ThirdParty/SuiteSparse/BTF/Source/btf_maxtrans.c b/ThirdParty/SuiteSparse/BTF/Source/btf_maxtrans.c index 3f44b26160..460fad4d28 100644 --- a/ThirdParty/SuiteSparse/BTF/Source/btf_maxtrans.c +++ b/ThirdParty/SuiteSparse/BTF/Source/btf_maxtrans.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === BTF_MAXTRANS ========================================================= */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// BTF/Source/btf_maxtrans: maximum transversal +//------------------------------------------------------------------------------ + +// BTF, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Author: Timothy A. Davis. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Finds a column permutation that maximizes the number of entries on the * diagonal of a sparse matrix. See btf.h for more information. @@ -40,9 +46,6 @@ * Thus, for general usage, cs_maxtrans is preferred. For square matrices that * are typically structurally non-singular, maxtrans is preferred. A partial * maxtrans can still be very useful when solving a sparse linear system. - * - * By Tim Davis. Copyright (c) 2004-2007, University of Florida. - * with support from Sandia National Laboratories. All Rights Reserved. */ #include "btf.h" @@ -130,7 +133,7 @@ * for (p = head ; ...) DO 90 K=1,JORD */ -static Int augment +static int augment ( Int k, /* which stage of the main loop we're in */ Int Ap [ ], /* column pointers, size n+1 */ @@ -314,7 +317,8 @@ Int BTF(maxtrans) /* returns # of columns in the matching */ ) { Int *Cheap, *Flag, *Istack, *Jstack, *Pstack ; - Int i, j, k, nmatch, work_limit_reached, result ; + Int i, j, k, nmatch, work_limit_reached ; + int result ; /* ---------------------------------------------------------------------- */ /* get workspace and initialize */ diff --git a/ThirdParty/SuiteSparse/BTF/Source/btf_order.c b/ThirdParty/SuiteSparse/BTF/Source/btf_order.c index b0bdb294b5..0039d7fcf5 100644 --- a/ThirdParty/SuiteSparse/BTF/Source/btf_order.c +++ b/ThirdParty/SuiteSparse/BTF/Source/btf_order.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === BTF_ORDER ============================================================ */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// BTF/Source/btf_order: permute a matrix to block triangular form +//------------------------------------------------------------------------------ + +// BTF, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Author: Timothy A. Davis. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Find a permutation P and Q to permute a square sparse matrix into upper block * triangular form. A(P,Q) will contain a zero-free diagonal if A has @@ -21,9 +27,6 @@ * might not be equal to the structural rank. * * See btf.h for more details. - * - * By Tim Davis. Copyright (c) 2004-2007, University of Florida. - * with support from Sandia National Laboratories. All Rights Reserved. */ #include "btf.h" diff --git a/ThirdParty/SuiteSparse/BTF/Source/btf_strongcomp.c b/ThirdParty/SuiteSparse/BTF/Source/btf_strongcomp.c index 36ec3e28f4..2b9047e8d7 100644 --- a/ThirdParty/SuiteSparse/BTF/Source/btf_strongcomp.c +++ b/ThirdParty/SuiteSparse/BTF/Source/btf_strongcomp.c @@ -1,13 +1,16 @@ -/* ========================================================================== */ -/* === BTF_STRONGCOMP ======================================================= */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// BTF/Source/btf_strongcomp: strongly connected components +//------------------------------------------------------------------------------ + +// BTF, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Author: Timothy A. Davis. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Finds the strongly connected components of a graph, or equivalently, permutes * the matrix into upper block triangular form. See btf.h for more details. * Input matrix and Q are not checked on input. - * - * By Tim Davis. Copyright (c) 2004-2007, University of Florida. - * with support from Sandia National Laboratories. All Rights Reserved. */ #include "btf.h" diff --git a/ThirdParty/SuiteSparse/BTF/build/.gitignore b/ThirdParty/SuiteSparse/BTF/build/.gitignore new file mode 100644 index 0000000000..52e15321b7 --- /dev/null +++ b/ThirdParty/SuiteSparse/BTF/build/.gitignore @@ -0,0 +1,4 @@ +# Ignore all files except this file. +* +*/ +!.gitignore diff --git a/ThirdParty/SuiteSparse/BTF/cmake_modules/FindBTF.cmake b/ThirdParty/SuiteSparse/BTF/cmake_modules/FindBTF.cmake new file mode 100644 index 0000000000..b5e6153ed4 --- /dev/null +++ b/ThirdParty/SuiteSparse/BTF/cmake_modules/FindBTF.cmake @@ -0,0 +1,129 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/BTF/cmake_modules/FindBTF.cmake +#------------------------------------------------------------------------------- + +# The following copyright and license applies to just this file only, not to +# the library itself: +# FindBTF.cmake, Copyright (c) 2022-2023, Timothy A. Davis. All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# Finds the BTF include file and compiled library and sets: + +# BTF_INCLUDE_DIR - where to find btf.h +# BTF_LIBRARY - dynamic BTF library +# BTF_STATIC - static BTF library +# BTF_LIBRARIES - libraries when using BTF +# BTF_FOUND - true if BTF found + +# set ``BTF_ROOT`` to a BTF installation root to +# tell this module where to look. + +# All the Find*.cmake files in SuiteSparse are installed by 'make install' into +# /usr/local/lib/cmake/SuiteSparse (where '/usr/local' is the +# ${CMAKE_INSTALL_PREFIX}). To access this file, place the following commands +# in your CMakeLists.txt file. See also SuiteSparse/Example/CMakeLists.txt: +# +# set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} +# ${CMAKE_INSTALL_PREFIX}/lib/cmake/SuiteSparse ) + +#------------------------------------------------------------------------------- + +# include files for BTF +find_path ( BTF_INCLUDE_DIR + NAMES btf.h + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/BTF + HINTS ${CMAKE_SOURCE_DIR}/../BTF + PATH_SUFFIXES include Include +) + +# dynamic BTF library (or static if no dynamic library was built) +find_library ( BTF_LIBRARY + NAMES btf btf_static + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/BTF + HINTS ${CMAKE_SOURCE_DIR}/../BTF + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( MSVC ) + set ( STATIC_NAME btf_static ) +else ( ) + set ( STATIC_NAME btf ) + set ( save ${CMAKE_FIND_LIBRARY_SUFFIXES} ) + set ( CMAKE_FIND_LIBRARY_SUFFIXES + ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES} ) +endif ( ) + +# static BTF library +find_library ( BTF_STATIC + NAMES ${STATIC_NAME} + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/BTF + HINTS ${CMAKE_SOURCE_DIR}/../BTF + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( NOT MSVC ) + # restore the CMAKE_FIND_LIBRARY_SUFFIXES variable + set ( CMAKE_FIND_LIBRARY_SUFFIXES ${save} ) +endif ( ) + +# get version of the library from the dynamic library name +get_filename_component ( BTF_LIBRARY ${BTF_LIBRARY} REALPATH ) +get_filename_component ( BTF_FILENAME ${BTF_LIBRARY} NAME ) +string ( + REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" + BTF_VERSION + ${BTF_FILENAME} +) + +# set ( BTF_VERSION "" ) +if ( EXISTS "${BTF_INCLUDE_DIR}" AND NOT BTF_VERSION ) + # if the version does not appear in the filename, read the include file + file ( STRINGS ${BTF_INCLUDE_DIR}/btf.h BTF_MAJOR_STR + REGEX "define BTF_MAIN_VERSION" ) + file ( STRINGS ${BTF_INCLUDE_DIR}/btf.h BTF_MINOR_STR + REGEX "define BTF_SUB_VERSION" ) + file ( STRINGS ${BTF_INCLUDE_DIR}/btf.h BTF_PATCH_STR + REGEX "define BTF_SUBSUB_VERSION" ) + message ( STATUS "major: ${BTF_MAJOR_STR}" ) + message ( STATUS "minor: ${BTF_MINOR_STR}" ) + message ( STATUS "patch: ${BTF_PATCH_STR}" ) + string ( REGEX MATCH "[0-9]+" BTF_MAJOR ${BTF_MAJOR_STR} ) + string ( REGEX MATCH "[0-9]+" BTF_MINOR ${BTF_MINOR_STR} ) + string ( REGEX MATCH "[0-9]+" BTF_PATCH ${BTF_PATCH_STR} ) + set (BTF_VERSION "${BTF_MAJOR}.${BTF_MINOR}.${BTF_PATCH}") +endif ( ) + +set ( BTF_LIBRARIES ${BTF_LIBRARY} ) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args ( BTF + REQUIRED_VARS BTF_LIBRARY BTF_INCLUDE_DIR + VERSION_VAR BTF_VERSION +) + +mark_as_advanced ( + BTF_INCLUDE_DIR + BTF_LIBRARY + BTF_STATIC + BTF_LIBRARIES +) + +if ( BTF_FOUND ) + message ( STATUS "BTF version: ${BTF_VERSION}" ) + message ( STATUS "BTF include: ${BTF_INCLUDE_DIR}" ) + message ( STATUS "BTF library: ${BTF_LIBRARY}" ) + message ( STATUS "BTF static: ${BTF_STATIC}" ) +else ( ) + message ( STATUS "BTF not found" ) + set ( BTF_INCLUDE_DIR "" ) + set ( BTF_LIBRARIES "" ) + set ( BTF_LIBRARY "" ) + set ( BTF_STATIC "" ) +endif ( ) + diff --git a/ThirdParty/SuiteSparse/CAMD/Demo/Makefile b/ThirdParty/SuiteSparse/CAMD/Demo/Makefile deleted file mode 100644 index f16c162e5c..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Demo/Makefile +++ /dev/null @@ -1,58 +0,0 @@ -#----------------------------------------------------------------------------- -# compile the CAMD demo -#----------------------------------------------------------------------------- - -default: camd_simple camd_demo camd_demo2 camd_l_demo - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -C = $(CC) $(CF) -I../../include - -LIB2 = $(LDFLAGS) -L../../lib -lcamd -lsuitesparseconfig $(LDLIBS) - -library: - ( cd ../../SuiteSparse_config ; $(MAKE) ) - ( cd ../Lib ; $(MAKE) ) - -#------------------------------------------------------------------------------ -# Create the demo program, run it, and compare the output -#------------------------------------------------------------------------------ - -dist: - -camd_demo: camd_demo.c library - $(C) -o camd_demo camd_demo.c $(LIB2) - ./camd_demo > my_camd_demo.out - - diff camd_demo.out my_camd_demo.out - -camd_l_demo: camd_l_demo.c library - $(C) -o camd_l_demo camd_l_demo.c $(LIB2) - ./camd_l_demo > my_camd_l_demo.out - - diff camd_l_demo.out my_camd_l_demo.out - -camd_demo2: camd_demo2.c library - $(C) -o camd_demo2 camd_demo2.c $(LIB2) - ./camd_demo2 > my_camd_demo2.out - - diff camd_demo2.out my_camd_demo2.out - -camd_simple: camd_simple.c library - $(C) -o camd_simple camd_simple.c $(LIB2) - ./camd_simple > my_camd_simple.out - - diff camd_simple.out my_camd_simple.out - -#------------------------------------------------------------------------------ -# Remove all but the files in the original distribution -#------------------------------------------------------------------------------ - -clean: - - $(RM) -r $(CLEAN) - -purge: distclean - -distclean: clean - - $(RM) camd_demo my_camd_demo.out - - $(RM) camd_l_demo my_camd_l_demo.out - - $(RM) camd_demo2 my_camd_demo2.out - - $(RM) camd_simple my_camd_simple.out - - $(RM) -r $(PURGE) - diff --git a/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo.c b/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo.c deleted file mode 100644 index 0fd909a2cc..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo.c +++ /dev/null @@ -1,172 +0,0 @@ -/* ========================================================================= */ -/* === CAMD demo main program ============================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* A simple C main program that illustrates the use of the ANSI C interface - * to CAMD. - */ - -#include "camd.h" -#include -#include - -int main (void) -{ - /* The symmetric can_24 Harwell/Boeing matrix, including upper and lower - * triangular parts, and the diagonal entries. Note that this matrix is - * 0-based, with row and column indices in the range 0 to n-1. */ - int n = 24, nz, - Ap [ ] = { 0, 9, 15, 21, 27, 33, 39, 48, 57, 61, 70, 76, 82, 88, 94, 100, - 106, 110, 119, 128, 137, 143, 152, 156, 160 }, - Ai [ ] = { - /* column 0: */ 0, 5, 6, 12, 13, 17, 18, 19, 21, - /* column 1: */ 1, 8, 9, 13, 14, 17, - /* column 2: */ 2, 6, 11, 20, 21, 22, - /* column 3: */ 3, 7, 10, 15, 18, 19, - /* column 4: */ 4, 7, 9, 14, 15, 16, - /* column 5: */ 0, 5, 6, 12, 13, 17, - /* column 6: */ 0, 2, 5, 6, 11, 12, 19, 21, 23, - /* column 7: */ 3, 4, 7, 9, 14, 15, 16, 17, 18, - /* column 8: */ 1, 8, 9, 14, - /* column 9: */ 1, 4, 7, 8, 9, 13, 14, 17, 18, - /* column 10: */ 3, 10, 18, 19, 20, 21, - /* column 11: */ 2, 6, 11, 12, 21, 23, - /* column 12: */ 0, 5, 6, 11, 12, 23, - /* column 13: */ 0, 1, 5, 9, 13, 17, - /* column 14: */ 1, 4, 7, 8, 9, 14, - /* column 15: */ 3, 4, 7, 15, 16, 18, - /* column 16: */ 4, 7, 15, 16, - /* column 17: */ 0, 1, 5, 7, 9, 13, 17, 18, 19, - /* column 18: */ 0, 3, 7, 9, 10, 15, 17, 18, 19, - /* column 19: */ 0, 3, 6, 10, 17, 18, 19, 20, 21, - /* column 20: */ 2, 10, 19, 20, 21, 22, - /* column 21: */ 0, 2, 6, 10, 11, 19, 20, 21, 22, - /* column 22: */ 2, 20, 21, 22, - /* column 23: */ 6, 11, 12, 23 } ; - - int P [24], Pinv [24], i, j, k, jnew, p, inew, result ; - double Control [CAMD_CONTROL], Info [CAMD_INFO] ; - char A [24][24] ; - int C [ ] = { 0, 0, 4, 0, 1, 0, 2, 2, 1, 1, 3, 4, 5, 5, 3, 4, - 5, 2, 5, 3, 4, 2, 1, 0 } ; - - printf ("CAMD version %d.%d, date: %s\n", CAMD_MAIN_VERSION, - CAMD_SUB_VERSION, CAMD_DATE) ; - printf ("CAMD demo, with the 24-by-24 Harwell/Boeing matrix, can_24:\n") ; - - /* get the default parameters, and print them */ - camd_defaults (Control) ; - camd_control (Control) ; - - /* print the input matrix */ - nz = Ap [n] ; - printf ("\nInput matrix: %d-by-%d, with %d entries.\n" - " Note that for a symmetric matrix such as this one, only the\n" - " strictly lower or upper triangular parts would need to be\n" - " passed to CAMD, since CAMD computes the ordering of A+A'. The\n" - " diagonal entries are also not needed, since CAMD ignores them.\n" - , n, n, nz) ; - for (j = 0 ; j < n ; j++) - { - printf ("\nColumn: %d, number of entries: %d, with row indices in" - " Ai [%d ... %d]:\n row indices:", - j, Ap [j+1] - Ap [j], Ap [j], Ap [j+1]-1) ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - printf (" %d", i) ; - } - printf ("\n") ; - } - - /* print a character plot of the input matrix. This is only reasonable - * because the matrix is small. */ - printf ("\nPlot of input matrix pattern:\n") ; - for (j = 0 ; j < n ; j++) - { - for (i = 0 ; i < n ; i++) A [i][j] = '.' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - A [i][j] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1d", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2d: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - /* order the matrix */ - result = camd_order (n, Ap, Ai, P, Control, Info, C) ; - printf ("return value from camd_order: %d (should be %d)\n", - result, CAMD_OK) ; - - /* print the statistics */ - camd_info (Info) ; - - if (result != CAMD_OK) - { - printf ("CAMD failed\n") ; - exit (1) ; - } - - /* print the permutation vector, P, and compute the inverse permutation */ - printf ("Permutation vector:\n") ; - for (k = 0 ; k < n ; k++) - { - /* row/column j is the kth row/column in the permuted matrix */ - j = P [k] ; - Pinv [j] = k ; - printf (" %2d", j) ; - } - printf ("\n\n") ; - - printf ("Inverse permutation vector:\n") ; - for (j = 0 ; j < n ; j++) - { - k = Pinv [j] ; - printf (" %2d", k) ; - } - printf ("\n\n") ; - - /* print a character plot of the permuted matrix. */ - printf ("\nPlot of permuted matrix pattern:\n") ; - for (jnew = 0 ; jnew < n ; jnew++) - { - j = P [jnew] ; - for (inew = 0 ; inew < n ; inew++) A [inew][jnew] = '.' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - inew = Pinv [Ai [p]] ; - A [inew][jnew] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1d", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2d: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - return (0) ; -} diff --git a/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo.out b/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo.out deleted file mode 100644 index 2c9ea98761..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo.out +++ /dev/null @@ -1,179 +0,0 @@ -CAMD version 2.4, date: May 4, 2016 -CAMD demo, with the 24-by-24 Harwell/Boeing matrix, can_24: - -camd version 2.4, May 4, 2016: approximate minimum degree ordering: - dense row parameter: 10 - (rows with more than max (10 * sqrt (n), 16) entries are - considered "dense", and placed last in output permutation) - aggressive absorption: yes - size of CAMD integer: 4 - - -Input matrix: 24-by-24, with 160 entries. - Note that for a symmetric matrix such as this one, only the - strictly lower or upper triangular parts would need to be - passed to CAMD, since CAMD computes the ordering of A+A'. The - diagonal entries are also not needed, since CAMD ignores them. - -Column: 0, number of entries: 9, with row indices in Ai [0 ... 8]: - row indices: 0 5 6 12 13 17 18 19 21 - -Column: 1, number of entries: 6, with row indices in Ai [9 ... 14]: - row indices: 1 8 9 13 14 17 - -Column: 2, number of entries: 6, with row indices in Ai [15 ... 20]: - row indices: 2 6 11 20 21 22 - -Column: 3, number of entries: 6, with row indices in Ai [21 ... 26]: - row indices: 3 7 10 15 18 19 - -Column: 4, number of entries: 6, with row indices in Ai [27 ... 32]: - row indices: 4 7 9 14 15 16 - -Column: 5, number of entries: 6, with row indices in Ai [33 ... 38]: - row indices: 0 5 6 12 13 17 - -Column: 6, number of entries: 9, with row indices in Ai [39 ... 47]: - row indices: 0 2 5 6 11 12 19 21 23 - -Column: 7, number of entries: 9, with row indices in Ai [48 ... 56]: - row indices: 3 4 7 9 14 15 16 17 18 - -Column: 8, number of entries: 4, with row indices in Ai [57 ... 60]: - row indices: 1 8 9 14 - -Column: 9, number of entries: 9, with row indices in Ai [61 ... 69]: - row indices: 1 4 7 8 9 13 14 17 18 - -Column: 10, number of entries: 6, with row indices in Ai [70 ... 75]: - row indices: 3 10 18 19 20 21 - -Column: 11, number of entries: 6, with row indices in Ai [76 ... 81]: - row indices: 2 6 11 12 21 23 - -Column: 12, number of entries: 6, with row indices in Ai [82 ... 87]: - row indices: 0 5 6 11 12 23 - -Column: 13, number of entries: 6, with row indices in Ai [88 ... 93]: - row indices: 0 1 5 9 13 17 - -Column: 14, number of entries: 6, with row indices in Ai [94 ... 99]: - row indices: 1 4 7 8 9 14 - -Column: 15, number of entries: 6, with row indices in Ai [100 ... 105]: - row indices: 3 4 7 15 16 18 - -Column: 16, number of entries: 4, with row indices in Ai [106 ... 109]: - row indices: 4 7 15 16 - -Column: 17, number of entries: 9, with row indices in Ai [110 ... 118]: - row indices: 0 1 5 7 9 13 17 18 19 - -Column: 18, number of entries: 9, with row indices in Ai [119 ... 127]: - row indices: 0 3 7 9 10 15 17 18 19 - -Column: 19, number of entries: 9, with row indices in Ai [128 ... 136]: - row indices: 0 3 6 10 17 18 19 20 21 - -Column: 20, number of entries: 6, with row indices in Ai [137 ... 142]: - row indices: 2 10 19 20 21 22 - -Column: 21, number of entries: 9, with row indices in Ai [143 ... 151]: - row indices: 0 2 6 10 11 19 20 21 22 - -Column: 22, number of entries: 4, with row indices in Ai [152 ... 155]: - row indices: 2 20 21 22 - -Column: 23, number of entries: 4, with row indices in Ai [156 ... 159]: - row indices: 6 11 12 23 - -Plot of input matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X . . . . X X . . . . . X X . . . X X X . X . . - 1: . X . . . . . . X X . . . X X . . X . . . . . . - 2: . . X . . . X . . . . X . . . . . . . . X X X . - 3: . . . X . . . X . . X . . . . X . . X X . . . . - 4: . . . . X . . X . X . . . . X X X . . . . . . . - 5: X . . . . X X . . . . . X X . . . X . . . . . . - 6: X . X . . X X . . . . X X . . . . . . X . X . X - 7: . . . X X . . X . X . . . . X X X X X . . . . . - 8: . X . . . . . . X X . . . . X . . . . . . . . . - 9: . X . . X . . X X X . . . X X . . X X . . . . . -10: . . . X . . . . . . X . . . . . . . X X X X . . -11: . . X . . . X . . . . X X . . . . . . . . X . X -12: X . . . . X X . . . . X X . . . . . . . . . . X -13: X X . . . X . . . X . . . X . . . X . . . . . . -14: . X . . X . . X X X . . . . X . . . . . . . . . -15: . . . X X . . X . . . . . . . X X . X . . . . . -16: . . . . X . . X . . . . . . . X X . . . . . . . -17: X X . . . X . X . X . . . X . . . X X X . . . . -18: X . . X . . . X . X X . . . . X . X X X . . . . -19: X . . X . . X . . . X . . . . . . X X X X X . . -20: . . X . . . . . . . X . . . . . . . . X X X X . -21: X . X . . . X . . . X X . . . . . . . X X X X . -22: . . X . . . . . . . . . . . . . . . . . X X X . -23: . . . . . . X . . . . X X . . . . . . . . . . X -return value from camd_order: 0 (should be 0) - -CAMD version 2.4.6, May 4, 2016, results: - status: OK - n, dimension of A: 24 - nz, number of nonzeros in A: 160 - symmetry of A: 1.0000 - number of nonzeros on diagonal: 24 - nonzeros in pattern of A+A' (excl. diagonal): 136 - # dense rows/columns of A+A': 0 - memory used, in bytes: 1644 - # of memory compactions: 0 - - The following approximate statistics are for a subsequent - factorization of A(P,P) + A(P,P)'. They are slight upper - bounds if there are no dense rows/columns in A+A', and become - looser if dense rows/columns exist. - - nonzeros in L (excluding diagonal): 135 - nonzeros in L (including diagonal): 159 - # divide operations for LDL' or LU: 135 - # multiply-subtract operations for LDL': 541 - # multiply-subtract operations for LU: 947 - max nz. in any column of L (incl. diagonal): 12 - - chol flop count for real A, sqrt counted as 1 flop: 1241 - LDL' flop count for real A: 1217 - LDL' flop count for complex A: 5543 - LU flop count for real A (with no pivoting): 2029 - LU flop count for complex A (with no pivoting): 8791 - -Permutation vector: - 23 3 1 5 0 22 4 8 9 7 6 21 17 19 10 14 2 11 20 15 12 13 18 16 - -Inverse permutation vector: - 4 2 16 1 6 3 10 9 7 8 14 17 20 21 15 19 23 12 22 13 18 11 5 0 - - -Plot of permuted matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X . . . . . . . . . X . . . . . . X . . X . . . - 1: . X . . . . . . . X . . . X X . . . . X . . X . - 2: . . X . . . . X X . . . X . . X . . . . . X . . - 3: . . . X X . . . . . X . X . . . . . . . X X . . - 4: . . . X X . . . . . X X X X . . . . . . X X X . - 5: . . . . . X . . . . . X . . . . X . X . . . . . - 6: . . . . . . X . X X . . . . . X . . . X . . . X - 7: . . X . . . . X X . . . . . . X . . . . . . . . - 8: . . X . . . X X X X . . X . . X . . . . . X X . - 9: . X . . . . X . X X . . X . . X . . . X . . X X -10: X . . X X . . . . . X X . X . . X X . . X . . . -11: . . . . X X . . . . X X . X X . X X X . . . . . -12: . . X X X . . . X X . . X X . . . . . . . X X . -13: . X . . X . . . . . X X X X X . . . X . . . X . -14: . X . . . . . . . . . X . X X . . . X . . . X . -15: . . X . . . X X X X . . . . . X . . . . . . . . -16: . . . . . X . . . . X X . . . . X X X . . . . . -17: X . . . . . . . . . X X . . . . X X . . X . . . -18: . . . . . X . . . . . X . X X . X . X . . . . . -19: . X . . . . X . . X . . . . . . . . . X . . X X -20: X . . X X . . . . . X . . . . . . X . . X . . . -21: . . X X X . . . X . . . X . . . . . . . . X . . -22: . X . . X . . . X X . . X X X . . . . X . . X . -23: . . . . . . X . . X . . . . . . . . . X . . . X diff --git a/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo2.c b/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo2.c deleted file mode 100644 index 8dd0b62054..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo2.c +++ /dev/null @@ -1,216 +0,0 @@ -/* ========================================================================= */ -/* === CAMD demo main program (jumbled matrix version) ===================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* A simple C main program that illustrates the use of the ANSI C interface - * to CAMD. - * - * Identical to camd_demo.c, except that it operates on an input matrix that has - * unsorted columns and duplicate entries. - */ - -#include "camd.h" -#include -#include - -int main (void) -{ - /* The symmetric can_24 Harwell/Boeing matrix (jumbled, and not symmetric). - * Since CAMD operates on A+A', only A(i,j) or A(j,i) need to be specified, - * or both. The diagonal entries are optional (some are missing). - * There are many duplicate entries, which must be removed. */ - int n = 24, nz, - Ap [ ] = { 0, 9, 14, 20, 28, 33, 37, 44, 53, 58, 63, 63, 66, 69, 72, 75, - 78, 82, 86, 91, 97, 101, 112, 112, 116 }, - Ai [ ] = { - /* column 0: */ 0, 17, 18, 21, 5, 12, 5, 0, 13, - /* column 1: */ 14, 1, 8, 13, 17, - /* column 2: */ 2, 20, 11, 6, 11, 22, - /* column 3: */ 3, 3, 10, 7, 18, 18, 15, 19, - /* column 4: */ 7, 9, 15, 14, 16, - /* column 5: */ 5, 13, 6, 17, - /* column 6: */ 5, 0, 11, 6, 12, 6, 23, - /* column 7: */ 3, 4, 9, 7, 14, 16, 15, 17, 18, - /* column 8: */ 1, 9, 14, 14, 14, - /* column 9: */ 7, 13, 8, 1, 17, - /* column 10: */ - /* column 11: */ 2, 12, 23, - /* column 12: */ 5, 11, 12, - /* column 13: */ 0, 13, 17, - /* column 14: */ 1, 9, 14, - /* column 15: */ 3, 15, 16, - /* column 16: */ 16, 4, 4, 15, - /* column 17: */ 13, 17, 19, 17, - /* column 18: */ 15, 17, 19, 9, 10, - /* column 19: */ 17, 19, 20, 0, 6, 10, - /* column 20: */ 22, 10, 20, 21, - /* column 21: */ 6, 2, 10, 19, 20, 11, 21, 22, 22, 22, 22, - /* column 22: */ - /* column 23: */ 12, 11, 12, 23 } ; - - int P [24], Pinv [24], i, j, k, jnew, p, inew, result ; - double Control [CAMD_CONTROL], Info [CAMD_INFO] ; - char A [24][24] ; - int C [ ] = { 3, 0, 4, 0, 1, 1, 2, 2, 2, 2, 3, 4, 5, 5, 3, 4, 5, 2, - 8, 10, 4, 2, 2, 0 } ; - - printf ("CAMD demo, with a jumbled version of the 24-by-24\n") ; - printf ("Harwell/Boeing matrix, can_24:\n") ; - - /* get the default parameters, and print them */ - camd_defaults (Control) ; - camd_control (Control) ; - - /* print the input matrix */ - nz = Ap [n] ; - printf ("\nJumbled input matrix: %d-by-%d, with %d entries.\n" - " Note that for a symmetric matrix such as this one, only the\n" - " strictly lower or upper triangular parts would need to be\n" - " passed to CAMD, since CAMD computes the ordering of A+A'. The\n" - " diagonal entries are also not needed, since CAMD ignores them.\n" - " This version of the matrix has jumbled columns and duplicate\n" - " row indices.\n", n, n, nz) ; - for (j = 0 ; j < n ; j++) - { - printf ("\nColumn: %d, number of entries: %d, with row indices in" - " Ai [%d ... %d]:\n row indices:", - j, Ap [j+1] - Ap [j], Ap [j], Ap [j+1]-1) ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - printf (" %d", i) ; - } - printf ("\n") ; - } - - /* print a character plot of the input matrix. This is only reasonable - * because the matrix is small. */ - printf ("\nPlot of (jumbled) input matrix pattern:\n") ; - for (j = 0 ; j < n ; j++) - { - for (i = 0 ; i < n ; i++) A [i][j] = '.' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - A [i][j] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1d", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2d: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - /* print a character plot of the matrix A+A'. */ - printf ("\nPlot of symmetric matrix to be ordered by camd_order:\n") ; - for (j = 0 ; j < n ; j++) - { - for (i = 0 ; i < n ; i++) A [i][j] = '.' ; - } - for (j = 0 ; j < n ; j++) - { - A [j][j] = 'X' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - A [i][j] = 'X' ; - A [j][i] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1d", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2d: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - /* order the matrix */ - result = camd_order (n, Ap, Ai, P, Control, Info, C) ; - printf ("return value from camd_order: %d (should be %d)\n", - result, CAMD_OK_BUT_JUMBLED) ; - - /* print the statistics */ - camd_info (Info) ; - - if (result != CAMD_OK_BUT_JUMBLED) - { - printf ("CAMD failed\n") ; - exit (1) ; - } - - /* print the permutation vector, P, and compute the inverse permutation */ - printf ("Permutation vector:\n") ; - for (k = 0 ; k < n ; k++) - { - /* row/column j is the kth row/column in the permuted matrix */ - j = P [k] ; - Pinv [j] = k ; - printf (" %2d", j) ; - } - printf ("\nPermuted constraints:\n") ; - for (k = 0 ; k < n ; k++) - { - /* row/column j is the kth row/column in the permuted matrix */ - printf (" %2d", C [P [k]]) ; - } - printf ("\n\n") ; - - printf ("Inverse permutation vector:\n") ; - for (j = 0 ; j < n ; j++) - { - k = Pinv [j] ; - printf (" %2d", k) ; - } - printf ("\n\n") ; - - /* print a character plot of the permuted matrix. */ - printf ("\nPlot of (symmetrized) permuted matrix pattern:\n") ; - for (j = 0 ; j < n ; j++) - { - for (i = 0 ; i < n ; i++) A [i][j] = '.' ; - } - for (jnew = 0 ; jnew < n ; jnew++) - { - j = P [jnew] ; - A [jnew][jnew] = 'X' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - inew = Pinv [Ai [p]] ; - A [inew][jnew] = 'X' ; - A [jnew][inew] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1d", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2d: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - return (0) ; -} diff --git a/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo2.out b/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo2.out deleted file mode 100644 index 5f2b44e484..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Demo/camd_demo2.out +++ /dev/null @@ -1,210 +0,0 @@ -CAMD demo, with a jumbled version of the 24-by-24 -Harwell/Boeing matrix, can_24: - -camd version 2.4, May 4, 2016: approximate minimum degree ordering: - dense row parameter: 10 - (rows with more than max (10 * sqrt (n), 16) entries are - considered "dense", and placed last in output permutation) - aggressive absorption: yes - size of CAMD integer: 4 - - -Jumbled input matrix: 24-by-24, with 116 entries. - Note that for a symmetric matrix such as this one, only the - strictly lower or upper triangular parts would need to be - passed to CAMD, since CAMD computes the ordering of A+A'. The - diagonal entries are also not needed, since CAMD ignores them. - This version of the matrix has jumbled columns and duplicate - row indices. - -Column: 0, number of entries: 9, with row indices in Ai [0 ... 8]: - row indices: 0 17 18 21 5 12 5 0 13 - -Column: 1, number of entries: 5, with row indices in Ai [9 ... 13]: - row indices: 14 1 8 13 17 - -Column: 2, number of entries: 6, with row indices in Ai [14 ... 19]: - row indices: 2 20 11 6 11 22 - -Column: 3, number of entries: 8, with row indices in Ai [20 ... 27]: - row indices: 3 3 10 7 18 18 15 19 - -Column: 4, number of entries: 5, with row indices in Ai [28 ... 32]: - row indices: 7 9 15 14 16 - -Column: 5, number of entries: 4, with row indices in Ai [33 ... 36]: - row indices: 5 13 6 17 - -Column: 6, number of entries: 7, with row indices in Ai [37 ... 43]: - row indices: 5 0 11 6 12 6 23 - -Column: 7, number of entries: 9, with row indices in Ai [44 ... 52]: - row indices: 3 4 9 7 14 16 15 17 18 - -Column: 8, number of entries: 5, with row indices in Ai [53 ... 57]: - row indices: 1 9 14 14 14 - -Column: 9, number of entries: 5, with row indices in Ai [58 ... 62]: - row indices: 7 13 8 1 17 - -Column: 10, number of entries: 0, with row indices in Ai [63 ... 62]: - row indices: - -Column: 11, number of entries: 3, with row indices in Ai [63 ... 65]: - row indices: 2 12 23 - -Column: 12, number of entries: 3, with row indices in Ai [66 ... 68]: - row indices: 5 11 12 - -Column: 13, number of entries: 3, with row indices in Ai [69 ... 71]: - row indices: 0 13 17 - -Column: 14, number of entries: 3, with row indices in Ai [72 ... 74]: - row indices: 1 9 14 - -Column: 15, number of entries: 3, with row indices in Ai [75 ... 77]: - row indices: 3 15 16 - -Column: 16, number of entries: 4, with row indices in Ai [78 ... 81]: - row indices: 16 4 4 15 - -Column: 17, number of entries: 4, with row indices in Ai [82 ... 85]: - row indices: 13 17 19 17 - -Column: 18, number of entries: 5, with row indices in Ai [86 ... 90]: - row indices: 15 17 19 9 10 - -Column: 19, number of entries: 6, with row indices in Ai [91 ... 96]: - row indices: 17 19 20 0 6 10 - -Column: 20, number of entries: 4, with row indices in Ai [97 ... 100]: - row indices: 22 10 20 21 - -Column: 21, number of entries: 11, with row indices in Ai [101 ... 111]: - row indices: 6 2 10 19 20 11 21 22 22 22 22 - -Column: 22, number of entries: 0, with row indices in Ai [112 ... 111]: - row indices: - -Column: 23, number of entries: 4, with row indices in Ai [112 ... 115]: - row indices: 12 11 12 23 - -Plot of (jumbled) input matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X . . . . . X . . . . . . X . . . . . X . . . . - 1: . X . . . . . . X X . . . . X . . . . . . . . . - 2: . . X . . . . . . . . X . . . . . . . . . X . . - 3: . . . X . . . X . . . . . . . X . . . . . . . . - 4: . . . . . . . X . . . . . . . . X . . . . . . . - 5: X . . . . X X . . . . . X . . . . . . . . . . . - 6: . . X . . X X . . . . . . . . . . . . X . X . . - 7: . . . X X . . X . X . . . . . . . . . . . . . . - 8: . X . . . . . . . X . . . . . . . . . . . . . . - 9: . . . . X . . X X . . . . . X . . . X . . . . . -10: . . . X . . . . . . . . . . . . . . X X X X . . -11: . . X . . . X . . . . . X . . . . . . . . X . X -12: X . . . . . X . . . . X X . . . . . . . . . . X -13: X X . . . X . . . X . . . X . . . X . . . . . . -14: . X . . X . . X X . . . . . X . . . . . . . . . -15: . . . X X . . X . . . . . . . X X . X . . . . . -16: . . . . X . . X . . . . . . . X X . . . . . . . -17: X X . . . X . X . X . . . X . . . X X X . . . . -18: X . . X . . . X . . . . . . . . . . . . . . . . -19: . . . X . . . . . . . . . . . . . X X X . X . . -20: . . X . . . . . . . . . . . . . . . . X X X . . -21: X . . . . . . . . . . . . . . . . . . . X X . . -22: . . X . . . . . . . . . . . . . . . . . X X . . -23: . . . . . . X . . . . X . . . . . . . . . . . X - -Plot of symmetric matrix to be ordered by camd_order: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X . . . . X X . . . . . X X . . . X X X . X . . - 1: . X . . . . . . X X . . . X X . . X . . . . . . - 2: . . X . . . X . . . . X . . . . . . . . X X X . - 3: . . . X . . . X . . X . . . . X . . X X . . . . - 4: . . . . X . . X . X . . . . X X X . . . . . . . - 5: X . . . . X X . . . . . X X . . . X . . . . . . - 6: X . X . . X X . . . . X X . . . . . . X . X . X - 7: . . . X X . . X . X . . . . X X X X X . . . . . - 8: . X . . . . . . X X . . . . X . . . . . . . . . - 9: . X . . X . . X X X . . . X X . . X X . . . . . -10: . . . X . . . . . . X . . . . . . . X X X X . . -11: . . X . . . X . . . . X X . . . . . . . . X . X -12: X . . . . X X . . . . X X . . . . . . . . . . X -13: X X . . . X . . . X . . . X . . . X . . . . . . -14: . X . . X . . X X X . . . . X . . . . . . . . . -15: . . . X X . . X . . . . . . . X X . X . . . . . -16: . . . . X . . X . . . . . . . X X . . . . . . . -17: X X . . . X . X . X . . . X . . . X X X . . . . -18: X . . X . . . X . X X . . . . X . X X X . . . . -19: X . . X . . X . . . X . . . . . . X X X X X . . -20: . . X . . . . . . . X . . . . . . . . X X X X . -21: X . X . . . X . . . X X . . . . . . . X X X X . -22: . . X . . . . . . . . . . . . . . . . . X X X . -23: . . . . . . X . . . . X X . . . . . . . . . . X -return value from camd_order: 1 (should be 1) - -CAMD version 2.4.6, May 4, 2016, results: - status: OK, but jumbled - n, dimension of A: 24 - nz, number of nonzeros in A: 102 - symmetry of A: 0.4000 - number of nonzeros on diagonal: 17 - nonzeros in pattern of A+A' (excl. diagonal): 136 - # dense rows/columns of A+A': 0 - memory used, in bytes: 2208 - # of memory compactions: 0 - - The following approximate statistics are for a subsequent - factorization of A(P,P) + A(P,P)'. They are slight upper - bounds if there are no dense rows/columns in A+A', and become - looser if dense rows/columns exist. - - nonzeros in L (excluding diagonal): 140 - nonzeros in L (including diagonal): 164 - # divide operations for LDL' or LU: 140 - # multiply-subtract operations for LDL': 593 - # multiply-subtract operations for LU: 1046 - max nz. in any column of L (incl. diagonal): 13 - - chol flop count for real A, sqrt counted as 1 flop: 1350 - LDL' flop count for real A: 1326 - LDL' flop count for complex A: 6004 - LU flop count for real A (with no pivoting): 2232 - LU flop count for complex A (with no pivoting): 9628 - -Permutation vector: - 23 3 1 5 4 8 9 7 17 22 21 6 10 14 0 2 11 15 20 13 16 12 18 19 -Permuted constraints: - 0 0 0 1 1 2 2 2 2 2 2 2 3 3 3 4 4 4 4 5 5 5 8 10 - -Inverse permutation vector: - 14 2 15 1 4 3 11 7 5 6 12 16 21 19 13 17 20 8 22 23 18 10 9 0 - - -Plot of (symmetrized) permuted matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X . . . . . . . . . . X . . . . X . . . . X . . - 1: . X . . . . . X . . . . X . . . . X . . . . X X - 2: . . X . . X X . X . . . . X . . . . . X . . . . - 3: . . . X . . . . X . . X . . X . . . . X . X . . - 4: . . . . X . X X . . . . . X . . . X . . X . . . - 5: . . X . . X X . . . . . . X . . . . . . . . . . - 6: . . X . X X X X X . . . . X . . . . . X . . X . - 7: . X . . X . X X X . . . . X . . . X . . X . X . - 8: . . X X . . X X X . . . . . X . . . . X . . X X - 9: . . . . . . . . . X X . . . . X . . X . . . . . -10: . . . . . . . . . X X X X . X X X . X . . . . X -11: X . . X . . . . . . X X . . X X X . . . . X . X -12: . X . . . . . . . . X . X . . . . . X . . . X X -13: . . X . X X X X . . . . . X . . . . . . . . . . -14: . . . X . . . . X . X X . . X . . . . X . X X X -15: . . . . . . . . . X X X . . . X X . X . . . . . -16: X . . . . . . . . . X X . . . X X . . . . X . . -17: . X . . X . . X . . . . . . . . . X . . X . X . -18: . . . . . . . . . X X . X . . X . . X . . . . X -19: . . X X . . X . X . . . . . X . . . . X . . . . -20: . . . . X . . X . . . . . . . . . X . . X . . . -21: X . . X . . . . . . . X . . X . X . . . . X . . -22: . X . . . . X X X . . . X . X . . X . . . . X X -23: . X . . . . . . X . X X X . X . . . X . . . X X diff --git a/ThirdParty/SuiteSparse/CAMD/Demo/camd_l_demo.c b/ThirdParty/SuiteSparse/CAMD/Demo/camd_l_demo.c deleted file mode 100644 index 1c127d05e5..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Demo/camd_l_demo.c +++ /dev/null @@ -1,173 +0,0 @@ -/* ========================================================================= */ -/* === CAMD demo main program (long integer version) ======================= */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* A simple C main program that illustrates the use of the ANSI C interface - * to CAMD. - */ - -#include "camd.h" -#include -#include -#define Long SuiteSparse_long - -int main (void) -{ - /* The symmetric can_24 Harwell/Boeing matrix, including upper and lower - * triangular parts, and the diagonal entries. Note that this matrix is - * 0-based, with row and column indices in the range 0 to n-1. */ - Long n = 24, nz, - Ap [ ] = { 0, 9, 15, 21, 27, 33, 39, 48, 57, 61, 70, 76, 82, 88, 94, 100, - 106, 110, 119, 128, 137, 143, 152, 156, 160 }, - Ai [ ] = { - /* column 0: */ 0, 5, 6, 12, 13, 17, 18, 19, 21, - /* column 1: */ 1, 8, 9, 13, 14, 17, - /* column 2: */ 2, 6, 11, 20, 21, 22, - /* column 3: */ 3, 7, 10, 15, 18, 19, - /* column 4: */ 4, 7, 9, 14, 15, 16, - /* column 5: */ 0, 5, 6, 12, 13, 17, - /* column 6: */ 0, 2, 5, 6, 11, 12, 19, 21, 23, - /* column 7: */ 3, 4, 7, 9, 14, 15, 16, 17, 18, - /* column 8: */ 1, 8, 9, 14, - /* column 9: */ 1, 4, 7, 8, 9, 13, 14, 17, 18, - /* column 10: */ 3, 10, 18, 19, 20, 21, - /* column 11: */ 2, 6, 11, 12, 21, 23, - /* column 12: */ 0, 5, 6, 11, 12, 23, - /* column 13: */ 0, 1, 5, 9, 13, 17, - /* column 14: */ 1, 4, 7, 8, 9, 14, - /* column 15: */ 3, 4, 7, 15, 16, 18, - /* column 16: */ 4, 7, 15, 16, - /* column 17: */ 0, 1, 5, 7, 9, 13, 17, 18, 19, - /* column 18: */ 0, 3, 7, 9, 10, 15, 17, 18, 19, - /* column 19: */ 0, 3, 6, 10, 17, 18, 19, 20, 21, - /* column 20: */ 2, 10, 19, 20, 21, 22, - /* column 21: */ 0, 2, 6, 10, 11, 19, 20, 21, 22, - /* column 22: */ 2, 20, 21, 22, - /* column 23: */ 6, 11, 12, 23 } ; - - Long P [24], Pinv [24], i, j, k, jnew, p, inew, result ; - double Control [CAMD_CONTROL], Info [CAMD_INFO] ; - char A [24][24] ; - Long C [ ] = { 0, 0, 4, 0, 1, 0, 2, 2, 1, 1, 3, 4, 5, 5, 3, 4, - 5, 2, 5, 3, 4, 2, 1, 0 }; - - printf ("CAMD version %d.%d, date: %s\n", CAMD_MAIN_VERSION, - CAMD_SUB_VERSION, CAMD_DATE) ; - printf ("CAMD demo, with the 24-by-24 Harwell/Boeing matrix, can_24:\n") ; - - /* get the default parameters, and print them */ - camd_l_defaults (Control) ; - camd_l_control (Control) ; - - /* print the input matrix */ - nz = Ap [n] ; - printf ("\nInput matrix: %ld-by-%ld, with %ld entries.\n" - " Note that for a symmetric matrix such as this one, only the\n" - " strictly lower or upper triangular parts would need to be\n" - " passed to CAMD, since CAMD computes the ordering of A+A'. The\n" - " diagonal entries are also not needed, since CAMD ignores them.\n" - , n, n, nz) ; - for (j = 0 ; j < n ; j++) - { - printf ("\nColumn: %ld, number of entries: %ld, with row indices in" - " Ai [%ld ... %ld]:\n row indices:", - j, Ap [j+1] - Ap [j], Ap [j], Ap [j+1]-1) ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - printf (" %ld", i) ; - } - printf ("\n") ; - } - - /* print a character plot of the input matrix. This is only reasonable - * because the matrix is small. */ - printf ("\nPlot of input matrix pattern:\n") ; - for (j = 0 ; j < n ; j++) - { - for (i = 0 ; i < n ; i++) A [i][j] = '.' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - A [i][j] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1ld", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2ld: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - /* order the matrix */ - result = camd_l_order (n, Ap, Ai, P, Control, Info, C) ; - printf ("return value from camd_l_order: %ld (should be %d)\n", - result, CAMD_OK) ; - - /* print the statistics */ - camd_l_info (Info) ; - - if (result != CAMD_OK) - { - printf ("CAMD failed\n") ; - exit (1) ; - } - - /* print the permutation vector, P, and compute the inverse permutation */ - printf ("Permutation vector:\n") ; - for (k = 0 ; k < n ; k++) - { - /* row/column j is the kth row/column in the permuted matrix */ - j = P [k] ; - Pinv [j] = k ; - printf (" %2ld", j) ; - } - printf ("\n\n") ; - - printf ("Inverse permutation vector:\n") ; - for (j = 0 ; j < n ; j++) - { - k = Pinv [j] ; - printf (" %2ld", k) ; - } - printf ("\n\n") ; - - /* print a character plot of the permuted matrix. */ - printf ("\nPlot of permuted matrix pattern:\n") ; - for (jnew = 0 ; jnew < n ; jnew++) - { - j = P [jnew] ; - for (inew = 0 ; inew < n ; inew++) A [inew][jnew] = '.' ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - inew = Pinv [Ai [p]] ; - A [inew][jnew] = 'X' ; - } - } - printf (" ") ; - for (j = 0 ; j < n ; j++) printf (" %1ld", j % 10) ; - printf ("\n") ; - for (i = 0 ; i < n ; i++) - { - printf ("%2ld: ", i) ; - for (j = 0 ; j < n ; j++) - { - printf (" %c", A [i][j]) ; - } - printf ("\n") ; - } - - return (0) ; -} diff --git a/ThirdParty/SuiteSparse/CAMD/Demo/camd_l_demo.out b/ThirdParty/SuiteSparse/CAMD/Demo/camd_l_demo.out deleted file mode 100644 index 0e875dafcb..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Demo/camd_l_demo.out +++ /dev/null @@ -1,179 +0,0 @@ -CAMD version 2.4, date: May 4, 2016 -CAMD demo, with the 24-by-24 Harwell/Boeing matrix, can_24: - -camd version 2.4, May 4, 2016: approximate minimum degree ordering: - dense row parameter: 10 - (rows with more than max (10 * sqrt (n), 16) entries are - considered "dense", and placed last in output permutation) - aggressive absorption: yes - size of CAMD integer: 8 - - -Input matrix: 24-by-24, with 160 entries. - Note that for a symmetric matrix such as this one, only the - strictly lower or upper triangular parts would need to be - passed to CAMD, since CAMD computes the ordering of A+A'. The - diagonal entries are also not needed, since CAMD ignores them. - -Column: 0, number of entries: 9, with row indices in Ai [0 ... 8]: - row indices: 0 5 6 12 13 17 18 19 21 - -Column: 1, number of entries: 6, with row indices in Ai [9 ... 14]: - row indices: 1 8 9 13 14 17 - -Column: 2, number of entries: 6, with row indices in Ai [15 ... 20]: - row indices: 2 6 11 20 21 22 - -Column: 3, number of entries: 6, with row indices in Ai [21 ... 26]: - row indices: 3 7 10 15 18 19 - -Column: 4, number of entries: 6, with row indices in Ai [27 ... 32]: - row indices: 4 7 9 14 15 16 - -Column: 5, number of entries: 6, with row indices in Ai [33 ... 38]: - row indices: 0 5 6 12 13 17 - -Column: 6, number of entries: 9, with row indices in Ai [39 ... 47]: - row indices: 0 2 5 6 11 12 19 21 23 - -Column: 7, number of entries: 9, with row indices in Ai [48 ... 56]: - row indices: 3 4 7 9 14 15 16 17 18 - -Column: 8, number of entries: 4, with row indices in Ai [57 ... 60]: - row indices: 1 8 9 14 - -Column: 9, number of entries: 9, with row indices in Ai [61 ... 69]: - row indices: 1 4 7 8 9 13 14 17 18 - -Column: 10, number of entries: 6, with row indices in Ai [70 ... 75]: - row indices: 3 10 18 19 20 21 - -Column: 11, number of entries: 6, with row indices in Ai [76 ... 81]: - row indices: 2 6 11 12 21 23 - -Column: 12, number of entries: 6, with row indices in Ai [82 ... 87]: - row indices: 0 5 6 11 12 23 - -Column: 13, number of entries: 6, with row indices in Ai [88 ... 93]: - row indices: 0 1 5 9 13 17 - -Column: 14, number of entries: 6, with row indices in Ai [94 ... 99]: - row indices: 1 4 7 8 9 14 - -Column: 15, number of entries: 6, with row indices in Ai [100 ... 105]: - row indices: 3 4 7 15 16 18 - -Column: 16, number of entries: 4, with row indices in Ai [106 ... 109]: - row indices: 4 7 15 16 - -Column: 17, number of entries: 9, with row indices in Ai [110 ... 118]: - row indices: 0 1 5 7 9 13 17 18 19 - -Column: 18, number of entries: 9, with row indices in Ai [119 ... 127]: - row indices: 0 3 7 9 10 15 17 18 19 - -Column: 19, number of entries: 9, with row indices in Ai [128 ... 136]: - row indices: 0 3 6 10 17 18 19 20 21 - -Column: 20, number of entries: 6, with row indices in Ai [137 ... 142]: - row indices: 2 10 19 20 21 22 - -Column: 21, number of entries: 9, with row indices in Ai [143 ... 151]: - row indices: 0 2 6 10 11 19 20 21 22 - -Column: 22, number of entries: 4, with row indices in Ai [152 ... 155]: - row indices: 2 20 21 22 - -Column: 23, number of entries: 4, with row indices in Ai [156 ... 159]: - row indices: 6 11 12 23 - -Plot of input matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X . . . . X X . . . . . X X . . . X X X . X . . - 1: . X . . . . . . X X . . . X X . . X . . . . . . - 2: . . X . . . X . . . . X . . . . . . . . X X X . - 3: . . . X . . . X . . X . . . . X . . X X . . . . - 4: . . . . X . . X . X . . . . X X X . . . . . . . - 5: X . . . . X X . . . . . X X . . . X . . . . . . - 6: X . X . . X X . . . . X X . . . . . . X . X . X - 7: . . . X X . . X . X . . . . X X X X X . . . . . - 8: . X . . . . . . X X . . . . X . . . . . . . . . - 9: . X . . X . . X X X . . . X X . . X X . . . . . -10: . . . X . . . . . . X . . . . . . . X X X X . . -11: . . X . . . X . . . . X X . . . . . . . . X . X -12: X . . . . X X . . . . X X . . . . . . . . . . X -13: X X . . . X . . . X . . . X . . . X . . . . . . -14: . X . . X . . X X X . . . . X . . . . . . . . . -15: . . . X X . . X . . . . . . . X X . X . . . . . -16: . . . . X . . X . . . . . . . X X . . . . . . . -17: X X . . . X . X . X . . . X . . . X X X . . . . -18: X . . X . . . X . X X . . . . X . X X X . . . . -19: X . . X . . X . . . X . . . . . . X X X X X . . -20: . . X . . . . . . . X . . . . . . . . X X X X . -21: X . X . . . X . . . X X . . . . . . . X X X X . -22: . . X . . . . . . . . . . . . . . . . . X X X . -23: . . . . . . X . . . . X X . . . . . . . . . . X -return value from camd_l_order: 0 (should be 0) - -CAMD version 2.4.6, May 4, 2016, results: - status: OK - n, dimension of A: 24 - nz, number of nonzeros in A: 160 - symmetry of A: 1.0000 - number of nonzeros on diagonal: 24 - nonzeros in pattern of A+A' (excl. diagonal): 136 - # dense rows/columns of A+A': 0 - memory used, in bytes: 3288 - # of memory compactions: 0 - - The following approximate statistics are for a subsequent - factorization of A(P,P) + A(P,P)'. They are slight upper - bounds if there are no dense rows/columns in A+A', and become - looser if dense rows/columns exist. - - nonzeros in L (excluding diagonal): 135 - nonzeros in L (including diagonal): 159 - # divide operations for LDL' or LU: 135 - # multiply-subtract operations for LDL': 541 - # multiply-subtract operations for LU: 947 - max nz. in any column of L (incl. diagonal): 12 - - chol flop count for real A, sqrt counted as 1 flop: 1241 - LDL' flop count for real A: 1217 - LDL' flop count for complex A: 5543 - LU flop count for real A (with no pivoting): 2029 - LU flop count for complex A (with no pivoting): 8791 - -Permutation vector: - 23 3 1 5 0 22 4 8 9 7 6 21 17 19 10 14 2 11 20 15 12 13 18 16 - -Inverse permutation vector: - 4 2 16 1 6 3 10 9 7 8 14 17 20 21 15 19 23 12 22 13 18 11 5 0 - - -Plot of permuted matrix pattern: - 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 - 0: X . . . . . . . . . X . . . . . . X . . X . . . - 1: . X . . . . . . . X . . . X X . . . . X . . X . - 2: . . X . . . . X X . . . X . . X . . . . . X . . - 3: . . . X X . . . . . X . X . . . . . . . X X . . - 4: . . . X X . . . . . X X X X . . . . . . X X X . - 5: . . . . . X . . . . . X . . . . X . X . . . . . - 6: . . . . . . X . X X . . . . . X . . . X . . . X - 7: . . X . . . . X X . . . . . . X . . . . . . . . - 8: . . X . . . X X X X . . X . . X . . . . . X X . - 9: . X . . . . X . X X . . X . . X . . . X . . X X -10: X . . X X . . . . . X X . X . . X X . . X . . . -11: . . . . X X . . . . X X . X X . X X X . . . . . -12: . . X X X . . . X X . . X X . . . . . . . X X . -13: . X . . X . . . . . X X X X X . . . X . . . X . -14: . X . . . . . . . . . X . X X . . . X . . . X . -15: . . X . . . X X X X . . . . . X . . . . . . . . -16: . . . . . X . . . . X X . . . . X X X . . . . . -17: X . . . . . . . . . X X . . . . X X . . X . . . -18: . . . . . X . . . . . X . X X . X . X . . . . . -19: . X . . . . X . . X . . . . . . . . . X . . X X -20: X . . X X . . . . . X . . . . . . X . . X . . . -21: . . X X X . . . X . . . X . . . . . . . . X . . -22: . X . . X . . . X X . . X X X . . . . X . . X . -23: . . . . . . X . . X . . . . . . . . . X . . . X diff --git a/ThirdParty/SuiteSparse/CAMD/Demo/camd_simple.c b/ThirdParty/SuiteSparse/CAMD/Demo/camd_simple.c deleted file mode 100644 index 87dbdd5b37..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Demo/camd_simple.c +++ /dev/null @@ -1,23 +0,0 @@ -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -#include -#include "camd.h" - -int n = 5 ; -int Ap [ ] = { 0, 2, 6, 10, 12, 14} ; -int Ai [ ] = { 0,1, 0,1,2,4, 1,2,3,4, 2,3, 1,4 } ; -int C [ ] = { 2, 0, 0, 0, 1 } ; -int P [5] ; - -int main (void) -{ - int k ; - (void) camd_order (n, Ap, Ai, P, (double *) NULL, (double *) NULL, C) ; - for (k = 0 ; k < n ; k++) printf ("P [%d] = %d\n", k, P [k]) ; - return (0) ; -} - diff --git a/ThirdParty/SuiteSparse/CAMD/Demo/camd_simple.out b/ThirdParty/SuiteSparse/CAMD/Demo/camd_simple.out deleted file mode 100644 index c94ebcd9c4..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Demo/camd_simple.out +++ /dev/null @@ -1,5 +0,0 @@ -P [0] = 3 -P [1] = 2 -P [2] = 1 -P [3] = 4 -P [4] = 0 diff --git a/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.bib b/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.bib deleted file mode 100644 index 03fbfa8f76..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.bib +++ /dev/null @@ -1,98 +0,0 @@ -@string{SIREV = "{SIAM} Review"} -@string{SIMAX = "{SIAM} J. Matrix Anal. Applic."} -@string{SIAMJSC = "{SIAM} J. Sci. Comput."} -@string{TOMS = "{ACM} Trans. Math. Softw."} - -@article{schu:01, - author = {J. Schulze}, - title = {Towards a tighter coupling of bottom-up and top-down sparse matrix ordering methods}, - journal = {BIT}, - volume = {41}, - number = {4}, - pages = "800--841", - year = {2001} - } - -@article{GeorgeLiu89, - author={George, A. and Liu, J. W. H.}, - year={1989}, - title={The Evolution of the Minimum Degree Ordering Algorithm}, - journal=SIREV, - volume={31}, - number={1}, - pages={1--19}} - -@article{AmestoyDavisDuff96, - author={Amestoy, P. R. and Davis, T. A. and Duff, I. S.}, - title={An approximate minimum degree ordering algorithm}, - journal=SIMAX, - year={1996} - ,volume={17} - ,number={4} - ,pages={886-905} - } - -@article{AmestoyDavisDuff04, - author={Amestoy, P. R. and Davis, T. A. and Duff, I. S.}, - title={Algorithm 837: An approximate minimum degree ordering algorithm}, - journal=TOMS, - year={2004} - ,volume={30} - ,number={3} - ,pages={381-388} - } - -@misc{hsl:2002, - author = {HSL}, - title = "{HSL} 2002: {A} collection of {F}ortran codes for large - scale scientific computation", - note = {{\tt www.cse.clrc.ac.uk/nag/hsl}}, - year = 2002} - - -@article{RothbergEisenstat98, - author={Rothberg, E. and Eisenstat, S. C.}, - title={Node selection strategies for bottom-up sparse matrix orderings}, - journal=SIMAX, - year={1998} - ,volume={19} - ,number={3} - ,pages={682-695} - } - -@article{KarypisKumar98e, - author={Karypis, G. and Kumar, V.}, - title={A fast and high quality multilevel scheme for partitioning irregular graphs}, - journal=SIAMJSC, - year={1998} - ,volume={20} - ,pages={359-392} - } - -@article{Chaco, - author={B. Hendrickson and E. Rothberg}, - title={Improving the runtime and quality of nested dissection ordering}, - journal=SIAMJSC, - year={1999} - ,volume={20} - ,pages={468--489} - } - -@article{PellegriniRomanAmestoy00, - author={Pellegrini, F. and Roman, J. and Amestoy, P.}, - title={Hybridizing nested dissection and halo approximate minimum degree for efficient sparse matrix ordering}, - journal={Concurrency: Practice and Experience}, - year={2000} - ,volume={12} - ,pages={68-84} - } - -@article{DavisGilbertLarimoreNg04, - author={Davis, T. A. and Gilbert, J. R. and Larimore, S. I. and Ng, E. G.}, - title={A column approximate minimum degree ordering algorithm}, - journal=TOMS, - year={2004} - ,volume={30} - ,pages={353-376} - } - diff --git a/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.pdf b/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.pdf deleted file mode 100644 index 11958b9a27..0000000000 Binary files a/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.pdf and /dev/null differ diff --git a/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.tex b/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.tex deleted file mode 100644 index 00396ebe6d..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Doc/CAMD_UserGuide.tex +++ /dev/null @@ -1,610 +0,0 @@ -\documentclass[11pt]{article} - -\newcommand{\m}[1]{{\bf{#1}}} % for matrices and vectors -\newcommand{\tr}{^{\sf T}} % transpose - -\topmargin 0in -\textheight 9in -\oddsidemargin 0pt -\evensidemargin 0pt -\textwidth 6.5in - -%------------------------------------------------------------------------------ -\begin{document} -%------------------------------------------------------------------------------ - -\title{CAMD User Guide} -\author{Patrick R. Amestoy\thanks{ENSEEIHT-IRIT, -2 rue Camichel 31017 Toulouse, France. -email: amestoy@enseeiht.fr. http://www.enseeiht.fr/$\sim$amestoy.} -\and Yanqing (Morris) Chen -\and Timothy A. Davis\thanks{ -email: DrTimothyAldenDavis@gmail.com, -http://www.suitesparse.com. -This work was supported by the National -Science Foundation, under grants ASC-9111263, DMS-9223088, and CCR-0203270. -Portions of the work were done while on sabbatical at Stanford University -and Lawrence Berkeley National Laboratory (with funding from Stanford -University and the SciDAC program). Ordering constraints added with -support from Sandia National Laboratory (Dept. of Energy). -} -\and Iain S. Duff\thanks{Rutherford Appleton Laboratory, Chilton, Didcot, -Oxon OX11 0QX, England. email: i.s.duff@rl.ac.uk. -http://www.numerical.rl.ac.uk/people/isd/isd.html. -This work was supported by the EPSRC under grant GR/R46441. -}} - -\date{VERSION 2.4.6, May 4, 2016} -\maketitle - -%------------------------------------------------------------------------------ -\begin{abstract} -CAMD is a set of ANSI C routines that implements the approximate minimum degree -ordering algorithm to permute sparse matrices prior to -numerical factorization. Ordering constraints can be optionally provided. -A MATLAB interface is included. -\end{abstract} -%------------------------------------------------------------------------------ - -CAMD Copyright\copyright 2013 by Timothy A. Davis, -Yanqing (Morris) Chen, -Patrick R. Amestoy, and Iain S. Duff. All Rights Reserved. -CAMD is available under alternate licences; contact T. Davis for details. - -{\bf CAMD License:} Refer to CAMD/Doc/License.txt for the license. - -{\bf Availability:} - http://www.suitesparse.com. - -{\bf Acknowledgments:} - - This work was supported by the National Science Foundation, under - grants ASC-9111263 and DMS-9223088 and CCR-0203270, and by Sandia - National Labs (a grant from DOE). - The conversion to C, the addition of the elimination tree - post-ordering, and the handling of dense rows and columns - were done while Davis was on sabbatical at - Stanford University and Lawrence Berkeley National Laboratory. - The ordering constraints were added by Chen and Davis. - -%------------------------------------------------------------------------------ -\newpage -\section{Overview} -%------------------------------------------------------------------------------ - -CAMD is a set of routines for preordering a sparse matrix prior to -numerical factorization. It uses an approximate minimum degree ordering -algorithm \cite{AmestoyDavisDuff96,AmestoyDavisDuff04} -to find a permutation matrix $\m{P}$ -so that the Cholesky factorization $\m{PAP}\tr=\m{LL}\tr$ has fewer -(often much fewer) nonzero entries than the Cholesky factorization of $\m{A}$. -The algorithm is typically much faster than other ordering methods -and minimum degree ordering -algorithms that compute an exact degree \cite{GeorgeLiu89}. -Some methods, such as approximate deficiency -\cite{RothbergEisenstat98} and graph-partitioning based methods -\cite{Chaco,KarypisKumar98e,PellegriniRomanAmestoy00,schu:01} -can produce better orderings, depending on the matrix. - -The algorithm starts with an undirected graph representation of a -symmetric sparse matrix $\m{A}$. Node $i$ in the graph corresponds to row -and column $i$ of the matrix, and there is an edge $(i,j)$ in the graph if -$a_{ij}$ is nonzero. -The degree of a node is initialized to the number of off-diagonal nonzeros -in row $i$, which is the size of the set of nodes -adjacent to $i$ in the graph. - -The selection of a pivot $a_{ii}$ from the diagonal of $\m{A}$ and the first -step of Gaussian elimination corresponds to one step of graph elimination. -Numerical fill-in causes new nonzero entries in the matrix -(fill-in refers to -nonzeros in $\m{L}$ that are not in $\m{A}$). -Node $i$ is eliminated and edges are added to its neighbors -so that they form a clique (or {\em element}). To reduce fill-in, -node $i$ is selected as the node of least degree in the graph. -This process repeats until the graph is eliminated. - -The clique is represented implicitly. Rather than listing all the -new edges in the graph, a single list of nodes is kept which represents -the clique. This list corresponds to the nonzero pattern of the first -column of $\m{L}$. As the elimination proceeds, some of these cliques -become subsets of subsequent cliques, and are removed. This graph -can be stored in place, that is -using the same amount of memory as the original graph. - -The most costly part of the minimum degree algorithm is the recomputation -of the degrees of nodes adjacent to the current pivot element. -Rather than keep track of the exact degree, the approximate minimum degree -algorithm finds an upper bound on the degree that is easier to compute. -For nodes of least degree, this bound tends to be tight. Using the -approximate degree instead of the exact degree leads to a substantial savings -in run time, particularly for very irregularly structured matrices. -It has no effect on the quality of the ordering. - -The elimination phase is followed by an -elimination tree post-ordering. This has no effect on fill-in, but -reorganizes the ordering so that the subsequent numerical factorization is -more efficient. It also includes a pre-processing phase in which nodes of -very high degree are removed (without causing fill-in), and placed last in the -permutation $\m{P}$ (subject to the constraints). -This reduces the run time substantially if the matrix -has a few rows with many nonzero entries, and has little effect on the quality -of the ordering. -CAMD operates on the -symmetric nonzero pattern of $\m{A}+\m{A}\tr$, so it can be given -an unsymmetric matrix, or either the lower or upper triangular part of -a symmetric matrix. - -CAMD has the ability to order the matrix with constraints. Each -node $i$ in the graph (row/column $i$ in the matrix) has a constraint, -{\tt C[i]}, which is in the range {\tt 0} to {\tt n-1}. All nodes with -{\tt C[i] = 0} are -ordered first, followed by all nodes with constraint {\tt 1}, and so on. -That is, {\tt C[P[k]]} is monotonically non-decreasing as {\tt k} varies from -{\tt 0} to {\tt n-1}. If {\tt C} is NULL, no -constraints are used (the ordering will be similar to AMD's ordering, -except that the postordering is different). -The optional {\tt C} parameter is also provided in the MATLAB interface, -({\tt p = camd (A,Control,C)}). - -For a discussion of the long history of the minimum degree algorithm, -see \cite{GeorgeLiu89}. - -%------------------------------------------------------------------------------ -\section{Availability} -%------------------------------------------------------------------------------ - -CAMD is available at http://www.suitesparse.com. -The Fortran version is available as the routine {\tt MC47} in HSL -(formerly the Harwell Subroutine Library) \cite{hsl:2002}. {\tt MC47} does -not include ordering constraints. - -%------------------------------------------------------------------------------ -\section{Using CAMD in MATLAB} -%------------------------------------------------------------------------------ - -To use CAMD in MATLAB, you must first compile the CAMD mexFunction. -Just type {\tt make} in the Unix system shell, while in the {\tt CAMD} -directory. You can also type {\tt camd\_make} in MATLAB, while in the -{\tt CAMD/MATLAB} directory. Place the {\tt CAMD/MATLAB} directory in your -MATLAB path. This can be done on any system with MATLAB, including Windows. -See Section~\ref{Install} for more details on how to install CAMD. - -The MATLAB statement {\tt p=camd(A)} finds a permutation vector {\tt p} such -that the Cholesky factorization {\tt chol(A(p,p))} is typically sparser than -{\tt chol(A)}. -If {\tt A} is unsymmetric, {\tt camd(A)} is identical to {\tt camd(A+A')} -(ignoring numerical cancellation). -If {\tt A} is not symmetric positive definite, -but has substantial diagonal entries and a mostly symmetric nonzero pattern, -then this ordering is also suitable for LU factorization. A partial pivoting -threshold may be required to prevent pivots from being selected off the -diagonal, such as the statement {\tt [L,U,P] = lu (A (p,p), 0.1)}. -Type {\tt help lu} for more details. -The statement {\tt [L,U,P,Q] = lu (A (p,p))} in MATLAB 6.5 is -not suitable, however, because it uses UMFPACK Version 4.0 and thus -does not attempt to select pivots from the diagonal. -UMFPACK Version 4.1 in MATLAB 7.0 and later -uses several strategies, including a symmetric pivoting strategy, and -will give you better results if you want to factorize an unsymmetric matrix -of this type. Refer to the UMFPACK User Guide for more details, at -http://www.suitesparse.com. - -The CAMD mexFunction is much faster than the built-in MATLAB symmetric minimum -degree ordering methods, SYMAMD and SYMMMD. Its ordering quality is -essentially identical to AMD, comparable to SYMAMD, and better than SYMMMD -\cite{DavisGilbertLarimoreNg04}. - -An optional input argument can be used to modify the control parameters for -CAMD (aggressive absorption, dense row/column handling, and printing of -statistics). An optional output -argument provides statistics on the ordering, including an analysis of the -fill-in and the floating-point operation count for a subsequent factorization. -For more details (once CAMD is installed), -type {\tt help camd} in the MATLAB command window. - -%------------------------------------------------------------------------------ -\section{Using CAMD in a C program} -\label{Cversion} -%------------------------------------------------------------------------------ - -The C-callable CAMD library consists of seven user-callable routines and one -include file. There are two versions of each of the routines, with -{\tt int} and {\tt long} integers. -The routines with prefix -{\tt camd\_l\_} use {\tt long} integer arguments; the others use -{\tt int} integer arguments. If you compile CAMD in the standard -ILP32 mode (32-bit {\tt int}'s, {\tt long}'s, and pointers) then the versions -are essentially identical. You will be able to solve problems using up to 2GB -of memory. If you compile CAMD in the standard LP64 mode, the size of an -{\tt int} remains 32-bits, but the size of a {\tt long} and a pointer both get -promoted to 64-bits. - -The following routines are fully described in Section~\ref{Primary}: - -\begin{itemize} -\item {\tt camd\_order} -({\tt long} version: {\tt camd\_l\_order}) - {\footnotesize - \begin{verbatim} - #include "camd.h" - int n, Ap [n+1], Ai [nz], P [n], C [n] ; - double Control [CAMD_CONTROL], Info [CAMD_INFO] ; - int result = camd_order (n, Ap, Ai, P, Control, Info, C) ; - \end{verbatim} - } - Computes the approximate minimum degree ordering of an $n$-by-$n$ matrix - $\m{A}$. Returns a permutation vector {\tt P} of size {\tt n}, where - {\tt P[k] = i} if row and column {\tt i} are the {\tt k}th row and - column in the permuted matrix. - This routine allocates its own memory of size $1.2e+9n$ integers, - where $e$ is the number of nonzeros in $\m{A}+\m{A}\tr$. - It computes statistics about the matrix $\m{A}$, such as the symmetry of - its nonzero pattern, the number of nonzeros in $\m{L}$, - and the number of floating-point operations required for Cholesky and LU - factorizations (which are returned in the {\tt Info} array). - The user's input matrix is not modified. - It returns {\tt CAMD\_OK} if successful, - {\tt CAMD\_OK\_BUT\_JUMBLED} if successful (but the matrix had unsorted - and/or duplicate row indices), - {\tt CAMD\_INVALID} if the matrix is invalid, - {\tt CAMD\_OUT\_OF\_MEMORY} if out of memory. - - The array {\tt C} provides the ordering constraints. - On input, {\tt C} may be null (to denote no constraints); - otherwise, it must be an array size {\tt n}, with entries in the range - {\tt 0} to {\tt n-1}. - On output, {\tt C[P[0..n-1]]} is monotonically non-descreasing. - -\item {\tt camd\_defaults} -({\tt long} version: {\tt camd\_l\_defaults}) - {\footnotesize - \begin{verbatim} - #include "camd.h" - double Control [CAMD_CONTROL] ; - camd_defaults (Control) ; - \end{verbatim} - } - Sets the default control parameters in the {\tt Control} array. These can - then be modified as desired before passing the array to the other CAMD - routines. - -\item {\tt camd\_control} -({\tt long} version: {\tt camd\_l\_control}) - {\footnotesize - \begin{verbatim} - #include "camd.h" - double Control [CAMD_CONTROL] ; - camd_control (Control) ; - \end{verbatim} - } - Prints a description of the control parameters, and their values. - -\item {\tt camd\_info} -({\tt long} version: {\tt camd\_l\_info}) - {\footnotesize - \begin{verbatim} - #include "camd.h" - double Info [CAMD_INFO] ; - camd_info (Info) ; - \end{verbatim} - } - Prints a description of the statistics computed by CAMD, and their values. - -\item {\tt camd\_valid} -({\tt long} version: {\tt camd\_valid}) - {\footnotesize - \begin{verbatim} - #include "camd.h" - int n, Ap [n+1], Ai [nz] ; - int result = camd_valid (n, n, Ap, Ai) ; - \end{verbatim} - } - Returns {\tt CAMD\_OK} or {\tt CAMD\_OK\_BUT\_JUMBLED} - if the matrix is valid as input to {\tt camd\_order}; - the latter is returned if the matrix has unsorted and/or duplicate - row indices in one or more columns. - Returns {\tt CAMD\_INVALID} if the matrix cannot be passed to - {\tt camd\_order}. - For {\tt camd\_order}, the matrix must - also be square. The first two arguments are the number of rows and the - number of columns of the matrix. For its use in CAMD, these must both - equal {\tt n}. - -\item {\tt camd\_2} -({\tt long} version: {\tt camd\_l2}) - CAMD ordering kernel. It is faster than {\tt camd\_order}, and - can be called by the user, but it is difficult to use. - It does not check its inputs for errors. - It does not require the columns of its input matrix to be sorted, - but it destroys the matrix on output. Additional workspace must be passed. - Refer to the source file {\tt CAMD/Source/camd\_2.c} for a description. - -\end{itemize} - -The nonzero pattern of the matrix $\m{A}$ is represented in compressed column -form. -For an $n$-by-$n$ matrix $\m{A}$ with {\tt nz} nonzero entries, the -representation consists of two arrays: {\tt Ap} of size {\tt n+1} and {\tt Ai} -of size {\tt nz}. The row indices of entries in column {\tt j} are stored in - {\tt Ai[Ap[j]} $\ldots$ {\tt Ap[j+1]-1]}. -For {\tt camd\_order}, -if duplicate row indices are present, or if the row indices in any given -column are not sorted in ascending order, then {\tt camd\_order} creates -an internal copy of the matrix with sorted rows and no duplicate entries, -and orders the copy. This adds slightly to the time and memory usage of -{\tt camd\_order}, but is not an error condition. - -The matrix is 0-based, and thus -row indices must be in the range {\tt 0} to {\tt n-1}. -The first entry {\tt Ap[0]} must be zero. -The total number of entries in the matrix is thus {\tt nz = Ap[n]}. - -The matrix must be square, but it does not need to be symmetric. -The {\tt camd\_order} routine constructs the nonzero pattern of -$\m{B} = \m{A}+\m{A}\tr$ (without forming $\m{A}\tr$ explicitly if -$\m{A}$ has sorted columns and no duplicate entries), -and then orders the matrix $\m{B}$. Thus, either the -lower triangular part of $\m{A}$, the upper triangular part, -or any combination may be passed. The transpose $\m{A}\tr$ may also be -passed to {\tt camd\_order}. -The diagonal entries may be present, but are ignored. - -%------------------------------------------------------------------------------ -\subsection{Control parameters} -\label{control_param} -%------------------------------------------------------------------------------ - -Control parameters are set in an optional {\tt Control} array. -It is optional in the sense that if -a {\tt NULL} pointer is passed for the {\tt Control} input argument, -then default control parameters are used. -% -\begin{itemize} -\item {\tt Control[CAMD\_DENSE]} (or {\tt Control(1)} in MATLAB): -controls the threshold for ``dense'' -rows/columns. A dense row/column in $\m{A}+\m{A}\tr$ -can cause CAMD to spend significant time -in ordering the matrix. If {\tt Control[CAMD\_DENSE]} $\ge 0$, -rows/columns with -more than {\tt Control[CAMD\_DENSE]} $\sqrt{n}$ entries are ignored during -the ordering, and placed last in the output order. The default -value of {\tt Control[CAMD\_DENSE]} is 10. If negative, no rows/columns -are treated as ``dense.'' Rows/columns with 16 or fewer off-diagonal -entries are never considered ``dense.'' -% -\item {\tt Control[CAMD\_AGGRESSIVE]} (or {\tt Control(2)} in MATLAB): -controls whether or not to use -aggressive absorption, in which a prior element is absorbed into the current -element if it is a subset of the current element, even if it is not -adjacent to the current pivot element (refer -to \cite{AmestoyDavisDuff96,AmestoyDavisDuff04} -for more details). The default value is nonzero, -which means that aggressive absorption will be performed. This nearly always -leads to a better ordering (because the approximate degrees are more -accurate) and a lower execution time. There are cases where it can -lead to a slightly worse ordering, however. To turn it off, set -{\tt Control[CAMD\_AGGRESSIVE]} to 0. -% -\end{itemize} - -Statistics are returned in the {\tt Info} array -(if {\tt Info} is {\tt NULL}, then no statistics are returned). -Refer to {\tt camd.h} file, for more details -(14 different statistics are returned, so the list is not included here). - -%------------------------------------------------------------------------------ -\subsection{Sample C program} -%------------------------------------------------------------------------------ - -The following program, {\tt camd\_demo.c}, illustrates the basic use of CAMD. -See Section~\ref{Synopsis} for a short description -of each calling sequence. - -{\footnotesize -\begin{verbatim} -#include -#include "camd.h" - -int n = 5 ; -int Ap [ ] = { 0, 2, 6, 10, 12, 14} ; -int Ai [ ] = { 0,1, 0,1,2,4, 1,2,3,4, 2,3, 1,4 } ; -int C [ ] = { 2, 0, 0, 0, 1 } ; -int P [5] ; - -int main (void) -{ - int k ; - (void) camd_order (n, Ap, Ai, P, (double *) NULL, (double *) NULL, C) ; - for (k = 0 ; k < n ; k++) printf ("P [%d] = %d\n", k, P [k]) ; - return (0) ; -} - -\end{verbatim} -} - -The {\tt Ap} and {\tt Ai} arrays represent the binary matrix -\[ -\m{A} = \left[ -\begin{array}{rrrrr} - 1 & 1 & 0 & 0 & 0 \\ - 1 & 1 & 1 & 0 & 1 \\ - 0 & 1 & 1 & 1 & 0 \\ - 0 & 0 & 1 & 1 & 0 \\ - 0 & 1 & 1 & 0 & 1 \\ -\end{array} -\right]. -\] -The diagonal entries are ignored. -% -CAMD constructs the pattern of $\m{A}+\m{A}\tr$, -and returns a permutation vector of $(3, 2, 1, 4, 0)$. -Note that nodes 1, 2, and 3 appear first (they are in the constraint set 0), -node 4 appears next (since {\tt C[4] = 1}), and node 0 appears last. -% -Since the matrix is unsymmetric but with a mostly symmetric nonzero -pattern, this would be a suitable permutation for an LU factorization of a -matrix with this nonzero pattern and whose diagonal entries are not too small. -The program uses default control settings and does not return any statistics -about the ordering, factorization, or solution ({\tt Control} and {\tt Info} -are both {\tt (double *) NULL}). It also ignores the status value returned by -{\tt camd\_order}. - -More example programs are included with the CAMD package. -The {\tt camd\_demo.c} program provides a more detailed demo of CAMD. -Another example is the CAMD mexFunction, {\tt camd\_mex.c}. - -%------------------------------------------------------------------------------ -\subsection{A note about zero-sized arrays} -%------------------------------------------------------------------------------ - -CAMD uses several user-provided arrays of size {\tt n} or {\tt nz}. -Either {\tt n} or {\tt nz} can be zero. -If you attempt to {\tt malloc} an array of size zero, -however, {\tt malloc} will return a null pointer which CAMD will report -as invalid. If you {\tt malloc} an array of -size {\tt n} or {\tt nz} to pass to CAMD, make sure that you handle the -{\tt n} = 0 and {\tt nz = 0} cases correctly. - -%------------------------------------------------------------------------------ -\section{Synopsis of C-callable routines} -\label{Synopsis} -%------------------------------------------------------------------------------ - -The matrix $\m{A}$ is {\tt n}-by-{\tt n} with {\tt nz} entries. - -{\footnotesize -\begin{verbatim} -#include "camd.h" -int n, status, Ap [n+1], Ai [nz], P [n], C [n] ; -double Control [CAMD_CONTROL], Info [CAMD_INFO] ; -camd_defaults (Control) ; -status = camd_order (n, Ap, Ai, P, Control, Info, C) ; -camd_control (Control) ; -camd_info (Info) ; -status = camd_valid (n, n, Ap, Ai) ; -\end{verbatim} -} - -The {\tt camd\_l\_*} routines are identical, except that all {\tt int} -arguments become {\tt long}: - -{\footnotesize -\begin{verbatim} -#include "camd.h" -long n, status, Ap [n+1], Ai [nz], P [n], C [n] ; -double Control [CAMD_CONTROL], Info [CAMD_INFO] ; -camd_l_defaults (Control) ; -status = camd_l_order (n, Ap, Ai, P, Control, Info, C) ; -camd_l_control (Control) ; -camd_l_info (Info) ; -status = camd_l_valid (n, n, Ap, Ai) ; -\end{verbatim} -} - -%------------------------------------------------------------------------------ -\section{Installation} -\label{Install} -%------------------------------------------------------------------------------ - -The following discussion assumes you have the {\tt make} program, either in -Unix, or in Windows with Cygwin. - -System-dependent configurations are in the -{\tt ../SuiteSparse\_config/SuiteSparse\_config.mk} -file. You can edit that file to customize the compilation. The default -settings will work on most systems. -Sample configuration files are provided -for Mac, Linux, Sun Solaris, and IBM AIX. -The system you are on is detected automatically. - -To compile and install the C-callable CAMD library, -go to the {\tt CAMD} directory and type {\tt make}. -A dynamic library is placed in -in {\tt AMD/Lib/libcamd.so.*}, ({\tt *.dylib} for the Mac). -Three demo programs of the AMD ordering routine will be compiled and tested in -the {\tt CAMD/Demo} directory. -The outputs of these demo programs will then be compared with output -files in the distribution. - -Typing {\tt make clean} will remove all but the final compiled libraries -and demo programs. Typing {\tt make purge} or {\tt make distclean} -removes all files not in the original distribution. -If you compile CAMD and then later change the -{\tt ../SuiteSparse\_config/SuiteSparse\_config.mk} file -then you should type {\tt make purge} and then {\tt make} to recompile. - -When you compile your program that uses the C-callable CAMD library, -you need to add the {\tt CAMD/Lib/libcamd.*} library -and you need to tell your compiler to look in the -{\tt CAMD/Include} directory for include -files. -See {\tt CAMD/Demo/Makefile} for an example. - -By doing {\tt make}, all compiled dynamic libraries are also copied into {\tt -SuiteSparse/lib} the include files are coped into {\tt SuiteSparse/include}, -and documentation is copied into {\tt SuiteSparse/doc}. - -Alternatively, you can install the shared library -and include files in /usr/local/lib and /usr/local/include, and -the documenation in /usr/local/doc. -Just do {\tt make} then {\tt make install}. -Now you can simply use {\tt -lcamd} when you compile your own program. - -If all you want to use is the CAMD mexFunction in MATLAB, you can skip -the use of the {\tt make} command entirely. Simply type -{\tt camd\_make} in MATLAB while in the {\tt CAMD/MATLAB} directory. -This works on any system with MATLAB, including Windows. -Alternately, type {\tt make} in the {\tt CAMD/MATLAB} directory. - -If you are including CAMD as a subset of a larger library and do not want -to link the C standard I/O library, or if you simply do not need to use -them, you can safely remove the {\tt camd\_control.c} and {\tt camd\_info.c} -files. Similarly, if you use default parameters (or define your -own {\tt Control} array), then you can exclude the {\tt camd\_defaults.c} -file. -Each of these files contains the user-callable routines of the same -name. None of these auxiliary routines are directly called by -{\tt camd\_order}. -The {\tt camd\_dump.c} file contains debugging routines -that are neither used nor compiled unless debugging is enabled. -The {\tt camd\_internal.h} file must be edited to enable debugging; -refer to the instructions in that file. -The bare minimum files required to use just {\tt camd\_order} are -{\tt camd.h} and {\tt camd\_internal.h} -in the {\tt Include} directory, -and -{\tt camd\_1.c}, -{\tt camd\_2.c}, -{\tt camd\_aat.c}, -{\tt camd\_global.c}, -{\tt and\_order.c}, -{\tt camd\_postorder.c}, -{\tt camd\_preprocess.c}, -and -{\tt camd\_valid.c} -in the {\tt Source} directory. - -%------------------------------------------------------------------------------ -\newpage -\section{The CAMD routines} -\label{Primary} -%------------------------------------------------------------------------------ - -The file {\tt CAMD/Include/camd.h} listed below -describes each user-callable routine in CAMD, -and gives details on their use. - -{\footnotesize -\input{camd_h.tex} -} - -%------------------------------------------------------------------------------ -\newpage -% References -%------------------------------------------------------------------------------ - -\bibliographystyle{plain} -\bibliography{CAMD_UserGuide} - -\end{document} diff --git a/ThirdParty/SuiteSparse/CAMD/Doc/ChangeLog b/ThirdParty/SuiteSparse/CAMD/Doc/ChangeLog deleted file mode 100644 index 3309a935b2..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Doc/ChangeLog +++ /dev/null @@ -1,107 +0,0 @@ -May 4, 2016: version 2.4.6 - - * minor changes to Makefile - -Apr 1, 2016: version 2.4.5 - - * licensing simplified (no other change); refer to CAMD/Doc/License.txt - -Feb 1, 2016: version 2.4.4 - - * update to Makefiles - -Jan 30, 2016: version 2.4.3 - - * modifications to Makefiles - -Jan 1, 2016: version 2.4.2 - - * modified Makefile to create shared libraries - No change to C code except version number - -Oct 10, 2014: version 2.4.1 - - modified MATLAB/camd_make.m. No change to C code except version number. - -July 31, 2013: version 2.4.0 - - * changed malloc and printf pointers to use SuiteSparse_config - -Jun 20, 2012: verison 2.3.1 - - * minor update for Windows (removed filesep) - -Jun 1, 2012: version 2.3.0 - - * changed from UFconfig to SuiteSparse_config - -May 15, 2012: version 2.2.4 - - * minor fix to SIZE_T_MAX definition (finicky compiler workaround) - -Dec 7, 2011: version 2.2.3 - - * fixed the Makefile to better align with CFLAGS and other standards - -Jan 25, 2011: version 2.2.2 - - * minor fix to "make install" - -Nov 30, 2009: version 2.2.1 - - * added "make install" and "make uninstall" - -May 31, 2007: version 2.2.0 - - * port to 64-bit MATLAB - - * Makefile moved from Source/ to Lib/ - -Dec 12, 2006, v2.1.3 - - * minor MATLAB cleanup - -Sept 28, 2006, v2.1.2 - - * #define SIZE_T_MAX not done if already defined (Mac OSX). - -Aug 31, 2006: v2.1.1 - - * trivial change to comments in camd.m - -June 27, 2006: CAMD Version 2.1 - - * bug fix. Ordering constraints not always met if dense and/or empty - nodes are present in the matrix. - -Apr. 30, 2006: CAMD Version 2.0 - - * CAMD released, based on AMD v2.0. To compare the two codes, type the - command ./docdiff in this directory (the "CAMD" and "camd" strings - are replaced with "AMD" and "amd" when the two packages are compared, - to make more evident the substantive differences between the packages). - - Primary differences with AMD v2.0: - - CAMD adds the ability to order the matrix with constraints. Each - node i in the graph (row/column i in the matrix) has a constraint, - C[i], which is in the range 0 to n-1. All nodes with C[i] = 0 are - ordered first, followed by all nodes with constraint 1, and so on. - That is, C[P[k]] is monotonically non-decreasing as k varies from 0 - to n-1. camd_order has an additional C parameter; if NULL, no - constraints are used (the ordering will be similar to AMD's ordering). - The optional C parameter is also added to the MATLAB interface, - p = camd (A,Control,C). - - Since the C parameter is optional, CAMD can replace AMD in any - application that uses AMD. Just pass C = NULL (or omit C in the MATLAB - interface). There is no Fortran version of CAMD, however. - - The postordering is different, and there is no camd_post_tree.c file. - - A new routine, camd_cvalid, has been added to check the validity of C. - - CAMD requires more workspace than AMD (n+1 integers). - - All user-visible names AMD* and amd* replaced with CAMD* and camd*. - diff --git a/ThirdParty/SuiteSparse/CAMD/Doc/License.txt b/ThirdParty/SuiteSparse/CAMD/Doc/License.txt deleted file mode 100644 index 5329cec2b3..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Doc/License.txt +++ /dev/null @@ -1,35 +0,0 @@ -CAMD, Copyright (c) by Timothy A. Davis, -Yanqing Chen, -Patrick R. Amestoy, and Iain S. Duff. All Rights Reserved. -CAMD is available under alternate licenses, contact T. Davis for details. - -CAMD License: BSD 3-clause - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the organizations to which the authors are - affiliated, nor the names of its contributors may be used to endorse - or promote products derived from this software without specific prior - written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR - SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER - CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. - -Availability: - - http://www.suitesparse.com - diff --git a/ThirdParty/SuiteSparse/CAMD/Doc/Makefile b/ThirdParty/SuiteSparse/CAMD/Doc/Makefile deleted file mode 100644 index 8d177e61e2..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Doc/Makefile +++ /dev/null @@ -1,37 +0,0 @@ -#------------------------------------------------------------------------------ -# CAMD Makefile for compiling on Unix systems -#------------------------------------------------------------------------------ - -default: dist - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -#------------------------------------------------------------------------------ -# Remove all but the files in the original distribution -#------------------------------------------------------------------------------ - -clean: - - $(RM) -r camd_temp $(CLEAN) - -purge: distclean - -distclean: clean - - $(RM) -r $(PURGE) - -#------------------------------------------------------------------------------ -# Create the User Guide and Quick Start Guide -#------------------------------------------------------------------------------ - -CAMD_UserGuide.pdf: CAMD_UserGuide.tex CAMD_UserGuide.bib ../Include/camd.h - echo '\\begin{verbatim}' > camd_h.tex - expand -8 ../Include/camd.h >> camd_h.tex - echo '\\end{verbatim}' >> camd_h.tex - pdflatex CAMD_UserGuide - bibtex CAMD_UserGuide - pdflatex CAMD_UserGuide - pdflatex CAMD_UserGuide - -dist: CAMD_UserGuide.pdf - - $(RM) *.aux *.bbl *.blg *.log *.toc camd_h.tex - - $(RM) camd_temp - diff --git a/ThirdParty/SuiteSparse/CAMD/Doc/camd.sed b/ThirdParty/SuiteSparse/CAMD/Doc/camd.sed deleted file mode 100644 index 877e3f068f..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Doc/camd.sed +++ /dev/null @@ -1,2 +0,0 @@ -s/CAMD/AMD/g -s/camd/amd/g diff --git a/ThirdParty/SuiteSparse/CAMD/Doc/cdiff b/ThirdParty/SuiteSparse/CAMD/Doc/cdiff deleted file mode 100755 index 7d477e2132..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Doc/cdiff +++ /dev/null @@ -1,4 +0,0 @@ -# -echo diff $1 $2 -sed -f camd.sed < $1 > camd_temp -diff camd_temp $2 diff --git a/ThirdParty/SuiteSparse/CAMD/Doc/docdiff b/ThirdParty/SuiteSparse/CAMD/Doc/docdiff deleted file mode 100755 index 539522c353..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Doc/docdiff +++ /dev/null @@ -1,35 +0,0 @@ -./cdiff ../Demo/camd_demo2.c ../../AMD/Demo/amd_demo2.c -./cdiff ../Demo/camd_demo.c ../../AMD/Demo/amd_demo.c -./cdiff ../Demo/camd_l_demo.c ../../AMD/Demo/amd_l_demo.c -./cdiff ../Demo/camd_simple.c ../../AMD/Demo/amd_simple.c -./cdiff ../Demo/Makefile ../../AMD/Demo/Makefile -./cdiff ../Doc/CAMD_UserGuide.bib ../../AMD/Doc/AMD_UserGuide.bib -./cdiff ../Doc/CAMD_UserGuide.tex ../../AMD/Doc/AMD_UserGuide.tex -./cdiff ../Doc/License.txt ../../AMD/Doc/License.txt -./cdiff ../Doc/Makefile ../../AMD/Doc/Makefile -./cdiff ../Include/camd.h ../../AMD/Include/amd.h -./cdiff ../Include/camd_internal.h ../../AMD/Include/amd_internal.h -./cdiff ../Lib/libcamd.def ../../AMD/Lib/libamd.def -./cdiff ../MATLAB/camd_demo.m ../../AMD/MATLAB/amd_demo.m -./cdiff ../MATLAB/camd.m ../../AMD/MATLAB/amd2.m -./cdiff ../MATLAB/camd_make.m ../../AMD/MATLAB/amd_make.m -./cdiff ../MATLAB/camd_mex.c ../../AMD/MATLAB/amd_mex.c -./cdiff ../MATLAB/can_24 ../../AMD/MATLAB/can_24 -./cdiff ../MATLAB/Contents.m ../../AMD/MATLAB/Contents.m -./cdiff ../MATLAB/Makefile ../../AMD/MATLAB/Makefile -./cdiff ../Source/camd_1.c ../../AMD/Source/amd_1.c -./cdiff ../Source/camd_2.c ../../AMD/Source/amd_2.c -./cdiff ../Source/camd_aat.c ../../AMD/Source/amd_aat.c -./cdiff ../Source/camd_control.c ../../AMD/Source/amd_control.c -./cdiff ../Source/camd_defaults.c ../../AMD/Source/amd_defaults.c -./cdiff ../Source/camd_dump.c ../../AMD/Source/amd_dump.c -./cdiff ../Source/camd_global.c ../../AMD/Source/amd_global.c -./cdiff ../Source/camd_info.c ../../AMD/Source/amd_info.c -./cdiff ../Source/camd_order.c ../../AMD/Source/amd_order.c -./cdiff ../Source/camd_postorder.c ../../AMD/Source/amd_postorder.c -# ./cdiff ../Source/camd_post_tree.c ../../AMD/Source/amd_post_tree.c -./cdiff ../Source/camd_preprocess.c ../../AMD/Source/amd_preprocess.c -./cdiff ../Source/camd_valid.c ../../AMD/Source/amd_valid.c -./cdiff ../Source/Makefile ../../AMD/Source/Makefile -./cdiff ../Makefile ../../AMD/Makefile -./cdiff ../README.txt ../../AMD/README.txt diff --git a/ThirdParty/SuiteSparse/CAMD/Doc/lesser.txt b/ThirdParty/SuiteSparse/CAMD/Doc/lesser.txt deleted file mode 100644 index 8add30ad59..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Doc/lesser.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/ThirdParty/SuiteSparse/CAMD/Include/camd.h b/ThirdParty/SuiteSparse/CAMD/Include/camd.h deleted file mode 100644 index 21898e0172..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Include/camd.h +++ /dev/null @@ -1,407 +0,0 @@ -/* ========================================================================= */ -/* === CAMD: approximate minimum degree ordering ========================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD Version 2.4, Copyright (c) 2013 by Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* CAMD finds a symmetric ordering P of a matrix A so that the Cholesky - * factorization of P*A*P' has fewer nonzeros and takes less work than the - * Cholesky factorization of A. If A is not symmetric, then it performs its - * ordering on the matrix A+A'. Two sets of user-callable routines are - * provided, one for int integers and the other for SuiteSparse_long integers. - * - * The method is based on the approximate minimum degree algorithm, discussed - * in Amestoy, Davis, and Duff, "An approximate degree ordering algorithm", - * SIAM Journal of Matrix Analysis and Applications, vol. 17, no. 4, pp. - * 886-905, 1996. - */ - -#ifndef CAMD_H -#define CAMD_H - -/* make it easy for C++ programs to include CAMD */ -#ifdef __cplusplus -extern "C" { -#endif - -/* get the definition of size_t: */ -#include - -#include "SuiteSparse_config.h" - -int camd_order /* returns CAMD_OK, CAMD_OK_BUT_JUMBLED, - * CAMD_INVALID, or CAMD_OUT_OF_MEMORY */ -( - int n, /* A is n-by-n. n must be >= 0. */ - const int Ap [ ], /* column pointers for A, of size n+1 */ - const int Ai [ ], /* row indices of A, of size nz = Ap [n] */ - int P [ ], /* output permutation, of size n */ - double Control [ ], /* input Control settings, of size CAMD_CONTROL */ - double Info [ ], /* output Info statistics, of size CAMD_INFO */ - const int C [ ] /* Constraint set of A, of size n; can be NULL */ -) ; - -SuiteSparse_long camd_l_order /* see above for description of arguments */ -( - SuiteSparse_long n, - const SuiteSparse_long Ap [ ], - const SuiteSparse_long Ai [ ], - SuiteSparse_long P [ ], - double Control [ ], - double Info [ ], - const SuiteSparse_long C [ ] -) ; - -/* Input arguments (not modified): - * - * n: the matrix A is n-by-n. - * Ap: an int/SuiteSparse_long array of size n+1, containing column - * pointers of A. - * Ai: an int/SuiteSparse_long array of size nz, containing the row - * indices of A, where nz = Ap [n]. - * Control: a double array of size CAMD_CONTROL, containing control - * parameters. Defaults are used if Control is NULL. - * - * Output arguments (not defined on input): - * - * P: an int/SuiteSparse_long array of size n, containing the output - * permutation. If row i is the kth pivot row, then P [k] = i. In - * MATLAB notation, the reordered matrix is A (P,P). - * Info: a double array of size CAMD_INFO, containing statistical - * information. Ignored if Info is NULL. - * - * On input, the matrix A is stored in column-oriented form. The row indices - * of nonzero entries in column j are stored in Ai [Ap [j] ... Ap [j+1]-1]. - * - * If the row indices appear in ascending order in each column, and there - * are no duplicate entries, then camd_order is slightly more efficient in - * terms of time and memory usage. If this condition does not hold, a copy - * of the matrix is created (where these conditions do hold), and the copy is - * ordered. - * - * Row indices must be in the range 0 to - * n-1. Ap [0] must be zero, and thus nz = Ap [n] is the number of nonzeros - * in A. The array Ap is of size n+1, and the array Ai is of size nz = Ap [n]. - * The matrix does not need to be symmetric, and the diagonal does not need to - * be present (if diagonal entries are present, they are ignored except for - * the output statistic Info [CAMD_NZDIAG]). The arrays Ai and Ap are not - * modified. This form of the Ap and Ai arrays to represent the nonzero - * pattern of the matrix A is the same as that used internally by MATLAB. - * If you wish to use a more flexible input structure, please see the - * umfpack_*_triplet_to_col routines in the UMFPACK package, at - * http://www.suitesparse.com. - * - * Restrictions: n >= 0. Ap [0] = 0. Ap [j] <= Ap [j+1] for all j in the - * range 0 to n-1. nz = Ap [n] >= 0. Ai [0..nz-1] must be in the range 0 - * to n-1. Finally, Ai, Ap, and P must not be NULL. If any of these - * restrictions are not met, CAMD returns CAMD_INVALID. - * - * CAMD returns: - * - * CAMD_OK if the matrix is valid and sufficient memory can be allocated to - * perform the ordering. - * - * CAMD_OUT_OF_MEMORY if not enough memory can be allocated. - * - * CAMD_INVALID if the input arguments n, Ap, Ai are invalid, or if P is - * NULL. - * - * CAMD_OK_BUT_JUMBLED if the matrix had unsorted columns, and/or duplicate - * entries, but was otherwise valid. - * - * The CAMD routine first forms the pattern of the matrix A+A', and then - * computes a fill-reducing ordering, P. If P [k] = i, then row/column i of - * the original is the kth pivotal row. In MATLAB notation, the permuted - * matrix is A (P,P), except that 0-based indexing is used instead of the - * 1-based indexing in MATLAB. - * - * The Control array is used to set various parameters for CAMD. If a NULL - * pointer is passed, default values are used. The Control array is not - * modified. - * - * Control [CAMD_DENSE]: controls the threshold for "dense" rows/columns. - * A dense row/column in A+A' can cause CAMD to spend a lot of time in - * ordering the matrix. If Control [CAMD_DENSE] >= 0, rows/columns - * with more than Control [CAMD_DENSE] * sqrt (n) entries are ignored - * during the ordering, and placed last in the output order. The - * default value of Control [CAMD_DENSE] is 10. If negative, no - * rows/columns are treated as "dense". Rows/columns with 16 or - * fewer off-diagonal entries are never considered "dense". - * - * Control [CAMD_AGGRESSIVE]: controls whether or not to use aggressive - * absorption, in which a prior element is absorbed into the current - * element if is a subset of the current element, even if it is not - * adjacent to the current pivot element (refer to Amestoy, Davis, - * & Duff, 1996, for more details). The default value is nonzero, - * which means to perform aggressive absorption. This nearly always - * leads to a better ordering (because the approximate degrees are - * more accurate) and a lower execution time. There are cases where - * it can lead to a slightly worse ordering, however. To turn it off, - * set Control [CAMD_AGGRESSIVE] to 0. - * - * Control [2..4] are not used in the current version, but may be used in - * future versions. - * - * The Info array provides statistics about the ordering on output. If it is - * not present, the statistics are not returned. This is not an error - * condition. - * - * Info [CAMD_STATUS]: the return value of CAMD, either CAMD_OK, - * CAMD_OK_BUT_JUMBLED, CAMD_OUT_OF_MEMORY, or CAMD_INVALID. - * - * Info [CAMD_N]: n, the size of the input matrix - * - * Info [CAMD_NZ]: the number of nonzeros in A, nz = Ap [n] - * - * Info [CAMD_SYMMETRY]: the symmetry of the matrix A. It is the number - * of "matched" off-diagonal entries divided by the total number of - * off-diagonal entries. An entry A(i,j) is matched if A(j,i) is also - * an entry, for any pair (i,j) for which i != j. In MATLAB notation, - * S = spones (A) ; - * B = tril (S, -1) + triu (S, 1) ; - * symmetry = nnz (B & B') / nnz (B) ; - * - * Info [CAMD_NZDIAG]: the number of entries on the diagonal of A. - * - * Info [CAMD_NZ_A_PLUS_AT]: the number of nonzeros in A+A', excluding the - * diagonal. If A is perfectly symmetric (Info [CAMD_SYMMETRY] = 1) - * with a fully nonzero diagonal, then Info [CAMD_NZ_A_PLUS_AT] = nz-n - * (the smallest possible value). If A is perfectly unsymmetric - * (Info [CAMD_SYMMETRY] = 0, for an upper triangular matrix, for - * example) with no diagonal, then Info [CAMD_NZ_A_PLUS_AT] = 2*nz - * (the largest possible value). - * - * Info [CAMD_NDENSE]: the number of "dense" rows/columns of A+A' that were - * removed from A prior to ordering. These are placed last in the - * output order P. - * - * Info [CAMD_MEMORY]: the amount of memory used by CAMD, in bytes. In the - * current version, this is 1.2 * Info [CAMD_NZ_A_PLUS_AT] + 9*n - * times the size of an integer. This is at most 2.4nz + 9n. This - * excludes the size of the input arguments Ai, Ap, and P, which have - * a total size of nz + 2*n + 1 integers. - * - * Info [CAMD_NCMPA]: the number of garbage collections performed. - * - * Info [CAMD_LNZ]: the number of nonzeros in L (excluding the diagonal). - * This is a slight upper bound because mass elimination is combined - * with the approximate degree update. It is a rough upper bound if - * there are many "dense" rows/columns. The rest of the statistics, - * below, are also slight or rough upper bounds, for the same reasons. - * The post-ordering of the assembly tree might also not exactly - * correspond to a true elimination tree postordering. - * - * Info [CAMD_NDIV]: the number of divide operations for a subsequent LDL' - * or LU factorization of the permuted matrix A (P,P). - * - * Info [CAMD_NMULTSUBS_LDL]: the number of multiply-subtract pairs for a - * subsequent LDL' factorization of A (P,P). - * - * Info [CAMD_NMULTSUBS_LU]: the number of multiply-subtract pairs for a - * subsequent LU factorization of A (P,P), assuming that no numerical - * pivoting is required. - * - * Info [CAMD_DMAX]: the maximum number of nonzeros in any column of L, - * including the diagonal. - * - * Info [14..19] are not used in the current version, but may be used in - * future versions. - */ - -/* ------------------------------------------------------------------------- */ -/* direct interface to CAMD */ -/* ------------------------------------------------------------------------- */ - -/* camd_2 is the primary CAMD ordering routine. It is not meant to be - * user-callable because of its restrictive inputs and because it destroys - * the user's input matrix. It does not check its inputs for errors, either. - * However, if you can work with these restrictions it can be faster than - * camd_order and use less memory (assuming that you can create your own copy - * of the matrix for CAMD to destroy). Refer to CAMD/Source/camd_2.c for a - * description of each parameter. */ - -void camd_2 -( - int n, - int Pe [ ], - int Iw [ ], - int Len [ ], - int iwlen, - int pfree, - int Nv [ ], - int Next [ ], - int Last [ ], - int Head [ ], - int Elen [ ], - int Degree [ ], - int W [ ], - double Control [ ], - double Info [ ], - const int C [ ], - int BucketSet [ ] -) ; - -void camd_l2 -( - SuiteSparse_long n, - SuiteSparse_long Pe [ ], - SuiteSparse_long Iw [ ], - SuiteSparse_long Len [ ], - SuiteSparse_long iwlen, - SuiteSparse_long pfree, - SuiteSparse_long Nv [ ], - SuiteSparse_long Next [ ], - SuiteSparse_long Last [ ], - SuiteSparse_long Head [ ], - SuiteSparse_long Elen [ ], - SuiteSparse_long Degree [ ], - SuiteSparse_long W [ ], - double Control [ ], - double Info [ ], - const SuiteSparse_long C [ ], - SuiteSparse_long BucketSet [ ] - -) ; - -/* ------------------------------------------------------------------------- */ -/* camd_valid */ -/* ------------------------------------------------------------------------- */ - -/* Returns CAMD_OK or CAMD_OK_BUT_JUMBLED if the matrix is valid as input to - * camd_order; the latter is returned if the matrix has unsorted and/or - * duplicate row indices in one or more columns. Returns CAMD_INVALID if the - * matrix cannot be passed to camd_order. For camd_order, the matrix must also - * be square. The first two arguments are the number of rows and the number - * of columns of the matrix. For its use in CAMD, these must both equal n. - */ - -int camd_valid -( - int n_row, /* # of rows */ - int n_col, /* # of columns */ - const int Ap [ ], /* column pointers, of size n_col+1 */ - const int Ai [ ] /* row indices, of size Ap [n_col] */ -) ; - -SuiteSparse_long camd_l_valid -( - SuiteSparse_long n_row, - SuiteSparse_long n_col, - const SuiteSparse_long Ap [ ], - const SuiteSparse_long Ai [ ] -) ; - -/* ------------------------------------------------------------------------- */ -/* camd_cvalid */ -/* ------------------------------------------------------------------------- */ - -/* Returns TRUE if the constraint set is valid as input to camd_order, - * FALSE otherwise. */ - -int camd_cvalid -( - int n, - const int C [ ] -) ; - -SuiteSparse_long camd_l_cvalid -( - SuiteSparse_long n, - const SuiteSparse_long C [ ] -) ; - -/* ------------------------------------------------------------------------- */ -/* CAMD memory manager and printf routines */ -/* ------------------------------------------------------------------------- */ - - /* moved to SuiteSparse_config.c */ - -/* ------------------------------------------------------------------------- */ -/* CAMD Control and Info arrays */ -/* ------------------------------------------------------------------------- */ - -/* camd_defaults: sets the default control settings */ -void camd_defaults (double Control [ ]) ; -void camd_l_defaults (double Control [ ]) ; - -/* camd_control: prints the control settings */ -void camd_control (double Control [ ]) ; -void camd_l_control (double Control [ ]) ; - -/* camd_info: prints the statistics */ -void camd_info (double Info [ ]) ; -void camd_l_info (double Info [ ]) ; - -#define CAMD_CONTROL 5 /* size of Control array */ -#define CAMD_INFO 20 /* size of Info array */ - -/* contents of Control */ -#define CAMD_DENSE 0 /* "dense" if degree > Control [0] * sqrt (n) */ -#define CAMD_AGGRESSIVE 1 /* do aggressive absorption if Control [1] != 0 */ - -/* default Control settings */ -#define CAMD_DEFAULT_DENSE 10.0 /* default "dense" degree 10*sqrt(n) */ -#define CAMD_DEFAULT_AGGRESSIVE 1 /* do aggressive absorption by default */ - -/* contents of Info */ -#define CAMD_STATUS 0 /* return value of camd_order and camd_l_order */ -#define CAMD_N 1 /* A is n-by-n */ -#define CAMD_NZ 2 /* number of nonzeros in A */ -#define CAMD_SYMMETRY 3 /* symmetry of pattern (1 is sym., 0 is unsym.) */ -#define CAMD_NZDIAG 4 /* # of entries on diagonal */ -#define CAMD_NZ_A_PLUS_AT 5 /* nz in A+A' */ -#define CAMD_NDENSE 6 /* number of "dense" rows/columns in A */ -#define CAMD_MEMORY 7 /* amount of memory used by CAMD */ -#define CAMD_NCMPA 8 /* number of garbage collections in CAMD */ -#define CAMD_LNZ 9 /* approx. nz in L, excluding the diagonal */ -#define CAMD_NDIV 10 /* number of fl. point divides for LU and LDL' */ -#define CAMD_NMULTSUBS_LDL 11 /* number of fl. point (*,-) pairs for LDL' */ -#define CAMD_NMULTSUBS_LU 12 /* number of fl. point (*,-) pairs for LU */ -#define CAMD_DMAX 13 /* max nz. in any column of L, incl. diagonal */ - -/* ------------------------------------------------------------------------- */ -/* return values of CAMD */ -/* ------------------------------------------------------------------------- */ - -#define CAMD_OK 0 /* success */ -#define CAMD_OUT_OF_MEMORY -1 /* malloc failed, or problem too large */ -#define CAMD_INVALID -2 /* input arguments are not valid */ -#define CAMD_OK_BUT_JUMBLED 1 /* input matrix is OK for camd_order, but - * columns were not sorted, and/or duplicate entries were present. CAMD had - * to do extra work before ordering the matrix. This is a warning, not an - * error. */ - -/* ========================================================================== */ -/* === CAMD version ========================================================= */ -/* ========================================================================== */ - -/* - * As an example, to test if the version you are using is 1.2 or later: - * - * if (CAMD_VERSION >= CAMD_VERSION_CODE (1,2)) ... - * - * This also works during compile-time: - * - * #if (CAMD_VERSION >= CAMD_VERSION_CODE (1,2)) - * printf ("This is version 1.2 or later\n") ; - * #else - * printf ("This is an early version\n") ; - * #endif - */ - -#define CAMD_DATE "May 4, 2016" -#define CAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) -#define CAMD_MAIN_VERSION 2 -#define CAMD_SUB_VERSION 4 -#define CAMD_SUBSUB_VERSION 6 -#define CAMD_VERSION CAMD_VERSION_CODE(CAMD_MAIN_VERSION,CAMD_SUB_VERSION) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ThirdParty/SuiteSparse/CAMD/Include/camd_internal.h b/ThirdParty/SuiteSparse/CAMD/Include/camd_internal.h deleted file mode 100644 index fddae6e96a..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Include/camd_internal.h +++ /dev/null @@ -1,321 +0,0 @@ -/* ========================================================================= */ -/* === camd_internal.h ===================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* This file is for internal use in CAMD itself, and does not normally need to - * be included in user code (it is included in UMFPACK, however). All others - * should use camd.h instead. - */ - -/* ========================================================================= */ -/* === NDEBUG ============================================================== */ -/* ========================================================================= */ - -/* - * Turning on debugging takes some work (see below). If you do not edit this - * file, then debugging is always turned off, regardless of whether or not - * -DNDEBUG is specified in your compiler options. - * - * If CAMD is being compiled as a mexFunction, then MATLAB_MEX_FILE is defined, - * and mxAssert is used instead of assert. If debugging is not enabled, no - * MATLAB include files or functions are used. Thus, the CAMD library libcamd.a - * can be safely used in either a stand-alone C program or in another - * mexFunction, without any change. - */ - -/* - CAMD will be exceedingly slow when running in debug mode. The next three - lines ensure that debugging is turned off. -*/ -#ifndef NDEBUG -#define NDEBUG -#endif - -/* - To enable debugging, uncomment the following line: -#undef NDEBUG -*/ - - -/* ------------------------------------------------------------------------- */ -/* ANSI include files */ -/* ------------------------------------------------------------------------- */ - -/* from stdlib.h: size_t, malloc, free, realloc, and calloc */ -#include - -#if !defined(NPRINT) || !defined(NDEBUG) -/* from stdio.h: printf. Not included if NPRINT is defined at compile time. - * fopen and fscanf are used when debugging. */ -#include -#endif - -/* from limits.h: INT_MAX and LONG_MAX */ -#include - -/* from math.h: sqrt */ -#include - -/* ------------------------------------------------------------------------- */ -/* MATLAB include files (only if being used in or via MATLAB) */ -/* ------------------------------------------------------------------------- */ - -#ifdef MATLAB_MEX_FILE -#include "matrix.h" -#include "mex.h" -#endif - -/* ------------------------------------------------------------------------- */ -/* basic definitions */ -/* ------------------------------------------------------------------------- */ - -#ifdef FLIP -#undef FLIP -#endif - -#ifdef MAX -#undef MAX -#endif - -#ifdef MIN -#undef MIN -#endif - -#ifdef EMPTY -#undef EMPTY -#endif - -#ifdef GLOBAL -#undef GLOBAL -#endif - -#ifdef PRIVATE -#undef PRIVATE -#endif - -/* FLIP is a "negation about -1", and is used to mark an integer i that is - * normally non-negative. FLIP (EMPTY) is EMPTY. FLIP of a number > EMPTY - * is negative, and FLIP of a number < EMTPY is positive. FLIP (FLIP (i)) = i - * for all integers i. UNFLIP (i) is >= EMPTY. */ -#define EMPTY (-1) -#define FLIP(i) (-(i)-2) -#define UNFLIP(i) ((i < EMPTY) ? FLIP (i) : (i)) - -/* for integer MAX/MIN, or for doubles when we don't care how NaN's behave: */ -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) - -/* logical expression of p implies q: */ -#define IMPLIES(p,q) (!(p) || (q)) - -/* Note that the IBM RS 6000 xlc predefines TRUE and FALSE in . */ -/* The Compaq Alpha also predefines TRUE and FALSE. */ -#ifdef TRUE -#undef TRUE -#endif -#ifdef FALSE -#undef FALSE -#endif - -#define TRUE (1) -#define FALSE (0) -#define PRIVATE static -#define GLOBAL -#define EMPTY (-1) - -/* Note that Linux's gcc 2.96 defines NULL as ((void *) 0), but other */ -/* compilers (even gcc 2.95.2 on Solaris) define NULL as 0 or (0). We */ -/* need to use the ANSI standard value of 0. */ -#ifdef NULL -#undef NULL -#endif - -#define NULL 0 - -/* largest value of size_t */ -#ifndef SIZE_T_MAX -#ifdef SIZE_MAX -/* C99 only */ -#define SIZE_T_MAX SIZE_MAX -#else -#define SIZE_T_MAX ((size_t) (-1)) -#endif -#endif - -/* ------------------------------------------------------------------------- */ -/* integer type for CAMD: int or SuiteSparse_long */ -/* ------------------------------------------------------------------------- */ - -#include "camd.h" - -#if defined (DLONG) || defined (ZLONG) - -#define Int SuiteSparse_long -#define ID SuiteSparse_long_id -#define Int_MAX SuiteSparse_long_max - -#define UnsignedInt SuiteSparse_unsigned_long - -#define CAMD_order camd_l_order -#define CAMD_defaults camd_l_defaults -#define CAMD_control camd_l_control -#define CAMD_info camd_l_info -#define CAMD_1 camd_l1 -#define CAMD_2 camd_l2 -#define CAMD_valid camd_l_valid -#define CAMD_cvalid camd_l_cvalid -#define CAMD_aat camd_l_aat -#define CAMD_postorder camd_l_postorder -#define CAMD_post_tree camd_l_post_tree -#define CAMD_dump camd_l_dump -#define CAMD_debug camd_l_debug -#define CAMD_debug_init camd_l_debug_init -#define CAMD_preprocess camd_l_preprocess - -#else - -#define Int int -#define ID "%d" -#define Int_MAX INT_MAX - -#define UnsignedInt unsigned int - -#define CAMD_order camd_order -#define CAMD_defaults camd_defaults -#define CAMD_control camd_control -#define CAMD_info camd_info -#define CAMD_1 camd_1 -#define CAMD_2 camd_2 -#define CAMD_valid camd_valid -#define CAMD_cvalid camd_cvalid -#define CAMD_aat camd_aat -#define CAMD_postorder camd_postorder -#define CAMD_post_tree camd_post_tree -#define CAMD_dump camd_dump -#define CAMD_debug camd_debug -#define CAMD_debug_init camd_debug_init -#define CAMD_preprocess camd_preprocess - -#endif - -/* ------------------------------------------------------------------------- */ -/* CAMD routine definitions (not user-callable) */ -/* ------------------------------------------------------------------------- */ - -GLOBAL size_t CAMD_aat -( - Int n, - const Int Ap [ ], - const Int Ai [ ], - Int Len [ ], - Int Tp [ ], - double Info [ ] -) ; - -GLOBAL void CAMD_1 -( - Int n, - const Int Ap [ ], - const Int Ai [ ], - Int P [ ], - Int Pinv [ ], - Int Len [ ], - Int slen, - Int S [ ], - double Control [ ], - double Info [ ], - const Int C [ ] -) ; - -GLOBAL Int CAMD_postorder -( - Int j, Int k, Int n, Int head [], Int next [], Int post [], Int stack [] -) ; - -GLOBAL void CAMD_preprocess -( - Int n, - const Int Ap [ ], - const Int Ai [ ], - Int Rp [ ], - Int Ri [ ], - Int W [ ], - Int Flag [ ] -) ; - -/* ------------------------------------------------------------------------- */ -/* debugging definitions */ -/* ------------------------------------------------------------------------- */ - -#ifndef NDEBUG - -/* from assert.h: assert macro */ -#include - -#ifndef EXTERN -#define EXTERN extern -#endif - -EXTERN Int CAMD_debug ; - -GLOBAL void CAMD_debug_init ( char *s ) ; - -GLOBAL void CAMD_dump -( - Int n, - Int Pe [ ], - Int Iw [ ], - Int Len [ ], - Int iwlen, - Int pfree, - Int Nv [ ], - Int Next [ ], - Int Last [ ], - Int Head [ ], - Int Elen [ ], - Int Degree [ ], - Int W [ ], - Int nel, - Int BucketSet [], - const Int C [], - Int Curc -) ; - -#ifdef ASSERT -#undef ASSERT -#endif - -/* Use mxAssert if CAMD is compiled into a mexFunction */ -#ifdef MATLAB_MEX_FILE -#define ASSERT(expression) (mxAssert ((expression), "")) -#else -#define ASSERT(expression) (assert (expression)) -#endif - -#define CAMD_DEBUG0(params) { SUITESPARSE_PRINTF (params) ; } -#define CAMD_DEBUG1(params) \ - { if (CAMD_debug >= 1) SUITESPARSE_PRINTF (params) ; } -#define CAMD_DEBUG2(params) \ - { if (CAMD_debug >= 2) SUITESPARSE_PRINTF (params) ; } -#define CAMD_DEBUG3(params) \ - { if (CAMD_debug >= 3) SUITESPARSE_PRINTF (params) ; } -#define CAMD_DEBUG4(params) \ - { if (CAMD_debug >= 4) SUITESPARSE_PRINTF (params) ; } - -#else - -/* no debugging */ -#define ASSERT(expression) -#define CAMD_DEBUG0(params) -#define CAMD_DEBUG1(params) -#define CAMD_DEBUG2(params) -#define CAMD_DEBUG3(params) -#define CAMD_DEBUG4(params) - -#endif diff --git a/ThirdParty/SuiteSparse/CAMD/Lib/Makefile b/ThirdParty/SuiteSparse/CAMD/Lib/Makefile deleted file mode 100644 index b3ae159ef8..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Lib/Makefile +++ /dev/null @@ -1,102 +0,0 @@ -#------------------------------------------------------------------------------- -# CAMD Lib/Makefile -#------------------------------------------------------------------------------- - -LIBRARY = libcamd -VERSION = 2.4.6 -SO_VERSION = 2 - -default: library - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -# CAMD depends on SuiteSparse_config -LDLIBS += -lsuitesparseconfig - -# compile and install in SuiteSparse/lib -library: - $(MAKE) install INSTALL=$(SUITESPARSE) - -C = $(CC) $(CF) -I../Include -I../../SuiteSparse_config - -#------------------------------------------------------------------------------- -# source files -#------------------------------------------------------------------------------- - -CAMD = camd_aat camd_1 camd_2 camd_dump camd_postorder camd_defaults \ - camd_order camd_control camd_info camd_valid camd_preprocess - -INC = ../Include/camd.h ../Include/camd_internal.h \ - ../../SuiteSparse_config/SuiteSparse_config.h - -#------------------------------------------------------------------------------- -# object files for each version -#------------------------------------------------------------------------------- - -CAMDI = $(addsuffix .o, $(subst camd_,camd_i_,$(CAMD))) -CAMDL = $(addsuffix .o, $(subst camd_,camd_l_,$(CAMD))) -OBJ = $(CAMDI) $(CAMDL) - -#------------------------------------------------------------------------------- -# compile each int and long routine (with no real/complex version) -#------------------------------------------------------------------------------- - -camd_i_%.o: ../Source/camd_%.c $(INC) - $(C) -DDINT -c $< -o $@ - -camd_l_%.o: ../Source/camd_%.c $(INC) - $(C) -DDLONG -c $< -o $@ - -#------------------------------------------------------------------------------- -# Create the static and shared libraries (C versions only) -#------------------------------------------------------------------------------- - -static: $(AR_TARGET) - -$(AR_TARGET): $(OBJ) - $(ARCHIVE) $@ $^ - - $(RANLIB) $@ - -#------------------------------------------------------------------------------- -# install (shared C version only) -#------------------------------------------------------------------------------- - -# install CAMD -install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET) - -$(INSTALL_LIB)/$(SO_TARGET): $(OBJ) - @mkdir -p $(INSTALL_LIB) - @mkdir -p $(INSTALL_INCLUDE) - @mkdir -p $(INSTALL_DOC) - $(CC) $(SO_OPTS) $^ -o $@ $(LDLIBS) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) ) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) ) - $(CP) ../Include/camd.h $(INSTALL_INCLUDE) - $(CP) ../Doc/CAMD_UserGuide.pdf $(INSTALL_DOC) - $(CP) ../README.txt $(INSTALL_DOC)/CAMD_README.txt - chmod 755 $(INSTALL_LIB)/$(SO_TARGET) - chmod 644 $(INSTALL_INCLUDE)/camd.h - chmod 644 $(INSTALL_DOC)/CAMD_UserGuide.pdf - chmod 644 $(INSTALL_DOC)/CAMD_README.txt - -# uninstall CAMD -uninstall: - $(RM) $(INSTALL_LIB)/$(SO_TARGET) - $(RM) $(INSTALL_LIB)/$(SO_PLAIN) - $(RM) $(INSTALL_LIB)/$(SO_MAIN) - $(RM) $(INSTALL_INCLUDE)/camd.h - $(RM) $(INSTALL_DOC)/CAMD_UserGuide.pdf - $(RM) $(INSTALL_DOC)/CAMD_README.txt - -#------------------------------------------------------------------------------- -# Remove all but the files in the original distribution -#------------------------------------------------------------------------------- - -clean: - - $(RM) -r $(CLEAN) - -purge: distclean - -distclean: clean - - $(RM) -r $(PURGE) - diff --git a/ThirdParty/SuiteSparse/CAMD/MATLAB/Contents.m b/ThirdParty/SuiteSparse/CAMD/MATLAB/Contents.m deleted file mode 100644 index ba35d1bd15..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/MATLAB/Contents.m +++ /dev/null @@ -1,14 +0,0 @@ -%Contents of the CAMD sparse matrix ordering package: -% -% camd - p = camd (A), the approximate minimum degree ordering of A -% camd_demo - a demo of camd, using the can_24 matrix -% camd_make - to compile camd for use in MATLAB -% -% Example: -% p = camd(A) -% -% See also: camd, amd, colamd, symamd, colmmd, symmmd, umfpack - -% Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, Iain S. Duff, and Y. Chen. - -help Contents diff --git a/ThirdParty/SuiteSparse/CAMD/MATLAB/camd.m b/ThirdParty/SuiteSparse/CAMD/MATLAB/camd.m deleted file mode 100644 index de430967bf..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/MATLAB/camd.m +++ /dev/null @@ -1,79 +0,0 @@ -function [p, Info] = camd (A, Control, C) %#ok -%CAMD p = camd (A), the approximate minimum degree ordering of A -% P = CAMD (S) returns the approximate minimum degree permutation vector for -% the sparse matrix C = S+S'. The Cholesky factorization of C (P,P), or -% S (P,P), tends to be sparser than that of C or S. CAMD tends to be faster -% than SYMMMD and SYMAMD, and tends to return better orderings than SYMMMD. -% S must be square. If S is full, camd(S) is equivalent to camd(sparse(S)). -% -% Usage: P = camd (S) ; % finds the ordering -% [P, Info] = camd (S,Control,C) ; % optional parameters & statistics -% Control = camd ; % returns default parameters -% camd ; % prints default parameters. -% -% Control (1); If S is n-by-n, then rows/columns with more than -% max (16, (Control (1))* sqrt(n)) entries in S+S' are considered -% "dense", and ignored during ordering. They are placed last in the -% output permutation. The default is 10.0 if Control is not present. -% Control (2): If nonzero, then aggressive absorption is performed. -% This is the default if Control is not present. -% Control (3): If nonzero, print statistics about the ordering. -% -% Info (1): status (0: ok, -1: out of memory, -2: matrix invalid) -% Info (2): n = size (A,1) -% Info (3): nnz (A) -% Info (4): the symmetry of the matrix S (0.0 means purely unsymmetric, -% 1.0 means purely symmetric). Computed as: -% B = tril (S, -1) + triu (S, 1) ; symmetry = nnz (B & B') / nnz (B); -% Info (5): nnz (diag (S)) -% Info (6): nnz in S+S', excluding the diagonal (= nnz (B+B')) -% Info (7): number "dense" rows/columns in S+S' -% Info (8): the amount of memory used by CAMD, in bytes -% Info (9): the number of memory compactions performed by CAMD -% -% The following statistics are slight upper bounds because of the -% approximate degree in CAMD. The bounds are looser if "dense" rows/columns -% are ignored during ordering (Info (7) > 0). The statistics are for a -% subsequent factorization of the matrix C (P,P). The LU factorization -% statistics assume no pivoting. -% -% Info (10): the number of nonzeros in L, excluding the diagonal -% Info (11): the number of divide operations for LL', LDL', or LU -% Info (12): the number of multiply-subtract pairs for LL' or LDL' -% Info (13): the number of multiply-subtract pairs for LU -% Info (14): the max # of nonzeros in any column of L (incl. diagonal) -% Info (15:20): unused, reserved for future use -% -% An assembly tree post-ordering is performed, which is typically the same -% as an elimination tree post-ordering. It is not always identical because -% of the approximate degree update used, and because "dense" rows/columns -% do not take part in the post-order. It well-suited for a subsequent -% "chol", however. If you require a precise elimination tree post-ordering, -% then do the following: -% -% Example: -% P = camd (S) ; -% C = spones (S) + spones (S') ; % skip this if S already symmetric -% [ignore, Q] = etree (C (P,P)) ; -% P = P (Q) ; -% -% CAMD has the ability to order the matrix with constraints. Each -% node i in the graph (row/column i in the matrix) has a constraint, -% C(i), which is in the range 1 to n. All nodes with C(i) = 1 are -% ordered first, followed by all nodes with constraint 2, and so on. -% That is, C(P) is monotonically non-decreasing. If C is not provided, -% no constraints are used (the ordering will be similar to AMD's ordering, -% except that the postordering is different). -% -% See also AMD, COLMMD, COLAMD, COLPERM, SYMAMD, SYMMMD, SYMRCM. - - -% Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, Iain S. Duff, and Y. Chen. -% -% Acknowledgements: This work was supported by the National Science -% Foundation, under grants ASC-9111263, DMS-9223088, and CCR-0203270, -% and by Sandia National Laboratories. -% - -help camd -error ('camd mexFunction not found! Type "camd_make" in MATLAB to compile camd'); diff --git a/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_demo.m b/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_demo.m deleted file mode 100644 index 5b5c177cbd..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_demo.m +++ /dev/null @@ -1,114 +0,0 @@ -function camd_demo -%CAMD_DEMO a demo of camd, using the can_24 matrix -% -% A demo of CAMD for MATLAB. -% -% Example: -% camd_demo -% -% See also: camd, camd_make - -% Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, Iain S. Duff, and Y. Chen. - -% This orders the same matrix as the ANSI C demo, camd_demo.c. It includes an -% additional analysis of the matrix via MATLAB's symbfact routine. - -% First, print the help information for CAMD -help camd - -% Get the Harwell/Boeing can_24 matrix. - -load can_24 -A = spconvert (can_24) ; - -n = size (A,1) ; - -rand ('state', 0) ; -C = irand (6, n) ; - -clf -hold off -subplot (2,2,1) ; -spy (A) -title ('HB/can24 matrix') ; - -% print the details during CAMD ordering and SYMBFACT -% spparms ('spumoni', 1) ; - -% order the matrix. Note that the Info argument is optional. -fprintf ('\nIf the next step fails, then you have\n') ; -fprintf ('not yet compiled the CAMD mexFunction.\n') ; -[p, Info] = camd (A) ; %#ok - -% order again, but this time print some statistics -[p, camd_Info] = camd (A, [10 1 1], C) ; - -fprintf ('Permutation vector:\n') ; -fprintf (' %2d', p) ; - -fprintf ('\n\n') ; -fprintf ('Corresponding constraint sets:\n') ; - -if (any (sort (C (p)) ~= C (p))) - error ('Error!') ; -end - -for j = 1:n - fprintf (' %2d', C (p (j))) ; -end -fprintf ('\n\n\n') ; - -subplot (2,2,2) ; -spy (A (p,p)) ; -title ('Permuted matrix') ; - -% The camd_demo.c program stops here. - -fprintf ('Analyze A(p,p) with MATLAB symbfact routine:\n') ; -[cn, height, parent, post, R] = symbfact (A(p,p)) ; - -subplot (2,2,3) ; -spy (R') ; -title ('Cholesky factor L') ; - -subplot (2,2,4) ; -treeplot (parent) ; -title ('etree') ; - -% results from symbfact -lnz = sum (cn) ; % number of nonzeros in L, incl. diagonal -cn = cn - 1 ; % get the count of off-diagonal entries -fl = n + sum (cn.^2 + 2*cn) ; % flop count for chol (A (p,p) -fprintf ('number of nonzeros in L (including diagonal): %d\n', lnz) ; -fprintf ('floating point operation count for chol (A (p,p)): %d\n', fl) ; - -% approximations from camd: -lnz2 = n + camd_Info (10) ; -fl2 = n + camd_Info (11) + 2 * camd_Info (12) ; -fprintf ('\nResults from CAMD''s approximate analysis:\n') ; -fprintf ('number of nonzeros in L (including diagonal): %d\n', lnz2) ; -fprintf ('floating point operation count for chol (A (p,p)): %d\n\n', fl2) ; - -fprintf ('\nNote that the ordering quality is not as good as p=amd(A).\n') ; -fprintf ('This is only because the ordering constraints, C, have been\n') ; -fprintf ('randomly selected.\n') ; - -if (lnz2 ~= lnz | fl ~= fl2) %#ok - fprintf ('Note that the nonzero and flop counts from CAMD are slight\n') ; - fprintf ('upper bounds. This is due to the approximate minimum degree\n'); - fprintf ('method used, in conjunction with "mass elimination".\n') ; - fprintf ('See the discussion about mass elimination in camd.h and\n') ; - fprintf ('camd_2.c for more details.\n') ; -end - -% turn off diagnostic output in MATLAB's sparse matrix routines -% spparms ('spumoni', 0) ; - -%------------------------------------------------------------------------------- - -function i = irand (n,s) -% irand: return a random vector of size s, with values between 1 and n -if (nargin == 1) - s = 1 ; -end -i = min (n, 1 + floor (rand (1,s) * n)) ; diff --git a/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_demo.m.out b/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_demo.m.out deleted file mode 100644 index 9cedeb5226..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_demo.m.out +++ /dev/null @@ -1,131 +0,0 @@ -camd_demo - CAMD p = camd (A), the approximate minimum degree ordering of A - P = CAMD (S) returns the approximate minimum degree permutation vector for - the sparse matrix C = S+S'. The Cholesky factorization of C (P,P), or - S (P,P), tends to be sparser than that of C or S. CAMD tends to be faster - than SYMMMD and SYMAMD, and tends to return better orderings than SYMMMD. - S must be square. If S is full, camd(S) is equivalent to camd(sparse(S)). - - Usage: P = camd (S) ; % finds the ordering - [P, Info] = camd (S,Control,C) ; % optional parameters & statistics - Control = camd ; % returns default parameters - camd ; % prints default parameters. - - Control (1); If S is n-by-n, then rows/columns with more than - max (16, (Control (1))* sqrt(n)) entries in S+S' are considered - "dense", and ignored during ordering. They are placed last in the - output permutation. The default is 10.0 if Control is not present. - Control (2): If nonzero, then aggressive absorption is performed. - This is the default if Control is not present. - Control (3): If nonzero, print statistics about the ordering. - - Info (1): status (0: ok, -1: out of memory, -2: matrix invalid) - Info (2): n = size (A,1) - Info (3): nnz (A) - Info (4): the symmetry of the matrix S (0.0 means purely unsymmetric, - 1.0 means purely symmetric). Computed as: - B = tril (S, -1) + triu (S, 1) ; symmetry = nnz (B & B') / nnz (B); - Info (5): nnz (diag (S)) - Info (6): nnz in S+S', excluding the diagonal (= nnz (B+B')) - Info (7): number "dense" rows/columns in S+S' - Info (8): the amount of memory used by CAMD, in bytes - Info (9): the number of memory compactions performed by CAMD - - The following statistics are slight upper bounds because of the - approximate degree in CAMD. The bounds are looser if "dense" rows/columns - are ignored during ordering (Info (7) > 0). The statistics are for a - subsequent factorization of the matrix C (P,P). The LU factorization - statistics assume no pivoting. - - Info (10): the number of nonzeros in L, excluding the diagonal - Info (11): the number of divide operations for LL', LDL', or LU - Info (12): the number of multiply-subtract pairs for LL' or LDL' - Info (13): the number of multiply-subtract pairs for LU - Info (14): the max # of nonzeros in any column of L (incl. diagonal) - Info (15:20): unused, reserved for future use - - An assembly tree post-ordering is performed, which is typically the same - as an elimination tree post-ordering. It is not always identical because - of the approximate degree update used, and because "dense" rows/columns - do not take part in the post-order. It well-suited for a subsequent - "chol", however. If you require a precise elimination tree post-ordering, - then do the following: - - Example: - P = camd (S) ; - C = spones (S) + spones (S') ; % skip this if S already symmetric - [ignore, Q] = etree (C (P,P)) ; - P = P (Q) ; - - CAMD has the ability to order the matrix with constraints. Each - node i in the graph (row/column i in the matrix) has a constraint, - C(i), which is in the range 1 to n. All nodes with C(i) = 1 are - ordered first, followed by all nodes with constraint 2, and so on. - That is, C(P) is monotonically non-decreasing. If C is not provided, - no constraints are used (the ordering will be similar to AMD's ordering, - except that the postordering is different). - - See also AMD, COLMMD, COLAMD, COLPERM, SYMAMD, SYMMMD, SYMRCM. - - -If the next step fails, then you have -not yet compiled the CAMD mexFunction. - -camd version 2.2, May 31, 2007: approximate minimum degree ordering: - dense row parameter: 10 - (rows with more than max (10 * sqrt (n), 16) entries are - considered "dense", and placed last in output permutation) - aggressive absorption: yes - - input matrix A is 24-by-24 - input matrix A has 160 nonzero entries - -camd: approximate minimum degree ordering, results: - status: OK - n, dimension of A: 24 - nz, number of nonzeros in A: 160 - symmetry of A: 1.0000 - number of nonzeros on diagonal: 24 - nonzeros in pattern of A+A' (excl. diagonal): 136 - # dense rows/columns of A+A': 0 - memory used, in bytes: 1644 - # of memory compactions: 0 - - The following approximate statistics are for a subsequent - factorization of A(P,P) + A(P,P)'. They are slight upper - bounds if there are no dense rows/columns in A+A', and become - looser if dense rows/columns exist. - - nonzeros in L (excluding diagonal): 149 - nonzeros in L (including diagonal): 173 - # divide operations for LDL' or LU: 149 - # multiply-subtract operations for LDL': 631 - # multiply-subtract operations for LU: 1113 - max nz. in any column of L (incl. diagonal): 12 - - chol flop count for real A, sqrt counted as 1 flop: 1435 - LDL' flop count for real A: 1411 - LDL' flop count for complex A: 6389 - LU flop count for real A (with no pivoting): 2375 - LU flop count for complex A (with no pivoting): 10245 - -Permutation vector: - 24 21 8 2 15 10 16 4 19 22 7 3 11 6 9 23 12 14 20 1 5 13 18 17 - -Corresponding constraint sets: - 1 1 1 2 2 3 3 3 3 3 3 4 4 5 5 5 5 5 6 6 6 6 6 6 - - -Analyze A(p,p) with MATLAB symbfact routine: -number of nonzeros in L (including diagonal): 173 -floating point operation count for chol (A (p,p)): 1435 - -Results from CAMD's approximate analysis: -number of nonzeros in L (including diagonal): 173 -floating point operation count for chol (A (p,p)): 1435 - - -Note that the ordering quality is not as good as p=amd(A). -This is only because the ordering constraints, C, have been -randomly selected. -diary off diff --git a/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_make.m b/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_make.m deleted file mode 100644 index 7b959bfc04..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_make.m +++ /dev/null @@ -1,43 +0,0 @@ -function camd_make -%CAMD_MAKE to compile camd for use in MATLAB -% -% Example: -% camd_make -% -% See also camd. - -% Copyright 1994-2007, Tim Davis, Patrick R. Amestoy, Iain S. Duff, and Y. Chen. - -details = 0 ; % 1 if details of each command are to be printed - -d = '' ; -if (~isempty (strfind (computer, '64'))) - d = '-largeArrayDims' ; -end - -% MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much -if (~verLessThan ('matlab', '8.3.0')) - d = ['-silent ' d] ; -end - -i = sprintf ('-I../Include -I../../SuiteSparse_config') ; -cmd = sprintf ('mex -O %s -DDLONG -output camd %s camd_mex.c %s', d, i, ... - '../../SuiteSparse_config/SuiteSparse_config.c') ; -files = {'camd_order', 'camd_dump', 'camd_postorder', ... - 'camd_aat', 'camd_2', 'camd_1', 'camd_defaults', 'camd_control', ... - 'camd_info', 'camd_valid', 'camd_preprocess' } ; -for i = 1 : length (files) - cmd = sprintf ('%s ../Source/%s.c', cmd, files {i}) ; -end -if (details) - fprintf ('%s\n', cmd) ; -end - -if (~(ispc || ismac)) - % for POSIX timing routine - cmd = [cmd ' -lrt'] ; -end - -eval (cmd) ; - -fprintf ('CAMD successfully compiled.\n') ; diff --git a/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_mex.c b/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_mex.c deleted file mode 100644 index 2be61209e4..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/MATLAB/camd_mex.c +++ /dev/null @@ -1,213 +0,0 @@ -/* ========================================================================= */ -/* === CAMD mexFunction ==================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* - * Usage: - * p = camd (A) - * p = camd (A, Control) - * [p, Info] = camd (A) - * [p, Info] = camd (A, Control, C) - * Control = camd ; % return the default Control settings for CAMD - * camd ; % print the default Control settings for CAMD - * - * Given a square matrix A, compute a permutation P suitable for a Cholesky - * factorization of the matrix B (P,P), where B = spones (A) + spones (A'). - * The method used is the approximate minimum degree ordering method. See - * camd.m and camd.h for more information. - * - * The input matrix need not have sorted columns, and can have duplicate - * entries. - */ - -#include "camd.h" -#include "mex.h" -#include "matrix.h" -#define Long SuiteSparse_long - -void mexFunction -( - int nargout, - mxArray *pargout [ ], - int nargin, - const mxArray *pargin [ ] -) -{ - Long i, m, n, *Ap, *Ai, *P, nc, result, spumoni, full, *C, Clen ; - double *Pout, *InfoOut, Control [CAMD_CONTROL], Info [CAMD_INFO], - *ControlIn, *Cin ; - mxArray *A ; - - /* --------------------------------------------------------------------- */ - /* get control parameters */ - /* --------------------------------------------------------------------- */ - - spumoni = 0 ; - if (nargin == 0) - { - /* get the default control parameters, and return */ - pargout [0] = mxCreateDoubleMatrix (CAMD_CONTROL, 1, mxREAL) ; - camd_l_defaults (mxGetPr (pargout [0])) ; - if (nargout == 0) - { - camd_l_control (mxGetPr (pargout [0])) ; - } - return ; - } - - camd_l_defaults (Control) ; - if (nargin > 1) - { - ControlIn = mxGetPr (pargin [1]) ; - nc = mxGetM (pargin [1]) * mxGetN (pargin [1]) ; - Control [CAMD_DENSE] - = (nc > 0) ? ControlIn [CAMD_DENSE] : CAMD_DEFAULT_DENSE ; - Control [CAMD_AGGRESSIVE] - = (nc > 1) ? ControlIn [CAMD_AGGRESSIVE] : CAMD_DEFAULT_AGGRESSIVE ; - spumoni = (nc > 2) ? (ControlIn [2] != 0) : 0 ; - } - - if (spumoni > 0) - { - camd_l_control (Control) ; - } - - /* --------------------------------------------------------------------- */ - /* get inputs */ - /* --------------------------------------------------------------------- */ - - if (nargout > 2 || nargin > 3) - { - mexErrMsgTxt ("Usage: p = camd (A)\n" - "or [p, Info] = camd (A, Control, C)") ; - } - - Clen = 0 ; - C = NULL ; - if (nargin > 2) - { - Cin = mxGetPr (pargin [2]) ; - Clen = mxGetNumberOfElements (pargin [2]) ; - if (Clen != 0) - { - C = (Long *) mxCalloc (Clen, sizeof (Long)) ; - for (i = 0 ; i < Clen ; i++) - { - /* convert c from 1-based to 0-based */ - C [i] = (Long) Cin [i] - 1 ; - } - } - } - - A = (mxArray *) pargin [0] ; - n = mxGetN (A) ; - m = mxGetM (A) ; - if (spumoni > 0) - { - mexPrintf (" input matrix A is %d-by-%d\n", m, n) ; - } - - if (mxGetNumberOfDimensions (A) != 2) - { - mexErrMsgTxt ("camd: A must be 2-dimensional") ; - } - if (m != n) - { - mexErrMsgTxt ("camd: A must be square") ; - } - - /* --------------------------------------------------------------------- */ - /* allocate workspace for output permutation */ - /* --------------------------------------------------------------------- */ - - P = mxMalloc ((n+1) * sizeof (Long)) ; - - /* --------------------------------------------------------------------- */ - /* if A is full, convert to a sparse matrix */ - /* --------------------------------------------------------------------- */ - - full = !mxIsSparse (A) ; - if (full) - { - if (spumoni > 0) - { - mexPrintf ( - " input matrix A is full (sparse copy of A will be created)\n"); - } - mexCallMATLAB (1, &A, 1, (mxArray **) pargin, "sparse") ; - } - Ap = (Long *) mxGetJc (A) ; - Ai = (Long *) mxGetIr (A) ; - if (spumoni > 0) - { - mexPrintf (" input matrix A has %d nonzero entries\n", Ap [n]) ; - } - - /* --------------------------------------------------------------------- */ - /* order the matrix */ - /* --------------------------------------------------------------------- */ - - result = camd_l_order (n, Ap, Ai, P, Control, Info, C) ; - - /* --------------------------------------------------------------------- */ - /* if A is full, free the sparse copy of A */ - /* --------------------------------------------------------------------- */ - - if (full) - { - mxDestroyArray (A) ; - } - - /* --------------------------------------------------------------------- */ - /* print results (including return value) */ - /* --------------------------------------------------------------------- */ - - if (spumoni > 0) - { - camd_l_info (Info) ; - } - - /* --------------------------------------------------------------------- */ - /* check error conditions */ - /* --------------------------------------------------------------------- */ - - if (result == CAMD_OUT_OF_MEMORY) - { - mexErrMsgTxt ("camd: out of memory") ; - } - else if (result == CAMD_INVALID) - { - mexErrMsgTxt ("camd: input matrix A is corrupted") ; - } - - /* --------------------------------------------------------------------- */ - /* copy the outputs to MATLAB */ - /* --------------------------------------------------------------------- */ - - /* output permutation, P */ - pargout [0] = mxCreateDoubleMatrix (1, n, mxREAL) ; - Pout = mxGetPr (pargout [0]) ; - for (i = 0 ; i < n ; i++) - { - Pout [i] = P [i] + 1 ; /* change to 1-based indexing for MATLAB */ - } - mxFree (P) ; - if (nargin > 2) mxFree (C) ; - - /* Info */ - if (nargout > 1) - { - pargout [1] = mxCreateDoubleMatrix (CAMD_INFO, 1, mxREAL) ; - InfoOut = mxGetPr (pargout [1]) ; - for (i = 0 ; i < CAMD_INFO ; i++) - { - InfoOut [i] = Info [i] ; - } - } -} diff --git a/ThirdParty/SuiteSparse/CAMD/MATLAB/can_24 b/ThirdParty/SuiteSparse/CAMD/MATLAB/can_24 deleted file mode 100644 index 38158a159a..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/MATLAB/can_24 +++ /dev/null @@ -1,160 +0,0 @@ - 1 1 1 - 6 1 1 - 7 1 1 -13 1 1 -14 1 1 -18 1 1 -19 1 1 -20 1 1 -22 1 1 - 2 2 1 - 9 2 1 -10 2 1 -14 2 1 -15 2 1 -18 2 1 - 3 3 1 - 7 3 1 -12 3 1 -21 3 1 -22 3 1 -23 3 1 - 4 4 1 - 8 4 1 -11 4 1 -16 4 1 -19 4 1 -20 4 1 - 5 5 1 - 8 5 1 -10 5 1 -15 5 1 -16 5 1 -17 5 1 - 1 6 1 - 6 6 1 - 7 6 1 -13 6 1 -14 6 1 -18 6 1 - 1 7 1 - 3 7 1 - 6 7 1 - 7 7 1 -12 7 1 -13 7 1 -20 7 1 -22 7 1 -24 7 1 - 4 8 1 - 5 8 1 - 8 8 1 -10 8 1 -15 8 1 -16 8 1 -17 8 1 -18 8 1 -19 8 1 - 2 9 1 - 9 9 1 -10 9 1 -15 9 1 - 2 10 1 - 5 10 1 - 8 10 1 - 9 10 1 -10 10 1 -14 10 1 -15 10 1 -18 10 1 -19 10 1 - 4 11 1 -11 11 1 -19 11 1 -20 11 1 -21 11 1 -22 11 1 - 3 12 1 - 7 12 1 -12 12 1 -13 12 1 -22 12 1 -24 12 1 - 1 13 1 - 6 13 1 - 7 13 1 -12 13 1 -13 13 1 -24 13 1 - 1 14 1 - 2 14 1 - 6 14 1 -10 14 1 -14 14 1 -18 14 1 - 2 15 1 - 5 15 1 - 8 15 1 - 9 15 1 -10 15 1 -15 15 1 - 4 16 1 - 5 16 1 - 8 16 1 -16 16 1 -17 16 1 -19 16 1 - 5 17 1 - 8 17 1 -16 17 1 -17 17 1 - 1 18 1 - 2 18 1 - 6 18 1 - 8 18 1 -10 18 1 -14 18 1 -18 18 1 -19 18 1 -20 18 1 - 1 19 1 - 4 19 1 - 8 19 1 -10 19 1 -11 19 1 -16 19 1 -18 19 1 -19 19 1 -20 19 1 - 1 20 1 - 4 20 1 - 7 20 1 -11 20 1 -18 20 1 -19 20 1 -20 20 1 -21 20 1 -22 20 1 - 3 21 1 -11 21 1 -20 21 1 -21 21 1 -22 21 1 -23 21 1 - 1 22 1 - 3 22 1 - 7 22 1 -11 22 1 -12 22 1 -20 22 1 -21 22 1 -22 22 1 -23 22 1 - 3 23 1 -21 23 1 -22 23 1 -23 23 1 - 7 24 1 -12 24 1 -13 24 1 -24 24 1 diff --git a/ThirdParty/SuiteSparse/CAMD/Makefile b/ThirdParty/SuiteSparse/CAMD/Makefile deleted file mode 100644 index 3351161992..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -#------------------------------------------------------------------------------ -# CAMD Makefile -#------------------------------------------------------------------------------ - -SUITESPARSE ?= $(realpath $(CURDIR)/..) -export SUITESPARSE - -default: all - -include ../SuiteSparse_config/SuiteSparse_config.mk - -demos: all - -# Compile all C code. Do not compile the FORTRAN versions. -all: - ( cd Lib ; $(MAKE) ) - ( cd Demo ; $(MAKE) ) - -# compile just the C-callable libraries (not Demos) -library: - ( cd Lib ; $(MAKE) ) - -# compile the static libraries only -static: - ( cd Lib ; $(MAKE) static ) - -# remove object files, but keep the compiled programs and library archives -clean: - ( cd Lib ; $(MAKE) clean ) - ( cd Demo ; $(MAKE) clean ) - ( cd MATLAB ; $(RM) $(CLEAN) ) - ( cd Doc ; $(MAKE) clean ) - -# clean, and then remove compiled programs and library archives -purge: - ( cd Lib ; $(MAKE) purge ) - ( cd Demo ; $(MAKE) purge ) - ( cd MATLAB ; $(RM) $(CLEAN) ; $(RM) *.mex* ) - ( cd Doc ; $(MAKE) purge ) - -distclean: purge - -# create PDF documents for the original distribution -docs: - ( cd Doc ; $(MAKE) ) - -# get ready for distribution -dist: purge - ( cd Demo ; $(MAKE) dist ) - ( cd Doc ; $(MAKE) ) - -ccode: library - -lib: library - -# install CAMD -install: - ( cd Lib ; $(MAKE) install ) - -# uninstall CAMD -uninstall: - ( cd Lib ; $(MAKE) uninstall ) - diff --git a/ThirdParty/SuiteSparse/CAMD/README.txt b/ThirdParty/SuiteSparse/CAMD/README.txt deleted file mode 100644 index 68c033497d..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/README.txt +++ /dev/null @@ -1,171 +0,0 @@ -CAMD, Copyright (c) 2007-2013, University of Florida. -Written by Timothy A. Davis (http://www.suitesparse.com), Yanqing Chen, Patrick -R. Amestoy, and Iain S. Duff. All Rights Reserved. CAMD is available under -alternate licences; contact T. Davis for details. - -CAMD: a set of routines for permuting sparse matrices prior to - factorization. Includes a version in C, a version in Fortran, and a MATLAB - mexFunction. - -Requires SuiteSparse_config, in the ../SuiteSparse_config directory relative to -this directory. - -Quick start (Unix, or Windows with Cygwin): - - To compile, test, and install CAMD, you may wish to first configure the - installation by editting the ../SuiteSparse_config/SuiteSparse_config.mk - file. Next, cd to this directory (CAMD) and type "make" (or "make lib" if - you do not have MATLAB). When done, type "make clean" to remove unused *.o - files (keeps the compiled libraries and demo programs). See the User Guide - (Doc/CAMD_UserGuide.pdf), or ../SuiteSparse_config/SuiteSparse_config.mk - for more details. To install do "make install". - -Quick start (for MATLAB users); - - To compile, test, and install the CAMD mexFunction, cd to the - CAMD/MATLAB directory and type camd_make at the MATLAB prompt. - -------------------------------------------------------------------------------- - -CAMD License: refer to CAMD/Doc/License.txt - -Availability: - - http://www.suitesparse.com - -------------------------------------------------------------------------------- - -This is the CAMD README file. It is a terse overview of CAMD. -Refer to the User Guide (Doc/CAMD_UserGuide.pdf) for how to install -and use CAMD. - -Description: - - CAMD is a set of routines for pre-ordering sparse matrices prior to Cholesky - or LU factorization, using the approximate minimum degree ordering - algorithm with optional ordering constraints. Written in ANSI/ISO C with - a MATLAB interface. - -Authors: - - Timothy A. Davis (DrTimothyAldenDavis@gmail.com) - Patrick R. Amestory, ENSEEIHT, Toulouse, France. - Iain S. Duff, Rutherford Appleton Laboratory, UK. - -Acknowledgements: - - This work was supported by the National Science Foundation, under - grants DMS-9504974, DMS-9803599, and CCR-0203270. - - Portions of this work were done while on sabbatical at Stanford University - and Lawrence Berkeley National Laboratory (with funding from the SciDAC - program). I would like to thank Gene Golub, Esmond Ng, and Horst Simon - for making this sabbatical possible. - -------------------------------------------------------------------------------- -Files and directories in the CAMD distribution: -------------------------------------------------------------------------------- - - --------------------------------------------------------------------------- - Subdirectories of the CAMD directory: - --------------------------------------------------------------------------- - - Doc documentation - Source primary source code - Include include file for use in your code that calls CAMD - Demo demo programs. also serves as test of the CAMD installation. - MATLAB CAMD mexFunction for MATLAB, and supporting m-files - Lib where the compiled C-callable and Fortran-callable - CAMD libraries placed. - - --------------------------------------------------------------------------- - Files in the CAMD directory: - --------------------------------------------------------------------------- - - Makefile top-level Makefile. - Windows users would require Cygwin to use "make" - - README.txt this file - - --------------------------------------------------------------------------- - Doc directory: documentation - --------------------------------------------------------------------------- - - ChangeLog change log - License.txt the CAMD License - Makefile for creating the documentation - CAMD_UserGuide.bib CAMD User Guide (references) - CAMD_UserGuide.tex CAMD User Guide (LaTeX) - CAMD_UserGuide.pdf CAMD User Guide (PDF) - - docdiff tools for comparing CAMD with AMD - cdiff - camd.sed - - --------------------------------------------------------------------------- - Source directory: - --------------------------------------------------------------------------- - - camd_order.c user-callable, primary CAMD ordering routine - camd_control.c user-callable, prints the control parameters - camd_defaults.c user-callable, sets default control parameters - camd_info.c user-callable, prints the statistics from CAMD - - camd_1.c non-user-callable, construct A+A' - camd_2.c user-callable, primary ordering kernel - (a C version of camd.f and camdbar.f, with - post-ordering added) - camd_aat.c non-user-callable, computes nnz (A+A') - camd_dump.c non-user-callable, debugging routines - camd_postorder.c non-user-callable, postorder - camd_valid.c non-user-callable, verifies a matrix - camd_preprocess.c non-user-callable, computes A', removes duplic - - --------------------------------------------------------------------------- - Include directory: - --------------------------------------------------------------------------- - - camd.h include file for C programs that use CAMD - camd_internal.h non-user-callable, include file for CAMD - - --------------------------------------------------------------------------- - Demo directory: - --------------------------------------------------------------------------- - - Makefile to compile the demos - - camd_demo.c C demo program for CAMD - camd_demo.out output of camd_demo.c - - camd_demo2.c C demo program for CAMD, jumbled matrix - camd_demo2.out output of camd_demo2.c - - camd_l_demo.c C demo program for CAMD ("long" version) - camd_l_demo.out output of camd_l_demo.c - - camd_simple.c simple C demo program for CAMD - camd_simple.out output of camd_simple.c - - --------------------------------------------------------------------------- - MATLAB directory: - --------------------------------------------------------------------------- - - Contents.m for "help camd" listing of toolbox contents - - camd.m MATLAB help file for CAMD - camd_make.m MATLAB m-file for compiling CAMD mexFunction - camd_install.m compile and install CAMD mexFunctions - - camd_mex.c CAMD mexFunction for MATLAB - - camd_demo.m MATLAB demo for CAMD - camd_demo.m.out diary output of camd_demo.m - can_24.mat input file for CAMD demo - - --------------------------------------------------------------------------- - Lib directory: libcamd.a and libcamd.so library placed here - --------------------------------------------------------------------------- - - Makefile Makefile for both shared and static libraries - old/ old version of Makefiles - diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_1.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_1.c deleted file mode 100644 index 753f9651ed..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_1.c +++ /dev/null @@ -1,183 +0,0 @@ -/* ========================================================================= */ -/* === CAMD_1 ============================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* CAMD_1: Construct A+A' for a sparse matrix A and perform the CAMD ordering. - * - * The n-by-n sparse matrix A can be unsymmetric. It is stored in MATLAB-style - * compressed-column form, with sorted row indices in each column, and no - * duplicate entries. Diagonal entries may be present, but they are ignored. - * Row indices of column j of A are stored in Ai [Ap [j] ... Ap [j+1]-1]. - * Ap [0] must be zero, and nz = Ap [n] is the number of entries in A. The - * size of the matrix, n, must be greater than or equal to zero. - * - * This routine must be preceded by a call to CAMD_aat, which computes the - * number of entries in each row/column in A+A', excluding the diagonal. - * Len [j], on input, is the number of entries in row/column j of A+A'. This - * routine constructs the matrix A+A' and then calls CAMD_2. No error checking - * is performed (this was done in CAMD_valid). - */ - -#include "camd_internal.h" - -GLOBAL void CAMD_1 -( - Int n, /* n > 0 */ - const Int Ap [ ], /* input of size n+1, not modified */ - const Int Ai [ ], /* input of size nz = Ap [n], not modified */ - Int P [ ], /* size n output permutation */ - Int Pinv [ ], /* size n output inverse permutation */ - Int Len [ ], /* size n input, undefined on output */ - Int slen, /* slen >= sum (Len [0..n-1]) + 7n+2, - * ideally slen = 1.2 * sum (Len) + 8n+2 */ - Int S [ ], /* size slen workspace */ - double Control [ ], /* input array of size CAMD_CONTROL */ - double Info [ ], /* output array of size CAMD_INFO */ - const Int C [ ] /* Constraint set of size n */ -) -{ - Int i, j, k, p, pfree, iwlen, pj, p1, p2, pj2, *Iw, *Pe, *Nv, *Head, - *Elen, *Degree, *s, *W, *Sp, *Tp, *BucketSet ; - - /* --------------------------------------------------------------------- */ - /* construct the matrix for CAMD_2 */ - /* --------------------------------------------------------------------- */ - - ASSERT (n > 0) ; - - iwlen = slen - (7*n+2) ; /* allocate 7*n+2 workspace from S */ - s = S ; - Pe = s ; s += n ; - Nv = s ; s += n ; - Head = s ; s += n+1 ; /* NOTE: was size n in AMD; size n+1 in CAMD */ - Elen = s ; s += n ; - Degree = s ; s += n ; - W = s ; s += n+1 ; /* NOTE: was size n in AMD; size n+1 in CAMD */ - BucketSet = s ; s += n ; - Iw = s ; s += iwlen ; - - ASSERT (CAMD_valid (n, n, Ap, Ai) == CAMD_OK) ; - ASSERT (CAMD_cvalid (n, C)) ; - - /* construct the pointers for A+A' */ - Sp = Nv ; /* use Nv and W as workspace for Sp and Tp [ */ - Tp = W ; - pfree = 0 ; - for (j = 0 ; j < n ; j++) - { - Pe [j] = pfree ; - Sp [j] = pfree ; - pfree += Len [j] ; - } - - /* Note that this restriction on iwlen is slightly more restrictive than - * what is strictly required in CAMD_2. CAMD_2 can operate with no elbow - * room at all, but it will be very slow. For better performance, at - * least size-n elbow room is enforced. */ - ASSERT (iwlen >= pfree + n) ; - -#ifndef NDEBUG - for (p = 0 ; p < iwlen ; p++) Iw [p] = EMPTY ; -#endif - - for (k = 0 ; k < n ; k++) - { - CAMD_DEBUG1 (("Construct row/column k= "ID" of A+A'\n", k)) ; - p1 = Ap [k] ; - p2 = Ap [k+1] ; - - /* construct A+A' */ - for (p = p1 ; p < p2 ; ) - { - /* scan the upper triangular part of A */ - j = Ai [p] ; - ASSERT (j >= 0 && j < n) ; - if (j < k) - { - /* entry A (j,k) in the strictly upper triangular part */ - ASSERT (Sp [j] < (j == n-1 ? pfree : Pe [j+1])) ; - ASSERT (Sp [k] < (k == n-1 ? pfree : Pe [k+1])) ; - Iw [Sp [j]++] = k ; - Iw [Sp [k]++] = j ; - p++ ; - } - else if (j == k) - { - /* skip the diagonal */ - p++ ; - break ; - } - else /* j > k */ - { - /* first entry below the diagonal */ - break ; - } - /* scan lower triangular part of A, in column j until reaching - * row k. Start where last scan left off. */ - ASSERT (Ap [j] <= Tp [j] && Tp [j] <= Ap [j+1]) ; - pj2 = Ap [j+1] ; - for (pj = Tp [j] ; pj < pj2 ; ) - { - i = Ai [pj] ; - ASSERT (i >= 0 && i < n) ; - if (i < k) - { - /* A (i,j) is only in the lower part, not in upper */ - ASSERT (Sp [i] < (i == n-1 ? pfree : Pe [i+1])) ; - ASSERT (Sp [j] < (j == n-1 ? pfree : Pe [j+1])) ; - Iw [Sp [i]++] = j ; - Iw [Sp [j]++] = i ; - pj++ ; - } - else if (i == k) - { - /* entry A (k,j) in lower part and A (j,k) in upper */ - pj++ ; - break ; - } - else /* i > k */ - { - /* consider this entry later, when k advances to i */ - break ; - } - } - Tp [j] = pj ; - } - Tp [k] = p ; - } - - /* clean up, for remaining mismatched entries */ - for (j = 0 ; j < n ; j++) - { - for (pj = Tp [j] ; pj < Ap [j+1] ; pj++) - { - i = Ai [pj] ; - ASSERT (i >= 0 && i < n) ; - /* A (i,j) is only in the lower part, not in upper */ - ASSERT (Sp [i] < (i == n-1 ? pfree : Pe [i+1])) ; - ASSERT (Sp [j] < (j == n-1 ? pfree : Pe [j+1])) ; - Iw [Sp [i]++] = j ; - Iw [Sp [j]++] = i ; - } - } - -#ifndef NDEBUG - for (j = 0 ; j < n-1 ; j++) ASSERT (Sp [j] == Pe [j+1]) ; - ASSERT (Sp [n-1] == pfree) ; -#endif - - /* Tp and Sp no longer needed ] */ - - /* --------------------------------------------------------------------- */ - /* order the matrix */ - /* --------------------------------------------------------------------- */ - - CAMD_2 (n, Pe, Iw, Len, iwlen, pfree, - Nv, Pinv, P, Head, Elen, Degree, W, Control, Info, C, BucketSet) ; -} diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_2.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_2.c deleted file mode 100644 index f19050d47f..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_2.c +++ /dev/null @@ -1,2012 +0,0 @@ -/* ========================================================================= */ -/* === CAMD_2 ============================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* CAMD_2: performs the CAMD ordering on a symmetric sparse matrix A, followed - * by a postordering (via depth-first search) of the assembly tree using the - * CAMD_postorder routine. - */ - -/* ========================================================================= */ -/* === Macros and definitions ============================================== */ -/* ========================================================================= */ - -/* True if node i is in the current Constraint Set */ -#define IsInCurrentSet(C,i,curC) ((C == NULL) ? 1 : (C [i] == curC)) - -/* True if i and j are in the same Constraint Set */ -#define InSameConstraintSet(C,i,j) ((C == NULL) ? 1 : (C [i] == C [j])) - -#include "camd_internal.h" - -/* ========================================================================= */ -/* === clear_flag ========================================================== */ -/* ========================================================================= */ - -static Int clear_flag (Int wflg, Int wbig, Int W [ ], Int n) -{ - Int x ; - if (wflg < 2 || wflg >= wbig) - { - for (x = 0 ; x < n ; x++) - { - if (W [x] != 0) W [x] = 1 ; - } - wflg = 2 ; - } - /* at this point, W [0..n-1] < wflg holds */ - return (wflg) ; -} - - -/* ========================================================================= */ -/* === CAMD_2 ============================================================== */ -/* ========================================================================= */ - -GLOBAL void CAMD_2 -( - Int n, /* A is n-by-n, where n > 0 */ - Int Pe [ ], /* Pe [0..n-1]: index in Iw of row i on input */ - Int Iw [ ], /* workspace of size iwlen. Iw [0..pfree-1] - * holds the matrix on input */ - Int Len [ ], /* Len [0..n-1]: length for row/column i on input */ - Int iwlen, /* length of Iw. iwlen >= pfree + n */ - Int pfree, /* Iw [pfree ... iwlen-1] is empty on input */ - - /* 7 size-n or size-n+1 workspaces, not defined on input: */ - Int Nv [ ], /* size n, the size of each supernode on output */ - Int Next [ ], /* size n, the output inverse permutation */ - Int Last [ ], /* size n, the output permutation */ - Int Head [ ], /* size n+1 (Note: it was size n in AMD) */ - Int Elen [ ], /* size n, the size columns of L for each supernode */ - Int Degree [ ], /* size n */ - Int W [ ], /* size n+1 (Note: it was size n in AMD) */ - - /* control parameters and output statistics */ - double Control [ ], /* array of size CAMD_CONTROL */ - double Info [ ], /* array of size CAMD_INFO */ - - /* input, not modified: */ - const Int C [ ], /* size n, C [i] is the constraint set of node i */ - - /* size-n workspace, not defined on input or output: */ - Int BucketSet [ ] /* size n */ -) -{ - -/* - * Given a representation of the nonzero pattern of a symmetric matrix, A, - * (excluding the diagonal) perform an approximate minimum (UMFPACK/MA38-style) - * degree ordering to compute a pivot order such that the introduction of - * nonzeros (fill-in) in the Cholesky factors A = LL' is kept low. At each - * step, the pivot selected is the one with the minimum UMFAPACK/MA38-style - * upper-bound on the external degree. This routine can optionally perform - * aggresive absorption (as done by MC47B in the Harwell Subroutine - * Library). - * - * The approximate degree algorithm implemented here is the symmetric analog of - * the degree update algorithm in MA38 and UMFPACK (the Unsymmetric-pattern - * MultiFrontal PACKage, both by Davis and Duff). The routine is based on the - * MA27 minimum degree ordering algorithm by Iain Duff and John Reid. - * - * This routine is a translation of the original AMDBAR and MC47B routines, - * in Fortran, with the following modifications: - * - * (1) dense rows/columns are removed prior to ordering the matrix, and placed - * last in the output order. The presence of a dense row/column can - * increase the ordering time by up to O(n^2), unless they are removed - * prior to ordering. - * - * (2) the minimum degree ordering is followed by a postordering (depth-first - * search) of the assembly tree. Note that mass elimination (discussed - * below) combined with the approximate degree update can lead to the mass - * elimination of nodes with lower exact degree than the current pivot - * element. No additional fill-in is caused in the representation of the - * Schur complement. The mass-eliminated nodes merge with the current - * pivot element. They are ordered prior to the current pivot element. - * Because they can have lower exact degree than the current element, the - * merger of two or more of these nodes in the current pivot element can - * lead to a single element that is not a "fundamental supernode". The - * diagonal block can have zeros in it. Thus, the assembly tree used here - * is not guaranteed to be the precise supernodal elemination tree (with - * "funadmental" supernodes), and the postordering performed by this - * routine is not guaranteed to be a precise postordering of the - * elimination tree. - * - * (3) input parameters are added, to control aggressive absorption and the - * detection of "dense" rows/columns of A. - * - * (4) additional statistical information is returned, such as the number of - * nonzeros in L, and the flop counts for subsequent LDL' and LU - * factorizations. These are slight upper bounds, because of the mass - * elimination issue discussed above. - * - * (5) additional routines are added to interface this routine to MATLAB - * to provide a simple C-callable user-interface, to check inputs for - * errors, compute the symmetry of the pattern of A and the number of - * nonzeros in each row/column of A+A', to compute the pattern of A+A', - * to perform the assembly tree postordering, and to provide debugging - * ouput. Many of these functions are also provided by the Fortran - * Harwell Subroutine Library routine MC47A. - * - * (6) both "int" and "long" versions are provided. In the descriptions below - * and integer is and "int" or "long", depending on which version is - * being used. - - ********************************************************************** - ***** CAUTION: ARGUMENTS ARE NOT CHECKED FOR ERRORS ON INPUT. ****** - ********************************************************************** - ** If you want error checking, a more versatile input format, and a ** - ** simpler user interface, use camd_order or camd_l_order instead. ** - ** This routine is not meant to be user-callable. ** - ********************************************************************** - - * ---------------------------------------------------------------------------- - * References: - * ---------------------------------------------------------------------------- - * - * [1] Timothy A. Davis and Iain Duff, "An unsymmetric-pattern multifrontal - * method for sparse LU factorization", SIAM J. Matrix Analysis and - * Applications, vol. 18, no. 1, pp. 140-158. Discusses UMFPACK / MA38, - * which first introduced the approximate minimum degree used by this - * routine. - * - * [2] Patrick Amestoy, Timothy A. Davis, and Iain S. Duff, "An approximate - * minimum degree ordering algorithm," SIAM J. Matrix Analysis and - * Applications, vol. 17, no. 4, pp. 886-905, 1996. Discusses AMDBAR and - * MC47B, which are the Fortran versions of this routine. - * - * [3] Alan George and Joseph Liu, "The evolution of the minimum degree - * ordering algorithm," SIAM Review, vol. 31, no. 1, pp. 1-19, 1989. - * We list below the features mentioned in that paper that this code - * includes: - * - * mass elimination: - * Yes. MA27 relied on supervariable detection for mass elimination. - * - * indistinguishable nodes: - * Yes (we call these "supervariables"). This was also in the MA27 - * code - although we modified the method of detecting them (the - * previous hash was the true degree, which we no longer keep track - * of). A supervariable is a set of rows with identical nonzero - * pattern. All variables in a supervariable are eliminated together. - * Each supervariable has as its numerical name that of one of its - * variables (its principal variable). - * - * quotient graph representation: - * Yes. We use the term "element" for the cliques formed during - * elimination. This was also in the MA27 code. The algorithm can - * operate in place, but it will work more efficiently if given some - * "elbow room." - * - * element absorption: - * Yes. This was also in the MA27 code. - * - * external degree: - * Yes. The MA27 code was based on the true degree. - * - * incomplete degree update and multiple elimination: - * No. This was not in MA27, either. Our method of degree update - * within MC47B is element-based, not variable-based. It is thus - * not well-suited for use with incomplete degree update or multiple - * elimination. - * - * AMD Authors, and Copyright (C) 2004 by: - * Timothy A. Davis, Patrick Amestoy, Iain S. Duff, John K. Reid. - * Modifications for CAMD authored by Davis and Yanqing "Morris" Chen. - * - * Acknowledgements: This work (and the UMFPACK package) was supported by the - * National Science Foundation (ASC-9111263, DMS-9223088, and CCR-0203270). - * The UMFPACK/MA38 approximate degree update algorithm, the unsymmetric analog - * which forms the basis of CAMD, was developed while Tim Davis was supported by - * CERFACS (Toulouse, France) in a post-doctoral position. This C version, and - * the etree postorder, were written while Tim Davis was on sabbatical at - * Stanford University and Lawrence Berkeley National Laboratory. - * Ordering constraints were added with support from Sandia National Labs (DOE). - - * ---------------------------------------------------------------------------- - * INPUT ARGUMENTS (unaltered): - * ---------------------------------------------------------------------------- - - * n: The matrix order. Restriction: n >= 1. - * - * iwlen: The size of the Iw array. On input, the matrix is stored in - * Iw [0..pfree-1]. However, Iw [0..iwlen-1] should be slightly larger - * than what is required to hold the matrix, at least iwlen >= pfree + n. - * Otherwise, excessive compressions will take place. The recommended - * value of iwlen is 1.2 * pfree + n, which is the value used in the - * user-callable interface to this routine (camd_order.c). The algorithm - * will not run at all if iwlen < pfree. Restriction: iwlen >= pfree + n. - * Note that this is slightly more restrictive than the actual minimum - * (iwlen >= pfree), but CAMD_2 will be very slow with no elbow room. - * Thus, this routine enforces a bare minimum elbow room of size n. - * - * pfree: On input the tail end of the array, Iw [pfree..iwlen-1], is empty, - * and the matrix is stored in Iw [0..pfree-1]. During execution, - * additional data is placed in Iw, and pfree is modified so that - * Iw [pfree..iwlen-1] is always the unused part of Iw. - * - * Control: A double array of size CAMD_CONTROL containing input parameters - * that affect how the ordering is computed. If NULL, then default - * settings are used. - * - * Control [CAMD_DENSE] is used to determine whether or not a given input - * row is "dense". A row is "dense" if the number of entries in the row - * exceeds Control [CAMD_DENSE] times sqrt (n), except that rows with 16 or - * fewer entries are never considered "dense". To turn off the detection - * of dense rows, set Control [CAMD_DENSE] to a negative number, or to a - * number larger than sqrt (n). The default value of Control [CAMD_DENSE] - * is CAMD_DEFAULT_DENSE, which is defined in camd.h as 10. - * - * Control [CAMD_AGGRESSIVE] is used to determine whether or not aggressive - * absorption is to be performed. If nonzero, then aggressive absorption - * is performed (this is the default). - * - * C: defines the ordering constraints. s = C [j] gives the constraint set s - * that contains the row/column j (Restriction: 0 <= s < n). - * In the output row permutation, all rows in set 0 appear first, followed - * by all rows in set 1, and so on. If NULL, all rows are treated as if - * they were in a single constraint set, and you will obtain a similar - * ordering as AMD (slightly different because of the different - * postordering used). - - * ---------------------------------------------------------------------------- - * INPUT/OUPUT ARGUMENTS: - * ---------------------------------------------------------------------------- - * - * Pe: An integer array of size n. On input, Pe [i] is the index in Iw of - * the start of row i. Pe [i] is ignored if row i has no off-diagonal - * entries. Thus Pe [i] must be in the range 0 to pfree-1 for non-empty - * rows. - * - * During execution, it is used for both supervariables and elements: - * - * Principal supervariable i: index into Iw of the description of - * supervariable i. A supervariable represents one or more rows of - * the matrix with identical nonzero pattern. In this case, - * Pe [i] >= 0. - * - * Non-principal supervariable i: if i has been absorbed into another - * supervariable j, then Pe [i] = FLIP (j), where FLIP (j) is defined - * as (-(j)-2). Row j has the same pattern as row i. Note that j - * might later be absorbed into another supervariable j2, in which - * case Pe [i] is still FLIP (j), and Pe [j] = FLIP (j2) which is - * < EMPTY, where EMPTY is defined as (-1) in camd_internal.h. - * - * Unabsorbed element e: the index into Iw of the description of element - * e, if e has not yet been absorbed by a subsequent element. Element - * e is created when the supervariable of the same name is selected as - * the pivot. In this case, Pe [i] >= 0. - * - * Absorbed element e: if element e is absorbed into element e2, then - * Pe [e] = FLIP (e2). This occurs when the pattern of e (which we - * refer to as Le) is found to be a subset of the pattern of e2 (that - * is, Le2). In this case, Pe [i] < EMPTY. If element e is "null" - * (it has no nonzeros outside its pivot block), then Pe [e] = EMPTY, - * and e is the root of an assembly subtree (or the whole tree if - * there is just one such root). - * - * Dense or empty variable i: if i is "dense" or empty (with zero degree), - * then Pe [i] = FLIP (n). - * - * On output, Pe holds the assembly tree/forest, which implicitly - * represents a pivot order with identical fill-in as the actual order - * (via a depth-first search of the tree), as follows. If Nv [i] > 0, - * then i represents a node in the assembly tree, and the parent of i is - * Pe [i], or EMPTY if i is a root. If Nv [i] = 0, then (i, Pe [i]) - * represents an edge in a subtree, the root of which is a node in the - * assembly tree. Note that i refers to a row/column in the original - * matrix, not the permuted matrix. - * - * Info: A double array of size CAMD_INFO. If present, (that is, not NULL), - * then statistics about the ordering are returned in the Info array. - * See camd.h for a description. - - * ---------------------------------------------------------------------------- - * INPUT/MODIFIED (undefined on output): - * ---------------------------------------------------------------------------- - * - * Len: An integer array of size n. On input, Len [i] holds the number of - * entries in row i of the matrix, excluding the diagonal. The contents - * of Len are undefined on output. Len also works as a temporary - * workspace in post ordering with dense nodes detected. - * - * Iw: An integer array of size iwlen. On input, Iw [0..pfree-1] holds the - * description of each row i in the matrix. The matrix must be symmetric, - * and both upper and lower triangular parts must be present. The - * diagonal must not be present. Row i is held as follows: - * - * Len [i]: the length of the row i data structure in the Iw array. - * Iw [Pe [i] ... Pe [i] + Len [i] - 1]: - * the list of column indices for nonzeros in row i (simple - * supervariables), excluding the diagonal. All supervariables - * start with one row/column each (supervariable i is just row i). - * If Len [i] is zero on input, then Pe [i] is ignored on input. - * - * Note that the rows need not be in any particular order, and there - * may be empty space between the rows. - * - * During execution, the supervariable i experiences fill-in. This is - * represented by placing in i a list of the elements that cause fill-in - * in supervariable i: - * - * Len [i]: the length of supervariable i in the Iw array. - * Iw [Pe [i] ... Pe [i] + Elen [i] - 1]: - * the list of elements that contain i. This list is kept short - * by removing absorbed elements. - * Iw [Pe [i] + Elen [i] ... Pe [i] + Len [i] - 1]: - * the list of supervariables in i. This list is kept short by - * removing nonprincipal variables, and any entry j that is also - * contained in at least one of the elements (j in Le) in the list - * for i (e in row i). - * - * When supervariable i is selected as pivot, we create an element e of - * the same name (e=i): - * - * Len [e]: the length of element e in the Iw array. - * Iw [Pe [e] ... Pe [e] + Len [e] - 1]: - * the list of supervariables in element e. - * - * An element represents the fill-in that occurs when supervariable i is - * selected as pivot (which represents the selection of row i and all - * non-principal variables whose principal variable is i). We use the - * term Le to denote the set of all supervariables in element e. Absorbed - * supervariables and elements are pruned from these lists when - * computationally convenient. - * - * CAUTION: THE INPUT MATRIX IS OVERWRITTEN DURING COMPUTATION. - * The contents of Iw are undefined on output. - - * ---------------------------------------------------------------------------- - * OUTPUT (need not be set on input): - * ---------------------------------------------------------------------------- - * - * - * Nv: An integer array of size n. During execution, ABS (Nv [i]) is equal to - * the number of rows that are represented by the principal supervariable - * i. If i is a nonprincipal or dense variable, then Nv [i] = 0. - * Initially, Nv [i] = 1 for all i. Nv [i] < 0 signifies that i is a - * principal variable in the pattern Lme of the current pivot element me. - * After element me is constructed, Nv [i] is set back to a positive - * value. - * - * On output, Nv [i] holds the number of pivots represented by super - * row/column i of the original matrix, or Nv [i] = 0 for non-principal - * rows/columns. Note that i refers to a row/column in the original - * matrix, not the permuted matrix. - * - * Nv also works as a temporary workspace in initializing the BucketSet - * array. - * - * Elen: An integer array of size n. See the description of Iw above. At the - * start of execution, Elen [i] is set to zero for all rows i. During - * execution, Elen [i] is the number of elements in the list for - * supervariable i. When e becomes an element, Elen [e] = FLIP (esize) is - * set, where esize is the size of the element (the number of pivots, plus - * the number of nonpivotal entries). Thus Elen [e] < EMPTY. - * Elen (i) = EMPTY set when variable i becomes nonprincipal. - * - * For variables, Elen (i) >= EMPTY holds until just before the - * postordering and permutation vectors are computed. For elements, - * Elen [e] < EMPTY holds. - * - * On output, Elen [i] is the degree of the row/column in the Cholesky - * factorization of the permuted matrix, corresponding to the original row - * i, if i is a super row/column. It is equal to EMPTY if i is - * non-principal. Note that i refers to a row/column in the original - * matrix, not the permuted matrix. - * - * Note that the contents of Elen on output differ from the Fortran - * version (Elen holds the inverse permutation in the Fortran version, - * which is instead returned in the Next array in this C version, - * described below). - * - * Last: In a degree list, Last [i] is the supervariable preceding i, or EMPTY - * if i is the head of the list. In a hash bucket, Last [i] is the hash - * key for i. - * - * Last [Head [hash]] is also used as the head of a hash bucket if - * Head [hash] contains a degree list (see the description of Head, - * below). - * - * On output, Last [0..n-1] holds the permutation. That is, if - * i = Last [k], then row i is the kth pivot row (where k ranges from 0 to - * n-1). Row Last [k] of A is the kth row in the permuted matrix, PAP'. - * - * Next: Next [i] is the supervariable following i in a link list, or EMPTY if - * i is the last in the list. Used for two kinds of lists: degree lists - * and hash buckets (a supervariable can be in only one kind of list at a - * time). - * - * On output Next [0..n-1] holds the inverse permutation. That is, if - * k = Next [i], then row i is the kth pivot row. Row i of A appears as - * the (Next[i])-th row in the permuted matrix, PAP'. - * - * Note that the contents of Next on output differ from the Fortran - * version (Next is undefined on output in the Fortran version). - - * ---------------------------------------------------------------------------- - * LOCAL WORKSPACE (not input or output - used only during execution): - * ---------------------------------------------------------------------------- - * - * Degree: An integer array of size n. If i is a supervariable, then - * Degree [i] holds the current approximation of the external degree of - * row i (an upper bound). The external degree is the number of nonzeros - * in row i, minus ABS (Nv [i]), the diagonal part. The bound is equal to - * the exact external degree if Elen [i] is less than or equal to two. - * - * We also use the term "external degree" for elements e to refer to - * |Le \ Lme|. If e is an element, then Degree [e] is |Le|, which is the - * degree of the off-diagonal part of the element e (not including the - * diagonal part). - * - * Head: An integer array of size n. Head is used for degree lists. - * Head [deg] is the first supervariable in a degree list. All - * supervariables i in a degree list Head [deg] have the same approximate - * degree, namely, deg = Degree [i]. If the list Head [deg] is empty then - * Head [deg] = EMPTY. - * - * During supervariable detection Head [hash] also serves as a pointer to - * a hash bucket. If Head [hash] >= 0, there is a degree list of degree - * hash. The hash bucket head pointer is Last [Head [hash]]. If - * Head [hash] = EMPTY, then the degree list and hash bucket are both - * empty. If Head [hash] < EMPTY, then the degree list is empty, and - * FLIP (Head [hash]) is the head of the hash bucket. After supervariable - * detection is complete, all hash buckets are empty, and the - * (Last [Head [hash]] = EMPTY) condition is restored for the non-empty - * degree lists. - * - * Head also workes as a temporary workspace in post ordering with dense - * nodes detected. - * - * W: An integer array of size n. The flag array W determines the status of - * elements and variables, and the external degree of elements. - * - * for elements: - * if W [e] = 0, then the element e is absorbed. - * if W [e] >= wflg, then W [e] - wflg is the size of the set - * |Le \ Lme|, in terms of nonzeros (the sum of ABS (Nv [i]) for - * each principal variable i that is both in the pattern of - * element e and NOT in the pattern of the current pivot element, - * me). - * if wflg > W [e] > 0, then e is not absorbed and has not yet been - * seen in the scan of the element lists in the computation of - * |Le\Lme| in Scan 1 below. - * - * for variables: - * during supervariable detection, if W [j] != wflg then j is - * not in the pattern of variable i. - * - * The W array is initialized by setting W [i] = 1 for all i, and by - * setting wflg = 2. It is reinitialized if wflg becomes too large (to - * ensure that wflg+n does not cause integer overflow). - * - * BucketSet: An integer array of size n. - * During execution it stores the rows that sorted in the ascending order - * based on C []. For instance: if C[]={0,2,1,0,1,0,2,1}, the - * Bucketset will be {0,3,5,2,4,7,1,6}. - * The elements in Bucketset are then modified, to maintain the order of - * roots (Pe[i]=-1) in each Constraint Set. - - * ---------------------------------------------------------------------------- - * LOCAL INTEGERS: - * ---------------------------------------------------------------------------- - */ - - Int deg, degme, dext, lemax, e, elenme, eln, i, ilast, inext, j, - jlast, k, knt1, knt2, knt3, lenj, ln, me, mindeg, nel, nleft, - nvi, nvj, nvpiv, slenme, wbig, we, wflg, wnvi, ok, ndense, ncmpa, nnull, - dense, aggressive ; - - UnsignedInt hash ; /* unsigned, so that hash % n is well defined.*/ - -/* - * deg: the degree of a variable or element - * degme: size, |Lme|, of the current element, me (= Degree [me]) - * dext: external degree, |Le \ Lme|, of some element e - * lemax: largest |Le| seen so far (called dmax in Fortran version) - * e: an element - * elenme: the length, Elen [me], of element list of pivotal variable - * eln: the length, Elen [...], of an element list - * hash: the computed value of the hash function - * i: a supervariable - * ilast: the entry in a link list preceding i - * inext: the entry in a link list following i - * j: a supervariable - * jlast: the entry in a link list preceding j - * k: the pivot order of an element or variable - * knt1: loop counter used during element construction - * knt2: loop counter used during element construction - * knt3: loop counter used during compression - * lenj: Len [j] - * ln: length of a supervariable list - * me: current supervariable being eliminated, and the current - * element created by eliminating that supervariable - * mindeg: current minimum degree - * nel: number of pivots selected so far - * nleft: n - nel, the number of nonpivotal rows/columns remaining - * nvi: the number of variables in a supervariable i (= Nv [i]) - * nvj: the number of variables in a supervariable j (= Nv [j]) - * nvpiv: number of pivots in current element - * slenme: number of variables in variable list of pivotal variable - * wbig: = INT_MAX - n for the "int" version, LONG_MAX - n for the - * "long" version. wflg is not allowed to be >= wbig. - * we: W [e] - * wflg: used for flagging the W array. See description of Iw. - * wnvi: wflg - Nv [i] - * x: either a supervariable or an element - * - * ok: true if supervariable j can be absorbed into i - * ndense: number of "dense" rows/columns - * nnull: number of empty rows/columns - * dense: rows/columns with initial degree > dense are considered "dense" - * aggressive: true if aggressive absorption is being performed - * ncmpa: number of garbage collections - - * ---------------------------------------------------------------------------- - * LOCAL DOUBLES, used for statistical output only (except for alpha): - * ---------------------------------------------------------------------------- - */ - - double f, r, ndiv, s, nms_lu, nms_ldl, dmax, alpha, lnz, lnzme ; - -/* - * f: nvpiv - * r: degme + nvpiv - * ndiv: number of divisions for LU or LDL' factorizations - * s: number of multiply-subtract pairs for LU factorization, for the - * current element me - * nms_lu number of multiply-subtract pairs for LU factorization - * nms_ldl number of multiply-subtract pairs for LDL' factorization - * dmax: the largest number of entries in any column of L, including the - * diagonal - * alpha: "dense" degree ratio - * lnz: the number of nonzeros in L (excluding the diagonal) - * lnzme: the number of nonzeros in L (excl. the diagonal) for the - * current element me - - * ---------------------------------------------------------------------------- - * LOCAL "POINTERS" (indices into the Iw array) - * ---------------------------------------------------------------------------- -*/ - - Int p, p1, p2, p3, p4, pdst, pend, pj, pme, pme1, pme2, pn, psrc ; - -/* - * Any parameter (Pe [...] or pfree) or local variable starting with "p" (for - * Pointer) is an index into Iw, and all indices into Iw use variables starting - * with "p." The only exception to this rule is the iwlen input argument. - * - * p: pointer into lots of things - * p1: Pe [i] for some variable i (start of element list) - * p2: Pe [i] + Elen [i] - 1 for some variable i - * p3: index of first supervariable in clean list - * p4: - * pdst: destination pointer, for compression - * pend: end of memory to compress - * pj: pointer into an element or variable - * pme: pointer into the current element (pme1...pme2) - * pme1: the current element, me, is stored in Iw [pme1...pme2] - * pme2: the end of the current element - * pn: pointer into a "clean" variable, also used to compress - * psrc: source pointer, for compression -*/ - - Int curC, pBucket, pBucket2, degreeListCounter, c, cmax = 0, - ndense_or_null ; - Int *Bucket, *Perm ; - -/* - * curC: the current Constraint Set being ordered - * pBucket: pointer into Bucketset[] when building the degreelist for each - * Constraint Set - * pBucket2: pointer into Bucketset[] to tell the post ordering where to stop - * degreeListCounter: number of elements remaining in the - * degreelist of current Constraint Set - * Bucket: used to construct BucketSet - * Perm: permutation - */ - -/* ========================================================================= */ -/* INITIALIZATIONS */ -/* ========================================================================= */ - - /* Note that this restriction on iwlen is slightly more restrictive than - * what is actually required in CAMD_2. CAMD_2 can operate with no elbow - * room at all, but it will be slow. For better performance, at least - * size-n elbow room is enforced. */ - ASSERT (iwlen >= pfree + n) ; - ASSERT (n > 0) ; - - /* initialize output statistics */ - lnz = 0 ; - ndiv = 0 ; - nms_lu = 0 ; - nms_ldl = 0 ; - dmax = 1 ; - me = EMPTY ; - - mindeg = 0 ; - ncmpa = 0 ; - nel = 0 ; - lemax = 0 ; - curC = 0 ; - -/* camd work initBucketSet using CountingSort - * BucketSort the index Array BucketSet According to Contrains Array C, Using - * Nv[] as a temporary workspace - * Input: Index Array from 0 to n.(index of rows) - * Output: Index Array sorted according to C. worked as a bucket set. - * - * All the value in C must be 0 <= C[i] <= n-1 - * For instance: if C[]={0,2,1,0,1,0,2,1}, the output Bucketset should be - * {0,3,5,2,4,7,1,6} - */ - - -/* CountingSort BucketSet[] based on C[], It is O(n) linear time */ - - if (C == NULL) - { - /* store everything in bucket without changing order */ - for (j = 0 ; j < n ; j++) - { - BucketSet [j] = j ; - } - } - else - { - - Bucket = Nv ; - for (i = 0 ; i < n ; i++) - { - Bucket [i] = 0 ; - } - cmax = C [0] ; - for (j = 0 ; j < n ; j++) - { - c = C [j] ; - CAMD_DEBUG1 (("C [%d] = "ID"\n", j, c)) ; - Bucket [c]++ ; - cmax = MAX (cmax, c) ; - ASSERT (c >= 0 && c < n) ; - } - CAMD_DEBUG1 (("Max constraint set: "ID"\n", cmax)) ; - for (i = 1 ; i < n ; i++) - { - Bucket [i] += Bucket [i-1] ; - } - for (j = n-1 ; j >= 0 ; j--) - { - BucketSet [--Bucket [C [j]]] = j ; - } - -#ifndef NDEBUG - CAMD_DEBUG3 (("\nConstraint Set "ID" :", C [BucketSet [0]])); - for (i = 0 ; i < n ; i++) - { - CAMD_DEBUG3 ((ID" ", BucketSet [i])) ; - if (i == n-1) - { - CAMD_DEBUG3 (("\n")) ; - break ; - } - if (C [BucketSet [i+1]] != C [BucketSet [i]]) - { - CAMD_DEBUG3 (("\nConstraint Set "ID" :", C [BucketSet [i+1]])) ; - } - } -#endif - } - - /* get control parameters */ - if (Control != (double *) NULL) - { - alpha = Control [CAMD_DENSE] ; - aggressive = (Control [CAMD_AGGRESSIVE] != 0) ; - } - else - { - alpha = CAMD_DEFAULT_DENSE ; - aggressive = CAMD_DEFAULT_AGGRESSIVE ; - } - /* Note: if alpha is NaN, this is undefined: */ - if (alpha < 0) - { - /* only remove completely dense rows/columns */ - dense = n-2 ; - } - else - { - dense = alpha * sqrt ((double) n) ; - } - dense = MAX (16, dense) ; - dense = MIN (n, dense) ; - CAMD_DEBUG1 (("\n\nCAMD (debug), alpha %g, aggr. "ID"\n", - alpha, aggressive)) ; - - for (i = 0 ; i < n ; i++) - { - Last [i] = EMPTY ; - Head [i] = EMPTY ; - Next [i] = EMPTY ; - /* if separate Hhead array is used for hash buckets: * - Hhead [i] = EMPTY ; - */ - Nv [i] = 1 ; - W [i] = 1 ; - Elen [i] = 0 ; - Degree [i] = Len [i] ; - } - Head [n] = EMPTY ; - - /* initialize wflg */ - wbig = Int_MAX - n ; - wflg = clear_flag (0, wbig, W, n) ; - - /* --------------------------------------------------------------------- */ - /* eliminate dense and empty rows */ - /* --------------------------------------------------------------------- */ - - ndense = 0 ; - nnull = 0 ; - - for (j = 0 ; j < n ; j++) - { - i = BucketSet [j] ; - deg = Degree [i] ; - ASSERT (deg >= 0 && deg < n) ; - if (deg > dense || deg == 0) - { - - /* ------------------------------------------------------------- - * Dense or empty variables are treated as non-principal variables - * represented by node n. That is, i is absorbed into n, just like - * j is absorbed into i in supervariable detection (see "found it!" - * comment, below). - * ------------------------------------------------------------- */ - - if (deg > dense) - { - CAMD_DEBUG1 (("Dense node "ID" degree "ID" bucket "ID"\n", - i, deg, j)) ; - ndense++ ; - } - else - { - CAMD_DEBUG1 (("Empty node "ID" degree "ID" bucket "ID"\n", - i, deg, j)) ; - nnull++ ; - } - Pe [i] = FLIP (n) ; - Nv [i] = 0 ; /* do not postorder this node */ - Elen [i] = EMPTY ; - nel++ ; - } - } - - ndense_or_null = ndense + nnull ; - - pBucket = 0 ; - degreeListCounter = 0 ; - pBucket2 = 0 ; - -/* ========================================================================= */ -/* WHILE (selecting pivots) DO */ -/* ========================================================================= */ - - while (nel < n) - { - - /* ------------------------------------------------------------------ */ - /* if empty, fill the degree list with next non-empty constraint set */ - /* ------------------------------------------------------------------ */ - - while (degreeListCounter == 0) - { - mindeg = n ; - /* determine the new constraint set */ - curC = (C == NULL) ? 0 : C [BucketSet [pBucket]] ; - for ( ; pBucket < n ; pBucket++) - { - /* add i to the degree list, unless it's dead or not in curC */ - i = BucketSet [pBucket] ; - if (!IsInCurrentSet (C, i, curC)) break ; - deg = Degree [i] ; - ASSERT (deg >= 0 && deg < n) ; - if (Pe [i] >= 0) - { - - /* ------------------------------------------------------ - * place i in the degree list corresponding to its degree - * ------------------------------------------------------ */ - - inext = Head [deg] ; - ASSERT (inext >= EMPTY && inext < n) ; - if (inext != EMPTY) Last [inext] = i ; - Next [i] = inext ; - Head [deg] = i ; - degreeListCounter++ ; - Last [i] = EMPTY ; - mindeg = MIN (mindeg, deg) ; - } - } - } - -#ifndef NDEBUG - CAMD_DEBUG1 (("\n======Nel "ID"\n", nel)) ; - if (CAMD_debug >= 2) - { - CAMD_dump (n, Pe, Iw, Len, iwlen, pfree, Nv, Next, - Last, Head, Elen, Degree, W, nel, BucketSet, C, curC) ; - } -#endif - -/* ========================================================================= */ -/* GET PIVOT OF MINIMUM DEGREE */ -/* ========================================================================= */ - - /* ----------------------------------------------------------------- */ - /* find next supervariable for elimination */ - /* ----------------------------------------------------------------- */ - - ASSERT (mindeg >= 0 && mindeg < n) ; - for (deg = mindeg ; deg < n ; deg++) - { - me = Head [deg] ; - if (me != EMPTY) break ; - } - mindeg = deg ; - ASSERT (me >= 0 && me < n) ; - CAMD_DEBUG1 (("=================me: "ID"\n", me)) ; - - /* ----------------------------------------------------------------- */ - /* remove chosen variable from link list */ - /* ----------------------------------------------------------------- */ - - inext = Next [me] ; - ASSERT (inext >= EMPTY && inext < n) ; - if (inext != EMPTY) Last [inext] = EMPTY ; - Head [deg] = inext ; - degreeListCounter-- ; - - /* ----------------------------------------------------------------- */ - /* me represents the elimination of pivots nel to nel+Nv[me]-1. */ - /* place me itself as the first in this set. */ - /* ----------------------------------------------------------------- */ - - elenme = Elen [me] ; - nvpiv = Nv [me] ; - ASSERT (nvpiv > 0) ; - nel += nvpiv ; - CAMD_DEBUG1 (("nvpiv is initially "ID"\n", nvpiv)) ; - -/* ========================================================================= */ -/* CONSTRUCT NEW ELEMENT */ -/* ========================================================================= */ - - /* ----------------------------------------------------------------- - * At this point, me is the pivotal supervariable. It will be - * converted into the current element. Scan list of the pivotal - * supervariable, me, setting tree pointers and constructing new list - * of supervariables for the new element, me. p is a pointer to the - * current position in the old list. - * ----------------------------------------------------------------- */ - - /* flag the variable "me" as being in Lme by negating Nv [me] */ - Nv [me] = -nvpiv ; - degme = 0 ; - ASSERT (Pe [me] >= 0 && Pe [me] < iwlen) ; - - if (elenme == 0) - { - - /* ------------------------------------------------------------- */ - /* construct the new element in place */ - /* ------------------------------------------------------------- */ - - pme1 = Pe [me] ; - pme2 = pme1 - 1 ; - - for (p = pme1 ; p <= pme1 + Len [me] - 1 ; p++) - { - i = Iw [p] ; - ASSERT (i >= 0 && i < n && Nv [i] >= 0) ; - nvi = Nv [i] ; - if (nvi > 0) - { - - /* ----------------------------------------------------- */ - /* i is a principal variable not yet placed in Lme. */ - /* store i in new list */ - /* ----------------------------------------------------- */ - - /* flag i as being in Lme by negating Nv [i] */ - degme += nvi ; - Nv [i] = -nvi ; - Iw [++pme2] = i ; - - /* ----------------------------------------------------- */ - /* remove variable i from degree list. */ - /* ----------------------------------------------------- */ - - if (IsInCurrentSet (C, i, curC)) - { - ilast = Last [i] ; - inext = Next [i] ; - ASSERT (ilast >= EMPTY && ilast < n) ; - ASSERT (inext >= EMPTY && inext < n) ; - if (inext != EMPTY) Last [inext] = ilast ; - if (ilast != EMPTY) - { - Next [ilast] = inext ; - } - else - { - /* i is at the head of the degree list */ - ASSERT (Degree [i] >= 0 && Degree [i] < n) ; - Head [Degree [i]] = inext ; - } - degreeListCounter-- ; - } - } - } - } - else - { - - /* ------------------------------------------------------------- */ - /* construct the new element in empty space, Iw [pfree ...] */ - /* ------------------------------------------------------------- */ - - p = Pe [me] ; - pme1 = pfree ; - slenme = Len [me] - elenme ; - - for (knt1 = 1 ; knt1 <= elenme + 1 ; knt1++) - { - - if (knt1 > elenme) - { - /* search the supervariables in me. */ - e = me ; - pj = p ; - ln = slenme ; - CAMD_DEBUG2 (("Search sv: "ID" "ID" "ID"\n", me,pj,ln)) ; - } - else - { - /* search the elements in me. */ - e = Iw [p++] ; - ASSERT (e >= 0 && e < n) ; - pj = Pe [e] ; - ln = Len [e] ; - CAMD_DEBUG2 (("Search element e "ID" in me "ID"\n", e,me)) ; - ASSERT (Elen [e] < EMPTY && W [e] > 0 && pj >= 0) ; - } - ASSERT (ln >= 0 && (ln == 0 || (pj >= 0 && pj < iwlen))) ; - - /* --------------------------------------------------------- - * search for different supervariables and add them to the - * new list, compressing when necessary. this loop is - * executed once for each element in the list and once for - * all the supervariables in the list. - * --------------------------------------------------------- */ - - for (knt2 = 1 ; knt2 <= ln ; knt2++) - { - i = Iw [pj++] ; - ASSERT (i >= 0 && i < n && (i == me || Elen [i] >= EMPTY)); - nvi = Nv [i] ; - CAMD_DEBUG2 ((": "ID" "ID" "ID" "ID"\n", - i, Elen [i], Nv [i], wflg)) ; - - if (nvi > 0) - { - - /* ------------------------------------------------- */ - /* compress Iw, if necessary */ - /* ------------------------------------------------- */ - - if (pfree >= iwlen) - { - - CAMD_DEBUG1 (("GARBAGE COLLECTION\n")) ; - - /* prepare for compressing Iw by adjusting pointers - * and lengths so that the lists being searched in - * the inner and outer loops contain only the - * remaining entries. */ - - Pe [me] = p ; - Len [me] -= knt1 ; - /* check if nothing left of supervariable me */ - if (Len [me] == 0) Pe [me] = EMPTY ; - Pe [e] = pj ; - Len [e] = ln - knt2 ; - /* nothing left of element e */ - if (Len [e] == 0) Pe [e] = EMPTY ; - - ncmpa++ ; /* one more garbage collection */ - - /* store first entry of each object in Pe */ - /* FLIP the first entry in each object */ - for (j = 0 ; j < n ; j++) - { - pn = Pe [j] ; - if (pn >= 0) - { - ASSERT (pn >= 0 && pn < iwlen) ; - Pe [j] = Iw [pn] ; - Iw [pn] = FLIP (j) ; - } - } - - /* psrc/pdst point to source/destination */ - psrc = 0 ; - pdst = 0 ; - pend = pme1 - 1 ; - - while (psrc <= pend) - { - /* search for next FLIP'd entry */ - j = FLIP (Iw [psrc++]) ; - if (j >= 0) - { - CAMD_DEBUG2 (("Got object j: "ID"\n", j)) ; - Iw [pdst] = Pe [j] ; - Pe [j] = pdst++ ; - lenj = Len [j] ; - /* copy from source to destination */ - for (knt3 = 0 ; knt3 <= lenj - 2 ; knt3++) - { - Iw [pdst++] = Iw [psrc++] ; - } - } - } - - /* move the new partially-constructed element */ - p1 = pdst ; - for (psrc = pme1 ; psrc <= pfree-1 ; psrc++) - { - Iw [pdst++] = Iw [psrc] ; - } - pme1 = p1 ; - pfree = pdst ; - pj = Pe [e] ; - p = Pe [me] ; - - } - - /* ------------------------------------------------- */ - /* i is a principal variable not yet placed in Lme */ - /* store i in new list */ - /* ------------------------------------------------- */ - - /* flag i as being in Lme by negating Nv [i] */ - degme += nvi ; - Nv [i] = -nvi ; - Iw [pfree++] = i ; - CAMD_DEBUG2 ((" s: "ID" nv "ID"\n", i, Nv [i])); - - /* ------------------------------------------------- */ - /* remove variable i from degree link list */ - /* ------------------------------------------------- */ - - if (IsInCurrentSet (C, i, curC)) - { - ilast = Last [i] ; - inext = Next [i] ; - ASSERT (ilast >= EMPTY && ilast < n) ; - ASSERT (inext >= EMPTY && inext < n) ; - if (inext != EMPTY) Last [inext] = ilast ; - if (ilast != EMPTY) - { - Next [ilast] = inext ; - } - else - { - /* i is at the head of the degree list */ - ASSERT (Degree [i] >= 0 && Degree [i] < n) ; - Head [Degree [i]] = inext ; - } - degreeListCounter-- ; - } - } - } - - if (e != me) - { - if (IsInCurrentSet (C, e, curC)) - { - /* absorb element here if in same bucket */ - /* set tree pointer and flag to indicate element e is - * absorbed into new element me (the parent of e is me) - */ - CAMD_DEBUG1 ((" Element "ID" => "ID"\n", e, me)) ; - Pe [e] = FLIP (me) ; - W [e] = 0 ; - } - else - { - /* make element a root; kill it if not in same bucket */ - CAMD_DEBUG1 (("2 Element "ID" => "ID"\n", e, me)) ; - Pe [e] = EMPTY ; - W [e] = 0 ; - } - } - } - - pme2 = pfree - 1 ; - } - - /* ----------------------------------------------------------------- */ - /* me has now been converted into an element in Iw [pme1..pme2] */ - /* ----------------------------------------------------------------- */ - - /* degme holds the external degree of new element */ - Degree [me] = degme ; - Pe [me] = pme1 ; - Len [me] = pme2 - pme1 + 1 ; - ASSERT (Pe [me] >= 0 && Pe [me] < iwlen) ; - - Elen [me] = FLIP (nvpiv + degme) ; - /* FLIP (Elen (me)) is now the degree of pivot (including - * diagonal part). */ - -#ifndef NDEBUG - CAMD_DEBUG2 (("New element structure: length= "ID"\n", pme2-pme1+1)) ; - for (pme = pme1 ; pme <= pme2 ; pme++) CAMD_DEBUG3 ((" "ID"", Iw[pme])); - CAMD_DEBUG3 (("\n")) ; -#endif - - /* ----------------------------------------------------------------- */ - /* make sure that wflg is not too large. */ - /* ----------------------------------------------------------------- */ - - /* With the current value of wflg, wflg+n must not cause integer - * overflow */ - - wflg = clear_flag (wflg, wbig, W, n) ; - -/* ========================================================================= */ -/* COMPUTE (W [e] - wflg) = |Le\Lme| FOR ALL ELEMENTS */ -/* ========================================================================= */ - - /* ----------------------------------------------------------------- - * Scan 1: compute the external degrees of previous elements with - * respect to the current element. That is: - * (W [e] - wflg) = |Le \ Lme| - * for each element e that appears in any supervariable in Lme. The - * notation Le refers to the pattern (list of supervariables) of a - * previous element e, where e is not yet absorbed, stored in - * Iw [Pe [e] + 1 ... Pe [e] + Len [e]]. The notation Lme - * refers to the pattern of the current element (stored in - * Iw [pme1..pme2]). If aggressive absorption is enabled, and - * (W [e] - wflg) becomes zero, then the element e will be absorbed - * in Scan 2. - * ----------------------------------------------------------------- */ - - CAMD_DEBUG2 (("me: ")) ; - for (pme = pme1 ; pme <= pme2 ; pme++) - { - i = Iw [pme] ; - ASSERT (i >= 0 && i < n) ; - eln = Elen [i] ; - CAMD_DEBUG3 ((""ID" Elen "ID": \n", i, eln)) ; - if (eln > 0) - { - /* note that Nv [i] has been negated to denote i in Lme: */ - nvi = -Nv [i] ; - ASSERT (nvi > 0 && Pe [i] >= 0 && Pe [i] < iwlen) ; - wnvi = wflg - nvi ; - for (p = Pe [i] ; p <= Pe [i] + eln - 1 ; p++) - { - e = Iw [p] ; - ASSERT (e >= 0 && e < n) ; - we = W [e] ; - CAMD_DEBUG4 ((" e "ID" we "ID" ", e, we)) ; - if (we >= wflg) - { - /* unabsorbed element e has been seen in this loop */ - CAMD_DEBUG4 ((" unabsorbed, first time seen")) ; - we -= nvi ; - } - else if (we != 0) - { - /* e is an unabsorbed element */ - /* this is the first we have seen e in all of Scan 1 */ - CAMD_DEBUG4 ((" unabsorbed")) ; - we = Degree [e] + wnvi ; - } - CAMD_DEBUG4 (("\n")) ; - W [e] = we ; - } - } - } - CAMD_DEBUG2 (("\n")) ; - -/* ========================================================================= */ -/* DEGREE UPDATE AND ELEMENT ABSORPTION */ -/* ========================================================================= */ - - /* ----------------------------------------------------------------- - * Scan 2: for each i in Lme, sum up the degree of Lme (which is - * degme), plus the sum of the external degrees of each Le for the - * elements e appearing within i, plus the supervariables in i. - * Place i in hash list. - * ----------------------------------------------------------------- */ - - for (pme = pme1 ; pme <= pme2 ; pme++) - { - i = Iw [pme] ; - ASSERT (i >= 0 && i < n && Nv [i] < 0 && Elen [i] >= 0) ; - CAMD_DEBUG2 (("Updating: i "ID" "ID" "ID"\n", i, Elen[i], Len [i])); - p1 = Pe [i] ; - p2 = p1 + Elen [i] - 1 ; - pn = p1 ; - hash = 0 ; - deg = 0 ; - ASSERT (p1 >= 0 && p1 < iwlen && p2 >= -1 && p2 < iwlen) ; - - /* ------------------------------------------------------------- */ - /* scan the element list associated with supervariable i */ - /* ------------------------------------------------------------- */ - - /* UMFPACK/MA38-style approximate degree: */ - if (aggressive) - { - for (p = p1 ; p <= p2 ; p++) - { - e = Iw [p] ; - ASSERT (e >= 0 && e < n) ; - we = W [e] ; - if (we != 0) - { - /* e is an unabsorbed element */ - /* dext = | Le \ Lme | */ - dext = we - wflg ; - if (dext > 0) - { - deg += dext ; - Iw [pn++] = e ; - hash += e ; - CAMD_DEBUG4 ((" e: "ID" hash = "ID"\n",e,hash)) ; - } - else - { - if (IsInCurrentSet (C, e, curC)) - { - /* external degree of e is zero and if - * C[e] = curC; absorb e into me */ - CAMD_DEBUG1 ((" Element "ID" =>"ID" (aggr)\n", - e, me)) ; - ASSERT (dext == 0) ; - Pe [e] = FLIP (me) ; - W [e] = 0 ; - } - else - { - /* make element a root; kill it if not in same - * bucket */ - CAMD_DEBUG1 (("2 Element "ID" =>"ID" (aggr)\n", - e, me)) ; - ASSERT (dext == 0) ; - Pe [e] = EMPTY ; - W [e] = 0 ; - } - } - } - } - } - else - { - for (p = p1 ; p <= p2 ; p++) - { - e = Iw [p] ; - ASSERT (e >= 0 && e < n) ; - we = W [e] ; - if (we != 0) - { - /* e is an unabsorbed element */ - dext = we - wflg ; - ASSERT (dext >= 0) ; - deg += dext ; - Iw [pn++] = e ; - hash += e ; - CAMD_DEBUG4 ((" e: "ID" hash = "ID"\n",e,hash)) ; - } - } - } - - /* count the number of elements in i (including me): */ - Elen [i] = pn - p1 + 1 ; - - /* ------------------------------------------------------------- */ - /* scan the supervariables in the list associated with i */ - /* ------------------------------------------------------------- */ - - /* The bulk of the CAMD run time is typically spent in this loop, - * particularly if the matrix has many dense rows that are not - * removed prior to ordering. */ - p3 = pn ; - p4 = p1 + Len [i] ; - for (p = p2 + 1 ; p < p4 ; p++) - { - j = Iw [p] ; - ASSERT (j >= 0 && j < n) ; - nvj = Nv [j] ; - if (nvj > 0) - { - /* j is unabsorbed, and not in Lme. */ - /* add to degree and add to new list */ - deg += nvj ; - Iw [pn++] = j ; - hash += j ; - CAMD_DEBUG4 ((" s: "ID" hash "ID" Nv[j]= "ID"\n", - j, hash, nvj)) ; - } - } - - /* ------------------------------------------------------------- */ - /* update the degree and check for mass elimination */ - /* ------------------------------------------------------------- */ - - /* with aggressive absorption, deg==0 is identical to the - * Elen [i] == 1 && p3 == pn test, below. */ - ASSERT (IMPLIES (aggressive, (deg==0) == (Elen[i]==1 && p3==pn))) ; - - if (Elen [i] == 1 && p3 == pn && IsInCurrentSet (C, i, curC)) - { - - /* --------------------------------------------------------- */ - /* mass elimination */ - /* --------------------------------------------------------- */ - - /* There is nothing left of this node except for an edge to - * the current pivot element. Elen [i] is 1, and there are - * no variables adjacent to node i. Absorb i into the - * current pivot element, me. Note that if there are two or - * more mass eliminations, fillin due to mass elimination is - * possible within the nvpiv-by-nvpiv pivot block. It is this - * step that causes CAMD's analysis to be an upper bound. - * - * The reason is that the selected pivot has a lower - * approximate degree than the true degree of the two mass - * eliminated nodes. There is no edge between the two mass - * eliminated nodes. They are merged with the current pivot - * anyway. - * - * No fillin occurs in the Schur complement, in any case, - * and this effect does not decrease the quality of the - * ordering itself, just the quality of the nonzero and - * flop count analysis. It also means that the post-ordering - * is not an exact elimination tree post-ordering. */ - - CAMD_DEBUG1 ((" MASS i "ID" => parent e "ID"\n", i, me)) ; - Pe [i] = FLIP (me) ; - nvi = -Nv [i] ; - degme -= nvi ; - nvpiv += nvi ; - nel += nvi ; - Nv [i] = 0 ; - Elen [i] = EMPTY ; - - } - else - { - - /* --------------------------------------------------------- */ - /* update the upper-bound degree of i */ - /* --------------------------------------------------------- */ - - /* the following degree does not yet include the size - * of the current element, which is added later: */ - - Degree [i] = MIN (Degree [i], deg) ; - - /* --------------------------------------------------------- */ - /* add me to the list for i */ - /* --------------------------------------------------------- */ - - /* move first supervariable to end of list */ - Iw [pn] = Iw [p3] ; - /* move first element to end of element part of list */ - Iw [p3] = Iw [p1] ; - /* add new element, me, to front of list. */ - Iw [p1] = me ; - /* store the new length of the list in Len [i] */ - Len [i] = pn - p1 + 1 ; - - /* --------------------------------------------------------- */ - /* place in hash bucket. Save hash key of i in Last [i]. */ - /* --------------------------------------------------------- */ - - /* NOTE: this can fail if hash is negative, because the ANSI C - * standard does not define a % b when a and/or b are negative. - * That's why hash is defined as an unsigned Int, to avoid this - * problem. */ - hash = hash % n ; - ASSERT (((Int) hash) >= 0 && ((Int) hash) < n) ; - - /* if the Hhead array is not used: */ - j = Head [hash] ; - if (j <= EMPTY) - { - /* degree list is empty, hash head is FLIP (j) */ - Next [i] = FLIP (j) ; - Head [hash] = FLIP (i) ; - } - else - { - /* degree list is not empty, use Last [Head [hash]] as - * hash head. */ - Next [i] = Last [j] ; - Last [j] = i ; - } - - /* if a separate Hhead array is used: * - Next [i] = Hhead [hash] ; - Hhead [hash] = i ; - */ - - CAMD_DEBUG4 ((" s: "ID" hash "ID" \n", i, hash)) ; - Last [i] = hash ; - } - } - - Degree [me] = degme ; - - /* ----------------------------------------------------------------- */ - /* Clear the counter array, W [...], by incrementing wflg. */ - /* ----------------------------------------------------------------- */ - - /* make sure that wflg+n does not cause integer overflow */ - lemax = MAX (lemax, degme) ; - wflg += lemax ; - wflg = clear_flag (wflg, wbig, W, n) ; - /* at this point, W [0..n-1] < wflg holds */ - -/* ========================================================================= */ -/* SUPERVARIABLE DETECTION */ -/* ========================================================================= */ - - CAMD_DEBUG1 (("Detecting supervariables:\n")) ; - for (pme = pme1 ; pme <= pme2 ; pme++) - { - i = Iw [pme] ; - ASSERT (i >= 0 && i < n) ; - CAMD_DEBUG2 (("Consider i "ID" nv "ID"\n", i, Nv [i])) ; - if (Nv [i] < 0) - { - /* i is a principal variable in Lme */ - - /* --------------------------------------------------------- - * examine all hash buckets with 2 or more variables. We do - * this by examing all unique hash keys for supervariables in - * the pattern Lme of the current element, me - * --------------------------------------------------------- */ - - CAMD_DEBUG2 (("Last: "ID"\n", Last [i])) ; - - /* let i = head of hash bucket, and empty the hash bucket */ - ASSERT (Last [i] >= 0 && Last [i] < n) ; - hash = Last [i] ; - - /* if Hhead array is not used: */ - j = Head [hash] ; - if (j == EMPTY) - { - /* hash bucket and degree list are both empty */ - i = EMPTY ; - } - else if (j < EMPTY) - { - /* degree list is empty */ - i = FLIP (j) ; - Head [hash] = EMPTY ; - } - else - { - /* degree list is not empty, restore Last [j] of head j */ - i = Last [j] ; - Last [j] = EMPTY ; - } - - /* if separate Hhead array is used: * - i = Hhead [hash] ; - Hhead [hash] = EMPTY ; - */ - - ASSERT (i >= EMPTY && i < n) ; - CAMD_DEBUG2 (("----i "ID" hash "ID"\n", i, hash)) ; - - while (i != EMPTY && Next [i] != EMPTY) - { - - /* ----------------------------------------------------- - * this bucket has one or more variables following i. - * scan all of them to see if i can absorb any entries - * that follow i in hash bucket. Scatter i into w. - * ----------------------------------------------------- */ - - ln = Len [i] ; - eln = Elen [i] ; - ASSERT (ln >= 0 && eln >= 0) ; - ASSERT (Pe [i] >= 0 && Pe [i] < iwlen) ; - /* do not flag the first element in the list (me) */ - for (p = Pe [i] + 1 ; p <= Pe [i] + ln - 1 ; p++) - { - ASSERT (Iw [p] >= 0 && Iw [p] < n) ; - W [Iw [p]] = wflg ; - } - - /* ----------------------------------------------------- */ - /* scan every other entry j following i in bucket */ - /* ----------------------------------------------------- */ - - jlast = i ; - j = Next [i] ; - ASSERT (j >= EMPTY && j < n) ; - - while (j != EMPTY) - { - /* ------------------------------------------------- */ - /* check if j and i have identical nonzero pattern */ - /* ------------------------------------------------- */ - - CAMD_DEBUG3 (("compare i "ID" and j "ID"\n", i,j)) ; - - /* check if i and j have the same Len and Elen */ - /* and are in the same bucket */ - ASSERT (Len [j] >= 0 && Elen [j] >= 0) ; - ASSERT (Pe [j] >= 0 && Pe [j] < iwlen) ; - ok = (Len [j] == ln) && (Elen [j] == eln) ; - ok = ok && InSameConstraintSet (C,i,j) ; - - /* skip the first element in the list (me) */ - for (p = Pe [j] + 1 ; ok && p <= Pe [j] + ln - 1 ; p++) - { - ASSERT (Iw [p] >= 0 && Iw [p] < n) ; - if (W [Iw [p]] != wflg) ok = 0 ; - } - if (ok) - { - /* --------------------------------------------- */ - /* found it! j can be absorbed into i */ - /* --------------------------------------------- */ - - CAMD_DEBUG1 (("found it! j "ID" => i "ID"\n", j,i)); - Pe [j] = FLIP (i) ; - /* both Nv [i] and Nv [j] are negated since they */ - /* are in Lme, and the absolute values of each */ - /* are the number of variables in i and j: */ - Nv [i] += Nv [j] ; - Nv [j] = 0 ; - Elen [j] = EMPTY ; - /* delete j from hash bucket */ - ASSERT (j != Next [j]) ; - j = Next [j] ; - Next [jlast] = j ; - - } - else - { - /* j cannot be absorbed into i */ - jlast = j ; - ASSERT (j != Next [j]) ; - j = Next [j] ; - } - ASSERT (j >= EMPTY && j < n) ; - } - - /* ----------------------------------------------------- - * no more variables can be absorbed into i - * go to next i in bucket and clear flag array - * ----------------------------------------------------- */ - - wflg++ ; - i = Next [i] ; - ASSERT (i >= EMPTY && i < n) ; - - } - } - } - CAMD_DEBUG2 (("detect done\n")) ; - -/* ========================================================================= */ -/* RESTORE DEGREE LISTS AND REMOVE NONPRINCIPAL SUPERVARIABLES FROM ELEMENT */ -/* ========================================================================= */ - - p = pme1 ; - nleft = n - nel ; - for (pme = pme1 ; pme <= pme2 ; pme++) - { - i = Iw [pme] ; - ASSERT (i >= 0 && i < n) ; - nvi = -Nv [i] ; - CAMD_DEBUG3 (("Restore i "ID" "ID"\n", i, nvi)) ; - if (nvi > 0) - { - /* i is a principal variable in Lme */ - /* restore Nv [i] to signify that i is principal */ - Nv [i] = nvi ; - - /* --------------------------------------------------------- */ - /* compute the external degree (add size of current element) */ - /* --------------------------------------------------------- */ - - deg = Degree [i] + degme - nvi ; - deg = MIN (deg, nleft - nvi) ; - ASSERT (deg >= 0 && deg < n) ; - - /* --------------------------------------------------------- */ - /* place the supervariable at the head of the degree list */ - /* --------------------------------------------------------- */ - - if (IsInCurrentSet (C, i, curC)) - { - inext = Head [deg] ; - ASSERT (inext >= EMPTY && inext < n) ; - if (inext != EMPTY) Last [inext] = i ; - Next [i] = inext ; - Last [i] = EMPTY ; - Head [deg] = i ; - degreeListCounter++ ; - } - - /* --------------------------------------------------------- */ - /* save the new degree, and find the minimum degree */ - /* --------------------------------------------------------- */ - - mindeg = MIN (mindeg, deg) ; - Degree [i] = deg ; - - /* --------------------------------------------------------- */ - /* place the supervariable in the element pattern */ - /* --------------------------------------------------------- */ - - Iw [p++] = i ; - } - } - CAMD_DEBUG2 (("restore done\n")) ; - -/* ========================================================================= */ -/* FINALIZE THE NEW ELEMENT */ -/* ========================================================================= */ - - CAMD_DEBUG2 (("ME = "ID" DONE\n", me)) ; - Nv [me] = nvpiv ; - /* save the length of the list for the new element me */ - Len [me] = p - pme1 ; - if (Len [me] == 0) - { - /* there is nothing left of the current pivot element */ - /* it is a root of the assembly tree */ - Pe [me] = EMPTY ; - W [me] = 0 ; - } - if (elenme != 0) - { - /* element was not constructed in place: deallocate part of */ - /* it since newly nonprincipal variables may have been removed */ - pfree = p ; - } - - /* Store the element back into BucketSet. This is the way to maintain - * the order of roots (Pe[i]=-1) in each Constraint Set. */ - BucketSet [pBucket2++] = me ; - - /* The new element has nvpiv pivots and the size of the contribution - * block for a multifrontal method is degme-by-degme, not including - * the "dense" rows/columns. If the "dense" rows/columns are included, - * the frontal matrix is no larger than - * (degme+ndense)-by-(degme+ndense). - */ - - if (Info != (double *) NULL) - { - f = nvpiv ; - r = degme + ndense ; - dmax = MAX (dmax, f + r) ; - - /* number of nonzeros in L (excluding the diagonal) */ - lnzme = f*r + (f-1)*f/2 ; - lnz += lnzme ; - - /* number of divide operations for LDL' and for LU */ - ndiv += lnzme ; - - /* number of multiply-subtract pairs for LU */ - s = f*r*r + r*(f-1)*f + (f-1)*f*(2*f-1)/6 ; - nms_lu += s ; - - /* number of multiply-subtract pairs for LDL' */ - nms_ldl += (s + lnzme)/2 ; - } - -#ifndef NDEBUG - CAMD_DEBUG2 (("finalize done nel "ID" n "ID"\n ::::\n", nel, n)) ; - for (pme = Pe [me] ; pme <= Pe [me] + Len [me] - 1 ; pme++) - { - CAMD_DEBUG3 ((" "ID"", Iw [pme])) ; - } - CAMD_DEBUG3 (("\n")) ; -#endif - - } - -/* ========================================================================= */ -/* DONE SELECTING PIVOTS */ -/* ========================================================================= */ - - if (Info != (double *) NULL) - { - - /* count the work to factorize the ndense-by-ndense submatrix */ - f = ndense ; - dmax = MAX (dmax, (double) ndense) ; - - /* number of nonzeros in L (excluding the diagonal) */ - lnzme = (f-1)*f/2 ; - lnz += lnzme ; - - /* number of divide operations for LDL' and for LU */ - ndiv += lnzme ; - - /* number of multiply-subtract pairs for LU */ - s = (f-1)*f*(2*f-1)/6 ; - nms_lu += s ; - - /* number of multiply-subtract pairs for LDL' */ - nms_ldl += (s + lnzme)/2 ; - - /* number of nz's in L (excl. diagonal) */ - Info [CAMD_LNZ] = lnz ; - - /* number of divide ops for LU and LDL' */ - Info [CAMD_NDIV] = ndiv ; - - /* number of multiply-subtract pairs for LDL' */ - Info [CAMD_NMULTSUBS_LDL] = nms_ldl ; - - /* number of multiply-subtract pairs for LU */ - Info [CAMD_NMULTSUBS_LU] = nms_lu ; - - /* number of "dense" rows/columns */ - Info [CAMD_NDENSE] = ndense ; - - /* largest front is dmax-by-dmax */ - Info [CAMD_DMAX] = dmax ; - - /* number of garbage collections in CAMD */ - Info [CAMD_NCMPA] = ncmpa ; - - /* successful ordering */ - Info [CAMD_STATUS] = CAMD_OK ; - } - -/* ========================================================================= */ -/* POST-ORDERING */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- - * Variables at this point: - * - * Pe: holds the elimination tree. The parent of j is FLIP (Pe [j]), - * or EMPTY if j is a root. The tree holds both elements and - * non-principal (unordered) variables absorbed into them. - * Dense and empty variables are non-principal and unordered. They are - * all represented by the fictitious node n (that is, Pe [i] = FLIP (n) - * and Elen [i] = EMPTY if i is a dense or empty node). - * - * Elen: holds the size of each element, including the diagonal part. - * FLIP (Elen [e]) > 0 if e is an element. For unordered - * variables i, Elen [i] is EMPTY. - * - * Nv: Nv [e] > 0 is the number of pivots represented by the element e. - * For unordered variables i, Nv [i] is zero. - * - * BucketSet: BucketSet [0.....pBucket2] holds all - * the elements that removed during the elimination, in eliminated order. - * - * - * Contents no longer needed: - * W, Iw, Len, Degree, Head, Next, Last. - * - * The matrix itself has been destroyed. - * - * n: the size of the matrix. - * ndense: the number of "dense" nodes. - * nnull: the number of empty nodes (zero degree) - * No other scalars needed (pfree, iwlen, etc.) - * ------------------------------------------------------------------------- */ - - - /* restore Pe */ - for (i = 0 ; i < n ; i++) - { - Pe [i] = FLIP (Pe [i]) ; - } - - /* restore Elen, for output information only */ - for (i = 0 ; i < n ; i++) - { - Elen [i] = FLIP (Elen [i]) ; - } - - /* Now, Pe [j] is the parent of j, or EMPTY if j is a root. - * Pe [j] = n if j is a dense/empty node */ - - /* place all variables in the list of children of their parents */ - for (j = n-1 ; j >= 0 ; j--) - { - if (Nv [j] > 0) continue ; /* skip if j is an element */ - ASSERT (Pe [j] >= 0 && Pe [j] <= n) ; - Next [j] = Head [Pe [j]] ; /* place j in list of its parent */ - Head [Pe [j]] = j ; - } - - /* place all elements in the list of children of their parents */ - for (e = n-1 ; e >= 0 ; e--) - { - if (Nv [e] <= 0) continue ; /* skip if e is a variable */ - if (Pe [e] == EMPTY) continue ; /* skip if e is a root */ - Next [e] = Head [Pe [e]] ; /* place e in list of its parent */ - Head [Pe [e]] = e ; - } - - /* determine where to put the postordering permutation */ - if (C != NULL && ndense_or_null > 0) - { - /* Perm needs to be computed in a temporary workspace, and then - * transformed and copied into the output permutation, in Last */ - Perm = Degree ; - } - else - { - /* the postorder computes the permutation directly, in Last */ - Perm = Last ; - } - - /* postorder the elements and their descendants (both elements and - * variables), but not (yet) the dense/empty nodes */ - for (k = 0 , i = 0 ; i < pBucket2 ; i++) - { - j = BucketSet [i] ; - ASSERT (j >= 0 && j < n) ; - if (Pe [j] == EMPTY) - { - k = CAMD_postorder (j, k, n, Head, Next, Perm, W) ; - } - } - - /* Perm [0..k-1] now contains a list of the nonempty/nondense nodes, - * ordered via minimum degree and following the constraints. */ - - CAMD_DEBUG1 (("before dense/empty, k = "ID"\n", k)) ; - fflush (stdout) ; - ASSERT (k + ndense_or_null == n) ; - - if (ndense_or_null > 0) - { - if (C == NULL) - { - /* postorder the dense/empty nodes (the parent of all these is n) */ - CAMD_postorder (n, k, n, Head, Next, Perm, W) ; - } - else - { - /* dense (or empty) nodes exist, AND C also exists. The dense/empty - * nodes are a link list whose head is Head[n], and Next[i] gives the - * next node after i in the list. They need to be sorted by their - * constraints, and then merged with Perm [0..k-1].*/ - - /* count how many dense/empty nodes are in each constraint set */ - - Bucket = W ; /* use W as workspace (it has size n+1) */ - - /* count the number of dense/empty nodes in each constraint set */ - for (c = 0 ; c <= cmax ; c++) - { - Bucket [c] = 0 ; - } - i = 0 ; - for (j = Head [n] ; j != EMPTY ; j = Next [j]) - { - CAMD_DEBUG1 (("Dense/empty node: "ID" : "ID" "ID"\n", j, - Pe [j], Elen [j])) ; - fflush (stdout) ; - ASSERT (Pe [j] == n && Elen [j] == EMPTY) ; - i++ ; - Bucket [C [j]]++ ; - } - ASSERT (i == ndense_or_null) ; - - /* find the cumulative sum of Bucket */ - knt1 = 0 ; - for (c = 0 ; c <= cmax ; c++) - { - i = Bucket [c] ; - Bucket [c] = knt1 ; - knt1 += i ; - } - CAMD_DEBUG1 (("knt1 "ID" dense/empty "ID"\n", knt1, ndense_or_null)); - ASSERT (knt1 == ndense_or_null) ; - - /* place dense/empty nodes in BucketSet, in constraint order, - * ties in natural order */ - for (j = Head [n] ; j != EMPTY ; j = Next [j]) - { - BucketSet [Bucket [C [j]]++] = j ; - } - -#ifndef NDEBUG - /* each set is in monotonically increasing order of constraints */ - for (i = 1 ; i < k ; i++) - { - ASSERT (C [Perm [i]] >= C [Perm [i-1]]) ; - } - for (i = 1 ; i < ndense_or_null ; i++) - { - /* in order of constraints, with ties in natural order */ - ASSERT ( - (C [BucketSet [i]] > C [BucketSet [i-1]]) || - (C [BucketSet [i]] == C [BucketSet [i-1]] - && (BucketSet [i] > BucketSet [i-1]))) ; - } -#endif - - /* merge Perm [0..k-1] and BucketSet [0..ndense+nnull] */ - p1 = 0 ; - p2 = 0 ; - p3 = 0 ; - while (p1 < k && p2 < ndense_or_null) - { - /* place the dense/empty nodes at the end of each constraint - * set, after the non-dense/non-empty nodes in the same set */ - if (C [Perm [p1]] <= C [BucketSet [p2]]) - { - /* non-dense/non-empty node */ - Last [p3++] = Perm [p1++] ; - } - else - { - /* dense/empty node */ - Last [p3++] = BucketSet [p2++] ; - } - } - /* wrap up; either Perm[0..k-1] or BucketSet[ ] is used up */ - while (p1 < k) - { - Last [p3++] = Perm [p1++] ; - } - while (p2 < ndense_or_null) - { - Last [p3++] = BucketSet [p2++] ; - } - } - } - -#ifndef NDEBUG - CAMD_DEBUG1 (("\nFinal constrained ordering:\n")) ; - i = 0 ; - CAMD_DEBUG1 (("Last ["ID"] = "ID", C["ID"] = "ID"\n", i, Last [i], - Last [i], C [Last [i]])) ; - for (i = 1 ; i < n ; i++) - { - CAMD_DEBUG1 (("Last ["ID"] = "ID", C["ID"] = "ID"\n", i, Last [i], - Last [i], C [Last [i]])) ; - - /* This is the critical assertion. It states that the permutation - * satisfies the constraints. */ - ASSERT (C [Last [i]] >= C [Last [i-1]]) ; - } -#endif -} diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_aat.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_aat.c deleted file mode 100644 index b385fc7ac9..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_aat.c +++ /dev/null @@ -1,183 +0,0 @@ -/* ========================================================================= */ -/* === CAMD_aat ============================================================ */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* CAMD_aat: compute the symmetry of the pattern of A, and count the number of - * nonzeros each column of A+A' (excluding the diagonal). Assumes the input - * matrix has no errors, with sorted columns and no duplicates - * (CAMD_valid (n, n, Ap, Ai) must be CAMD_OK, but this condition is not - * checked). - */ - -#include "camd_internal.h" - -GLOBAL size_t CAMD_aat /* returns nz in A+A' */ -( - Int n, - const Int Ap [ ], - const Int Ai [ ], - Int Len [ ], /* Len [j]: length of column j of A+A', excl diagonal*/ - Int Tp [ ], /* workspace of size n */ - double Info [ ] -) -{ - Int p1, p2, p, i, j, pj, pj2, k, nzdiag, nzboth, nz ; - double sym ; - size_t nzaat ; - -#ifndef NDEBUG - CAMD_debug_init ("CAMD AAT") ; - for (k = 0 ; k < n ; k++) Tp [k] = EMPTY ; - ASSERT (CAMD_valid (n, n, Ap, Ai) == CAMD_OK) ; -#endif - - if (Info != (double *) NULL) - { - /* clear the Info array, if it exists */ - for (i = 0 ; i < CAMD_INFO ; i++) - { - Info [i] = EMPTY ; - } - Info [CAMD_STATUS] = CAMD_OK ; - } - - for (k = 0 ; k < n ; k++) - { - Len [k] = 0 ; - } - - nzdiag = 0 ; - nzboth = 0 ; - nz = Ap [n] ; - - for (k = 0 ; k < n ; k++) - { - p1 = Ap [k] ; - p2 = Ap [k+1] ; - CAMD_DEBUG2 (("\nAAT Column: "ID" p1: "ID" p2: "ID"\n", k, p1, p2)) ; - - /* construct A+A' */ - for (p = p1 ; p < p2 ; ) - { - /* scan the upper triangular part of A */ - j = Ai [p] ; - if (j < k) - { - /* entry A (j,k) is in the strictly upper triangular part, - * add both A (j,k) and A (k,j) to the matrix A+A' */ - Len [j]++ ; - Len [k]++ ; - CAMD_DEBUG3 ((" upper ("ID","ID") ("ID","ID")\n", j,k, k,j)); - p++ ; - } - else if (j == k) - { - /* skip the diagonal */ - p++ ; - nzdiag++ ; - break ; - } - else /* j > k */ - { - /* first entry below the diagonal */ - break ; - } - /* scan lower triangular part of A, in column j until reaching - * row k. Start where last scan left off. */ - ASSERT (Tp [j] != EMPTY) ; - ASSERT (Ap [j] <= Tp [j] && Tp [j] <= Ap [j+1]) ; - pj2 = Ap [j+1] ; - for (pj = Tp [j] ; pj < pj2 ; ) - { - i = Ai [pj] ; - if (i < k) - { - /* A (i,j) is only in the lower part, not in upper. - * add both A (i,j) and A (j,i) to the matrix A+A' */ - Len [i]++ ; - Len [j]++ ; - CAMD_DEBUG3 ((" lower ("ID","ID") ("ID","ID")\n", - i,j, j,i)) ; - pj++ ; - } - else if (i == k) - { - /* entry A (k,j) in lower part and A (j,k) in upper */ - pj++ ; - nzboth++ ; - break ; - } - else /* i > k */ - { - /* consider this entry later, when k advances to i */ - break ; - } - } - Tp [j] = pj ; - } - /* Tp [k] points to the entry just below the diagonal in column k */ - Tp [k] = p ; - } - - /* clean up, for remaining mismatched entries */ - for (j = 0 ; j < n ; j++) - { - for (pj = Tp [j] ; pj < Ap [j+1] ; pj++) - { - i = Ai [pj] ; - /* A (i,j) is only in the lower part, not in upper. - * add both A (i,j) and A (j,i) to the matrix A+A' */ - Len [i]++ ; - Len [j]++ ; - CAMD_DEBUG3 ((" lower cleanup ("ID","ID") ("ID","ID")\n", - i,j, j,i)) ; - } - } - - /* --------------------------------------------------------------------- */ - /* compute the symmetry of the nonzero pattern of A */ - /* --------------------------------------------------------------------- */ - - /* Given a matrix A, the symmetry of A is: - * B = tril (spones (A), -1) + triu (spones (A), 1) ; - * sym = nnz (B & B') / nnz (B) ; - * or 1 if nnz (B) is zero. - */ - - if (nz == nzdiag) - { - sym = 1 ; - } - else - { - sym = (2 * (double) nzboth) / ((double) (nz - nzdiag)) ; - } - - nzaat = 0 ; - for (k = 0 ; k < n ; k++) - { - nzaat += Len [k] ; - } - CAMD_DEBUG1 (("CAMD nz in A+A', excluding diagonal (nzaat) = %g\n", - (double) nzaat)) ; - CAMD_DEBUG1 ((" nzboth: "ID" nz: "ID" nzdiag: "ID" symmetry: %g\n", - nzboth, nz, nzdiag, sym)) ; - - if (Info != (double *) NULL) - { - Info [CAMD_STATUS] = CAMD_OK ; - Info [CAMD_N] = n ; - Info [CAMD_NZ] = nz ; - Info [CAMD_SYMMETRY] = sym ; /* symmetry of pattern of A */ - Info [CAMD_NZDIAG] = nzdiag ; /* nonzeros on diagonal of A */ - Info [CAMD_NZ_A_PLUS_AT] = nzaat ; /* nonzeros in A+A' */ - } - - return (nzaat) ; -} diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_control.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_control.c deleted file mode 100644 index c1c57541bc..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_control.c +++ /dev/null @@ -1,64 +0,0 @@ -/* ========================================================================= */ -/* === CAMD_control ======================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* User-callable. Prints the control parameters for CAMD. See camd.h - * for details. If the Control array is not present, the defaults are - * printed instead. - */ - -#include "camd_internal.h" - -GLOBAL void CAMD_control -( - double Control [ ] -) -{ - double alpha ; - Int aggressive ; - - if (Control != (double *) NULL) - { - alpha = Control [CAMD_DENSE] ; - aggressive = Control [CAMD_AGGRESSIVE] != 0 ; - } - else - { - alpha = CAMD_DEFAULT_DENSE ; - aggressive = CAMD_DEFAULT_AGGRESSIVE ; - } - - SUITESPARSE_PRINTF (( - "\ncamd version %d.%d, %s: approximate minimum degree ordering:\n" - " dense row parameter: %g\n", CAMD_MAIN_VERSION, CAMD_SUB_VERSION, - CAMD_DATE, alpha)) ; - - if (alpha < 0) - { - SUITESPARSE_PRINTF ((" no rows treated as dense\n")) ; - } - else - { - SUITESPARSE_PRINTF (( - " (rows with more than max (%g * sqrt (n), 16) entries are\n" - " considered \"dense\", and placed last in output permutation)\n", - alpha)) ; - } - - if (aggressive) - { - SUITESPARSE_PRINTF ((" aggressive absorption: yes\n")) ; - } - else - { - SUITESPARSE_PRINTF ((" aggressive absorption: no\n")) ; - } - - SUITESPARSE_PRINTF ((" size of CAMD integer: %d\n\n", sizeof (Int))) ; -} diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_defaults.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_defaults.c deleted file mode 100644 index 5ac59bff3f..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_defaults.c +++ /dev/null @@ -1,36 +0,0 @@ -/* ========================================================================= */ -/* === CAMD_defaults ======================================================= */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* User-callable. Sets default control parameters for CAMD. See camd.h - * for details. - */ - -#include "camd_internal.h" - -/* ========================================================================= */ -/* === CAMD defaults ======================================================= */ -/* ========================================================================= */ - -GLOBAL void CAMD_defaults -( - double Control [ ] -) -{ - Int i ; - if (Control != (double *) NULL) - { - for (i = 0 ; i < CAMD_CONTROL ; i++) - { - Control [i] = 0 ; - } - Control [CAMD_DENSE] = CAMD_DEFAULT_DENSE ; - Control [CAMD_AGGRESSIVE] = CAMD_DEFAULT_AGGRESSIVE ; - } -} diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_dump.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_dump.c deleted file mode 100644 index 6b0b495b2f..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_dump.c +++ /dev/null @@ -1,189 +0,0 @@ -/* ========================================================================= */ -/* === CAMD_dump =========================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* Debugging routines for CAMD. Not used if NDEBUG is not defined at compile- - * time (the default). See comments in camd_internal.h on how to enable - * debugging. Not user-callable. - */ - -#include "camd_internal.h" - -#ifndef NDEBUG - -/* This global variable is present only when debugging */ -GLOBAL Int CAMD_debug = -999 ; /* default is no debug printing */ - -/* ========================================================================= */ -/* === CAMD_debug_init ===================================================== */ -/* ========================================================================= */ - -/* Sets the debug print level, by reading the file debug.camd (if it exists) */ - -GLOBAL void CAMD_debug_init ( char *s ) -{ - FILE *f ; - f = fopen ("debug.camd", "r") ; - if (f == (FILE *) NULL) - { - CAMD_debug = -999 ; - } - else - { - fscanf (f, ID, &CAMD_debug) ; - fclose (f) ; - } - if (CAMD_debug >= 0) - { - printf ("%s: CAMD_debug_init, D= "ID"\n", s, CAMD_debug) ; - } -} - -/* ========================================================================= */ -/* === CAMD_dump =========================================================== */ -/* ========================================================================= */ - -/* Dump CAMD's data structure, except for the hash buckets. This routine - * cannot be called when the hash buckets are non-empty. - */ - -GLOBAL void CAMD_dump ( - Int n, /* A is n-by-n */ - Int Pe [ ], /* pe [0..n-1]: index in iw of start of row i */ - Int Iw [ ], /* workspace of size iwlen, iwlen [0..pfree-1] - * holds the matrix on input */ - Int Len [ ], /* len [0..n-1]: length for row i */ - Int iwlen, /* length of iw */ - Int pfree, /* iw [pfree ... iwlen-1] is empty on input */ - Int Nv [ ], /* nv [0..n-1] */ - Int Next [ ], /* next [0..n-1] */ - Int Last [ ], /* last [0..n-1] */ - Int Head [ ], /* head [0..n-1] */ - Int Elen [ ], /* size n */ - Int Degree [ ], /* size n */ - Int W [ ], /* size n */ - Int nel, - Int BucketSet [ ], - const Int C [ ], - Int CurC -) -{ - Int i, pe, elen, nv, len, e, p, k, j, deg, w, cnt, ilast ; - - if (CAMD_debug < 0) return ; - ASSERT (pfree <= iwlen) ; - CAMD_DEBUG3 (("\nCAMD dump, pfree: "ID"\n", pfree)) ; - for (i = 0 ; i < n ; i++) - { - pe = Pe [i] ; - elen = Elen [i] ; - nv = Nv [i] ; - len = Len [i] ; - w = W [i] ; - - if (elen >= EMPTY) - { - if (nv == 0) - { - CAMD_DEBUG4 (("\nI "ID": nonprincipal: ", i)) ; - ASSERT (elen == EMPTY) ; - if (pe == FLIP(n)) - { - CAMD_DEBUG4 ((" dense node\n")) ; - ASSERT (w == 1) ; - } - else - { - ASSERT (pe < EMPTY) ; - CAMD_DEBUG4 ((" i "ID" -> parent "ID"\n", i, FLIP (Pe[i]))); - } - } - else - { - CAMD_DEBUG4 (("\nI "ID": active principal supervariable:\n",i)); - CAMD_DEBUG4 ((" nv(i): "ID" Flag: %d\n", nv, (nv < 0))) ; - ASSERT (elen >= 0) ; - ASSERT (nv > 0 && pe >= 0) ; - p = pe ; - CAMD_DEBUG4 ((" e/s: ")) ; - if (elen == 0) CAMD_DEBUG4 ((" : ")) ; - ASSERT (pe + len <= pfree) ; - for (k = 0 ; k < len ; k++) - { - j = Iw [p] ; - CAMD_DEBUG4 ((" "ID"", j)) ; - ASSERT (j >= 0 && j < n) ; - if (k == elen-1) CAMD_DEBUG4 ((" : ")) ; - p++ ; - } - CAMD_DEBUG4 (("\n")) ; - } - } - else - { - e = i ; - if (w == 0) - { - CAMD_DEBUG4 (("\nE "ID": absorbed element: w "ID"\n", e, w)) ; - ASSERT (nv > 0 && pe < 0) ; - CAMD_DEBUG4 ((" e "ID" -> parent "ID"\n", e, FLIP (Pe [e]))) ; - } - else - { - CAMD_DEBUG4 (("\nE "ID": unabsorbed element: w "ID"\n", e, w)) ; - ASSERT (nv > 0 && pe >= 0) ; - p = pe ; - CAMD_DEBUG4 ((" : ")) ; - ASSERT (pe + len <= pfree) ; - for (k = 0 ; k < len ; k++) - { - j = Iw [p] ; - CAMD_DEBUG4 ((" "ID"", j)) ; - ASSERT (j >= 0 && j < n) ; - p++ ; - } - CAMD_DEBUG4 (("\n")) ; - } - } - CAMD_DEBUG4 (("C[i] is :"ID"\n", (C == NULL) ? 0 : C [i])); - } - - /* this routine cannot be called when the hash buckets are non-empty */ - CAMD_DEBUG4 (("\nDegree lists:\n")) ; - if (nel >= 0) - { - cnt = 0 ; - for (deg = 0 ; deg < n ; deg++) - { - if (Head [deg] == EMPTY) continue ; - ilast = EMPTY ; - CAMD_DEBUG4 ((ID": \n", deg)) ; - for (i = Head [deg] ; i != EMPTY ; i = Next [i]) - { - CAMD_DEBUG4 ((" "ID" : next "ID" last "ID" deg "ID"\n", - i, Next [i], Last [i], Degree [i])) ; - ASSERT (i >= 0 && i < n && ilast == Last [i] && - deg == Degree [i]) ; - cnt += Nv [i] ; - ilast = i ; - } - CAMD_DEBUG4 (("\n")) ; - } - } - - CAMD_DEBUG4(("\nCurrent C[i] is "ID". current Buckets are:\n", CurC)) ; - for (i = 0 ; i < n ; i++) - { - if ((C == NULL) ? 1 : (C [BucketSet [i]] <= CurC)) - CAMD_DEBUG4((ID",",BucketSet [i])); - } - CAMD_DEBUG4 (("\n")) ; -} - -#endif diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_global.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_global.c deleted file mode 100644 index eef93ee489..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_global.c +++ /dev/null @@ -1,14 +0,0 @@ -/* ========================================================================= */ -/* === camd_global ========================================================= */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* In prior versions of CAMD, this file declared the camd_malloc, camd_free, - camd_realloc, camd_calloc, and camd_printf functions. They are now replaced - by functions defined in SuiteSparse_config/SuiteSparse_config.c. - */ diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_info.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_info.c deleted file mode 100644 index 96547e6863..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_info.c +++ /dev/null @@ -1,119 +0,0 @@ -/* ========================================================================= */ -/* === CAMD_info =========================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* User-callable. Prints the output statistics for CAMD. See camd.h - * for details. If the Info array is not present, nothing is printed. - */ - -#include "camd_internal.h" - -#define PRI(format,x) { if (x >= 0) { SUITESPARSE_PRINTF ((format, x)) ; }} - -GLOBAL void CAMD_info -( - double Info [ ] -) -{ - double n, ndiv, nmultsubs_ldl, nmultsubs_lu, lnz, lnzd ; - - SUITESPARSE_PRINTF (("\nCAMD version %d.%d.%d, %s, results:\n", - CAMD_MAIN_VERSION, CAMD_SUB_VERSION, CAMD_SUBSUB_VERSION, CAMD_DATE)) ; - - if (!Info) - { - return ; - } - - n = Info [CAMD_N] ; - ndiv = Info [CAMD_NDIV] ; - nmultsubs_ldl = Info [CAMD_NMULTSUBS_LDL] ; - nmultsubs_lu = Info [CAMD_NMULTSUBS_LU] ; - lnz = Info [CAMD_LNZ] ; - lnzd = (n >= 0 && lnz >= 0) ? (n + lnz) : (-1) ; - - /* CAMD return status */ - SUITESPARSE_PRINTF ((" status: ")) ; - if (Info [CAMD_STATUS] == CAMD_OK) - { - SUITESPARSE_PRINTF (("OK\n")) ; - } - else if (Info [CAMD_STATUS] == CAMD_OUT_OF_MEMORY) - { - SUITESPARSE_PRINTF (("out of memory\n")) ; - } - else if (Info [CAMD_STATUS] == CAMD_INVALID) - { - SUITESPARSE_PRINTF (("invalid matrix\n")) ; - } - else if (Info [CAMD_STATUS] == CAMD_OK_BUT_JUMBLED) - { - SUITESPARSE_PRINTF (("OK, but jumbled\n")) ; - } - else - { - SUITESPARSE_PRINTF (("unknown\n")) ; - } - - /* statistics about the input matrix */ - PRI (" n, dimension of A: %.20g\n", n); - PRI (" nz, number of nonzeros in A: %.20g\n", - Info [CAMD_NZ]) ; - PRI (" symmetry of A: %.4f\n", - Info [CAMD_SYMMETRY]) ; - PRI (" number of nonzeros on diagonal: %.20g\n", - Info [CAMD_NZDIAG]) ; - PRI (" nonzeros in pattern of A+A' (excl. diagonal): %.20g\n", - Info [CAMD_NZ_A_PLUS_AT]) ; - PRI (" # dense rows/columns of A+A': %.20g\n", - Info [CAMD_NDENSE]) ; - - /* statistics about CAMD's behavior */ - PRI (" memory used, in bytes: %.20g\n", - Info [CAMD_MEMORY]) ; - PRI (" # of memory compactions: %.20g\n", - Info [CAMD_NCMPA]) ; - - /* statistics about the ordering quality */ - SUITESPARSE_PRINTF (("\n" - " The following approximate statistics are for a subsequent\n" - " factorization of A(P,P) + A(P,P)'. They are slight upper\n" - " bounds if there are no dense rows/columns in A+A', and become\n" - " looser if dense rows/columns exist.\n\n")) ; - - PRI (" nonzeros in L (excluding diagonal): %.20g\n", - lnz) ; - PRI (" nonzeros in L (including diagonal): %.20g\n", - lnzd) ; - PRI (" # divide operations for LDL' or LU: %.20g\n", - ndiv) ; - PRI (" # multiply-subtract operations for LDL': %.20g\n", - nmultsubs_ldl) ; - PRI (" # multiply-subtract operations for LU: %.20g\n", - nmultsubs_lu) ; - PRI (" max nz. in any column of L (incl. diagonal): %.20g\n", - Info [CAMD_DMAX]) ; - - /* total flop counts for various factorizations */ - - if (n >= 0 && ndiv >= 0 && nmultsubs_ldl >= 0 && nmultsubs_lu >= 0) - { - SUITESPARSE_PRINTF (("\n" - " chol flop count for real A, sqrt counted as 1 flop: %.20g\n" - " LDL' flop count for real A: %.20g\n" - " LDL' flop count for complex A: %.20g\n" - " LU flop count for real A (with no pivoting): %.20g\n" - " LU flop count for complex A (with no pivoting): %.20g\n\n", - n + ndiv + 2*nmultsubs_ldl, - ndiv + 2*nmultsubs_ldl, - 9*ndiv + 8*nmultsubs_ldl, - ndiv + 2*nmultsubs_lu, - 9*ndiv + 8*nmultsubs_lu)) ; - } -} diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_order.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_order.c deleted file mode 100644 index 67eb1fdafc..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_order.c +++ /dev/null @@ -1,200 +0,0 @@ -/* ========================================================================= */ -/* === CAMD_order ========================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* User-callable CAMD minimum degree ordering routine. See camd.h for - * documentation. - */ - -#include "camd_internal.h" - -/* ========================================================================= */ -/* === CAMD_order ========================================================== */ -/* ========================================================================= */ - -GLOBAL Int CAMD_order -( - Int n, - const Int Ap [ ], - const Int Ai [ ], - Int P [ ], - double Control [ ], - double Info [ ], - const Int C [ ] -) -{ - Int *Len, *S, nz, i, *Pinv, info, status, *Rp, *Ri, *Cp, *Ci, ok ; - size_t nzaat, slen ; - double mem = 0 ; - -#ifndef NDEBUG - CAMD_debug_init ("camd") ; -#endif - - /* clear the Info array, if it exists */ - info = Info != (double *) NULL ; - if (info) - { - for (i = 0 ; i < CAMD_INFO ; i++) - { - Info [i] = EMPTY ; - } - Info [CAMD_N] = n ; - Info [CAMD_STATUS] = CAMD_OK ; - } - - /* make sure inputs exist and n is >= 0 */ - if (Ai == (Int *) NULL || Ap == (Int *) NULL || P == (Int *) NULL || n < 0) - { - if (info) Info [CAMD_STATUS] = CAMD_INVALID ; - return (CAMD_INVALID) ; /* arguments are invalid */ - } - - if (n == 0) - { - return (CAMD_OK) ; /* n is 0 so there's nothing to do */ - } - - nz = Ap [n] ; - if (info) - { - Info [CAMD_NZ] = nz ; - } - if (nz < 0) - { - if (info) Info [CAMD_STATUS] = CAMD_INVALID ; - return (CAMD_INVALID) ; - } - - /* check if n or nz will cause size_t overflow */ - if ((size_t) n >= SIZE_T_MAX / sizeof (Int) - || (size_t) nz >= SIZE_T_MAX / sizeof (Int)) - { - if (info) Info [CAMD_STATUS] = CAMD_OUT_OF_MEMORY ; - return (CAMD_OUT_OF_MEMORY) ; /* problem too large */ - } - - /* check the input matrix: CAMD_OK, CAMD_INVALID, or CAMD_OK_BUT_JUMBLED */ - status = CAMD_valid (n, n, Ap, Ai) ; - - if (status == CAMD_INVALID) - { - if (info) Info [CAMD_STATUS] = CAMD_INVALID ; - return (CAMD_INVALID) ; /* matrix is invalid */ - } - - /* allocate two size-n integer workspaces */ - Len = SuiteSparse_malloc (n, sizeof (Int)) ; - Pinv = SuiteSparse_malloc (n, sizeof (Int)) ; - mem += n ; - mem += n ; - if (!Len || !Pinv) - { - /* :: out of memory :: */ - SuiteSparse_free (Len) ; - SuiteSparse_free (Pinv) ; - if (info) Info [CAMD_STATUS] = CAMD_OUT_OF_MEMORY ; - return (CAMD_OUT_OF_MEMORY) ; - } - - if (status == CAMD_OK_BUT_JUMBLED) - { - /* sort the input matrix and remove duplicate entries */ - CAMD_DEBUG1 (("Matrix is jumbled\n")) ; - Rp = SuiteSparse_malloc (n+1, sizeof (Int)) ; - Ri = SuiteSparse_malloc (nz, sizeof (Int)) ; - mem += (n+1) ; - mem += MAX (nz,1) ; - if (!Rp || !Ri) - { - /* :: out of memory :: */ - SuiteSparse_free (Rp) ; - SuiteSparse_free (Ri) ; - SuiteSparse_free (Len) ; - SuiteSparse_free (Pinv) ; - if (info) Info [CAMD_STATUS] = CAMD_OUT_OF_MEMORY ; - return (CAMD_OUT_OF_MEMORY) ; - } - /* use Len and Pinv as workspace to create R = A' */ - CAMD_preprocess (n, Ap, Ai, Rp, Ri, Len, Pinv) ; - Cp = Rp ; - Ci = Ri ; - } - else - { - /* order the input matrix as-is. No need to compute R = A' first */ - Rp = NULL ; - Ri = NULL ; - Cp = (Int *) Ap ; - Ci = (Int *) Ai ; - } - - /* --------------------------------------------------------------------- */ - /* determine the symmetry and count off-diagonal nonzeros in A+A' */ - /* --------------------------------------------------------------------- */ - - nzaat = CAMD_aat (n, Cp, Ci, Len, P, Info) ; - CAMD_DEBUG1 (("nzaat: %g\n", (double) nzaat)) ; - ASSERT ((MAX (nz-n, 0) <= nzaat) && (nzaat <= 2 * (size_t) nz)) ; - - /* --------------------------------------------------------------------- */ - /* allocate workspace for matrix, elbow room, and 7 size-n vectors */ - /* --------------------------------------------------------------------- */ - - S = NULL ; - slen = nzaat ; /* space for matrix */ - ok = ((slen + nzaat/5) >= slen) ; /* check for size_t overflow */ - slen += nzaat/5 ; /* add elbow room */ - for (i = 0 ; ok && i < 8 ; i++) - { - ok = ((slen + n+1) > slen) ; /* check for size_t overflow */ - slen += (n+1) ; /* size-n elbow room, 7 size-(n+1) workspace */ - } - mem += slen ; - ok = ok && (slen < SIZE_T_MAX / sizeof (Int)) ; /* check for overflow */ - ok = ok && (slen < Int_MAX) ; /* S[i] for Int i must be OK */ - if (ok) - { - S = SuiteSparse_malloc (slen, sizeof (Int)) ; - } - CAMD_DEBUG1 (("slen %g\n", (double) slen)) ; - if (!S) - { - /* :: out of memory :: (or problem too large) */ - SuiteSparse_free (Rp) ; - SuiteSparse_free (Ri) ; - SuiteSparse_free (Len) ; - SuiteSparse_free (Pinv) ; - if (info) Info [CAMD_STATUS] = CAMD_OUT_OF_MEMORY ; - return (CAMD_OUT_OF_MEMORY) ; - } - if (info) - { - /* memory usage, in bytes. */ - Info [CAMD_MEMORY] = mem * sizeof (Int) ; - } - - /* --------------------------------------------------------------------- */ - /* order the matrix */ - /* --------------------------------------------------------------------- */ - - CAMD_1 (n, Cp, Ci, P, Pinv, Len, slen, S, Control, Info, C) ; - - /* --------------------------------------------------------------------- */ - /* free the workspace */ - /* --------------------------------------------------------------------- */ - - SuiteSparse_free (Rp) ; - SuiteSparse_free (Ri) ; - SuiteSparse_free (Len) ; - SuiteSparse_free (Pinv) ; - SuiteSparse_free (S) ; - if (info) Info [CAMD_STATUS] = status ; - return (status) ; /* successful ordering */ -} diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_postorder.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_postorder.c deleted file mode 100644 index 4af03e11eb..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_postorder.c +++ /dev/null @@ -1,50 +0,0 @@ -/* ========================================================================= */ -/* === CAMD_postorder ====================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* Perform a postordering (via depth-first search) of an assembly tree. */ - -#include "camd_internal.h" - -GLOBAL Int CAMD_postorder -( - Int j, /* start at node j, a root of the assembly tree */ - Int k, /* on input, next node is the kth node */ - Int n, /* normal nodes 0 to n-1, place-holder node n */ - Int head [], /* head of link list of children of each node */ - Int next [], /* next[i] is the next child after i in link list */ - Int post [], /* postordering, post [k] = p if p is the kth node */ - Int stack [] /* recursion stack */ -) -{ - int i, p, top = 0 ; - stack [0] = j ; /* place j on the stack, maybe place-holder node n */ - while (top >= 0) /* while (stack is not empty) */ - { - p = stack [top] ; /* p = top of stack */ - i = head [p] ; /* i = youngest child of p */ - if (i == -1) - { - top-- ; /* p has no unordered children left */ - if (p != n) - { - /* node p is the kth postordered node. Do not postorder the - * place-holder node n, which is the root of a subtree - * containing all dense and empty nodes. */ - post [k++] = p ; - } - } - else - { - head [p] = next [i] ; /* remove i from children of p */ - stack [++top] = i ; /* start dfs on child node i */ - } - } - return (k) ; -} diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_preprocess.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_preprocess.c deleted file mode 100644 index aa399c36ec..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_preprocess.c +++ /dev/null @@ -1,118 +0,0 @@ -/* ========================================================================= */ -/* === CAMD_preprocess ===================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* Sorts, removes duplicate entries, and transposes from the nonzero pattern of - * a column-form matrix A, to obtain the matrix R. The input matrix can have - * duplicate entries and/or unsorted columns (CAMD_valid (n,Ap,Ai) must not be - * CAMD_INVALID). - * - * This input condition is NOT checked. This routine is not user-callable. - */ - -#include "camd_internal.h" - -/* ========================================================================= */ -/* === CAMD_preprocess ===================================================== */ -/* ========================================================================= */ - -/* CAMD_preprocess does not check its input for errors or allocate workspace. - * On input, the condition (CAMD_valid (n,n,Ap,Ai) != CAMD_INVALID) must hold. - */ - -GLOBAL void CAMD_preprocess -( - Int n, /* input matrix: A is n-by-n */ - const Int Ap [ ], /* size n+1 */ - const Int Ai [ ], /* size nz = Ap [n] */ - - /* output matrix R: */ - Int Rp [ ], /* size n+1 */ - Int Ri [ ], /* size nz (or less, if duplicates present) */ - - Int W [ ], /* workspace of size n */ - Int Flag [ ] /* workspace of size n */ -) -{ - - /* --------------------------------------------------------------------- */ - /* local variables */ - /* --------------------------------------------------------------------- */ - - Int i, j, p, p2 ; - - ASSERT (CAMD_valid (n, n, Ap, Ai) != CAMD_INVALID) ; - - /* --------------------------------------------------------------------- */ - /* count the entries in each row of A (excluding duplicates) */ - /* --------------------------------------------------------------------- */ - - for (i = 0 ; i < n ; i++) - { - W [i] = 0 ; /* # of nonzeros in row i (excl duplicates) */ - Flag [i] = EMPTY ; /* Flag [i] = j if i appears in column j */ - } - for (j = 0 ; j < n ; j++) - { - p2 = Ap [j+1] ; - for (p = Ap [j] ; p < p2 ; p++) - { - i = Ai [p] ; - if (Flag [i] != j) - { - /* row index i has not yet appeared in column j */ - W [i]++ ; /* one more entry in row i */ - Flag [i] = j ; /* flag row index i as appearing in col j*/ - } - } - } - - /* --------------------------------------------------------------------- */ - /* compute the row pointers for R */ - /* --------------------------------------------------------------------- */ - - Rp [0] = 0 ; - for (i = 0 ; i < n ; i++) - { - Rp [i+1] = Rp [i] + W [i] ; - } - for (i = 0 ; i < n ; i++) - { - W [i] = Rp [i] ; - Flag [i] = EMPTY ; - } - - /* --------------------------------------------------------------------- */ - /* construct the row form matrix R */ - /* --------------------------------------------------------------------- */ - - /* R = row form of pattern of A */ - for (j = 0 ; j < n ; j++) - { - p2 = Ap [j+1] ; - for (p = Ap [j] ; p < p2 ; p++) - { - i = Ai [p] ; - if (Flag [i] != j) - { - /* row index i has not yet appeared in column j */ - Ri [W [i]++] = j ; /* put col j in row i */ - Flag [i] = j ; /* flag row index i as appearing in col j*/ - } - } - } - -#ifndef NDEBUG - ASSERT (CAMD_valid (n, n, Rp, Ri) == CAMD_OK) ; - for (j = 0 ; j < n ; j++) - { - ASSERT (W [j] == Rp [j+1]) ; - } -#endif -} diff --git a/ThirdParty/SuiteSparse/CAMD/Source/camd_valid.c b/ThirdParty/SuiteSparse/CAMD/Source/camd_valid.c deleted file mode 100644 index a1da203d89..0000000000 --- a/ThirdParty/SuiteSparse/CAMD/Source/camd_valid.c +++ /dev/null @@ -1,112 +0,0 @@ -/* ========================================================================= */ -/* === CAMD_valid ========================================================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD, Copyright (c) Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* Check if a column-form matrix is valid or not. The matrix A is - * n_row-by-n_col. The row indices of entries in column j are in - * Ai [Ap [j] ... Ap [j+1]-1]. Required conditions are: - * - * n_row >= 0 - * n_col >= 0 - * nz = Ap [n_col] >= 0 number of entries in the matrix - * Ap [0] == 0 - * Ap [j] <= Ap [j+1] for all j in the range 0 to n_col. - * Ai [0 ... nz-1] must be in the range 0 to n_row-1. - * - * If any of the above conditions hold, CAMD_INVALID is returned. If the - * following condition holds, CAMD_OK_BUT_JUMBLED is returned (a warning, - * not an error): - * - * row indices in Ai [Ap [j] ... Ap [j+1]-1] are not sorted in ascending - * order, and/or duplicate entries exist. - * - * Otherwise, CAMD_OK is returned. - */ - -#include "camd_internal.h" - -GLOBAL Int CAMD_valid -( - /* inputs, not modified on output: */ - Int n_row, /* A is n_row-by-n_col */ - Int n_col, - const Int Ap [ ], /* column pointers of A, of size n_col+1 */ - const Int Ai [ ] /* row indices of A, of size nz = Ap [n_col] */ -) -{ - Int nz, j, p1, p2, ilast, i, p, result = CAMD_OK ; - if (n_row < 0 || n_col < 0 || Ap == NULL || Ai == NULL) - { - return (CAMD_INVALID) ; - } - nz = Ap [n_col] ; - if (Ap [0] != 0 || nz < 0) - { - /* column pointers must start at Ap [0] = 0, and Ap [n] must be >= 0 */ - CAMD_DEBUG0 (("column 0 pointer bad or nz < 0\n")) ; - return (CAMD_INVALID) ; - } - for (j = 0 ; j < n_col ; j++) - { - p1 = Ap [j] ; - p2 = Ap [j+1] ; - CAMD_DEBUG2 (("\nColumn: "ID" p1: "ID" p2: "ID"\n", j, p1, p2)) ; - if (p1 > p2) - { - /* column pointers must be ascending */ - CAMD_DEBUG0 (("column "ID" pointer bad\n", j)) ; - return (CAMD_INVALID) ; - } - ilast = EMPTY ; - for (p = p1 ; p < p2 ; p++) - { - i = Ai [p] ; - CAMD_DEBUG3 (("row: "ID"\n", i)) ; - if (i < 0 || i >= n_row) - { - /* row index out of range */ - CAMD_DEBUG0 (("index out of range, col "ID" row "ID"\n", j, i)); - return (CAMD_INVALID) ; - } - if (i <= ilast) - { - /* row index unsorted, or duplicate entry present */ - CAMD_DEBUG1 (("index unsorted/dupl col "ID" row "ID"\n", j, i)); - result = CAMD_OK_BUT_JUMBLED ; - } - ilast = i ; - } - } - return (result) ; -} - - -GLOBAL Int CAMD_cvalid /* return TRUE if the Constraint set is valid, - * FALSE otherwise */ -( - /* inputs, not modified on output: */ - Int n, /* the length of constraint set */ - const Int C [ ] /* constraint set */ -) -{ - Int i ; - if (C != NULL) - { - for (i = 0 ; i < n ; i++) - { - if (C [i] < 0 || C [i] > n - 1) - { - CAMD_DEBUG0 (("C["ID"] = "ID" invalid\n", i, C [i])) ; - return (FALSE) ; - } - } - } - return (TRUE) ; -} - diff --git a/ThirdParty/SuiteSparse/CITATION.bib b/ThirdParty/SuiteSparse/CITATION.bib new file mode 100644 index 0000000000..13b13d93ac --- /dev/null +++ b/ThirdParty/SuiteSparse/CITATION.bib @@ -0,0 +1,490 @@ + +@article{10.1145/3322125, +author = {Davis, Timothy A.}, +title = {Algorithm 1000: SuiteSparse:GraphBLAS: Graph Algorithms in the Language of Sparse Linear Algebra}, +year = {2019}, +issue_date = {December 2019}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {45}, +number = {4}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/3322125}, +doi = {10.1145/3322125}, +abstract = {SuiteSparse:GraphBLAS is a full implementation of the GraphBLAS standard, which defines a set of sparse matrix operations on an extended algebra of semirings using an almost unlimited variety of operators and types. When applied to sparse adjacency matrices, these algebraic operations are equivalent to computations on graphs. GraphBLAS provides a powerful and expressive framework for creating graph algorithms based on the elegant mathematics of sparse matrix operations on a semiring. An overview of the GraphBLAS specification is given, followed by a description of the key features and performance of its implementation in the SuiteSparse:GraphBLAS package.}, +journal = {ACM Trans. Math. Softw.}, +month = {dec}, +articleno = {44}, +numpages = {25}, +keywords = {GraphBLAS, Graph algorithms, sparse matrices} +} + +@book{FA02, + author={T. A. Davis}, + title={Direct Methods for Sparse Linear Systems}, + publisher={SIAM}, + address={Philadelphia, PA}, + year={2006}, + url={https://doi.org/10.1137/1.9780898718881}, + doi={10.1137/1.9780898718881}} + + +@article{10.1145/2049662.2049670, +author = {Davis, Timothy A.}, +title = {Algorithm 915, SuiteSparseQR: Multifrontal Multithreaded Rank-Revealing Sparse QR Factorization}, +year = {2011}, +issue_date = {November 2011}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {38}, +number = {1}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/2049662.2049670}, +doi = {10.1145/2049662.2049670}, +abstract = {SuiteSparseQR is a sparse QR factorization package based on the multifrontal method. Within each frontal matrix, LAPACK and the multithreaded BLAS enable the method to obtain high performance on multicore architectures. Parallelism across different frontal matrices is handled with Intel's Threading Building Blocks library. The symbolic analysis and ordering phase pre-eliminates singletons by permuting the input matrix A into the form [R11 R12; 0 A22] where R11 is upper triangular with diagonal entries above a given tolerance. Next, the fill-reducing ordering, column elimination tree, and frontal matrix structures are found without requiring the formation of the pattern of ATA. Approximate rank-detection is performed within each frontal matrix using Heath's method. While Heath's method is not always exact, it has the advantage of not requiring column pivoting and thus does not interfere with the fill-reducing ordering. For sufficiently large problems, the resulting sparse QR factorization obtains a substantial fraction of the theoretical peak performance of a multicore computer.}, +journal = {ACM Trans. Math. Softw.}, +month = {dec}, +articleno = {8}, +numpages = {22}, +keywords = {least-square problems, sparse matrices, QR factorization} +} + +@article{10.1145/3065870, +author = {Yeralan, Sencer Nuri and Davis, Timothy A. and Sid-Lakhdar, Wissam M. and Ranka, Sanjay}, +title = {Algorithm 980: Sparse QR Factorization on the GPU}, +year = {2017}, +issue_date = {June 2018}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {44}, +number = {2}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/3065870}, +doi = {10.1145/3065870}, +abstract = {Sparse matrix factorization involves a mix of regular and irregular computation, which is a particular challenge when trying to obtain high-performance on the highly parallel general-purpose computing cores available on graphics processing units (GPUs). We present a sparse multifrontal QR factorization method that meets this challenge and is significantly faster than a highly optimized method on a multicore CPU. Our method factorizes many frontal matrices in parallel and keeps all the data transmitted between frontal matrices on the GPU. A novel bucket scheduler algorithm extends the communication-avoiding QR factorization for dense matrices by exploiting more parallelism and by exploiting the staircase form present in the frontal matrices of a sparse multifrontal method.}, +journal = {ACM Trans. Math. Softw.}, +month = {aug}, +articleno = {17}, +numpages = {29}, +keywords = {GPU, QR factorization, least-square problems, sparse matrices} +} + +@article{10.1145/1391989.1391995, +author = {Chen, Yanqing and Davis, Timothy A. and Hager, William W. and Rajamanickam, Sivasankaran}, +title = {Algorithm 887: CHOLMOD, Supernodal Sparse Cholesky Factorization and Update/Downdate}, +year = {2008}, +issue_date = {October 2008}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {35}, +number = {3}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/1391989.1391995}, +doi = {10.1145/1391989.1391995}, +abstract = {CHOLMOD is a set of routines for factorizing sparse symmetric positive definite matrices of the form A or AAT, updating/downdating a sparse Cholesky factorization, solving linear systems, updating/downdating the solution to the triangular system Lx = b, and many other sparse matrix functions for both symmetric and unsymmetric matrices. Its supernodal Cholesky factorization relies on LAPACK and the Level-3 BLAS, and obtains a substantial fraction of the peak performance of the BLAS. Both real and complex matrices are supported. CHOLMOD is written in ANSI/ISO C, with both C and MATLABTM interfaces. It appears in MATLAB 7.2 as x = Ab when A is sparse symmetric positive definite, as well as in several other sparse matrix functions.}, +journal = {ACM Trans. Math. Softw.}, +month = {oct}, +articleno = {22}, +numpages = {14}, +keywords = {sparse matrices, linear equations, Cholesky factorization} +} + +@article{10.1145/1462173.1462176, +author = {Davis, Timothy A. and Hager, William W.}, +title = {Dynamic Supernodes in Sparse Cholesky Update/Downdate and Triangular Solves}, +year = {2009}, +issue_date = {February 2009}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {35}, +number = {4}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/1462173.1462176}, +doi = {10.1145/1462173.1462176}, +abstract = {The supernodal method for sparse Cholesky factorization represents the factor L as a set of supernodes, each consisting of a contiguous set of columns of L with identical nonzero pattern. A conventional supernode is stored as a dense submatrix. While this is suitable for sparse Cholesky factorization where the nonzero pattern of L does not change, it is not suitable for methods that modify a sparse Cholesky factorization after a low-rank change to A (an update/downdate, undefined = A ± WWT). Supernodes merge and split apart during an update/downdate. Dynamic supernodes are introduced which allow a sparse Cholesky update/downdate to obtain performance competitive with conventional supernodal methods. A dynamic supernodal solver is shown to exceed the performance of the conventional (BLAS-based) supernodal method for solving triangular systems. These methods are incorporated into CHOLMOD, a sparse Cholesky factorization and update/downdate package which forms the basis of x = Ab MATLAB when A is sparse and symmetric positive definite.}, +journal = {ACM Trans. Math. Softw.}, +month = {feb}, +articleno = {27}, +numpages = {23}, +keywords = {sparse matrices, linear equations, Cholesky factorization} +} + + +@article{doi:10.1137/S089547980343641X, +author = {Davis, Timothy A. and Hager, William W.}, +title = {Row Modifications of a Sparse Cholesky Factorization}, +journal = {SIAM Journal on Matrix Analysis and Applications}, +volume = {26}, +number = {3}, +pages = {621-639}, +year = {2005}, +doi = {10.1137/S089547980343641X}, +URL = {https://doi.org/10.1137/S089547980343641X }, +eprint = { https://doi.org/10.1137/S089547980343641X } , + abstract = { Given a sparse, symmetric positive definite matrix C and an associated sparse Cholesky factorization LDL\$\tr\$, we develop sparse techniques for updating the factorization after a symmetric modification of a row and column of C. We show how the modification in the Cholesky factorization associated with this rank-2 modification of C can be computed efficiently using a sparse rank-1 technique developed in [T. A. Davis and W. W. Hager, SIAM J. Matrix Anal. Appl., 20 (1999), pp. 606--627]. We also determine how the solution of a linear system Lx = b changes after changing a row and column of C or after a rank-r change in C. } +} + + +@article{doi:10.1137/S0895479899357346, +author = {Davis, Timothy A. and Hager, William W.}, +title = {Multiple-Rank Modifications of a Sparse Cholesky Factorization}, +journal = {SIAM Journal on Matrix Analysis and Applications}, +volume = {22}, +number = {4}, +pages = {997-1013}, +year = {2001}, +doi = {10.1137/S0895479899357346}, +URL = { https://doi.org/10.1137/S0895479899357346 }, +eprint = { https://doi.org/10.1137/S0895479899357346 } , + abstract = { Given a sparse symmetric positive definite matrix \$\mathbf{AA}\tr\$ and an associated sparse Cholesky factorization \$\mathbf{LDL}\tr\$ or \$\mathbf{LL}\tr\$, we develop sparse techniques for updating the factorization after either adding a collection of columns to A or deleting a collection of columns from A. Our techniques are based on an analysis and manipulation of the underlying graph structure, using the framework developed in an earlier paper on rank-1 modifications [T. A. Davis and W. W. Hager, SIAM J. Matrix Anal. Appl., 20 (1999), pp. 606--627]. Computationally, the multiple-rank update has better memory traffic and executes much faster than an equivalent series of rank-1 updates since the multiple-rank update makes one pass through L computing the new entries, while a series of rank-1 updates requires multiple passes through L. } +} + + + +@article{doi:10.1137/S0895479897321076, +author = {Davis, Timothy A. and Hager, William W.}, +title = {Modifying a Sparse Cholesky Factorization}, +journal = {SIAM Journal on Matrix Analysis and Applications}, +volume = {20}, +number = {3}, +pages = {606-627}, +year = {1999}, +doi = {10.1137/S0895479897321076}, +URL = { https://doi.org/10.1137/S0895479897321076 }, +eprint = { https://doi.org/10.1137/S0895479897321076 } , + abstract = { Given a sparse symmetric positive definite matrix \${\bf AA}^{\sf T}\$ and an associated sparse Cholesky factorization \${\bf LDL}^{\sf T}\$ or \${\bf LL}^{\sf T}\$, we develop sparse techniques for obtaining the new factorization associated with either adding a column to \${\bf A}\$ or deleting a column from \${\bf A}\$. Our techniques are based on an analysis and manipulation of the underlying graph structure and on ideas of Gill et al.\ [ Math. Comp., 28 (1974), pp. 505--535] for modifying a dense Cholesky factorization. We show that our methods extend to the general case where an arbitrary sparse symmetric positive definite matrix is modified. Our methods are optimal in the sense that they take time proportional to the number of nonzero entries in \${\bf L}\$ and \${\bf D}\$ that change. } +} + + +@article{RENNICH2016140, +title = {Accelerating sparse Cholesky factorization on GPUs}, +journal = {Parallel Computing}, +volume = {59}, +pages = {140-150}, +year = {2016}, +note = {Theory and Practice of Irregular Applications}, +issn = {0167-8191}, +doi = {https://doi.org/10.1016/j.parco.2016.06.004}, +url = {https://www.sciencedirect.com/science/article/pii/S016781911630059X}, +author = {Steven C. Rennich and Darko Stosic and Timothy A. Davis}, +keywords = {Sparse, Cholesky, Factorization, GPU, Parallel}, +abstract = {Sparse factorization is a fundamental tool in scientific computing. As the major component of a sparse direct solver, it represents the dominant computational cost for many analyses. For factorizations which involve sufficient dense math, the substantial computational capability provided by GPUs (Graphics Processing Units) can help alleviate this cost. However, for many other cases, the prevalence of small/irregular dense math and the relatively slow communication between the host and device over the PCIe bus, make it challenging to significantly accelerate sparse factorization using the GPU. In this paper we describe a left-looking supernodal Cholesky factorization algorithm which permits improved utilization of the GPU when factoring sparse matrices. The central idea is to stream subtrees of the elimination tree through the GPU and perform the factorization of each subtree entirely on the GPU. This avoids the majority of the PCIe communication without the need for a complex task scheduler. Importantly, within these subtrees, many independent, small, dense operations are batched to minimize kernel launch overhead and many of these batched kernels are executed concurrently to maximize device utilization. Performance results for commonly studied matrices are presented along with suggested actions for further optimization.} +} + +@article{10.1145/1024074.1024081, +author = {Amestoy, Patrick R. and Davis, Timothy A. and Duff, Iain S.}, +title = {Algorithm 837: AMD, an Approximate Minimum Degree Ordering Algorithm}, +year = {2004}, +issue_date = {September 2004}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {30}, +number = {3}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/1024074.1024081}, +doi = {10.1145/1024074.1024081}, +abstract = {AMD is a set of routines that implements the approximate minimum degree ordering algorithm to permute sparse matrices prior to numerical factorization. There are versions written in both C and Fortran 77. A MATLAB interface is included.}, +journal = {ACM Trans. Math. Softw.}, +month = {sep}, +pages = {381–388}, +numpages = {8}, +keywords = {sparse matrices, Linear equations, ordering methods, minimum degree} +} + + + + + + + +@article{doi:10.1137/S0895479894278952, +author = {Amestoy, Patrick R. and Davis, Timothy A. and Duff, Iain S.}, +title = {An Approximate Minimum Degree Ordering Algorithm}, +journal = {SIAM Journal on Matrix Analysis and Applications}, +volume = {17}, +number = {4}, +pages = {886-905}, +year = {1996}, +doi = {10.1137/S0895479894278952}, +URL = { https://doi.org/10.1137/S0895479894278952 }, +eprint = { https://doi.org/10.1137/S0895479894278952 } , + abstract = { Abstract. An approximate minimum degree (AMD), ordering algorithm for preordering a symmetric sparse matrix prior to numerical factorization is presented. We use techniques based on the quotient graph for matrix factorization that allow us to obtain computationally cheap bounds for the minimum degree. We show that these bounds are often equal to the actual degree. The resulting algorithm is typically much faster than previous minimum degree ordering algorithms and produces results that are comparable in quality with the best orderings from other minimum degree algorithms. } +} + + +@article{10.1145/1024074.1024080, +author = {Davis, Timothy A. and Gilbert, John R. and Larimore, Stefan I. and Ng, Esmond G.}, +title = {Algorithm 836: COLAMD, a Column Approximate Minimum Degree Ordering Algorithm}, +year = {2004}, +issue_date = {September 2004}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {30}, +number = {3}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/1024074.1024080}, +doi = {10.1145/1024074.1024080}, +abstract = {Two codes are discussed, COLAMD and SYMAMD, that compute approximate minimum degree orderings for sparse matrices in two contexts: (1) sparse partial pivoting, which requires a sparsity preserving column pre-ordering prior to numerical factorization, and (2) sparse Cholesky factorization, which requires a symmetric permutation of both the rows and columns of the matrix being factorized. These orderings are computed by COLAMD and SYMAMD, respectively. The ordering from COLAMD is also suitable for sparse QR factorization, and the factorization of matrices of the form ATA and AAT, such as those that arise in least-squares problems and interior point methods for linear programming problems. The two routines are available both in MATLAB and C-callable forms. They appear as built-in routines in MATLAB Version 6.0.}, +journal = {ACM Trans. Math. Softw.}, +month = {sep}, +pages = {377–380}, +numpages = {4}, +keywords = {sparse nonsymmetric matrices, ordering methods, Linear equations} +} + +@article{10.1145/1024074.1024079, +author = {Davis, Timothy A. and Gilbert, John R. and Larimore, Stefan I. and Ng, Esmond G.}, +title = {A Column Approximate Minimum Degree Ordering Algorithm}, +year = {2004}, +issue_date = {September 2004}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {30}, +number = {3}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/1024074.1024079}, +doi = {10.1145/1024074.1024079}, +abstract = {Sparse Gaussian elimination with partial pivoting computes the factorization PAQ = LU of a sparse matrix A, where the row ordering P is selected during factorization using standard partial pivoting with row interchanges. The goal is to select a column preordering, Q, based solely on the nonzero pattern of A, that limits the worst-case number of nonzeros in the factorization. The fill-in also depends on P, but Q is selected to reduce an upper bound on the fill-in for any subsequent choice of P. The choice of Q can have a dramatic impact on the number of nonzeros in L and U. One scheme for determining a good column ordering for A is to compute a symmetric ordering that reduces fill-in in the Cholesky factorization of ATA. A conventional minimum degree ordering algorithm would require the sparsity structure of ATA to be computed, which can be expensive both in terms of space and time since ATA may be much denser than A. An alternative is to compute Q directly from the sparsity structure of A; this strategy is used by MATLAB's COLMMD preordering algorithm. A new ordering algorithm, COLAMD, is presented. It is based on the same strategy but uses a better ordering heuristic. COLAMD is faster and computes better orderings, with fewer nonzeros in the factors of the matrix.}, +journal = {ACM Trans. Math. Softw.}, +month = {sep}, +pages = {353–376}, +numpages = {24}, +keywords = {linear equations, Sparse nonsymmetric matrices, ordering methods} +} + +@article{10.1145/992200.992206, +author = {Davis, Timothy A.}, +title = {Algorithm 832: UMFPACK V4.3---an Unsymmetric-Pattern Multifrontal Method}, +year = {2004}, +issue_date = {June 2004}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {30}, +number = {2}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/992200.992206}, +doi = {10.1145/992200.992206}, +abstract = {An ANSI C code for sparse LU factorization is presented that combines a column pre-ordering strategy with a right-looking unsymmetric-pattern multifrontal numerical factorization. The pre-ordering and symbolic analysis phase computes an upper bound on fill-in, work, and memory usage during the subsequent numerical factorization. User-callable routines are provided for ordering and analyzing a sparse matrix, computing the numerical factorization, solving a system with the LU factors, transposing and permuting a sparse matrix, and converting between sparse matrix representations. The simple user interface shields the user from the details of the complex sparse factorization data structures by returning simple handles to opaque objects. Additional user-callable routines are provided for printing and extracting the contents of these opaque objects. An even simpler way to use the package is through its MATLAB interface. UMFPACK is incorporated as a built-in operator in MATLAB 6.5 as x = Ab when A is sparse and unsymmetric.}, +journal = {ACM Trans. Math. Softw.}, +month = {jun}, +pages = {196–199}, +numpages = {4}, +keywords = {ordering methods, multifrontal method, sparse nonsymmetric matrices, linear equations} +} + + +@article{10.1145/992200.992205, +author = {Davis, Timothy A.}, +title = {A Column Pre-Ordering Strategy for the Unsymmetric-Pattern Multifrontal Method}, +year = {2004}, +issue_date = {June 2004}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {30}, +number = {2}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/992200.992205}, +doi = {10.1145/992200.992205}, +abstract = {A new method for sparse LU factorization is presented that combines a column pre-ordering strategy with a right-looking unsymmetric-pattern multifrontal numerical factorization. The column ordering is selected to give a good a priori upper bound on fill-in and then refined during numerical factorization (while preserving the bound). Pivot rows are selected to maintain numerical stability and to preserve sparsity. The method analyzes the matrix and automatically selects one of three pre-ordering and pivoting strategies. The number of nonzeros in the LU factors computed by the method is typically less than or equal to those found by a wide range of unsymmetric sparse LU factorization methods, including left-looking methods and prior multifrontal methods.}, +journal = {ACM Trans. Math. Softw.}, +month = {jun}, +pages = {165–195}, +numpages = {31}, +keywords = {linear equations, multifrontal method, sparse nonsymmetric matrices, ordering methods} +} + +@article{10.1145/305658.287640, +author = {Davis, Timothy A. and Duff, Iain S.}, +title = {A Combined Unifrontal/Multifrontal Method for Unsymmetric Sparse Matrices}, +year = {1999}, +issue_date = {March 1999}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {25}, +number = {1}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/305658.287640}, +doi = {10.1145/305658.287640}, +abstract = {We discuss the organization of frontal matrices in multifrontal methods for the solution of large sparse sets of unsymmetric linear equations. In the multifrontal method, work on a frontal matrix can be suspended, the frontal matrix can be stored for later reuse, and a new frontal matrix can be generated. There are thus several frontal matrices stored during the factorization, and one or more of these are assembled (summed) when creating a new frontal matrix. Although this means that arbitrary sparsity patterns can be handled efficiently, extra work is required to sum the frontal matrices together and can be costly because indirect addressing is requred. The (uni)frontal method avoids this extra work by factorizing the matrix with a single frontal matrix. Rows and columns are added to the frontal matrix, and pivot rows and columns are removed. Data movement is simpler, but higher fill-in can result if the matrix cannot be permuted into a variable-band form with small profile. We consider a combined unifrontal/multifrontal algorithm to enable general fill-in reduction orderings to be applied without the data movement of previous multifrontal approaches. We discuss this technique in the context of a code designed for the solution of sparse systems with unsymmetric pattern.}, +journal = {ACM Trans. Math. Softw.}, +month = {mar}, +pages = {1–20}, +numpages = {20}, +keywords = {linear equations, frontal methods, sparse unsymmetric matrices, multifrontal methods} +} + + + + + + + + +@article{doi:10.1137/S0895479894246905, +author = {Davis, Timothy A. and Duff, Iain S.}, +title = {An Unsymmetric-Pattern Multifrontal Method for Sparse LU Factorization}, +journal = {SIAM Journal on Matrix Analysis and Applications}, +volume = {18}, +number = {1}, +pages = {140-158}, +year = {1997}, +doi = {10.1137/S0895479894246905}, +URL = { https://doi.org/10.1137/S0895479894246905 }, +eprint = { https://doi.org/10.1137/S0895479894246905 } , + abstract = { Sparse matrix factorization algorithms for general problems are typically characterized by irregular memory access patterns that limit their performance on parallel-vector supercomputers. For symmetric problems, methods such as the multifrontal method avoid indirect addressing in the innermost loops by using dense matrix kernels. However, no efficient LU factorization algorithm based primarily on dense matrix kernels exists for matrices whose pattern is very unsymmetric. We address this deficiency and present a new unsymmetric-pattern multifrontal method based on dense matrix kernels. As in the classical multifrontal method, advantage is taken of repetitive structure in the matrix by factorizing more than one pivot in each frontal matrix, thus enabling the use of Level 2 and Level 3 BLAS. The performance is compared with the classical multifrontal method and other unsymmetric solvers on a CRAY C-98. } +} + + +@article{10.1145/2491491.2491498, +author = {Davis, Timothy A.}, +title = {Algorithm 930: FACTORIZE: An Object-Oriented Linear System Solver for MATLAB}, +year = {2013}, +issue_date = {July 2013}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {39}, +number = {4}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/2491491.2491498}, +doi = {10.1145/2491491.2491498}, +abstract = {The MATLAB™ backslash (x=Ab) is an elegant and powerful interface to a suite of high-performance factorization methods for the direct solution of the linear system Ax = b and the least-squares problem minx ‖b - Ax‖. It is a meta-algorithm that selects the best factorization method for a particular matrix, whether sparse or dense. However, the simplicity and elegance of its single-character interface prohibits the reuse of its factorization for subsequent systems. Requiring MATLAB users to find the best factorization method on their own can lead to suboptimal choices; even MATLAB experts can make the wrong choice. Furthermore, naive MATLAB users have a tendency to translate mathematical expressions from linear algebra directly into MATLAB, so that x = A-1b becomes the inferior yet all-to-prevalent x=inv(A)*b. To address these issues, an object-oriented FACTORIZE method is presented. Via simple-to-use operator overloading, solving two linear systems can be written as F=factorize(A); x=Fb; y=Fc, where A is factorized only once. The selection of the best factorization method (LU, Cholesky, LDLT, QR, or a complete orthogonal decomposition for rank-deficient matrices) is hidden from the user. The mathematical expression x = A-1b directly translates into the MATLAB expression x=inverse(A)*b, which does not compute the inverse at all, but does the right thing by factorizing A and solving the corresponding triangular systems.}, +journal = {ACM Trans. Math. Softw.}, +month = {jul}, +articleno = {28}, +numpages = {18}, +keywords = {object-oriented methods, least-square problems, matrix factorization, Linear systems} +} + + +@article{10.1145/1824801.1824814, +author = {Davis, Timothy A. and Palamadai Natarajan, Ekanathan}, +title = {Algorithm 907: KLU, A Direct Sparse Solver for Circuit Simulation Problems}, +year = {2010}, +issue_date = {September 2010}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {37}, +number = {3}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/1824801.1824814}, +doi = {10.1145/1824801.1824814}, +abstract = {KLU is a software package for solving sparse unsymmetric linear systems of equations that arise in circuit simulation applications. It relies on a permutation to Block Triangular Form (BTF), several methods for finding a fill-reducing ordering (variants of approximate minimum degree and nested dissection), and Gilbert/Peierls’ sparse left-looking LU factorization algorithm to factorize each block. The package is written in C and includes a MATLAB interface. Performance results comparing KLU with SuperLU, Sparse 1.3, and UMFPACK on circuit simulation matrices are presented. KLU is the default sparse direct solver in the XyceTMcircuit simulation package developed by Sandia National Laboratories.}, +journal = {ACM Trans. Math. Softw.}, +month = {sep}, +articleno = {36}, +numpages = {17}, +keywords = {LU factorization, circuit simulation, sparse matrices} +} + +@article{10.1145/1114268.1114277, +author = {Davis, Timothy A.}, +title = {Algorithm 849: A Concise Sparse Cholesky Factorization Package}, +year = {2005}, +issue_date = {December 2005}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {31}, +number = {4}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/1114268.1114277}, +doi = {10.1145/1114268.1114277}, +abstract = {The LDL software package is a set of short, concise routines for factorizing symmetric positive-definite sparse matrices, with some applicability to symmetric indefinite matrices. Its primary purpose is to illustrate much of the basic theory of sparse matrix algorithms in as concise a code as possible, including an elegant method of sparse symmetric factorization that computes the factorization row-by-row but stores it column-by-column. The entire symbolic and numeric factorization consists of less than 50 executable lines of code. The package is written in C, and includes a MATLAB interface.}, +journal = {ACM Trans. Math. Softw.}, +month = {dec}, +pages = {587–591}, +numpages = {5}, +keywords = {Cholesky factorization, linear equations, sparse matrices} +} + +@article{10.1145/2049662.2049663, +author = {Davis, Timothy A. and Hu, Yifan}, +title = {The University of Florida Sparse Matrix Collection}, +year = {2011}, +issue_date = {November 2011}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {38}, +number = {1}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/2049662.2049663}, +doi = {10.1145/2049662.2049663}, +abstract = {We describe the University of Florida Sparse Matrix Collection, a large and actively growing set of sparse matrices that arise in real applications. The Collection is widely used by the numerical linear algebra community for the development and performance evaluation of sparse matrix algorithms. It allows for robust and repeatable experiments: robust because performance results with artificially generated matrices can be misleading, and repeatable because matrices are curated and made publicly available in many formats. Its matrices cover a wide spectrum of domains, include those arising from problems with underlying 2D or 3D geometry (as structural engineering, computational fluid dynamics, model reduction, electromagnetics, semiconductor devices, thermodynamics, materials, acoustics, computer graphics/vision, robotics/kinematics, and other discretizations) and those that typically do not have such geometry (optimization, circuit simulation, economic and financial modeling, theoretical and quantum chemistry, chemical process simulation, mathematics and statistics, power networks, and other networks and graphs). We provide software for accessing and managing the Collection, from MATLAB™, Mathematica™, Fortran, and C, as well as an online search capability. Graph visualization of the matrices is provided, and a new multilevel coarsening scheme is proposed to facilitate this task.}, +journal = {ACM Trans. Math. Softw.}, +month = {dec}, +articleno = {1}, +numpages = {25}, +keywords = {sparse matrices, Graph drawing, performance evaluation, multilevel algorithms} +} + + +@article{Kolodziej2019, + doi = {10.21105/joss.01244}, + url = {https://doi.org/10.21105/joss.01244}, + year = {2019}, + publisher = {The Open Journal}, + volume = {4}, + number = {35}, + pages = {1244}, + author = {Scott P. Kolodziej and Mohsen Aznaveh and Matthew Bullock and Jarrett David and Timothy A. Davis and Matthew Henderson and Yifan Hu and Read Sandstrom}, + title = {The SuiteSparse Matrix Collection Website Interface}, + journal = {Journal of Open Source Software} +} + + +@article{10.1145/2513109.2513116, +author = {Foster, Leslie V. and Davis, Timothy A.}, +title = {Algorithm 933: Reliable Calculation of Numerical Rank, Null Space Bases, Pseudoinverse Solutions, and Basic Solutions Using SuitesparseQR}, +year = {2013}, +issue_date = {September 2013}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {40}, +number = {1}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/2513109.2513116}, +doi = {10.1145/2513109.2513116}, +abstract = {The SPQR_RANK package contains routines that calculate the numerical rank of large, sparse, numerically rank-deficient matrices. The routines can also calculate orthonormal bases for numerical null spaces, approximate pseudoinverse solutions to least squares problems involving rank-deficient matrices, and basic solutions to these problems. The algorithms are based on SPQR from SuiteSparseQR (ACM Transactions on Mathematical Software 38, Article 8, 2011). SPQR is a high-performance routine for forming QR factorizations of large, sparse matrices. It returns an estimate for the numerical rank that is usually, but not always, correct. The new routines improve the accuracy of the numerical rank calculated by SPQR and reliably determine the numerical rank in the sense that, based on extensive testing with matrices from applications, the numerical rank is almost always accurately determined when our methods report that the numerical rank should be correct. Reliable determination of numerical rank is critical to the other calculations in the package. The routines work well for matrices with either small or large null space dimensions.}, +journal = {ACM Trans. Math. Softw.}, +month = {oct}, +articleno = {7}, +numpages = {23}, +keywords = {QR factorization, pseudoinverse, Numerical rank, null space, rank revealing, sparse matrices} +} + +@article{10.1145/3337792, +author = {Davis, Timothy A. and Hager, William W. and Kolodziej, Scott P. and Yeralan, S. Nuri}, +title = {Algorithm 1003: Mongoose, a Graph Coarsening and Partitioning Library}, +year = {2020}, +issue_date = {March 2020}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +volume = {46}, +number = {1}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/3337792}, +doi = {10.1145/3337792}, +abstract = {Partitioning graphs is a common and useful operation in many areas, from parallel computing to VLSI design to sparse matrix algorithms. In this article, we introduce Mongoose, a multilevel hybrid graph partitioning algorithm and library. Building on previous work in multilevel partitioning frameworks and combinatoric approaches, we introduce novel stall-reducing and stall-free coarsening strategies, as well as an efficient hybrid algorithm leveraging (1) traditional combinatoric methods and (2) continuous quadratic programming formulations. We demonstrate how this new hybrid algorithm outperforms either strategy in isolation, and we also compare Mongoose to METIS and demonstrate its effectiveness on large and social networking (power law) graphs.}, +journal = {ACM Trans. Math. Softw.}, +month = {mar}, +articleno = {7}, +numpages = {18}, +keywords = {vertex matching, Graph partitioning, graph coarsening} +} + + +@article{10.1145/3519024, +author = {Lourenco, Christopher and Chen, Jinhao and Moreno-Centeno, Erick and Davis, Timothy A.}, +title = {Algorithm 1XXX: SPEX Left LU, Exactly Solving Sparse Linear Systems via a Sparse Left-Looking Integer-Preserving LU Factorization}, +year = {2022}, +publisher = {Association for Computing Machinery}, +address = {New York, NY, USA}, +issn = {0098-3500}, +url = {https://doi.org/10.1145/3519024}, +doi = {10.1145/3519024}, +abstract = {SPEX Left LU is a software package for exactly solving unsymmetric sparse linear systems. As a component of the sparse exact (SPEX) software package, SPEX Left LU can be applied to any input matrix, A, whose entries are integral, rational, or decimal, and provides a solution to the system Ax = b which is either exact or accurate to user-specified precision. SPEX Left LU preorders the matrix A with a user-specified fill-reducing ordering and computes a left-looking LU factorization with the special property that each operation used to compute the L and U matrices is integral. Notable additional applications of this package include benchmarking the stability and accuracy of state-of-the-art linear solvers, and determining whether singular-to-double-precision matrices are indeed singular. Computationally, this paper evaluates the impact of several novel pivoting schemes in exact arithmetic, benchmarks the exact iterative solvers within Linbox, and benchmarks the accuracy of MATLAB sparse backslash. Most importantly, it is shown that SPEX Left LU outperforms the exact iterative solvers in run time on easy instances and in stability as the iterative solver fails on a sizeable subset of the tested (both easy and hard) instances. The SPEX Left LU package is written in ANSI C, comes with a MATLAB interface, and is distributed via GitHub, as a component of the SPEX software package, and as a component of SuiteSparse.}, +note = {Just Accepted}, +journal = {ACM Trans. Math. Softw.}, +month = {feb}, +keywords = {exact matrix factorization, sparse linear systems, sparse matrix algorithms, exactly solving linear systems, roundoff errors} +} + diff --git a/ThirdParty/SuiteSparse/COLAMD/CMakeLists.txt b/ThirdParty/SuiteSparse/COLAMD/CMakeLists.txt new file mode 100644 index 0000000000..0f9603c950 --- /dev/null +++ b/ThirdParty/SuiteSparse/COLAMD/CMakeLists.txt @@ -0,0 +1,165 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/COLAMD/CMakeLists.txt: cmake for COLAMD +#------------------------------------------------------------------------------- + +# Copyright (c) 1998-2023, Timothy A. Davis. All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- +# get the version +#------------------------------------------------------------------------------- + +cmake_minimum_required ( VERSION 3.19 ) + +set ( COLAMD_DATE "Jan 17, 2023" ) +set ( COLAMD_VERSION_MAJOR 3 ) +set ( COLAMD_VERSION_MINOR 0 ) +set ( COLAMD_VERSION_SUB 3 ) + +message ( STATUS "Building COLAMD version: v" + ${COLAMD_VERSION_MAJOR}. + ${COLAMD_VERSION_MINOR}. + ${COLAMD_VERSION_SUB} " (" ${COLAMD_DATE} ")" ) + +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${CMAKE_SOURCE_DIR}/cmake_modules + ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( colamd + VERSION "${COLAMD_VERSION_MAJOR}.${COLAMD_VERSION_MINOR}.${COLAMD_VERSION_SUB}" + LANGUAGES C ) + +#------------------------------------------------------------------------------- +# find library dependencies +#------------------------------------------------------------------------------- + +find_package ( SuiteSparse_config 7.0.0 REQUIRED ) + +#------------------------------------------------------------------------------- +# configure files +#------------------------------------------------------------------------------- + +configure_file ( "Config/colamd.h.in" + "${PROJECT_SOURCE_DIR}/Include/colamd.h" + NEWLINE_STYLE LF ) + +#------------------------------------------------------------------------------- +# include directories +#------------------------------------------------------------------------------- + +include_directories ( Source Include ${SUITESPARSE_CONFIG_INCLUDE_DIR} ) + +#------------------------------------------------------------------------------- +# dynamic colamd library properties +#------------------------------------------------------------------------------- + +file ( GLOB COLAMD_SOURCES "Source/*.c" ) + +add_library ( colamd SHARED ${COLAMD_SOURCES} ) + +set_target_properties ( colamd PROPERTIES + VERSION ${COLAMD_VERSION_MAJOR}.${COLAMD_VERSION_MINOR}.${COLAMD_VERSION_SUB} + C_STANDARD_REQUIRED 11 + SOVERSION ${COLAMD_VERSION_MAJOR} + PUBLIC_HEADER "Include/colamd.h" + WINDOWS_EXPORT_ALL_SYMBOLS ON ) + +#------------------------------------------------------------------------------- +# static colamd library properties +#------------------------------------------------------------------------------- + +if ( NOT NSTATIC ) + add_library ( colamd_static STATIC ${COLAMD_SOURCES} ) + + set_target_properties ( colamd_static PROPERTIES + VERSION ${COLAMD_VERSION_MAJOR}.${COLAMD_VERSION_MINOR}.${COLAMD_VERSION_SUB} + OUTPUT_NAME colamd + C_STANDARD_REQUIRED 11 + SOVERSION ${COLAMD_VERSION_MAJOR} ) + + if ( MSVC ) + set_target_properties ( colamd_static PROPERTIES + OUTPUT_NAME colamd_static ) + endif ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# add the library dependencies +#------------------------------------------------------------------------------- + +target_link_libraries ( colamd PUBLIC ${SUITESPARSE_CONFIG_LIBRARY} ) +if ( NOT NSTATIC ) + target_link_libraries ( colamd_static PUBLIC ${SUITESPARSE_CONFIG_STATIC} ) +endif ( ) + +# libm: +if ( NOT WIN32 ) + target_link_libraries ( colamd PUBLIC m ) + if ( NOT NSTATIC ) + target_link_libraries ( colamd_static PUBLIC m ) + endif ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# COLAMD installation location +#------------------------------------------------------------------------------- + +install ( TARGETS colamd + LIBRARY DESTINATION ${SUITESPARSE_LIBDIR} + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} + RUNTIME DESTINATION ${SUITESPARSE_BINDIR} + PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} ) +install ( FILES ${CMAKE_SOURCE_DIR}/cmake_modules/FindCOLAMD.cmake + DESTINATION ${SUITESPARSE_LIBDIR}/cmake/SuiteSparse + COMPONENT Development ) +if ( NOT NSTATIC ) + install ( TARGETS colamd_static + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} ) +endif ( ) + +#------------------------------------------------------------------------------- +# Demo library and programs +#------------------------------------------------------------------------------- + +option ( DEMO "ON: Build the demo programs. OFF (default): do not build the demo programs." off ) +if ( DEMO ) + + #--------------------------------------------------------------------------- + # demo library + #--------------------------------------------------------------------------- + + message ( STATUS "Also compiling the demos in COLAMD/Demo" ) + + #--------------------------------------------------------------------------- + # Demo programs + #--------------------------------------------------------------------------- + + add_executable ( colamd_example "Demo/colamd_example.c" ) + add_executable ( colamd_l_example "Demo/colamd_l_example.c" ) + + # Libraries required for Demo programs + target_link_libraries ( colamd_example PUBLIC colamd ) + target_link_libraries ( colamd_l_example PUBLIC colamd ) + +else ( ) + + message ( STATUS "Skipping the demos in COLAMD/Demo" ) + +endif ( ) + +#------------------------------------------------------------------------------- +# report status +#------------------------------------------------------------------------------- + +include ( SuiteSparseReport ) + diff --git a/ThirdParty/SuiteSparse/COLAMD/Config/colamd.h.in b/ThirdParty/SuiteSparse/COLAMD/Config/colamd.h.in new file mode 100644 index 0000000000..fb0450ac45 --- /dev/null +++ b/ThirdParty/SuiteSparse/COLAMD/Config/colamd.h.in @@ -0,0 +1,236 @@ +//------------------------------------------------------------------------------ +// COLAMD/Source/colamd.h: include file for COLAMD +//------------------------------------------------------------------------------ + +// COLAMD, Copyright (c) 1998-2022, Timothy A. Davis and Stefan Larimore, +// All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + +/* COLAMD / SYMAMD include file + + You must include this file (colamd.h) in any routine that uses colamd, + symamd, or the related macros and definitions. + + Authors: + + The authors of the code itself are Stefan I. Larimore and Timothy A. + Davis (DrTimothyAldenDavis@gmail.com). The algorithm was + developed in collaboration with John Gilbert, Xerox PARC, and Esmond + Ng, Oak Ridge National Laboratory. + + Acknowledgements: + + This work was supported by the National Science Foundation, under + grants DMS-9504974 and DMS-9803599. + + Availability: + + The colamd/symamd library is available at http://www.suitesparse.com + This file is required by the colamd.c, colamdmex.c, and symamdmex.c + files, and by any C code that calls the routines whose prototypes are + listed below, or that uses the colamd/symamd definitions listed below. + +*/ + +#ifndef COLAMD_H +#define COLAMD_H + +/* make it easy for C++ programs to include COLAMD */ +#ifdef __cplusplus +extern "C" { +#endif + +/* ========================================================================== */ +/* === Include files ======================================================== */ +/* ========================================================================== */ + +#include "SuiteSparse_config.h" + +/* ========================================================================== */ +/* === COLAMD version ======================================================= */ +/* ========================================================================== */ + +/* COLAMD Version 2.4 and later will include the following definitions. + * As an example, to test if the version you are using is 2.4 or later: + * + * #ifdef COLAMD_VERSION + * if (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4)) ... + * #endif + * + * This also works during compile-time: + * + * #if defined(COLAMD_VERSION) && (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4)) + * printf ("This is version 2.4 or later\n") ; + * #else + * printf ("This is an early version\n") ; + * #endif + * + * Versions 2.3 and earlier of COLAMD do not include a #define'd version number. + */ + +#define COLAMD_DATE "@COLAMD_DATE@" +#define COLAMD_MAIN_VERSION @COLAMD_VERSION_MAJOR@ +#define COLAMD_SUB_VERSION @COLAMD_VERSION_MINOR@ +#define COLAMD_SUBSUB_VERSION @COLAMD_VERSION_SUB@ + +#define COLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) +#define COLAMD_VERSION \ + COLAMD_VERSION_CODE(COLAMD_MAIN_VERSION,COLAMD_SUB_VERSION) + +/* ========================================================================== */ +/* === Knob and statistics definitions ====================================== */ +/* ========================================================================== */ + +/* size of the knobs [ ] array. Only knobs [0..1] are currently used. */ +#define COLAMD_KNOBS 20 + +/* number of output statistics. Only stats [0..6] are currently used. */ +#define COLAMD_STATS 20 + +/* knobs [0] and stats [0]: dense row knob and output statistic. */ +#define COLAMD_DENSE_ROW 0 + +/* knobs [1] and stats [1]: dense column knob and output statistic. */ +#define COLAMD_DENSE_COL 1 + +/* knobs [2]: aggressive absorption */ +#define COLAMD_AGGRESSIVE 2 + +/* stats [2]: memory defragmentation count output statistic */ +#define COLAMD_DEFRAG_COUNT 2 + +/* stats [3]: colamd status: zero OK, > 0 warning or notice, < 0 error */ +#define COLAMD_STATUS 3 + +/* stats [4..6]: error info, or info on jumbled columns */ +#define COLAMD_INFO1 4 +#define COLAMD_INFO2 5 +#define COLAMD_INFO3 6 + +/* error codes returned in stats [3]: */ +#define COLAMD_OK (0) +#define COLAMD_OK_BUT_JUMBLED (1) +#define COLAMD_ERROR_A_not_present (-1) +#define COLAMD_ERROR_p_not_present (-2) +#define COLAMD_ERROR_nrow_negative (-3) +#define COLAMD_ERROR_ncol_negative (-4) +#define COLAMD_ERROR_nnz_negative (-5) +#define COLAMD_ERROR_p0_nonzero (-6) +#define COLAMD_ERROR_A_too_small (-7) +#define COLAMD_ERROR_col_length_negative (-8) +#define COLAMD_ERROR_row_index_out_of_bounds (-9) +#define COLAMD_ERROR_out_of_memory (-10) +#define COLAMD_ERROR_internal_error (-999) + + +/* ========================================================================== */ +/* === Prototypes of user-callable routines ================================= */ +/* ========================================================================== */ + +size_t colamd_recommended /* returns recommended value of Alen, */ + /* or 0 if input arguments are erroneous */ +( + int32_t nnz, /* nonzeros in A */ + int32_t n_row, /* number of rows in A */ + int32_t n_col /* number of columns in A */ +) ; + +size_t colamd_l_recommended /* returns recommended value of Alen, */ + /* or 0 if input arguments are erroneous */ +( + int64_t nnz, /* nonzeros in A */ + int64_t n_row, /* number of rows in A */ + int64_t n_col /* number of columns in A */ +) ; + +void colamd_set_defaults /* sets default parameters */ +( /* knobs argument is modified on output */ + double knobs [COLAMD_KNOBS] /* parameter settings for colamd */ +) ; + +void colamd_l_set_defaults /* sets default parameters */ +( /* knobs argument is modified on output */ + double knobs [COLAMD_KNOBS] /* parameter settings for colamd */ +) ; + +int colamd /* returns (1) if successful, (0) otherwise*/ +( /* A and p arguments are modified on output */ + int32_t n_row, /* number of rows in A */ + int32_t n_col, /* number of columns in A */ + int32_t Alen, /* size of the array A */ + int32_t A [], /* row indices of A, of size Alen */ + int32_t p [], /* column pointers of A, of size n_col+1 */ + double knobs [COLAMD_KNOBS], /* parameter settings for colamd */ + int32_t stats [COLAMD_STATS] /* colamd output stats and error codes */ +) ; + +int colamd_l /* returns (1) if successful, (0) otherwise*/ +( /* A and p arguments are modified on output */ + int64_t n_row, /* number of rows in A */ + int64_t n_col, /* number of columns in A */ + int64_t Alen, /* size of the array A */ + int64_t A [], /* row indices of A, of size Alen */ + int64_t p [], /* column pointers of A, of size n_col+1 */ + double knobs [COLAMD_KNOBS], /* parameter settings for colamd */ + int64_t stats [COLAMD_STATS] /* colamd output stats and error codes */ +) ; + +int symamd /* return (1) if OK, (0) otherwise */ +( + int32_t n, /* number of rows and columns of A */ + int32_t A [], /* row indices of A */ + int32_t p [], /* column pointers of A */ + int32_t perm [], /* output permutation, size n_col+1 */ + double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */ + int32_t stats [COLAMD_STATS], /* output stats and error codes */ + void * (*allocate) (size_t, size_t), + /* pointer to calloc (ANSI C) or */ + /* mxCalloc (for MATLAB mexFunction) */ + void (*release) (void *) + /* pointer to free (ANSI C) or */ + /* mxFree (for MATLAB mexFunction) */ +) ; + +int symamd_l /* return (1) if OK, (0) otherwise */ +( + int64_t n, /* number of rows and columns of A */ + int64_t A [], /* row indices of A */ + int64_t p [], /* column pointers of A */ + int64_t perm [], /* output permutation, size n_col+1 */ + double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */ + int64_t stats [COLAMD_STATS], /* output stats and error codes */ + void * (*allocate) (size_t, size_t), + /* pointer to calloc (ANSI C) or */ + /* mxCalloc (for MATLAB mexFunction) */ + void (*release) (void *) + /* pointer to free (ANSI C) or */ + /* mxFree (for MATLAB mexFunction) */ +) ; + +void colamd_report +( + int32_t stats [COLAMD_STATS] +) ; + +void colamd_l_report +( + int64_t stats [COLAMD_STATS] +) ; + +void symamd_report +( + int32_t stats [COLAMD_STATS] +) ; + +void symamd_l_report +( + int64_t stats [COLAMD_STATS] +) ; + +#ifdef __cplusplus +} +#endif + +#endif /* COLAMD_H */ diff --git a/ThirdParty/SuiteSparse/COLAMD/Demo/Makefile b/ThirdParty/SuiteSparse/COLAMD/Demo/Makefile deleted file mode 100644 index 5a1f9e544e..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/Demo/Makefile +++ /dev/null @@ -1,49 +0,0 @@ -#----------------------------------------------------------------------------- -# compile the COLAMD demo -#----------------------------------------------------------------------------- - -default: all - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -I = -I../../include - -C = $(CC) $(CF) $(I) - -LIB2 = $(LDFLAGS) -L../../lib -lcolamd -lsuitesparseconfig $(LDLIBS) - -all: library colamd_example colamd_l_example - -library: - ( cd ../../SuiteSparse_config ; $(MAKE) ) - ( cd ../Lib ; $(MAKE) ) - -#------------------------------------------------------------------------------ -# Create the demo program, run it, and compare the output -#------------------------------------------------------------------------------ - -dist: - -colamd_example: colamd_example.c - $(C) -o colamd_example colamd_example.c $(LIB2) - - ./colamd_example > my_colamd_example.out - - diff colamd_example.out my_colamd_example.out - -colamd_l_example: colamd_l_example.c - $(C) -o colamd_l_example colamd_l_example.c $(LIB2) - - ./colamd_l_example > my_colamd_l_example.out - - diff colamd_l_example.out my_colamd_l_example.out - -#------------------------------------------------------------------------------ -# Remove all but the files in the original distribution -#------------------------------------------------------------------------------ - -clean: - - $(RM) -r $(CLEAN) - -purge: distclean - -distclean: clean - - $(RM) colamd_example colamd_l_example - - $(RM) my_colamd_example.out my_colamd_l_example.out - - $(RM) -r $(PURGE) diff --git a/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_example.c b/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_example.c deleted file mode 100644 index 02fa3697ec..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_example.c +++ /dev/null @@ -1,178 +0,0 @@ -/* ========================================================================== */ -/* === colamd and symamd example ============================================ */ -/* ========================================================================== */ - -/* COLAMD / SYMAMD example - - colamd example of use, to order the columns of a 5-by-4 matrix with - 11 nonzero entries in the following nonzero pattern, with default knobs. - - x 0 x 0 - x 0 x x - 0 x x 0 - 0 0 x x - x x 0 0 - - symamd example of use, to order the rows and columns of a 5-by-5 - matrix with 13 nonzero entries in the following nonzero pattern, - with default knobs. - - x x 0 0 0 - x x x x 0 - 0 x x 0 0 - 0 x 0 x x - 0 0 0 x x - - (where x denotes a nonzero value). -*/ - -/* ========================================================================== */ - -#include -#include "colamd.h" - -#define A_NNZ 11 -#define A_NROW 5 -#define A_NCOL 4 -#define ALEN 150 - -#define B_NNZ 4 -#define B_N 5 - -int main (void) -{ - - /* ====================================================================== */ - /* input matrix A definition */ - /* ====================================================================== */ - - int A [ALEN] = { - - 0, 1, 4, /* row indices of nonzeros in column 0 */ - 2, 4, /* row indices of nonzeros in column 1 */ - 0, 1, 2, 3, /* row indices of nonzeros in column 2 */ - 1, 3} ; /* row indices of nonzeros in column 3 */ - - int p [ ] = { - - 0, /* column 0 is in A [0..2] */ - 3, /* column 1 is in A [3..4] */ - 5, /* column 2 is in A [5..8] */ - 9, /* column 3 is in A [9..10] */ - A_NNZ} ; /* number of nonzeros in A */ - - /* ====================================================================== */ - /* input matrix B definition */ - /* ====================================================================== */ - - int B [ ] = { /* Note: only strictly lower triangular part */ - /* is included, since symamd ignores the */ - /* diagonal and upper triangular part of B. */ - - 1, /* row indices of nonzeros in column 0 */ - 2, 3, /* row indices of nonzeros in column 1 */ - /* row indices of nonzeros in column 2 (none) */ - 4 /* row indices of nonzeros in column 3 */ - } ; /* row indices of nonzeros in column 4 (none) */ - - int q [ ] = { - - 0, /* column 0 is in B [0] */ - 1, /* column 1 is in B [1..2] */ - 3, /* column 2 is empty */ - 3, /* column 3 is in B [3] */ - 4, /* column 4 is empty */ - B_NNZ} ; /* number of nonzeros in strictly lower B */ - - /* ====================================================================== */ - /* other variable definitions */ - /* ====================================================================== */ - - int perm [B_N+1] ; /* note the size is N+1 */ - int stats [COLAMD_STATS] ; /* for colamd and symamd output statistics */ - - int row, col, pp, length, ok ; - - /* ====================================================================== */ - /* dump the input matrix A */ - /* ====================================================================== */ - - printf ("colamd %d-by-%d input matrix:\n", A_NROW, A_NCOL) ; - for (col = 0 ; col < A_NCOL ; col++) - { - length = p [col+1] - p [col] ; - printf ("Column %d, with %d entries:\n", col, length) ; - for (pp = p [col] ; pp < p [col+1] ; pp++) - { - row = A [pp] ; - printf (" row %d\n", row) ; - } - } - - /* ====================================================================== */ - /* order the matrix. Note that this destroys A and overwrites p */ - /* ====================================================================== */ - - ok = colamd (A_NROW, A_NCOL, ALEN, A, p, (double *) NULL, stats) ; - colamd_report (stats) ; - - if (!ok) - { - printf ("colamd error!\n") ; - exit (1) ; - } - - /* ====================================================================== */ - /* print the column ordering */ - /* ====================================================================== */ - - printf ("colamd column ordering:\n") ; - printf ("1st column: %d\n", p [0]) ; - printf ("2nd column: %d\n", p [1]) ; - printf ("3rd column: %d\n", p [2]) ; - printf ("4th column: %d\n", p [3]) ; - - /* ====================================================================== */ - /* dump the strictly lower triangular part of symmetric input matrix B */ - /* ====================================================================== */ - - printf ("\n\nsymamd %d-by-%d input matrix:\n", B_N, B_N) ; - printf ("Entries in strictly lower triangular part:\n") ; - for (col = 0 ; col < B_N ; col++) - { - length = q [col+1] - q [col] ; - printf ("Column %d, with %d entries:\n", col, length) ; - for (pp = q [col] ; pp < q [col+1] ; pp++) - { - row = B [pp] ; - printf (" row %d\n", row) ; - } - } - - /* ====================================================================== */ - /* order the matrix B. Note that this does not modify B or q. */ - /* ====================================================================== */ - - ok = symamd (B_N, B, q, perm, (double *) NULL, stats, &calloc, &free) ; - symamd_report (stats) ; - - if (!ok) - { - printf ("symamd error!\n") ; - exit (1) ; - } - - /* ====================================================================== */ - /* print the symmetric ordering */ - /* ====================================================================== */ - - printf ("symamd column ordering:\n") ; - printf ("1st row/column: %d\n", perm [0]) ; - printf ("2nd row/column: %d\n", perm [1]) ; - printf ("3rd row/column: %d\n", perm [2]) ; - printf ("4th row/column: %d\n", perm [3]) ; - printf ("5th row/column: %d\n", perm [4]) ; - - exit (0) ; -} - diff --git a/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_example.out b/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_example.out deleted file mode 100644 index a2b6b0ae87..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_example.out +++ /dev/null @@ -1,50 +0,0 @@ -colamd 5-by-4 input matrix: -Column 0, with 3 entries: - row 0 - row 1 - row 4 -Column 1, with 2 entries: - row 2 - row 4 -Column 2, with 4 entries: - row 0 - row 1 - row 2 - row 3 -Column 3, with 2 entries: - row 1 - row 3 - -colamd version 2.9, May 4, 2016: OK. -colamd: number of dense or empty rows ignored: 0 -colamd: number of dense or empty columns ignored: 0 -colamd: number of garbage collections performed: 0 -colamd column ordering: -1st column: 1 -2nd column: 0 -3rd column: 2 -4th column: 3 - - -symamd 5-by-5 input matrix: -Entries in strictly lower triangular part: -Column 0, with 1 entries: - row 1 -Column 1, with 2 entries: - row 2 - row 3 -Column 2, with 0 entries: -Column 3, with 1 entries: - row 4 -Column 4, with 0 entries: - -symamd version 2.9, May 4, 2016: OK. -symamd: number of dense or empty rows ignored: 0 -symamd: number of dense or empty columns ignored: 0 -symamd: number of garbage collections performed: 0 -symamd column ordering: -1st row/column: 0 -2nd row/column: 2 -3rd row/column: 1 -4th row/column: 3 -5th row/column: 4 diff --git a/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_l_example.c b/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_l_example.c deleted file mode 100644 index 657a9a73be..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_l_example.c +++ /dev/null @@ -1,179 +0,0 @@ -/* ========================================================================== */ -/* === colamd and symamd example ============================================ */ -/* ========================================================================== */ - -/* COLAMD / SYMAMD example - - colamd example of use, to order the columns of a 5-by-4 matrix with - 11 nonzero entries in the following nonzero pattern, with default knobs. - - x 0 x 0 - x 0 x x - 0 x x 0 - 0 0 x x - x x 0 0 - - symamd example of use, to order the rows and columns of a 5-by-5 - matrix with 13 nonzero entries in the following nonzero pattern, - with default knobs. - - x x 0 0 0 - x x x x 0 - 0 x x 0 0 - 0 x 0 x x - 0 0 0 x x - - (where x denotes a nonzero value). -*/ - -/* ========================================================================== */ - -#include -#include "colamd.h" -#define Long SuiteSparse_long - -#define A_NNZ 11 -#define A_NROW 5 -#define A_NCOL 4 -#define ALEN 150 - -#define B_NNZ 4 -#define B_N 5 - -int main (void) -{ - - /* ====================================================================== */ - /* input matrix A definition */ - /* ====================================================================== */ - - Long A [ALEN] = { - - 0, 1, 4, /* row indices of nonzeros in column 0 */ - 2, 4, /* row indices of nonzeros in column 1 */ - 0, 1, 2, 3, /* row indices of nonzeros in column 2 */ - 1, 3} ; /* row indices of nonzeros in column 3 */ - - Long p [ ] = { - - 0, /* column 0 is in A [0..2] */ - 3, /* column 1 is in A [3..4] */ - 5, /* column 2 is in A [5..8] */ - 9, /* column 3 is in A [9..10] */ - A_NNZ} ; /* number of nonzeros in A */ - - /* ====================================================================== */ - /* input matrix B definition */ - /* ====================================================================== */ - - Long B [ ] = { /* Note: only strictly lower triangular part */ - /* is included, since symamd ignores the */ - /* diagonal and upper triangular part of B. */ - - 1, /* row indices of nonzeros in column 0 */ - 2, 3, /* row indices of nonzeros in column 1 */ - /* row indices of nonzeros in column 2 (none) */ - 4 /* row indices of nonzeros in column 3 */ - } ; /* row indices of nonzeros in column 4 (none) */ - - Long q [ ] = { - - 0, /* column 0 is in B [0] */ - 1, /* column 1 is in B [1..2] */ - 3, /* column 2 is empty */ - 3, /* column 3 is in B [3] */ - 4, /* column 4 is empty */ - B_NNZ} ; /* number of nonzeros in strictly lower B */ - - /* ====================================================================== */ - /* other variable definitions */ - /* ====================================================================== */ - - Long perm [B_N+1] ; /* note the size is N+1 */ - Long stats [COLAMD_STATS] ; /* for colamd and symamd output statistics */ - - Long row, col, pp, length, ok ; - - /* ====================================================================== */ - /* dump the input matrix A */ - /* ====================================================================== */ - - printf ("colamd %d-by-%d input matrix:\n", A_NROW, A_NCOL) ; - for (col = 0 ; col < A_NCOL ; col++) - { - length = p [col+1] - p [col] ; - printf ("Column %ld, with %ld entries:\n", col, length) ; - for (pp = p [col] ; pp < p [col+1] ; pp++) - { - row = A [pp] ; - printf (" row %ld\n", row) ; - } - } - - /* ====================================================================== */ - /* order the matrix. Note that this destroys A and overwrites p */ - /* ====================================================================== */ - - ok = colamd_l (A_NROW, A_NCOL, ALEN, A, p, (double *) NULL, stats) ; - colamd_l_report (stats) ; - - if (!ok) - { - printf ("colamd error!\n") ; - exit (1) ; - } - - /* ====================================================================== */ - /* print the column ordering */ - /* ====================================================================== */ - - printf ("colamd_l column ordering:\n") ; - printf ("1st column: %ld\n", p [0]) ; - printf ("2nd column: %ld\n", p [1]) ; - printf ("3rd column: %ld\n", p [2]) ; - printf ("4th column: %ld\n", p [3]) ; - - /* ====================================================================== */ - /* dump the strictly lower triangular part of symmetric input matrix B */ - /* ====================================================================== */ - - printf ("\n\nsymamd_l %d-by-%d input matrix:\n", B_N, B_N) ; - printf ("Entries in strictly lower triangular part:\n") ; - for (col = 0 ; col < B_N ; col++) - { - length = q [col+1] - q [col] ; - printf ("Column %ld, with %ld entries:\n", col, length) ; - for (pp = q [col] ; pp < q [col+1] ; pp++) - { - row = B [pp] ; - printf (" row %ld\n", row) ; - } - } - - /* ====================================================================== */ - /* order the matrix B. Note that this does not modify B or q. */ - /* ====================================================================== */ - - ok = symamd_l (B_N, B, q, perm, (double *) NULL, stats, &calloc, &free) ; - symamd_l_report (stats) ; - - if (!ok) - { - printf ("symamd error!\n") ; - exit (1) ; - } - - /* ====================================================================== */ - /* print the symmetric ordering */ - /* ====================================================================== */ - - printf ("symamd_l column ordering:\n") ; - printf ("1st row/column: %ld\n", perm [0]) ; - printf ("2nd row/column: %ld\n", perm [1]) ; - printf ("3rd row/column: %ld\n", perm [2]) ; - printf ("4th row/column: %ld\n", perm [3]) ; - printf ("5th row/column: %ld\n", perm [4]) ; - - exit (0) ; -} - diff --git a/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_l_example.out b/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_l_example.out deleted file mode 100644 index 2f1035c5cb..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/Demo/colamd_l_example.out +++ /dev/null @@ -1,50 +0,0 @@ -colamd 5-by-4 input matrix: -Column 0, with 3 entries: - row 0 - row 1 - row 4 -Column 1, with 2 entries: - row 2 - row 4 -Column 2, with 4 entries: - row 0 - row 1 - row 2 - row 3 -Column 3, with 2 entries: - row 1 - row 3 - -colamd version 2.9, May 4, 2016: OK. -colamd: number of dense or empty rows ignored: 0 -colamd: number of dense or empty columns ignored: 0 -colamd: number of garbage collections performed: 0 -colamd_l column ordering: -1st column: 1 -2nd column: 0 -3rd column: 2 -4th column: 3 - - -symamd_l 5-by-5 input matrix: -Entries in strictly lower triangular part: -Column 0, with 1 entries: - row 1 -Column 1, with 2 entries: - row 2 - row 3 -Column 2, with 0 entries: -Column 3, with 1 entries: - row 4 -Column 4, with 0 entries: - -symamd version 2.9, May 4, 2016: OK. -symamd: number of dense or empty rows ignored: 0 -symamd: number of dense or empty columns ignored: 0 -symamd: number of garbage collections performed: 0 -symamd_l column ordering: -1st row/column: 0 -2nd row/column: 2 -3rd row/column: 1 -4th row/column: 3 -5th row/column: 4 diff --git a/ThirdParty/SuiteSparse/COLAMD/Doc/ChangeLog b/ThirdParty/SuiteSparse/COLAMD/Doc/ChangeLog index 7640c626bb..f7a3dcf3c8 100644 --- a/ThirdParty/SuiteSparse/COLAMD/Doc/ChangeLog +++ b/ThirdParty/SuiteSparse/COLAMD/Doc/ChangeLog @@ -1,3 +1,17 @@ +Jan 17, 2023: version 3.0.3 + + * SuiteSparse_config: now v7.0.0 + +Dec 9, 2022: version 3.0.2 + + * minor change to build system + +Nov 12, 2022: version 3.0.0 + + * using CMake build system + * integers: int (32-bit) and SuiteSparse_long (nominally 64-bit) replaced + with int32_t and int64_t. + May 4, 2016: version 2.9.6 * minor changes to Makefile diff --git a/ThirdParty/SuiteSparse/COLAMD/Doc/License.txt b/ThirdParty/SuiteSparse/COLAMD/Doc/License.txt index 4fff9e9771..6abd8a41cd 100644 --- a/ThirdParty/SuiteSparse/COLAMD/Doc/License.txt +++ b/ThirdParty/SuiteSparse/COLAMD/Doc/License.txt @@ -1,4 +1,4 @@ -COLAMD, Copyright 1998-2016, Timothy A. Davis. http://www.suitesparse.com +COLAMD, Copyright 1998-2022, Timothy A. Davis. http://www.suitesparse.com http://www.suitesparse.com -------------------------------------------------------------------------------- diff --git a/ThirdParty/SuiteSparse/COLAMD/Doc/lesser.txt b/ThirdParty/SuiteSparse/COLAMD/Doc/lesser.txt deleted file mode 100644 index 8add30ad59..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/Doc/lesser.txt +++ /dev/null @@ -1,504 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - , 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! - - diff --git a/ThirdParty/SuiteSparse/COLAMD/Include/colamd.h b/ThirdParty/SuiteSparse/COLAMD/Include/colamd.h index fbe9593089..f258ef68ec 100644 --- a/ThirdParty/SuiteSparse/COLAMD/Include/colamd.h +++ b/ThirdParty/SuiteSparse/COLAMD/Include/colamd.h @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === colamd/symamd prototypes and definitions ============================= */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// COLAMD/Source/colamd.h: include file for COLAMD +//------------------------------------------------------------------------------ + +// COLAMD, Copyright (c) 1998-2022, Timothy A. Davis and Stefan Larimore, +// All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* COLAMD / SYMAMD include file @@ -9,27 +15,22 @@ Authors: - The authors of the code itself are Stefan I. Larimore and Timothy A. - Davis (DrTimothyAldenDavis@gmail.com). The algorithm was - developed in collaboration with John Gilbert, Xerox PARC, and Esmond - Ng, Oak Ridge National Laboratory. + The authors of the code itself are Stefan I. Larimore and Timothy A. + Davis (DrTimothyAldenDavis@gmail.com). The algorithm was + developed in collaboration with John Gilbert, Xerox PARC, and Esmond + Ng, Oak Ridge National Laboratory. Acknowledgements: - This work was supported by the National Science Foundation, under - grants DMS-9504974 and DMS-9803599. - - Notice: - - Copyright (c) 1998-2007, Timothy A. Davis, All Rights Reserved. - See COLAMD/Doc/License.txt for the license. + This work was supported by the National Science Foundation, under + grants DMS-9504974 and DMS-9803599. Availability: - The colamd/symamd library is available at http://www.suitesparse.com - This file is required by the colamd.c, colamdmex.c, and symamdmex.c - files, and by any C code that calls the routines whose prototypes are - listed below, or that uses the colamd/symamd definitions listed below. + The colamd/symamd library is available at http://www.suitesparse.com + This file is required by the colamd.c, colamdmex.c, and symamdmex.c + files, and by any C code that calls the routines whose prototypes are + listed below, or that uses the colamd/symamd definitions listed below. */ @@ -45,7 +46,7 @@ extern "C" { /* === Include files ======================================================== */ /* ========================================================================== */ -#include +#include "SuiteSparse_config.h" /* ========================================================================== */ /* === COLAMD version ======================================================= */ @@ -55,7 +56,7 @@ extern "C" { * As an example, to test if the version you are using is 2.4 or later: * * #ifdef COLAMD_VERSION - * if (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4)) ... + * if (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4)) ... * #endif * * This also works during compile-time: @@ -69,13 +70,14 @@ extern "C" { * Versions 2.3 and earlier of COLAMD do not include a #define'd version number. */ -#define COLAMD_DATE "May 4, 2016" +#define COLAMD_DATE "Jan 17, 2023" +#define COLAMD_MAIN_VERSION 3 +#define COLAMD_SUB_VERSION 0 +#define COLAMD_SUBSUB_VERSION 3 + #define COLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) -#define COLAMD_MAIN_VERSION 2 -#define COLAMD_SUB_VERSION 9 -#define COLAMD_SUBSUB_VERSION 6 #define COLAMD_VERSION \ - COLAMD_VERSION_CODE(COLAMD_MAIN_VERSION,COLAMD_SUB_VERSION) + COLAMD_VERSION_CODE(COLAMD_MAIN_VERSION,COLAMD_SUB_VERSION) /* ========================================================================== */ /* === Knob and statistics definitions ====================================== */ @@ -108,126 +110,123 @@ extern "C" { #define COLAMD_INFO3 6 /* error codes returned in stats [3]: */ -#define COLAMD_OK (0) -#define COLAMD_OK_BUT_JUMBLED (1) -#define COLAMD_ERROR_A_not_present (-1) -#define COLAMD_ERROR_p_not_present (-2) -#define COLAMD_ERROR_nrow_negative (-3) -#define COLAMD_ERROR_ncol_negative (-4) -#define COLAMD_ERROR_nnz_negative (-5) -#define COLAMD_ERROR_p0_nonzero (-6) -#define COLAMD_ERROR_A_too_small (-7) -#define COLAMD_ERROR_col_length_negative (-8) -#define COLAMD_ERROR_row_index_out_of_bounds (-9) -#define COLAMD_ERROR_out_of_memory (-10) -#define COLAMD_ERROR_internal_error (-999) +#define COLAMD_OK (0) +#define COLAMD_OK_BUT_JUMBLED (1) +#define COLAMD_ERROR_A_not_present (-1) +#define COLAMD_ERROR_p_not_present (-2) +#define COLAMD_ERROR_nrow_negative (-3) +#define COLAMD_ERROR_ncol_negative (-4) +#define COLAMD_ERROR_nnz_negative (-5) +#define COLAMD_ERROR_p0_nonzero (-6) +#define COLAMD_ERROR_A_too_small (-7) +#define COLAMD_ERROR_col_length_negative (-8) +#define COLAMD_ERROR_row_index_out_of_bounds (-9) +#define COLAMD_ERROR_out_of_memory (-10) +#define COLAMD_ERROR_internal_error (-999) /* ========================================================================== */ /* === Prototypes of user-callable routines ================================= */ /* ========================================================================== */ -#include "SuiteSparse_config.h" - -size_t colamd_recommended /* returns recommended value of Alen, */ - /* or 0 if input arguments are erroneous */ +size_t colamd_recommended /* returns recommended value of Alen, */ + /* or 0 if input arguments are erroneous */ ( - int nnz, /* nonzeros in A */ - int n_row, /* number of rows in A */ - int n_col /* number of columns in A */ + int32_t nnz, /* nonzeros in A */ + int32_t n_row, /* number of rows in A */ + int32_t n_col /* number of columns in A */ ) ; -size_t colamd_l_recommended /* returns recommended value of Alen, */ - /* or 0 if input arguments are erroneous */ +size_t colamd_l_recommended /* returns recommended value of Alen, */ + /* or 0 if input arguments are erroneous */ ( - SuiteSparse_long nnz, /* nonzeros in A */ - SuiteSparse_long n_row, /* number of rows in A */ - SuiteSparse_long n_col /* number of columns in A */ + int64_t nnz, /* nonzeros in A */ + int64_t n_row, /* number of rows in A */ + int64_t n_col /* number of columns in A */ ) ; -void colamd_set_defaults /* sets default parameters */ -( /* knobs argument is modified on output */ - double knobs [COLAMD_KNOBS] /* parameter settings for colamd */ +void colamd_set_defaults /* sets default parameters */ +( /* knobs argument is modified on output */ + double knobs [COLAMD_KNOBS] /* parameter settings for colamd */ ) ; -void colamd_l_set_defaults /* sets default parameters */ -( /* knobs argument is modified on output */ - double knobs [COLAMD_KNOBS] /* parameter settings for colamd */ +void colamd_l_set_defaults /* sets default parameters */ +( /* knobs argument is modified on output */ + double knobs [COLAMD_KNOBS] /* parameter settings for colamd */ ) ; -int colamd /* returns (1) if successful, (0) otherwise*/ -( /* A and p arguments are modified on output */ - int n_row, /* number of rows in A */ - int n_col, /* number of columns in A */ - int Alen, /* size of the array A */ - int A [], /* row indices of A, of size Alen */ - int p [], /* column pointers of A, of size n_col+1 */ - double knobs [COLAMD_KNOBS],/* parameter settings for colamd */ - int stats [COLAMD_STATS] /* colamd output statistics and error codes */ +int colamd /* returns (1) if successful, (0) otherwise*/ +( /* A and p arguments are modified on output */ + int32_t n_row, /* number of rows in A */ + int32_t n_col, /* number of columns in A */ + int32_t Alen, /* size of the array A */ + int32_t A [], /* row indices of A, of size Alen */ + int32_t p [], /* column pointers of A, of size n_col+1 */ + double knobs [COLAMD_KNOBS], /* parameter settings for colamd */ + int32_t stats [COLAMD_STATS] /* colamd output stats and error codes */ ) ; -SuiteSparse_long colamd_l /* returns (1) if successful, (0) otherwise*/ -( /* A and p arguments are modified on output */ - SuiteSparse_long n_row, /* number of rows in A */ - SuiteSparse_long n_col, /* number of columns in A */ - SuiteSparse_long Alen, /* size of the array A */ - SuiteSparse_long A [], /* row indices of A, of size Alen */ - SuiteSparse_long p [], /* column pointers of A, of size n_col+1 */ - double knobs [COLAMD_KNOBS],/* parameter settings for colamd */ - SuiteSparse_long stats [COLAMD_STATS] /* colamd output statistics - * and error codes */ +int colamd_l /* returns (1) if successful, (0) otherwise*/ +( /* A and p arguments are modified on output */ + int64_t n_row, /* number of rows in A */ + int64_t n_col, /* number of columns in A */ + int64_t Alen, /* size of the array A */ + int64_t A [], /* row indices of A, of size Alen */ + int64_t p [], /* column pointers of A, of size n_col+1 */ + double knobs [COLAMD_KNOBS], /* parameter settings for colamd */ + int64_t stats [COLAMD_STATS] /* colamd output stats and error codes */ ) ; -int symamd /* return (1) if OK, (0) otherwise */ +int symamd /* return (1) if OK, (0) otherwise */ ( - int n, /* number of rows and columns of A */ - int A [], /* row indices of A */ - int p [], /* column pointers of A */ - int perm [], /* output permutation, size n_col+1 */ - double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */ - int stats [COLAMD_STATS], /* output statistics and error codes */ + int32_t n, /* number of rows and columns of A */ + int32_t A [], /* row indices of A */ + int32_t p [], /* column pointers of A */ + int32_t perm [], /* output permutation, size n_col+1 */ + double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */ + int32_t stats [COLAMD_STATS], /* output stats and error codes */ void * (*allocate) (size_t, size_t), - /* pointer to calloc (ANSI C) or */ - /* mxCalloc (for MATLAB mexFunction) */ + /* pointer to calloc (ANSI C) or */ + /* mxCalloc (for MATLAB mexFunction) */ void (*release) (void *) - /* pointer to free (ANSI C) or */ - /* mxFree (for MATLAB mexFunction) */ + /* pointer to free (ANSI C) or */ + /* mxFree (for MATLAB mexFunction) */ ) ; -SuiteSparse_long symamd_l /* return (1) if OK, (0) otherwise */ +int symamd_l /* return (1) if OK, (0) otherwise */ ( - SuiteSparse_long n, /* number of rows and columns of A */ - SuiteSparse_long A [], /* row indices of A */ - SuiteSparse_long p [], /* column pointers of A */ - SuiteSparse_long perm [], /* output permutation, size n_col+1 */ - double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */ - SuiteSparse_long stats [COLAMD_STATS], /* output stats and error codes */ + int64_t n, /* number of rows and columns of A */ + int64_t A [], /* row indices of A */ + int64_t p [], /* column pointers of A */ + int64_t perm [], /* output permutation, size n_col+1 */ + double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */ + int64_t stats [COLAMD_STATS], /* output stats and error codes */ void * (*allocate) (size_t, size_t), - /* pointer to calloc (ANSI C) or */ - /* mxCalloc (for MATLAB mexFunction) */ + /* pointer to calloc (ANSI C) or */ + /* mxCalloc (for MATLAB mexFunction) */ void (*release) (void *) - /* pointer to free (ANSI C) or */ - /* mxFree (for MATLAB mexFunction) */ + /* pointer to free (ANSI C) or */ + /* mxFree (for MATLAB mexFunction) */ ) ; void colamd_report ( - int stats [COLAMD_STATS] + int32_t stats [COLAMD_STATS] ) ; void colamd_l_report ( - SuiteSparse_long stats [COLAMD_STATS] + int64_t stats [COLAMD_STATS] ) ; void symamd_report ( - int stats [COLAMD_STATS] + int32_t stats [COLAMD_STATS] ) ; void symamd_l_report ( - SuiteSparse_long stats [COLAMD_STATS] + int64_t stats [COLAMD_STATS] ) ; #ifdef __cplusplus diff --git a/ThirdParty/SuiteSparse/COLAMD/Lib/Makefile b/ThirdParty/SuiteSparse/COLAMD/Lib/Makefile deleted file mode 100644 index 2d0c5aa6a7..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/Lib/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -#------------------------------------------------------------------------------- -# COLAMD Lib/Makefile -#------------------------------------------------------------------------------- - -LIBRARY = libcolamd -VERSION = 2.9.6 -SO_VERSION = 2 - -default: library - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -# COLAMD depends on SuiteSparse_config -LDLIBS += -lsuitesparseconfig - -# compile and install in SuiteSparse/lib -library: - $(MAKE) install INSTALL=$(SUITESPARSE) - -I = -I../Include -I../../SuiteSparse_config - -INC = ../Include/colamd.h ../../SuiteSparse_config/SuiteSparse_config.h - -SRC = ../Source/colamd.c - -OBJ = colamd.o colamd_l.o - -colamd.o: $(SRC) $(INC) - $(CC) $(CF) $(I) -c ../Source/colamd.c - -colamd_l.o: $(SRC) $(INC) - $(CC) $(CF) $(I) -c ../Source/colamd.c -DDLONG -o colamd_l.o - -# creates libcolamd.a, a C-callable COLAMD library -static: $(AR_TARGET) - -$(AR_TARGET): $(OBJ) - $(ARCHIVE) $@ $^ - - $(RANLIB) $@ - -ccode: library - -clean: - - $(RM) -r $(CLEAN) - -purge: distclean - -distclean: clean - - $(RM) -r $(PURGE) - -# install COLAMD -install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET) - -$(INSTALL_LIB)/$(SO_TARGET): $(OBJ) - @mkdir -p $(INSTALL_LIB) - @mkdir -p $(INSTALL_INCLUDE) - @mkdir -p $(INSTALL_DOC) - $(CC) $(SO_OPTS) $^ -o $@ $(LDLIBS) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) ) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) ) - $(CP) ../Include/colamd.h $(INSTALL_INCLUDE) - $(CP) ../README.txt $(INSTALL_DOC)/COLAMD_README.txt - chmod 755 $(INSTALL_LIB)/$(SO_TARGET) - chmod 644 $(INSTALL_INCLUDE)/colamd.h - chmod 644 $(INSTALL_DOC)/COLAMD_README.txt - -uninstall: - $(RM) $(INSTALL_LIB)/$(SO_TARGET) - $(RM) $(INSTALL_LIB)/$(SO_PLAIN) - $(RM) $(INSTALL_LIB)/$(SO_MAIN) - $(RM) $(INSTALL_INCLUDE)/colamd.h - $(RM) $(INSTALL_DOC)/COLAMD_README.txt - diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/Contents.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/Contents.m deleted file mode 100644 index 960fd14727..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/Contents.m +++ /dev/null @@ -1,19 +0,0 @@ -% COLAMD, column approximate minimum degree ordering -% -% Primary: -% colamd2 - Column approximate minimum degree permutation. -% symamd2 - SYMAMD Symmetric approximate minimum degree permutation. -% -% helper and test functions: -% colamd_demo - demo for colamd, column approx minimum degree ordering algorithm -% colamd_make - compiles COLAMD2 and SYMAMD2 for MATLAB -% colamd_make - compiles and installs COLAMD2 and SYMAMD2 for MATLAB -% colamd_test - test colamd2 and symamd2 -% luflops - compute the flop count for sparse LU factorization -% -% Example: -% p = colamd2 (A) -% - -% Copyright 1998-2007, Timothy A. Davis, and Stefan Larimore -% Developed in collaboration with J. Gilbert and E. Ng. diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd2.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd2.m deleted file mode 100644 index 9916cc7f9b..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd2.m +++ /dev/null @@ -1,87 +0,0 @@ -function [p,stats] = colamd2 (S, knobs) -%COLAMD2 Column approximate minimum degree permutation. -% P = COLAMD2(S) returns the column approximate minimum degree permutation -% vector for the sparse matrix S. For a non-symmetric matrix S, S(:,P) -% tends to have sparser LU factors than S. The Cholesky factorization of -% S(:,P)'*S(:,P) also tends to be sparser than that of S'*S. The ordering -% is followed by a column elimination tree post-ordering. -% -% Note that this function is the source code for the built-in MATLAB colamd -% function. It has been renamed here to colamd2 to avoid a filename clash. -% colamd and colamd2 are identical. -% -% See also COLAMD, AMD, SYMAMD, SYMAMD2. -% -% Example: -% P = colamd2 (S) -% [P, stats] = colamd2 (S, knobs) -% -% knobs is an optional one- to three-element input vector. If S is m-by-n, -% then rows with more than max(16,knobs(1)*sqrt(n)) entries are ignored. -% Columns with more than max(16,knobs(2)*sqrt(min(m,n))) entries are -% removed prior to ordering, and ordered last in the output permutation P. -% Only completely dense rows or columns are removed if knobs(1) and knobs(2) -% are < 0, respectively. If knobs(3) is nonzero, stats and knobs are -% printed. The default is knobs = [10 10 0]. Note that knobs differs from -% earlier versions of colamd. - -% Copyright 1998-2007, Timothy A. Davis, and Stefan Larimore -% Developed in collaboration with J. Gilbert and E. Ng. -% -% Acknowledgements: This work was supported by the National Science -% Foundation, under grants DMS-9504974 and DMS-9803599. - -%------------------------------------------------------------------------------- -% Perform the colamd ordering: -%------------------------------------------------------------------------------- - -if (nargout <= 1 & nargin == 1) %#ok - p = colamd2mex (S) ; -elseif (nargout <= 1 & nargin == 2) %#ok - p = colamd2mex (S, knobs) ; -elseif (nargout == 2 & nargin == 1) %#ok - [p, stats] = colamd2mex (S) ; -elseif (nargout == 2 & nargin == 2) %#ok - [p, stats] = colamd2mex (S, knobs) ; -else - error ('colamd: incorrect number of input and/or output arguments') ; -end - -%------------------------------------------------------------------------------- -% column elimination tree post-ordering: -%------------------------------------------------------------------------------- - -[ignore, q] = etree (S (:,p), 'col') ; -p = p (q) ; - -% stats is an optional 20-element output vector that provides data about the -% ordering and the validity of the input matrix S. Ordering statistics are -% in stats (1:3). stats (1) and stats (2) are the number of dense or empty -% rows and columns ignored by COLAMD and stats (3) is the number of -% garbage collections performed on the internal data structure used by -% COLAMD (roughly of size 2.2*nnz(S) + 4*m + 7*n integers). -% -% MATLAB built-in functions are intended to generate valid sparse matrices, -% with no duplicate entries, with ascending row indices of the nonzeros -% in each column, with a non-negative number of entries in each column (!) -% and so on. If a matrix is invalid, then COLAMD may or may not be able -% to continue. If there are duplicate entries (a row index appears two or -% more times in the same column) or if the row indices in a column are out -% of order, then COLAMD can correct these errors by ignoring the duplicate -% entries and sorting each column of its internal copy of the matrix S (the -% input matrix S is not repaired, however). If a matrix is invalid in other -% ways then COLAMD cannot continue, an error message is printed, and no -% output arguments (P or stats) are returned. COLAMD is thus a simple way -% to check a sparse matrix to see if it's valid. -% -% stats (4:7) provide information if COLAMD was able to continue. The -% matrix is OK if stats (4) is zero, or 1 if invalid. stats (5) is the -% rightmost column index that is unsorted or contains duplicate entries, -% or zero if no such column exists. stats (6) is the last seen duplicate -% or out-of-order row index in the column index given by stats (5), or zero -% if no such row index exists. stats (7) is the number of duplicate or -% out-of-order row indices. -% -% stats (8:20) is always zero in the current version of COLAMD (reserved -% for future use). - diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_demo.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_demo.m deleted file mode 100644 index 47176f4ad8..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_demo.m +++ /dev/null @@ -1,178 +0,0 @@ -%COLAMD_DEMO demo for colamd, column approx minimum degree ordering algorithm -% -% Example: -% colamd_demo -% -% The following m-files and mexFunctions provide alternative sparse matrix -% ordering methods for MATLAB. They are typically faster (sometimes much -% faster) and typically provide better orderings than their MATLAB counterparts: -% -% colamd a replacement for colmmd. -% -% Typical usage: p = colamd (A) ; -% -% symamd a replacement for symmmd. Based on colamd. -% -% Typical usage: p = symamd (A) ; -% -% For a description of the methods used, see the colamd.c file. -% http://www.suitesparse.com -% -% See also colamd, symamd - -% Minor changes: in MATLAB 7, symmmd and colmmd are flagged as "obsolete". -% This demo checks if they exist, so it should still work when they are removed. - -% Copyright 1998-2007, Timothy A. Davis, and Stefan Larimore -% Developed in collaboration with J. Gilbert and E. Ng. - -%------------------------------------------------------------------------------- -% Print the introduction, the help info, and compile the mexFunctions -%------------------------------------------------------------------------------- - -fprintf (1, '\n-----------------------------------------------------------\n') ; -fprintf (1, 'Colamd2/symamd2 demo.') ; -fprintf (1, '\n-----------------------------------------------------------\n') ; -help colamd_demo ; - -fprintf (1, '\n-----------------------------------------------------------\n') ; -fprintf (1, 'Colamd help information:') ; -fprintf (1, '\n-----------------------------------------------------------\n') ; -help colamd2 ; - -fprintf (1, '\n-----------------------------------------------------------\n') ; -fprintf (1, 'Symamd help information:') ; -fprintf (1, '\n-----------------------------------------------------------\n') ; -help symamd2 ; - -%------------------------------------------------------------------------------- -% Solving Ax=b -%------------------------------------------------------------------------------- - -n = 100 ; -fprintf (1, '\n-----------------------------------------------------------\n') ; -fprintf (1, 'Solving Ax=b for a small %d-by-%d random matrix:', n, n) ; -fprintf (1, '\n-----------------------------------------------------------\n') ; -fprintf (1, '\nNote: Random sparse matrices are AWFUL test cases.\n') ; -fprintf (1, 'They''re just easy to generate in a demo.\n') ; - -% set up the system - -rand ('state', 0) ; -randn ('state', 0) ; -spparms ('default') ; -A = sprandn (n, n, 5/n) + speye (n) ; -b = (1:n)' ; - -fprintf (1, '\n\nSolving via lu (PAQ = LU), where Q is from colamd2:\n') ; -q = colamd2 (A) ; -I = speye (n) ; -Q = I (:, q) ; -[L,U,P] = lu (A*Q) ; -fl = luflops (L, U) ; -x = Q * (U \ (L \ (P * b))) ; -fprintf (1, '\nFlop count for [L,U,P] = lu (A*Q): %d\n', fl) ; -fprintf (1, 'residual: %e\n', norm (A*x-b)); - -try - fprintf (1, '\n\nSolving via lu (PAQ = LU), where Q is from colmmd:\n') ; - q = colmmd (A) ; - I = speye (n) ; - Q = I (:, q) ; - [L,U,P] = lu (A*Q) ; - fl = luflops (L, U) ; - x = Q * (U \ (L \ (P * b))) ; - fprintf (1, '\nFlop count for [L,U,P] = lu (A*Q): %d\n', fl) ; - fprintf (1, 'residual: %e\n', ... - norm (A*x-b)) ; -catch - fprintf (1, 'colmmd is obsolete; test skipped\n') ; -end - -fprintf (1, '\n\nSolving via lu (PA = LU), without regard for sparsity:\n') ; -[L,U,P] = lu (A) ; -fl = luflops (L, U) ; -x = U \ (L \ (P * b)) ; -fprintf (1, '\nFlop count for [L,U,P] = lu (A*Q): %d\n', fl) ; -fprintf (1, 'residual: %e\n', norm (A*x-b)); - -%------------------------------------------------------------------------------- -% Large demo for colamd2 -%------------------------------------------------------------------------------- - -fprintf (1, '\n-----------------------------------------------------------\n') ; -fprintf (1, 'Large demo for colamd2 (symbolic analysis only):') ; -fprintf (1, '\n-----------------------------------------------------------\n') ; - -rand ('state', 0) ; -randn ('state', 0) ; -spparms ('default') ; -n = 1000 ; -fprintf (1, 'Generating a random %d-by-%d sparse matrix.\n', n, n) ; -A = sprandn (n, n, 5/n) + speye (n) ; - -fprintf (1, '\n\nUnordered matrix:\n') ; -lnz = symbfact (A, 'col') ; -fprintf (1, 'nz in Cholesky factors of A''A: %d\n', sum (lnz)) ; -fprintf (1, 'flop count for Cholesky of A''A: %d\n', sum (lnz.^2)) ; - -tic ; -p = colamd2 (A) ; -t = toc ; -lnz = symbfact (A (:,p), 'col') ; -fprintf (1, '\n\nColamd run time: %f\n', t) ; -fprintf (1, 'colamd2 ordering quality: \n') ; -fprintf (1, 'nz in Cholesky factors of A(:,p)''A(:,p): %d\n', sum (lnz)) ; -fprintf (1, 'flop count for Cholesky of A(:,p)''A(:,p): %d\n', sum (lnz.^2)) ; - -try - tic ; - p = colmmd (A) ; - t = toc ; - lnz = symbfact (A (:,p), 'col') ; - fprintf (1, '\n\nColmmd run time: %f\n', t) ; - fprintf (1, 'colmmd ordering quality: \n') ; - fprintf (1, 'nz in Cholesky factors of A(:,p)''A(:,p): %d\n', sum (lnz)) ; - fprintf (1, 'flop count for Cholesky of A(:,p)''A(:,p): %d\n', ... - sum (lnz.^2)) ; -catch - fprintf (1, 'colmmd is obsolete; test skipped\n') ; -end - -%------------------------------------------------------------------------------- -% Large demo for symamd2 -%------------------------------------------------------------------------------- - -fprintf (1, '\n-----------------------------------------------------------\n') ; -fprintf (1, 'Large demo for symamd2 (symbolic analysis only):') ; -fprintf (1, '\n-----------------------------------------------------------\n') ; - -fprintf (1, 'Generating a random symmetric %d-by-%d sparse matrix.\n', n, n) ; -A = A+A' ; - -fprintf (1, '\n\nUnordered matrix:\n') ; -lnz = symbfact (A, 'sym') ; -fprintf (1, 'nz in Cholesky factors of A: %d\n', sum (lnz)) ; -fprintf (1, 'flop count for Cholesky of A: %d\n', sum (lnz.^2)) ; - -tic ; -p = symamd2 (A) ; -t = toc ; -lnz = symbfact (A (p,p), 'sym') ; -fprintf (1, '\n\nSymamd run time: %f\n', t) ; -fprintf (1, 'symamd2 ordering quality: \n') ; -fprintf (1, 'nz in Cholesky factors of A(p,p): %d\n', sum (lnz)) ; -fprintf (1, 'flop count for Cholesky of A(p,p): %d\n', sum (lnz.^2)) ; - -try - tic ; - p = symmmd (A) ; - t = toc ; - lnz = symbfact (A (p,p), 'sym') ; - fprintf (1, '\n\nSymmmd run time: %f\n', t) ; - fprintf (1, 'symmmd ordering quality: \n') ; - fprintf (1, 'nz in Cholesky factors of A(p,p): %d\n', sum (lnz)) ; - fprintf (1, 'flop count for Cholesky of A(p,p): %d\n', sum (lnz.^2)) ; -catch - fprintf (1, 'symmmd is obsolete\n') ; -end diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_install.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_install.m deleted file mode 100644 index 7ac0110b95..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_install.m +++ /dev/null @@ -1,18 +0,0 @@ -function colamd_install -%COLAMD_MAKE to compile and install the colamd2 and symamd2 mexFunction. -% Your current directory must be COLAMD/MATLAB for this function to work. -% -% Example: -% colamd_install -% -% See also colamd2, symamd2. - -% Copyright 1998-2007, Timothy A. Davis, and Stefan Larimore -% Developed in collaboration with J. Gilbert and E. Ng. - -colamd_make -addpath (pwd) -fprintf ('\nThe following path has been added. You may wish to add it\n') ; -fprintf ('permanently, using the MATLAB pathtool command.\n') ; -fprintf ('%s\n\n', pwd) ; -colamd_demo diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_make.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_make.m deleted file mode 100644 index 1491cf191f..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_make.m +++ /dev/null @@ -1,48 +0,0 @@ -function colamd_make -%COLAMD_MAKE compiles COLAMD2 and SYMAMD2 for MATLAB -% -% Example: -% colamd_make -% -% See also colamd, symamd - -% Copyright 1998-2007, Timothy A. Davis, and Stefan Larimore -% Developed in collaboration with J. Gilbert and E. Ng. - -details = 0 ; % 1 if details of each command are to be printed -d = '' ; -if (~isempty (strfind (computer, '64'))) - d = '-largeArrayDims' ; -end - -% MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much -if (~verLessThan ('matlab', '8.3.0')) - d = ['-silent ' d] ; -end - -src = '../Source/colamd.c ../../SuiteSparse_config/SuiteSparse_config.c' ; -cmd = sprintf ( ... - 'mex -DDLONG -O %s -I../../SuiteSparse_config -I../Include -output ', d) ; -s = [cmd 'colamd2mex colamdmex.c ' src] ; - -if (~(ispc || ismac)) - % for POSIX timing routine - s = [s ' -lrt'] ; -end - -if (details) - fprintf ('%s\n', s) ; -end -eval (s) ; -s = [cmd 'symamd2mex symamdmex.c ' src] ; - -if (~(ispc || ismac)) - % for POSIX timing routine - s = [s ' -lrt'] ; -end - -if (details) - fprintf ('%s\n', s) ; -end -eval (s) ; -fprintf ('COLAMD2 and SYMAMD2 successfully compiled.\n') ; diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_test.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_test.m deleted file mode 100644 index 6c6dac51cb..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamd_test.m +++ /dev/null @@ -1,510 +0,0 @@ -function colamd_test -%COLAMD_TEST test colamd2 and symamd2 -% Example: -% colamd_test -% -% COLAMD and SYMAMD testing function. Here we try to give colamd2 and symamd2 -% every possible type of matrix and erroneous input that they may encounter. -% We want either a valid permutation returned or we want them to fail -% gracefully. -% -% You are prompted as to whether or not the colamd2 and symand routines and -% the test mexFunctions are to be compiled. -% -% See also colamd2, symamd2 - -% Copyright 1998-2007, Timothy A. Davis, and Stefan Larimore -% Developed in collaboration with J. Gilbert and E. Ng. - - -help colamd_test - - - fprintf ('Compiling colamd2, symamd2, and test mexFunctions.\n') ; - colamd_make ; - - d = '' ; - if (~isempty (strfind (computer, '64'))) - d = '-largeArrayDims' ; - end - cmd = sprintf (... - 'mex -DDLONG -O %s -I../../SuiteSparse_config -I../Include ', d) ; - src = '../Source/colamd.c ../../SuiteSparse_config/SuiteSparse_config.c' ; - if (~(ispc || ismac)) - % for POSIX timing routine - src = [src ' -lrt'] ; - end - eval ([cmd 'colamdtestmex.c ' src]) ; - eval ([cmd 'symamdtestmex.c ' src]) ; - fprintf ('Done compiling.\n') ; - - -fprintf ('\nThe following codes will be tested:\n') ; -which colamd2 -which symamd2 -which colamd2mex -which symamd2mex -which colamdtestmex -which symamdtestmex - -fprintf ('\nStarting the tests. Please be patient.\n') ; - -h = waitbar (0, 'COLAMD test') ; - -rand ('state', 0) ; -randn ('state', 0) ; - -A = sprandn (500,500,0.4) ; - -p = colamd2 (A, [10 10 1]) ; check_perm (p, A) ; -p = colamd2 (A, [2 7 1]) ; check_perm (p, A) ; -p = symamd2 (A, [10 1]) ; check_perm (p, A) ; -p = symamd2 (A, [7 1]) ; check_perm (p, A) ; -p = symamd2 (A, [4 1]) ; check_perm (p, A) ; - - -fprintf ('Null matrices') ; -A = zeros (0,0) ; -A = sparse (A) ; - -[p, stats] = colamd2 (A, [10 10 0]) ; %#ok -check_perm (p, A) ; - -[p, stats] = symamd2 (A, [10 0]) ; %#ok -check_perm (p, A) ; - -A = zeros (0, 100) ; -A = sparse (A) ; -[p, stats] = colamd2 (A, [10 10 0]) ; %#ok -check_perm (p, A) ; - -A = zeros (100, 0) ; -A = sparse (A) ; -[p, stats] = colamd2 (A, [10 10 0]) ; -check_perm (p, A) ; -fprintf (' OK\n') ; - - -fprintf ('Matrices with a few dense row/cols\n') ; - -for trial = 1:20 - - waitbar (trial/20, h, 'COLAMD: with dense rows/cols') ; - - % random square unsymmetric matrix - A = rand_matrix (1000, 1000, 1, 10, 20) ; - - for tol = [0:.1:2 3:20 1e6] - - [p, stats] = colamd2 (A, [tol tol 0]) ; %#ok - check_perm (p, A) ; - - B = A + A' ; - [p, stats] = symamd2 (B, [tol 0]) ; %#ok - check_perm (p, A) ; - - [p, stats] = colamd2 (A, [tol 1 0]) ; %#ok - check_perm (p, A) ; - - [p, stats] = colamd2 (A, [1 tol 0]) ; %#ok - check_perm (p, A) ; - end -end -fprintf (' OK\n') ; - -fprintf ('General matrices\n') ; -for trial = 1:400 - - waitbar (trial/400, h, 'COLAMD: general') ; - - % matrix of random mtype - mtype = irand (3) ; - A = rand_matrix (2000, 2000, mtype, 0, 0) ; - p = colamd2 (A) ; - check_perm (p, A) ; - if (mtype == 3) - p = symamd2 (A) ; - check_perm (p, A) ; - end - -end -fprintf (' OK\n') ; - -fprintf ('Test error handling with invalid inputs\n') ; - -% Check different erroneous input. -for trial = 1:30 - - waitbar (trial/30, h, 'COLAMD: error handling') ; - - A = rand_matrix (1000, 1000, 2, 0, 0) ; - [m n] = size (A) ; - - for err = 1:13 - - p = Tcolamd (A, [n n 0 0 err]) ; - if (p ~= -1) %#ok - check_perm (p, A) ; - end - - if (err == 1) - % check different (valid) input args to colamd2 - p = Acolamd (A) ; - - p2 = Acolamd (A, [10 10 0 0 0]) ; - if (any (p ~= p2)) - error ('colamd2: mismatch 1!') ; - end - [p2 stats] = Acolamd (A) ; %#ok - if (any (p ~= p2)) - error ('colamd2: mismatch 2!') ; - end - [p2 stats] = Acolamd (A, [10 10 0 0 0]) ; - if (any (p ~= p2)) - error ('colamd2: mismatch 3!') ; - end - end - - B = A'*A ; - p = Tsymamd (B, [n 0 err]) ; - if (p ~= -1) %#ok - check_perm (p, A) ; - end - - if (err == 1) - - % check different (valid) input args to symamd2 - p = Asymamd (B) ; - check_perm (p, A) ; - p2 = Asymamd (B, [10 0 0]) ; - if (any (p ~= p2)) - error ('symamd2: mismatch 1!') ; - end - [p2 stats] = Asymamd (B) ; %#ok - if (any (p ~= p2)) - error ('symamd2: mismatch 2!') ; - end - [p2 stats] = Asymamd (B, [10 0 0]) ; %#ok - if (any (p ~= p2)) - error ('symamd2: mismatch 3!') ; - end - end - - end - -end -fprintf (' OK\n') ; - -fprintf ('Matrices with a few empty columns\n') ; - -for trial = 1:400 - - % some are square, some are rectangular - n = 0 ; - while (n < 5) - A = rand_matrix (1000, 1000, irand (2), 0, 0) ; - [m n] = size (A) ; - end - - % Add 5 null columns at random locations. - null_col = randperm (n) ; - null_col = sort (null_col (1:5)) ; - A (:, null_col) = 0 ; - - % Order the matrix and make sure that the null columns are ordered last. - [p, stats] = colamd2 (A, [1e6 1e6 0]) ; - check_perm (p, A) ; - -% if (stats (2) ~= 5) -% stats (2) -% error ('colamd2: wrong number of null columns') ; -% end - - % find all null columns in A - null_col = find (sum (spones (A), 1) == 0) ; - nnull = length (null_col) ; %#ok - if (any (null_col ~= p ((n-4):n))) - error ('colamd2: Null cols are not ordered last in natural order') ; - end - - -end -fprintf (' OK\n') ; - -fprintf ('Matrices with a few empty rows and columns\n') ; - -for trial = 1:400 - - waitbar (trial/400, h, 'COLAMD: with empty rows/cols') ; - - % symmetric matrices - n = 0 ; - while (n < 5) - A = rand_matrix (1000, 1000, 3, 0, 0) ; - [m n] = size (A) ; - end - - % Add 5 null columns and rows at random locations. - null_col = randperm (n) ; - null_col = sort (null_col (1:5)) ; - A (:, null_col) = 0 ; - A (null_col, :) = 0 ; - - % Order the matrix and make sure that the null rows/cols are ordered last. - [p,stats] = symamd2 (A, [10 0]) ; - check_perm (p, A) ; - - % find actual number of null rows and columns - Alo = tril (A, -1) ; - nnull = length (find (sum (Alo') == 0 & sum (Alo) == 0)) ; %#ok - - if (stats (2) ~= nnull | nnull < 5) %#ok - error ('symamd2: wrong number of null columns') ; - end - if (any (null_col ~= p ((n-4):n))) - error ('symamd2: Null cols are not ordered last in natural order') ; - end - -end -fprintf (' OK\n') ; - -fprintf ('Matrices with a few empty rows\n') ; - -% Test matrices with null rows inserted. - -for trial = 1:400 - - waitbar (trial/400, h, 'COLAMD: with null rows') ; - - m = 0 ; - while (m < 5) - A = rand_matrix (1000, 1000, 2, 0, 0) ; - [m n] = size (A) ; %#ok - end - - % Add 5 null rows at random locations. - null_row = randperm (m) ; - null_row = sort (null_row (1:5)) ; - A (null_row, :) = 0 ; - - p = colamd2 (A, [10 10 0]) ; - check_perm (p, A) ; - if (stats (1) ~= 5) - error ('colamd2: wrong number of null rows') ; - end - -end -fprintf (' OK\n') ; - - -fprintf ('\ncolamd2 and symamd2: all tests passed\n\n') ; -close (h) ; - -%------------------------------------------------------------------------------- - -function [p,stats] = Acolamd (S, knobs) -% Acolamd: compare colamd2 and Tcolamd results - -if (nargin < 3) - if (nargout == 1) - [p] = colamd2 (S) ; - [p1] = Tcolamd (S, [10 10 0 0 0]) ; - else - [p, stats] = colamd2 (S) ; - [p1, stats1] = Tcolamd (S, [10 10 0 0 0]) ; %#ok - end -else - if (nargout == 1) - [p] = colamd2 (S, knobs (1:3)) ; - [p1] = Tcolamd (S, knobs) ; - else - [p, stats] = colamd2 (S, knobs (1:3)) ; - [p1, stats1] = Tcolamd (S, knobs) ; %#ok - end -end - -check_perm (p, S) ; -check_perm (p1, S) ; - -if (any (p1 ~= p)) - error ('Acolamd mismatch!') ; -end - - -%------------------------------------------------------------------------------- - -function [p,stats] = Asymamd (S, knobs) -% Asymamd: compare symamd2 and Tsymamd results - -if (nargin < 3) - if (nargout == 1) - [p] = symamd2 (S) ; - [p1] = Tsymamd (S, [10 0 0]) ; - else - [p, stats] = symamd2 (S) ; - [p1, stats1] = Tsymamd (S, [10 0 0]) ; %#ok - end -else - if (nargout == 1) - [p] = symamd2 (S, knobs (1:2)) ; - [p1] = Tsymamd (S, knobs) ; - else - [p, stats] = symamd2 (S, knobs (1:2)) ; - [p1, stats1] = Tsymamd (S, knobs) ; %#ok - end -end - -if (any (p1 ~= p)) - error ('Asymamd mismatch!') ; -end - - -%------------------------------------------------------------------------------- - -function check_perm (p, A) -% check_perm: check for a valid permutation vector - -if (isempty (A) & isempty (p)) %#ok - % empty permutation vectors of empty matrices are OK - return -end - -if (isempty (p)) - error ('bad permutation: cannot be empty') ; -end - -[m n] = size (A) ; -[pm pn] = size (p) ; -if (pn == 1) - % force p to be a row vector - p = p' ; - [pm pn] = size (p) ; -end - -if (n ~= pn) - error ('bad permutation: wrong size') ; -end - -if (pm ~= 1) ; - % p must be a vector - error ('bad permutation: not a vector') ; -else - if (any (sort (p) - (1:pn))) - error ('bad permutation') ; - end -end - -%------------------------------------------------------------------------------- - -function i = irand (n) -% irand: return a random integer between 1 and n -i = min (n, 1 + floor (rand * n)) ; - -%------------------------------------------------------------------------------- - -function A = rand_matrix (nmax, mmax, mtype, drows, dcols) -% rand_matrix: return a random sparse matrix -% -% A = rand_matrix (nmax, mmax, mtype, drows, dcols) -% -% A binary matrix of random size, at most nmax-by-mmax, with drows dense rows -% and dcols dense columns. -% -% mtype 1: square unsymmetric (mmax is ignored) -% mtype 2: rectangular -% mtype 3: symmetric (mmax is ignored) - -n = irand (nmax) ; -if (mtype ~= 2) - % square - m = n ; -else - m = irand (mmax) ; -end - -A = sprand (m, n, 10 / max (m,n)) ; - -if (drows > 0) - % add dense rows - for k = 1:drows - i = irand (m) ; - nz = irand (n) ; - p = randperm (n) ; - p = p (1:nz) ; - A (i,p) = 1 ; - end -end - -if (dcols > 0) - % add dense cols - for k = 1:dcols - j = irand (n) ; - nz = irand (m) ; - p = randperm (m) ; - p = p (1:nz) ; - A (p,j) = 1 ; - end -end - -A = spones (A) ; - -% ensure that there are no empty columns -d = find (full (sum (A)) == 0) ; %#ok -A (m,d) = 1 ; %#ok - -% ensure that there are no empty rows -d = find (full (sum (A,2)) == 0) ; %#ok -A (d,n) = 1 ; %#ok - -if (mtype == 3) - % symmetric - A = A + A' + speye (n) ; -end - -A = spones (A) ; - -%------------------------------------------------------------------------------- - -function [p,stats] = Tcolamd (S, knobs) -% Tcolamd: run colamd2 in a testing mode - -if (nargout <= 1 & nargin == 1) %#ok - p = colamdtestmex (S) ; -elseif (nargout <= 1 & nargin == 2) %#ok - p = colamdtestmex (S, knobs) ; -elseif (nargout == 2 & nargin == 1) %#ok - [p, stats] = colamdtestmex (S) ; -elseif (nargout == 2 & nargin == 2) %#ok - [p, stats] = colamdtestmex (S, knobs) ; -else - error ('colamd2: incorrect number of input and/or output arguments') ; -end - -if (p (1) ~= -1) - [ignore, q] = etree (S (:,p), 'col') ; - p = p (q) ; - check_perm (p, S) ; -end - -%------------------------------------------------------------------------------- - -function [p, stats] = Tsymamd (S, knobs) -% Tsymamd: run symamd2 in a testing mode - -if (nargout <= 1 & nargin == 1) %#ok - p = symamdtestmex (S) ; -elseif (nargout <= 1 & nargin == 2) %#ok - p = symamdtestmex (S, knobs) ; -elseif (nargout == 2 & nargin == 1) %#ok - [p, stats] = symamdtestmex (S) ; -elseif (nargout == 2 & nargin == 2) %#ok - [p, stats] = symamdtestmex (S, knobs) ; -else - error ('symamd2: incorrect number of input and/or output arguments') ; -end - -if (p (1) ~= -1) - [ignore, q] = etree (S (p,p)) ; - p = p (q) ; - check_perm (p, S) ; -end diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamdmex.c b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamdmex.c deleted file mode 100644 index f6be92f235..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamdmex.c +++ /dev/null @@ -1,210 +0,0 @@ -/* ========================================================================== */ -/* === colamd mexFunction =================================================== */ -/* ========================================================================== */ - -/* Usage: - - P = colamd2 (A) ; - [ P, stats ] = colamd2 (A, knobs) ; - - see colamd.m for a description. - - Authors: - - The authors of the code itself are Stefan I. Larimore and Timothy A. - Davis (DrTimothyAldenDavis@gmail.com). The algorithm was - developed in collaboration with John Gilbert, Xerox PARC, and Esmond - Ng, Oak Ridge National Laboratory. - - Acknowledgements: - - This work was supported by the National Science Foundation, under - grants DMS-9504974 and DMS-9803599. - - Notice: - - Copyright (c) 1998-2007, Timothy A. Davis, All Rights Reserved. - - Availability: - - The colamd/symamd library is available at http://www.suitesparse.com - -*/ - -/* ========================================================================== */ -/* === Include files ======================================================== */ -/* ========================================================================== */ - -#include "colamd.h" -#include "mex.h" -#include "matrix.h" -#include -#include -#define Long SuiteSparse_long - -/* ========================================================================== */ -/* === colamd mexFunction =================================================== */ -/* ========================================================================== */ - -void mexFunction -( - /* === Parameters ======================================================= */ - - int nlhs, /* number of left-hand sides */ - mxArray *plhs [], /* left-hand side matrices */ - int nrhs, /* number of right--hand sides */ - const mxArray *prhs [] /* right-hand side matrices */ -) -{ - /* === Local variables ================================================== */ - - Long *A ; /* colamd's copy of the matrix, and workspace */ - Long *p ; /* colamd's copy of the column pointers */ - Long Alen ; /* size of A */ - Long n_col ; /* number of columns of A */ - Long n_row ; /* number of rows of A */ - Long nnz ; /* number of entries in A */ - Long full ; /* TRUE if input matrix full, FALSE if sparse */ - double knobs [COLAMD_KNOBS] ; /* colamd user-controllable parameters */ - double *out_perm ; /* output permutation vector */ - double *out_stats ; /* output stats vector */ - double *in_knobs ; /* input knobs vector */ - Long i ; /* loop counter */ - mxArray *Ainput ; /* input matrix handle */ - Long spumoni ; /* verbosity variable */ - Long stats [COLAMD_STATS] ; /* stats for colamd */ - - /* === Check inputs ===================================================== */ - - if (nrhs < 1 || nrhs > 2 || nlhs < 0 || nlhs > 2) - { - mexErrMsgTxt ( - "colamd: incorrect number of input and/or output arguments") ; - } - - /* === Get knobs ======================================================== */ - - colamd_l_set_defaults (knobs) ; - spumoni = 0 ; - - /* check for user-passed knobs */ - if (nrhs == 2) - { - in_knobs = mxGetPr (prhs [1]) ; - i = mxGetNumberOfElements (prhs [1]) ; - if (i > 0) knobs [COLAMD_DENSE_ROW] = in_knobs [0] ; - if (i > 1) knobs [COLAMD_DENSE_COL] = in_knobs [1] ; - if (i > 2) spumoni = (Long) (in_knobs [2] != 0) ; - } - - /* print knob settings if spumoni is set */ - if (spumoni) - { - mexPrintf ("\ncolamd version %d.%d, %s:\n", - COLAMD_MAIN_VERSION, COLAMD_SUB_VERSION, COLAMD_DATE) ; - if (knobs [COLAMD_DENSE_ROW] >= 0) - { - mexPrintf ("knobs(1): %g, rows with > max(16,%g*sqrt(size(A,2)))" - " entries removed\n", in_knobs [0], knobs [COLAMD_DENSE_ROW]) ; - } - else - { - mexPrintf ("knobs(1): %g, only completely dense rows removed\n", - in_knobs [0]) ; - } - if (knobs [COLAMD_DENSE_COL] >= 0) - { - mexPrintf ("knobs(2): %g, cols with > max(16,%g*sqrt(min(size(A)))" - " entries removed\n", in_knobs [1], knobs [COLAMD_DENSE_COL]) ; - } - else - { - mexPrintf ("knobs(2): %g, only completely dense columns removed\n", - in_knobs [1]) ; - } - mexPrintf ("knobs(3): %g, statistics and knobs printed\n", - in_knobs [2]) ; - } - - /* === If A is full, convert to a sparse matrix ========================= */ - - Ainput = (mxArray *) prhs [0] ; - if (mxGetNumberOfDimensions (Ainput) != 2) - { - mexErrMsgTxt ("colamd: input matrix must be 2-dimensional") ; - } - full = !mxIsSparse (Ainput) ; - if (full) - { - mexCallMATLAB (1, &Ainput, 1, (mxArray **) prhs, "sparse") ; - } - - /* === Allocate workspace for colamd ==================================== */ - - /* get size of matrix */ - n_row = mxGetM (Ainput) ; - n_col = mxGetN (Ainput) ; - - /* get column pointer vector so we can find nnz */ - p = (Long *) mxCalloc (n_col+1, sizeof (Long)) ; - (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (Long)) ; - nnz = p [n_col] ; - Alen = (Long) colamd_l_recommended (nnz, n_row, n_col) ; - if (Alen == 0) - { - mexErrMsgTxt ("colamd: problem too large") ; - } - - /* === Copy input matrix into workspace ================================= */ - - A = (Long *) mxCalloc (Alen, sizeof (Long)) ; - (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (Long)) ; - - if (full) - { - mxDestroyArray (Ainput) ; - } - - /* === Order the columns (destroys A) =================================== */ - - if (!colamd_l (n_row, n_col, Alen, A, p, knobs, stats)) - { - colamd_l_report (stats) ; - mexErrMsgTxt ("colamd error!") ; - } - mxFree (A) ; - - /* === Return the permutation vector ==================================== */ - - plhs [0] = mxCreateDoubleMatrix (1, n_col, mxREAL) ; - out_perm = mxGetPr (plhs [0]) ; - for (i = 0 ; i < n_col ; i++) - { - /* colamd is 0-based, but MATLAB expects this to be 1-based */ - out_perm [i] = p [i] + 1 ; - } - mxFree (p) ; - - /* === Return the stats vector ========================================== */ - - /* print stats if spumoni is set */ - if (spumoni) - { - colamd_l_report (stats) ; - } - - if (nlhs == 2) - { - plhs [1] = mxCreateDoubleMatrix (1, COLAMD_STATS, mxREAL) ; - out_stats = mxGetPr (plhs [1]) ; - for (i = 0 ; i < COLAMD_STATS ; i++) - { - out_stats [i] = stats [i] ; - } - - /* fix stats (5) and (6), for 1-based information on jumbled matrix. */ - /* note that this correction doesn't occur if symamd returns FALSE */ - out_stats [COLAMD_INFO1] ++ ; - out_stats [COLAMD_INFO2] ++ ; - } -} diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamdtestmex.c b/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamdtestmex.c deleted file mode 100644 index 64ef2cb9b7..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/colamdtestmex.c +++ /dev/null @@ -1,567 +0,0 @@ -/* ========================================================================== */ -/* === colamdtest mexFunction =============================================== */ -/* ========================================================================== */ - -/* COLAMD test function - - This MATLAB mexFunction is for testing only. It is not meant for - production use. See colamdmex.c instead. - - Usage: - - [ P, stats ] = colamdtest (A, knobs) ; - - See colamd.m for a description. knobs is required. - - knobs (1) dense row control - knobs (2) dense column control - knobs (3) spumoni - knobs (4) for testing only. Controls the workspace used by - colamd. - - knobs (5) for testing only. Controls how the input matrix is - jumbled prior to calling colamd, to test its error - handling capability. - - Authors: - - The authors of the code itself are Stefan I. Larimore and Timothy A. - Davis (DrTimothyAldenDavis@gmail.com). The algorithm was - developed in collaboration with John Gilbert, Xerox PARC, and Esmond - Ng, Oak Ridge National Laboratory. - - Acknowledgements: - - This work was supported by the National Science Foundation, under - grants DMS-9504974 and DMS-9803599. - - Notice: - - Copyright (c) 1998-2007, Timothy A. Davis, All Rights Reserved. - See COLAMD/Doc/License.txt for the License. - - Availability: - - The colamd/symamd library is available at http://www.suitesparse.com - -*/ - -/* ========================================================================== */ -/* === Include files ======================================================== */ -/* ========================================================================== */ - -#include "colamd.h" -#include "mex.h" -#include "matrix.h" -#include -#include -#define Long SuiteSparse_long - -static void dump_matrix -( - Long A [ ], - Long p [ ], - Long n_row, - Long n_col, - Long Alen, - Long limit -) ; - -/* ========================================================================== */ -/* === colamd mexFunction =================================================== */ -/* ========================================================================== */ - -void mexFunction -( - /* === Parameters ======================================================= */ - - int nlhs, /* number of left-hand sides */ - mxArray *plhs [], /* left-hand side matrices */ - int nrhs, /* number of right--hand sides */ - const mxArray *prhs [] /* right-hand side matrices */ -) -{ - /* === Local variables ================================================== */ - - Long *A ; /* colamd's copy of the matrix, and workspace */ - Long *p ; /* colamd's copy of the column pointers */ - Long Alen ; /* size of A */ - Long n_col ; /* number of columns of A */ - Long n_row ; /* number of rows of A */ - Long nnz ; /* number of entries in A */ - Long full ; /* TRUE if input matrix full, FALSE if sparse */ - double knobs [COLAMD_KNOBS] ; /* colamd user-controllable parameters */ - double *out_perm ; /* output permutation vector */ - double *out_stats ; /* output stats vector */ - double *in_knobs ; /* input knobs vector */ - Long i ; /* loop counter */ - mxArray *Ainput ; /* input matrix handle */ - Long spumoni ; /* verbosity variable */ - Long stats2 [COLAMD_STATS] ;/* stats for colamd */ - - Long *cp, *cp_end, result, col, length ; - Long *stats ; - stats = stats2 ; - - /* === Check inputs ===================================================== */ - - if (nrhs < 1 || nrhs > 2 || nlhs < 0 || nlhs > 2) - { - mexErrMsgTxt ( - "colamd: incorrect number of input and/or output arguments") ; - } - - if (nrhs != 2) - { - mexErrMsgTxt ("colamdtest: knobs are required") ; - } - /* for testing we require all 5 knobs */ - if (mxGetNumberOfElements (prhs [1]) != 5) - { - mexErrMsgTxt ("colamd: must have all 5 knobs for testing") ; - } - - /* === Get knobs ======================================================== */ - - colamd_l_set_defaults (knobs) ; - spumoni = 0 ; - - /* check for user-passed knobs */ - if (nrhs == 2) - { - in_knobs = mxGetPr (prhs [1]) ; - i = mxGetNumberOfElements (prhs [1]) ; - if (i > 0) knobs [COLAMD_DENSE_ROW] = in_knobs [0] ; - if (i > 1) knobs [COLAMD_DENSE_COL] = in_knobs [1] ; - if (i > 2) spumoni = (Long) in_knobs [2] ; - } - - /* print knob settings if spumoni is set */ - if (spumoni) - { - mexPrintf ("\ncolamd version %d.%d, %s:\n", - COLAMD_MAIN_VERSION, COLAMD_SUB_VERSION, COLAMD_DATE) ; - if (knobs [COLAMD_DENSE_ROW] >= 0) - { - mexPrintf ("knobs(1): %g, rows with > max(16,%g*sqrt(size(A,2)))" - " entries removed\n", in_knobs [0], knobs [COLAMD_DENSE_ROW]) ; - } - else - { - mexPrintf ("knobs(1): %g, only completely dense rows removed\n", - in_knobs [0]) ; - } - if (knobs [COLAMD_DENSE_COL] >= 0) - { - mexPrintf ("knobs(2): %g, cols with > max(16,%g*sqrt(min(size(A)))" - " entries removed\n", in_knobs [1], knobs [COLAMD_DENSE_COL]) ; - } - else - { - mexPrintf ("knobs(2): %g, only completely dense columns removed\n", - in_knobs [1]) ; - } - mexPrintf ("knobs(3): %g, statistics and knobs printed\n", - in_knobs [2]) ; - } - - /* === If A is full, convert to a sparse matrix ========================= */ - - Ainput = (mxArray *) prhs [0] ; - if (mxGetNumberOfDimensions (Ainput) != 2) - { - mexErrMsgTxt ("colamd: input matrix must be 2-dimensional") ; - } - full = !mxIsSparse (Ainput) ; - if (full) - { - mexCallMATLAB (1, &Ainput, 1, (mxArray **) prhs, "sparse") ; - } - - /* === Allocate workspace for colamd ==================================== */ - - /* get size of matrix */ - n_row = mxGetM (Ainput) ; - n_col = mxGetN (Ainput) ; - - /* get column pointer vector so we can find nnz */ - p = (Long *) mxCalloc (n_col+1, sizeof (Long)) ; - (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (Long)) ; - nnz = p [n_col] ; - Alen = (Long) colamd_l_recommended (nnz, n_row, n_col) ; - if (Alen == 0) - { - mexErrMsgTxt ("colamd: problem too large") ; - } - - -/* === Modify size of Alen if testing ======================================= */ - -/* - knobs [3] amount of workspace given to colamd. - < 0 : TIGHT memory - > 0 : MIN + knob [3] - 1 - == 0 : RECOMMENDED memory -*/ - -/* Here only for testing */ -/* size of the Col and Row structures */ -#define COLAMD_C(n_col) (((n_col) + 1) * 24 / sizeof (Long)) -#define COLAMD_R(n_row) (((n_row) + 1) * 16 / sizeof (Long)) -#ifdef MIN -#undef MIN -#endif -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#define COLAMD_MIN_MEMORY(nnz,n_row,n_col) \ - (2 * (nnz) + COLAMD_C (n_col) + COLAMD_R (n_row)) - - /* get knob [3], if negative */ - if (in_knobs [3] < 0) - { - Alen = COLAMD_MIN_MEMORY (nnz, n_row, n_col) + n_col ; - } - else if (in_knobs [3] > 0) - { - Alen = COLAMD_MIN_MEMORY (nnz, n_row, n_col) + in_knobs [3] - 1 ; - } - - /* otherwise, we use the recommended amount set above */ - - /* === Copy input matrix into workspace ================================= */ - - A = (Long *) mxCalloc (Alen, sizeof (Long)) ; - (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (Long)) ; - - if (full) - { - mxDestroyArray (Ainput) ; - } - - -/* === Jumble matrix ======================================================== */ - -/* - knobs [4] FOR TESTING ONLY: Specifies how to jumble matrix - 0 : No jumbling - 1 : Make n_row less than zero - 2 : Make first pointer non-zero - 3 : Make column pointers not non-decreasing - 4 : Make a column pointer greater or equal to Alen - 5 : Make row indices not strictly increasing - 6 : Make a row index greater or equal to n_row - 7 : Set A = NULL - 8 : Set p = NULL - 9 : Repeat row index - 10: make row indices not sorted - 11: jumble columns massively (note this changes - the pattern of the matrix A.) - 12: Set stats = NULL - 13: Make n_col less than zero -*/ - - /* jumble appropriately */ - switch ((Long) in_knobs [4]) - { - - case 0 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: no errors expected\n") ; - } - result = 1 ; /* no errors */ - break ; - - case 1 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: nrow out of range\n") ; - } - result = 0 ; /* nrow out of range */ - n_row = -1 ; - break ; - - case 2 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: p [0] nonzero\n") ; - } - result = 0 ; /* p [0] must be zero */ - p [0] = 1 ; - break ; - - case 3 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: negative length last column\n") ; - } - result = (n_col == 0) ; /* p must be monotonically inc. */ - p [n_col] = p [0] ; - break ; - - case 4 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: Alen too small\n") ; - } - result = 0 ; /* out of memory */ - p [n_col] = Alen ; - break ; - - case 5 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: row index out of range (-1)\n") ; - } - if (nnz > 0) /* row index out of range */ - { - result = 0 ; - A [nnz-1] = -1 ; - } - else - { - if (spumoni > 0) - { - mexPrintf ("Note: no row indices to put out of range\n") ; - } - result = 1 ; - } - break ; - - case 6 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: row index out of range (n_row)\n") ; - } - if (nnz > 0) /* row index out of range */ - { - if (spumoni > 0) - { - mexPrintf ("Changing A[nnz-1] from %d to %d\n", - A [nnz-1], n_row) ; - } - result = 0 ; - A [nnz-1] = n_row ; - } - else - { - if (spumoni > 0) - { - mexPrintf ("Note: no row indices to put out of range\n") ; - } - result = 1 ; - } - break ; - - case 7 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: A not present\n") ; - } - result = 0 ; /* A not present */ - A = (Long *) NULL ; - break ; - - case 8 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: p not present\n") ; - } - result = 0 ; /* p not present */ - p = (Long *) NULL ; - break ; - - case 9 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: duplicate row index\n") ; - } - result = 1 ; /* duplicate row index */ - - for (col = 0 ; col < n_col ; col++) - { - length = p [col+1] - p [col] ; - if (length > 1) - { - A [p [col]] = A [p [col] + 1] ; - if (spumoni > 0) - { - mexPrintf ("Made duplicate row %d in col %d\n", - A [p [col] + 1], col) ; - } - break ; - } - } - - if (spumoni > 1) - { - dump_matrix (A, p, n_row, n_col, Alen, col+2) ; - } - break ; - - case 10 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: unsorted column\n") ; - } - result = 1 ; /* jumbled columns */ - - for (col = 0 ; col < n_col ; col++) - { - length = p [col+1] - p [col] ; - if (length > 1) - { - i = A[p [col]] ; - A [p [col]] = A[p [col] + 1] ; - A [p [col] + 1] = i ; - if (spumoni > 0) - { - mexPrintf ("Unsorted column %d \n", col) ; - } - break ; - } - } - - if (spumoni > 1) - { - dump_matrix (A, p, n_row, n_col, Alen, col+2) ; - } - break ; - - case 11 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: massive jumbling\n") ; - } - result = 1 ; /* massive jumbling, but no errors */ - srand (1) ; - for (i = 0 ; i < n_col ; i++) - { - cp = &A [p [i]] ; - cp_end = &A [p [i+1]] ; - while (cp < cp_end) - { - *cp++ = rand() % n_row ; - } - } - if (spumoni > 1) - { - dump_matrix (A, p, n_row, n_col, Alen, n_col) ; - } - break ; - - case 12 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: stats not present\n") ; - } - result = 0 ; /* stats not present */ - stats = (Long *) NULL ; - break ; - - case 13 : - if (spumoni > 0) - { - mexPrintf ("colamdtest: ncol out of range\n") ; - } - result = 0 ; /* ncol out of range */ - n_col = -1 ; - break ; - - } - - - /* === Order the columns (destroys A) =================================== */ - - if (!colamd_l (n_row, n_col, Alen, A, p, knobs, stats)) - { - - /* return p = -1 if colamd failed */ - plhs [0] = mxCreateDoubleMatrix (1, 1, mxREAL) ; - out_perm = mxGetPr (plhs [0]) ; - out_perm [0] = -1 ; - mxFree (p) ; - mxFree (A) ; - - if (spumoni > 0 || result) - { - colamd_l_report (stats) ; - } - - if (result) - { - mexErrMsgTxt ("colamd should have returned TRUE\n") ; - } - - return ; - /* mexErrMsgTxt ("colamd error!") ; */ - } - - if (!result) - { - colamd_l_report (stats) ; - mexErrMsgTxt ("colamd should have returned FALSE\n") ; - } - mxFree (A) ; - - /* === Return the permutation vector ==================================== */ - - plhs [0] = mxCreateDoubleMatrix (1, n_col, mxREAL) ; - out_perm = mxGetPr (plhs [0]) ; - for (i = 0 ; i < n_col ; i++) - { - /* colamd is 0-based, but MATLAB expects this to be 1-based */ - out_perm [i] = p [i] + 1 ; - } - mxFree (p) ; - - /* === Return the stats vector ========================================== */ - - /* print stats if spumoni > 0 */ - if (spumoni > 0) - { - colamd_l_report (stats) ; - } - - if (nlhs == 2) - { - plhs [1] = mxCreateDoubleMatrix (1, COLAMD_STATS, mxREAL) ; - out_stats = mxGetPr (plhs [1]) ; - for (i = 0 ; i < COLAMD_STATS ; i++) - { - out_stats [i] = stats [i] ; - } - - /* fix stats (5) and (6), for 1-based information on jumbled matrix. */ - /* note that this correction doesn't occur if symamd returns FALSE */ - out_stats [COLAMD_INFO1] ++ ; - out_stats [COLAMD_INFO2] ++ ; - } -} - - -static void dump_matrix -( - Long A [ ], - Long p [ ], - Long n_row, - Long n_col, - Long Alen, - Long limit -) -{ - Long col, k, row ; - - mexPrintf ("dump matrix: nrow %d ncol %d Alen %d\n", n_row, n_col, Alen) ; - - for (col = 0 ; col < MIN (n_col, limit) ; col++) - { - mexPrintf ("column %d, p[col] %d, p [col+1] %d, length %d\n", - col, p [col], p [col+1], p [col+1] - p [col]) ; - for (k = p [col] ; k < p [col+1] ; k++) - { - row = A [k] ; - mexPrintf (" %d", row) ; - } - mexPrintf ("\n") ; - } -} diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/luflops.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/luflops.m deleted file mode 100644 index f3c9e453bb..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/luflops.m +++ /dev/null @@ -1,34 +0,0 @@ -function fl = luflops (L, U) -%LUFLOPS compute the flop count for sparse LU factorization -% -% Example: -% fl = luflops (L,U) -% -% Given a sparse LU factorization (L and U), return the flop count required -% by a conventional LU factorization algorithm to compute it. L and U can -% be either sparse or full matrices. L must be lower triangular and U must -% be upper triangular. Do not attempt to use this on the permuted L from -% [L,U] = lu (A). Instead, use [L,U,P] = lu (A) or [L,U,P,Q] = lu (A). -% -% Note that there is a subtle undercount in this estimate. Suppose A is -% completely dense, but during LU factorization exact cancellation occurs, -% causing some of the entries in L and U to become identically zero. The -% flop count returned by this routine is an undercount. There is a simple -% way to fix this (L = spones (L) + spones (tril (A))), but the fix is partial. -% It can also occur that some entry in L is a "symbolic" fill-in (zero in -% A, but a fill-in entry and thus must be computed), but numerically -% zero. The only way to get a reliable LU factorization would be to do a -% purely symbolic factorization of A. This cannot be done with -% symbfact (A, 'col'). -% -% See NA Digest, Vol 00, #50, Tuesday, Dec. 5, 2000 -% -% See also symbfact - -% Copyright 1998-2007, Timothy A. Davis - - -Lnz = full (sum (spones (L))) - 1 ; % off diagonal nz in cols of L -Unz = full (sum (spones (U')))' - 1 ; % off diagonal nz in rows of U -fl = 2*Lnz*Unz + sum (Lnz) ; - diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamd2.m b/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamd2.m deleted file mode 100644 index ecae450be5..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamd2.m +++ /dev/null @@ -1,86 +0,0 @@ -function [p, stats] = symamd2 (S, knobs) -%SYMAMD Symmetric approximate minimum degree permutation. -% P = SYMAMD2(S) for a symmetric positive definite matrix S, returns the -% permutation vector p such that S(p,p) tends to have a sparser Cholesky -% factor than S. Sometimes SYMAMD works well for symmetric indefinite -% matrices too. The matrix S is assumed to be symmetric; only the -% strictly lower triangular part is referenced. S must be square. -% Note that p = amd(S) is much faster and generates comparable orderings. -% The ordering is followed by an elimination tree post-ordering. -% -% Note that this function is source code for the built-in MATLAB symamd -% function. It has been renamed here to symamd2 to avoid a filename clash. -% symamd and symamd2 are identical. -% -% See also SYMAMD, AMD, COLAMD, COLAMD2. -% -% Example: -% P = symamd2 (S) -% [P, stats] = symamd2 (S, knobs) -% -% knobs is an optional one- to two-element input vector. If S is n-by-n, -% then rows and columns with more than max(16,knobs(1)*sqrt(n)) entries are -% removed prior to ordering, and ordered last in the output permutation P. -% No rows/columns are removed if knobs(1)<0. If knobs(2) is nonzero, stats -% and knobs are printed. The default is knobs = [10 0]. Note that knobs -% differs from earlier versions of symamd. - -% Copyright 1998-2007, Timothy A. Davis, and Stefan Larimore -% Developed in collaboration with J. Gilbert and E. Ng. -% Acknowledgements: This work was supported by the National Science -% Foundation, under grants DMS-9504974 and DMS-9803599. - -%------------------------------------------------------------------------------- -% perform the symamd ordering: -%------------------------------------------------------------------------------- - -if (nargout <= 1 & nargin == 1) %#ok - p = symamd2mex (S) ; -elseif (nargout <= 1 & nargin == 2) %#ok - p = symamd2mex (S, knobs) ; -elseif (nargout == 2 & nargin == 1) %#ok - [p, stats] = symamd2mex (S) ; -elseif (nargout == 2 & nargin == 2) %#ok - [p, stats] = symamd2mex (S, knobs) ; -else - error('symamd: incorrect number of input and/or output arguments.') ; -end - -%------------------------------------------------------------------------------- -% symmetric elimination tree post-ordering: -%------------------------------------------------------------------------------- - -[ignore, q] = etree (S (p,p)) ; -p = p (q) ; - - -% stats is an optional 20-element output vector that provides data about the -% ordering and the validity of the input matrix S. Ordering statistics are -% in stats (1:3). stats (1) = stats (2) is the number of dense or empty -% rows and columns ignored by SYMAMD and stats (3) is the number of -% garbage collections performed on the internal data structure used by -% SYMAMD (roughly of size 8.4*nnz(tril(S,-1)) + 9*n integers). -% -% MATLAB built-in functions are intended to generate valid sparse matrices, -% with no duplicate entries, with ascending row indices of the nonzeros -% in each column, with a non-negative number of entries in each column (!) -% and so on. If a matrix is invalid, then SYMAMD may or may not be able -% to continue. If there are duplicate entries (a row index appears two or -% more times in the same column) or if the row indices in a column are out -% of order, then SYMAMD can correct these errors by ignoring the duplicate -% entries and sorting each column of its internal copy of the matrix S (the -% input matrix S is not repaired, however). If a matrix is invalid in other -% ways then SYMAMD cannot continue, an error message is printed, and no -% output arguments (P or stats) are returned. SYMAMD is thus a simple way -% to check a sparse matrix to see if it's valid. -% -% stats (4:7) provide information if SYMAMD was able to continue. The -% matrix is OK if stats (4) is zero, or 1 if invalid. stats (5) is the -% rightmost column index that is unsorted or contains duplicate entries, -% or zero if no such column exists. stats (6) is the last seen duplicate -% or out-of-order row index in the column index given by stats (5), or zero -% if no such row index exists. stats (7) is the number of duplicate or -% out-of-order row indices. -% -% stats (8:20) is always zero in the current version of SYMAMD (reserved -% for future use). diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamdmex.c b/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamdmex.c deleted file mode 100644 index af79e269d9..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamdmex.c +++ /dev/null @@ -1,192 +0,0 @@ -/* ========================================================================== */ -/* === symamd mexFunction =================================================== */ -/* ========================================================================== */ - -/* SYMAMD mexFunction - - Usage: - - P = symamd2 (A) ; - [ P, stats ] = symamd2 (A, knobs) ; - - See symamd.m for a description. - - Authors: - - The authors of the code itself are Stefan I. Larimore and Timothy A. - Davis (DrTimothyAldenDavis@gmail.com). The algorithm was - developed in collaboration with John Gilbert, Xerox PARC, and Esmond - Ng, Oak Ridge National Laboratory. - - Acknowledgements: - - This work was supported by the National Science Foundation, under - grants DMS-9504974 and DMS-9803599. - - Notice: - - Copyright (c) 1998-2007, Timothy A. Davis. All Rights Reserved. - See COLAMD/Doc/License.txt for the License. - - Availability: - - The colamd/symamd library is available at http://www.suitesparse.com - -*/ - -/* ========================================================================== */ -/* === Include files ======================================================== */ -/* ========================================================================== */ - -#include "colamd.h" -#include "mex.h" -#include "matrix.h" -#include -#define Long SuiteSparse_long - -/* ========================================================================== */ -/* === symamd mexFunction =================================================== */ -/* ========================================================================== */ - -void mexFunction -( - /* === Parameters ======================================================= */ - - int nlhs, /* number of left-hand sides */ - mxArray *plhs [], /* left-hand side matrices */ - int nrhs, /* number of right--hand sides */ - const mxArray *prhs [] /* right-hand side matrices */ -) -{ - /* === Local variables ================================================== */ - - Long *perm ; /* column ordering of M and ordering of A */ - Long *A ; /* row indices of input matrix A */ - Long *p ; /* column pointers of input matrix A */ - Long n_col ; /* number of columns of A */ - Long n_row ; /* number of rows of A */ - Long full ; /* TRUE if input matrix full, FALSE if sparse */ - double knobs [COLAMD_KNOBS] ; /* colamd user-controllable parameters */ - double *out_perm ; /* output permutation vector */ - double *out_stats ; /* output stats vector */ - double *in_knobs ; /* input knobs vector */ - Long i ; /* loop counter */ - mxArray *Ainput ; /* input matrix handle */ - Long spumoni ; /* verbosity variable */ - Long stats [COLAMD_STATS] ; /* stats for symamd */ - - /* === Check inputs ===================================================== */ - - if (nrhs < 1 || nrhs > 2 || nlhs < 0 || nlhs > 2) - { - mexErrMsgTxt ( - "symamd: incorrect number of input and/or output arguments.") ; - } - - /* === Get knobs ======================================================== */ - - colamd_l_set_defaults (knobs) ; - spumoni = 0 ; - - /* check for user-passed knobs */ - if (nrhs == 2) - { - in_knobs = mxGetPr (prhs [1]) ; - i = mxGetNumberOfElements (prhs [1]) ; - if (i > 0) knobs [COLAMD_DENSE_ROW] = in_knobs [0] ; - if (i > 1) spumoni = (Long) (in_knobs [1] != 0) ; - } - - /* print knob settings if spumoni is set */ - if (spumoni) - { - mexPrintf ("\nsymamd version %d.%d, %s:\n", - COLAMD_MAIN_VERSION, COLAMD_SUB_VERSION, COLAMD_DATE) ; - if (knobs [COLAMD_DENSE_ROW] >= 0) - { - mexPrintf ("knobs(1): %g, rows/cols with > " - "max(16,%g*sqrt(size(A,2))) entries removed\n", - in_knobs [0], knobs [COLAMD_DENSE_ROW]) ; - } - else - { - mexPrintf ("knobs(1): %g, no dense rows removed\n", in_knobs [0]) ; - } - mexPrintf ("knobs(2): %g, statistics and knobs printed\n", - in_knobs [1]) ; - } - - /* === If A is full, convert to a sparse matrix ========================= */ - - Ainput = (mxArray *) prhs [0] ; - if (mxGetNumberOfDimensions (Ainput) != 2) - { - mexErrMsgTxt ("symamd: input matrix must be 2-dimensional.") ; - } - full = !mxIsSparse (Ainput) ; - if (full) - { - mexCallMATLAB (1, &Ainput, 1, (mxArray **) prhs, "sparse") ; - } - - /* === Allocate workspace for symamd ==================================== */ - - /* get size of matrix */ - n_row = mxGetM (Ainput) ; - n_col = mxGetN (Ainput) ; - if (n_col != n_row) - { - mexErrMsgTxt ("symamd: matrix must be square.") ; - } - - A = (Long *) mxGetIr (Ainput) ; - p = (Long *) mxGetJc (Ainput) ; - perm = (Long *) mxCalloc (n_col+1, sizeof (Long)) ; - - /* === Order the rows and columns of A (does not destroy A) ============= */ - - if (!symamd_l (n_col, A, p, perm, knobs, stats, &mxCalloc, &mxFree)) - { - symamd_l_report (stats) ; - mexErrMsgTxt ("symamd error!") ; - } - - if (full) - { - mxDestroyArray (Ainput) ; - } - - /* === Return the permutation vector ==================================== */ - - plhs [0] = mxCreateDoubleMatrix (1, n_col, mxREAL) ; - out_perm = mxGetPr (plhs [0]) ; - for (i = 0 ; i < n_col ; i++) - { - /* symamd is 0-based, but MATLAB expects this to be 1-based */ - out_perm [i] = perm [i] + 1 ; - } - mxFree (perm) ; - - /* === Return the stats vector ========================================== */ - - /* print stats if spumoni is set */ - if (spumoni) - { - symamd_l_report (stats) ; - } - - if (nlhs == 2) - { - plhs [1] = mxCreateDoubleMatrix (1, COLAMD_STATS, mxREAL) ; - out_stats = mxGetPr (plhs [1]) ; - for (i = 0 ; i < COLAMD_STATS ; i++) - { - out_stats [i] = stats [i] ; - } - - /* fix stats (5) and (6), for 1-based information on jumbled matrix. */ - /* note that this correction doesn't occur if symamd returns FALSE */ - out_stats [COLAMD_INFO1] ++ ; - out_stats [COLAMD_INFO2] ++ ; - } -} diff --git a/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamdtestmex.c b/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamdtestmex.c deleted file mode 100644 index 57cf05ca4b..0000000000 --- a/ThirdParty/SuiteSparse/COLAMD/MATLAB/symamdtestmex.c +++ /dev/null @@ -1,533 +0,0 @@ -/* ========================================================================== */ -/* === symamdtest mexFunction =============================================== */ -/* ========================================================================== */ - -/* SYMAMD test function - - This MATLAB mexFunction is for testing only. It is not meant for - production use. See symamdmex.c instead. - - Usage: - - [ P, stats ] = symamdtest (A, knobs) ; - - See symamd.m for a description. knobs is required. - - knobs (1) dense row control - knobs (2) spumoni - knobs (3) for testing only. Controls how the input matrix is - jumbled prior to calling symamd, to test its error - handling capability. - - Authors: - - The authors of the code itself are Stefan I. Larimore and Timothy A. - Davis (DrTimothyAldenDavis@gmail.com). The algorithm was - developed in collaboration with John Gilbert, Xerox PARC, and Esmond - Ng, Oak Ridge National Laboratory. - - Acknowledgements: - - This work was supported by the National Science Foundation, under - grants DMS-9504974 and DMS-9803599. - - Notice: - - Copyright (c) 1998-2007, Timothy A. Davis. All Rights Reserved. - See COLAMD/Doc/License.txt for the License. - - Availability: - - The colamd/symamd library is available at http://www.suitesparse.com - -*/ - -/* ========================================================================== */ -/* === Include files ======================================================== */ -/* ========================================================================== */ - -#include "colamd.h" -#include "mex.h" -#include "matrix.h" -#include -#include -#define Long SuiteSparse_long - -static void dump_matrix -( - Long A [ ], - Long p [ ], - Long n_row, - Long n_col, - Long Alen, - Long limit -) ; - -/* ========================================================================== */ -/* === symamd mexFunction =================================================== */ -/* ========================================================================== */ - -void mexFunction -( - /* === Parameters ======================================================= */ - - int nlhs, /* number of left-hand sides */ - mxArray *plhs [], /* left-hand side matrices */ - int nrhs, /* number of right--hand sides */ - const mxArray *prhs [] /* right-hand side matrices */ -) -{ - /* === Local variables ================================================== */ - - Long *perm ; /* column ordering of M and ordering of A */ - Long *A ; /* row indices of input matrix A */ - Long *p ; /* column pointers of input matrix A */ - Long n_col ; /* number of columns of A */ - Long n_row ; /* number of rows of A */ - Long full ; /* TRUE if input matrix full, FALSE if sparse */ - double knobs [COLAMD_KNOBS] ; /* colamd user-controllable parameters */ - double *out_perm ; /* output permutation vector */ - double *out_stats ; /* output stats vector */ - double *in_knobs ; /* input knobs vector */ - Long i ; /* loop counter */ - mxArray *Ainput ; /* input matrix handle */ - Long spumoni ; /* verbosity variable */ - Long stats2 [COLAMD_STATS] ;/* stats for symamd */ - - Long *cp, *cp_end, result, nnz, col, length ; - Long *stats ; - stats = stats2 ; - - /* === Check inputs ===================================================== */ - - if (nrhs < 1 || nrhs > 2 || nlhs < 0 || nlhs > 2) - { - mexErrMsgTxt ( - "symamd: incorrect number of input and/or output arguments.") ; - } - - if (nrhs != 2) - { - mexErrMsgTxt ("symamdtest: knobs are required") ; - } - /* for testing we require all 3 knobs */ - if (mxGetNumberOfElements (prhs [1]) != 3) - { - mexErrMsgTxt ("symamdtest: must have all 3 knobs for testing") ; - } - - /* === Get knobs ======================================================== */ - - colamd_l_set_defaults (knobs) ; - spumoni = 0 ; - - /* check for user-passed knobs */ - if (nrhs == 2) - { - in_knobs = mxGetPr (prhs [1]) ; - i = mxGetNumberOfElements (prhs [1]) ; - if (i > 0) knobs [COLAMD_DENSE_ROW] = in_knobs [0] ; - if (i > 1) spumoni = (Long) in_knobs [1] ; - } - - /* print knob settings if spumoni is set */ - if (spumoni) - { - mexPrintf ("\nsymamd version %d.%d, %s:\n", - COLAMD_MAIN_VERSION, COLAMD_SUB_VERSION, COLAMD_DATE) ; - if (knobs [COLAMD_DENSE_ROW] >= 0) - { - mexPrintf ("knobs(1): %g, rows/cols with > " - "max(16,%g*sqrt(size(A,2))) entries removed\n", - in_knobs [0], knobs [COLAMD_DENSE_ROW]) ; - } - else - { - mexPrintf ("knobs(1): %g, no dense rows removed\n", in_knobs [0]) ; - } - mexPrintf ("knobs(2): %g, statistics and knobs printed\n", - in_knobs [1]) ; - mexPrintf ("Testing %d\n", in_knobs [2]) ; - } - - /* === If A is full, convert to a sparse matrix ========================= */ - - Ainput = (mxArray *) prhs [0] ; - if (mxGetNumberOfDimensions (Ainput) != 2) - { - mexErrMsgTxt ("symamd: input matrix must be 2-dimensional.") ; - } - full = !mxIsSparse (Ainput) ; - if (full) - { - mexCallMATLAB (1, &Ainput, 1, (mxArray **) prhs, "sparse") ; - } - - /* === Allocate workspace for symamd ==================================== */ - - /* get size of matrix */ - n_row = mxGetM (Ainput) ; - n_col = mxGetN (Ainput) ; - if (n_col != n_row) - { - mexErrMsgTxt ("symamd: matrix must be square.") ; - } - - /* p = mxGetJc (Ainput) ; */ - p = (Long *) mxCalloc (n_col+1, sizeof (Long)) ; - (void) memcpy (p, mxGetJc (Ainput), (n_col+1)*sizeof (Long)) ; - - nnz = p [n_col] ; - if (spumoni > 0) - { - mexPrintf ("symamdtest: nnz %d\n", nnz) ; - } - - /* A = mxGetIr (Ainput) ; */ - A = (Long *) mxCalloc (nnz+1, sizeof (Long)) ; - (void) memcpy (A, mxGetIr (Ainput), nnz*sizeof (Long)) ; - - perm = (Long *) mxCalloc (n_col+1, sizeof (Long)) ; - -/* === Jumble matrix ======================================================== */ - - -/* - knobs [2] FOR TESTING ONLY: Specifies how to jumble matrix - 0 : No jumbling - 1 : (no errors) - 2 : Make first pointer non-zero - 3 : Make column pointers not non-decreasing - 4 : (no errors) - 5 : Make row indices not strictly increasing - 6 : Make a row index greater or equal to n_row - 7 : Set A = NULL - 8 : Set p = NULL - 9 : Repeat row index - 10: make row indices not sorted - 11: jumble columns massively (note this changes - the pattern of the matrix A.) - 12: Set stats = NULL - 13: Make n_col less than zero -*/ - - /* jumble appropriately */ - switch ((Long) in_knobs [2]) - { - - case 0 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: no errors expected\n") ; - } - result = 1 ; /* no errors */ - break ; - - case 1 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: no errors expected (1)\n") ; - } - result = 1 ; - break ; - - case 2 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: p [0] nonzero\n") ; - } - result = 0 ; /* p [0] must be zero */ - p [0] = 1 ; - break ; - - case 3 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: negative length last column\n") ; - } - result = (n_col == 0) ; /* p must be monotonically inc. */ - p [n_col] = p [0] ; - break ; - - case 4 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: no errors expected (4)\n") ; - } - result = 1 ; - break ; - - case 5 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: row index out of range (-1)\n") ; - } - if (nnz > 0) /* row index out of range */ - { - result = 0 ; - A [nnz-1] = -1 ; - } - else - { - if (spumoni > 0) - { - mexPrintf ("Note: no row indices to put out of range\n") ; - } - result = 1 ; - } - break ; - - case 6 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: row index out of range (ncol)\n") ; - } - if (nnz > 0) /* row index out of range */ - { - result = 0 ; - A [nnz-1] = n_col ; - } - else - { - if (spumoni > 0) - { - mexPrintf ("Note: no row indices to put out of range\n") ; - } - result = 1 ; - } - break ; - - case 7 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: A not present\n") ; - } - result = 0 ; /* A not present */ - A = (Long *) NULL ; - break ; - - case 8 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: p not present\n") ; - } - result = 0 ; /* p not present */ - p = (Long *) NULL ; - break ; - - case 9 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: duplicate row index\n") ; - } - result = 1 ; /* duplicate row index */ - - for (col = 0 ; col < n_col ; col++) - { - length = p [col+1] - p [col] ; - if (length > 1) - { - A [p [col+1]-2] = A [p [col+1] - 1] ; - if (spumoni > 0) - { - mexPrintf ("Made duplicate row %d in col %d\n", - A [p [col+1] - 1], col) ; - } - break ; - } - } - - if (spumoni > 1) - { - dump_matrix (A, p, n_row, n_col, nnz, col+2) ; - } - break ; - - case 10 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: unsorted column\n") ; - } - result = 1 ; /* jumbled columns */ - - for (col = 0 ; col < n_col ; col++) - { - length = p [col+1] - p [col] ; - if (length > 1) - { - i = A[p [col]] ; - A [p [col]] = A[p [col] + 1] ; - A [p [col] + 1] = i ; - if (spumoni > 0) - { - mexPrintf ("Unsorted column %d \n", col) ; - } - break ; - } - } - - if (spumoni > 1) - { - dump_matrix (A, p, n_row, n_col, nnz, col+2) ; - } - break ; - - case 11 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: massive jumbling\n") ; - } - result = 1 ; /* massive jumbling, but no errors */ - srand (1) ; - for (i = 0 ; i < n_col ; i++) - { - cp = &A [p [i]] ; - cp_end = &A [p [i+1]] ; - while (cp < cp_end) - { - *cp++ = rand() % n_row ; - } - } - if (spumoni > 1) - { - dump_matrix (A, p, n_row, n_col, nnz, n_col) ; - } - break ; - - case 12 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: stats not present\n") ; - } - result = 0 ; /* stats not present */ - stats = (Long *) NULL ; - break ; - - case 13 : - if (spumoni > 0) - { - mexPrintf ("symamdtest: ncol out of range\n") ; - } - result = 0 ; /* ncol out of range */ - n_col = -1 ; - break ; - - } - - /* === Order the rows and columns of A (does not destroy A) ============= */ - - if (!symamd_l (n_col, A, p, perm, knobs, stats, &mxCalloc, &mxFree)) - { - - /* return p = -1 if colamd failed */ - plhs [0] = mxCreateDoubleMatrix (1, 1, mxREAL) ; - out_perm = mxGetPr (plhs [0]) ; - out_perm [0] = -1 ; - mxFree (p) ; - mxFree (A) ; - - if (spumoni > 0 || result) - { - symamd_l_report (stats) ; - } - - if (result) - { - mexErrMsgTxt ("symamd should have returned TRUE\n") ; - } - - return ; - /* mexErrMsgTxt ("symamd error!") ; */ - } - - if (!result) - { - symamd_l_report (stats) ; - mexErrMsgTxt ("symamd should have returned FALSE\n") ; - } - - if (full) - { - mxDestroyArray (Ainput) ; - } - - /* === Return the permutation vector ==================================== */ - - plhs [0] = mxCreateDoubleMatrix (1, n_col, mxREAL) ; - out_perm = mxGetPr (plhs [0]) ; - for (i = 0 ; i < n_col ; i++) - { - /* symamd is 0-based, but MATLAB expects this to be 1-based */ - out_perm [i] = perm [i] + 1 ; - } - mxFree (perm) ; - - /* === Return the stats vector ========================================== */ - - /* print stats if spumoni > 0 */ - if (spumoni > 0) - { - symamd_l_report (stats) ; - } - - if (nlhs == 2) - { - plhs [1] = mxCreateDoubleMatrix (1, COLAMD_STATS, mxREAL) ; - out_stats = mxGetPr (plhs [1]) ; - for (i = 0 ; i < COLAMD_STATS ; i++) - { - out_stats [i] = stats [i] ; - } - - /* fix stats (5) and (6), for 1-based information on jumbled matrix. */ - /* note that this correction doesn't occur if symamd returns FALSE */ - out_stats [COLAMD_INFO1] ++ ; - out_stats [COLAMD_INFO2] ++ ; - } -} - - -#ifdef MIN -#undef MIN -#endif -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) - - -static void dump_matrix -( - Long A [ ], - Long p [ ], - Long n_row, - Long n_col, - Long Alen, - Long limit -) -{ - Long col, k, row ; - - mexPrintf ("dump matrix: nrow %d ncol %d Alen %d\n", n_row, n_col, Alen) ; - - if (!A) - { - mexPrintf ("A not present\n") ; - return ; - } - - if (!p) - { - mexPrintf ("p not present\n") ; - return ; - } - - for (col = 0 ; col < MIN (n_col, limit) ; col++) - { - mexPrintf ("column %d, p[col] %d, p [col+1] %d, length %d\n", - col, p [col], p [col+1], p [col+1] - p [col]) ; - for (k = p [col] ; k < p [col+1] ; k++) - { - row = A [k] ; - mexPrintf (" %d", row) ; - } - mexPrintf ("\n") ; - } -} diff --git a/ThirdParty/SuiteSparse/COLAMD/Makefile b/ThirdParty/SuiteSparse/COLAMD/Makefile index 26eddc755f..2c7de9ee43 100644 --- a/ThirdParty/SuiteSparse/COLAMD/Makefile +++ b/ThirdParty/SuiteSparse/COLAMD/Makefile @@ -1,55 +1,83 @@ -#------------------------------------------------------------------------------ -# COLAMD Makefile -#------------------------------------------------------------------------------ +#------------------------------------------------------------------------------- +# SuiteSparse/COLAMD/Makefile +#------------------------------------------------------------------------------- -SUITESPARSE ?= $(realpath $(CURDIR)/..) -export SUITESPARSE +# COLAMD: Copyright (c) 1998-2022, Timothy A. Davis and Stefan Larimore, +# All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause -default: all +#------------------------------------------------------------------------------- -include ../SuiteSparse_config/SuiteSparse_config.mk +# A simple Makefile for COLAMD, which relies on cmake to do the +# actual build. All the work is done in cmake so this Makefile is just for +# convenience. -demos: all +# To compile with an alternate compiler: +# +# make CC=gcc CXX=g++ +# +# To compile/install for system-wide usage: +# +# make +# sudo make install +# +# To compile/install for local usage (SuiteSparse/lib and SuiteSparse/include): +# +# make local +# make install +# +# To clean up the files: +# +# make clean -# Compile all C code -all: - ( cd Lib ; $(MAKE) ) - ( cd Demo ; $(MAKE) ) +JOBS ?= 8 -# compile just the C-callable libraries (not Demos) +default: library + +# default is to install only in /usr/local library: - ( cd Lib ; $(MAKE) ) + ( cd build && cmake $(CMAKE_OPTIONS) .. && cmake --build . -j${JOBS} ) -# compile the static libraries only -static: - ( cd Lib ; $(MAKE) static ) +# install only in SuiteSparse/lib and SuiteSparse/include +local: + ( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=1 .. && cmake --build . -j${JOBS} ) -# remove object files, but keep the compiled programs and library archives -clean: - ( cd Lib ; $(MAKE) clean ) - ( cd Demo ; $(MAKE) clean ) - ( cd MATLAB ; $(RM) $(CLEAN) ) +# install only in /usr/local (default) +global: + ( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=0 .. && cmake --build . -j${JOBS} ) -# clean, and then remove compiled programs and library archives -purge: - ( cd Lib ; $(MAKE) purge ) - ( cd Demo ; $(MAKE) purge ) - ( cd MATLAB ; $(RM) $(CLEAN) ; $(RM) *.mex* ) +debug: + ( cd build && cmake $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug .. && cmake --build . -j${JOBS} ) -distclean: purge +all: library -# get ready for distribution -dist: purge - ( cd Demo ; $(MAKE) dist ) +demos: library + ( cd build && cmake $(CMAKE_OPTIONS) -DDEMO=1 .. && cmake --build . -j${JOBS} ) + - ./build/colamd_example > ./build/colamd_example.out + - diff --strip-trailing-cr ./Demo/colamd_example.out ./build/colamd_example.out + - ./build/colamd_l_example > ./build/colamd_l_example.out + - diff --strip-trailing-cr ./Demo/colamd_l_example.out ./build/colamd_l_example.out -ccode: library +# just compile after running cmake; do not run cmake again +remake: + ( cd build && cmake --build . -j${JOBS} ) -lib: library +# just run cmake to set things up +setup: + ( cd build ; cmake $(CMAKE_OPTIONS) .. ) -# install COLAMD install: - ( cd Lib ; $(MAKE) install ) + ( cd build && cmake --install . ) -# uninstall COLAMD +# remove any installed libraries and #include files uninstall: - ( cd Lib ; $(MAKE) uninstall ) + - xargs rm < build/install_manifest.txt + +# remove all files not in the distribution +clean: + - $(RM) -rf build/* Config/*.tmp MATLAB/*.o MATLAB/*.mex* timelog.m + +purge: clean + +distclean: clean + diff --git a/ThirdParty/SuiteSparse/COLAMD/README.txt b/ThirdParty/SuiteSparse/COLAMD/README.txt index 7c79343fa5..e6e43b0970 100644 --- a/ThirdParty/SuiteSparse/COLAMD/README.txt +++ b/ThirdParty/SuiteSparse/COLAMD/README.txt @@ -1,6 +1,8 @@ -COLAMD, Copyright 1998-2016, Timothy A. Davis. http://www.suitesparse.com +COLAMD, Copyright 1998-2022, Timothy A. Davis. http://www.suitesparse.com ------------------------------------------------------------------------------- +SPDX-License-Identifier: BSD-3-clause + The COLAMD column approximate minimum degree ordering algorithm computes a permutation vector P such that the LU factorization of A (:,P) tends to be sparser than that of A. The Cholesky factorization of @@ -11,18 +13,9 @@ that M'*M has the same pattern as A, and then uses COLAMD to compute a column ordering of M. Colamd and symamd tend to be faster and generate better orderings than their MATLAB counterparts, colmmd and symmmd. -To compile and test the colamd m-files and mexFunctions, just unpack the -COLAMD/ directory from the COLAMD.tar.gz file, and run MATLAB from -within that directory. Next, type colamd_test to compile and test colamd -and symamd. This will work on any computer with MATLAB (Unix, PC, or Mac). -Alternatively, type "make" (in Unix) to compile and run a simple example C -code, without using MATLAB. - To compile and install the colamd m-files and mexFunctions, just cd to COLAMD/MATLAB and type colamd_install in the MATLAB command window. A short demo will run. Optionally, type colamd_test to run an extensive tests. -Type "make" in Unix in the COLAMD directory to compile the C-callable -library and to run a short demo. Colamd is a built-in routine in MATLAB, available from The Mathworks, Inc. Under most cases, the compiled COLAMD from Versions 2.0 to the @@ -33,16 +26,26 @@ mexFunction. v2.5 adds additional checks for integer overflow, so that the "int" version can be safely used with 64-bit pointers. Refer to the ChangeLog for more details. -Other "make" targets: +COLAMD includes a simple top-level Makefile, which is optional. All the work +is done via cmake. Windows users can simply import the CMakeLists.txt into MS +Visual Studio. + +"make" targets: + make compiles the COLAMD library; + "make install" will install in /usr/local/lib, + /usr/local/include, SuiteSparse/lib, and + SuiteSparse/include + make demos compiles and runs a few demos make library compiles a C-callable library containing colamd make clean removes all files not in the distribution, but keeps the compiled libraries. make distclean removes all files not in the distribution - make install installs the library in /usr/local/lib and - /usr/local/include - make uninstall uninstalls the library from /usr/local/lib and - /usr/local/include + make local compiles the COLAMD library; + "make install" will install only in + SuiteSparse/lib and SuiteSparse/include + make install installs the library + make uninstall uninstalls the library To use colamd and symamd within an application written in C, all you need are colamd.c, and colamd.h, which are the C-callable @@ -86,8 +89,9 @@ COLAMD files: Demo simple demo Doc additional documentation (see colamd.c for more) Include include file - Lib compiled C-callable library - Makefile primary Unix Makefile + Config source for colamd.h + Makefile optional Makefile + CMakeLists.txt for using cmake to build COLAMD MATLAB MATLAB functions README.txt this file Source C source code @@ -97,7 +101,6 @@ COLAMD files: colamd_example.out output of colamd_example.c colamd_l_example.c simple example, long integers colamd_l_example.out output of colamd_l_example.c - Makefile Makefile for C demos ./Doc: ChangeLog change log @@ -106,9 +109,6 @@ COLAMD files: ./Include: colamd.h include file - ./Lib: - Makefile Makefile for C-callable library - ./MATLAB: colamd2.m MATLAB interface for colamd2 colamd_demo.m simple demo @@ -126,3 +126,8 @@ COLAMD files: ./Source: colamd.c primary source code + colamd_l.c primary source code for int64_t version + + ./build: where COLAMD is built + .gitignore + diff --git a/ThirdParty/SuiteSparse/COLAMD/Source/colamd.c b/ThirdParty/SuiteSparse/COLAMD/Source/colamd.c index bb5b0ac16e..af5b27f7a0 100644 --- a/ThirdParty/SuiteSparse/COLAMD/Source/colamd.c +++ b/ThirdParty/SuiteSparse/COLAMD/Source/colamd.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === colamd/symamd - a sparse matrix column ordering algorithm ============ */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// COLAMD/Source/colamd.c: column approximate minimum degree ordering +//------------------------------------------------------------------------------ + +// COLAMD, Copyright (c) 1998-2022, Timothy A. Davis and Stefan Larimore, +// All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ /* COLAMD / SYMAMD @@ -46,7 +52,7 @@ Copyright and License: - Copyright (c) 1998-2007, Timothy A. Davis, All Rights Reserved. + Copyright (c) 1998-2022, Timothy A. Davis, All Rights Reserved. COLAMD is also available under alternate licenses, contact T. Davis for details. @@ -76,10 +82,9 @@ /* === Description of user-callable routines ================================ */ /* ========================================================================== */ -/* COLAMD includes both int and SuiteSparse_long versions of all its routines. - The description below is for the int version. For SuiteSparse_long, all - int arguments become SuiteSparse_long. SuiteSparse_long is normally - defined as long, except for WIN64. +/* COLAMD includes both int32_t and int64_t versions of all its routines. + The description below is for the int32_t version. For int64_t, all + int32_t arguments become int64_t. ---------------------------------------------------------------------------- colamd_recommended: @@ -88,9 +93,9 @@ C syntax: #include "colamd.h" - size_t colamd_recommended (int nnz, int n_row, int n_col) ; - size_t colamd_l_recommended (SuiteSparse_long nnz, - SuiteSparse_long n_row, SuiteSparse_long n_col) ; + size_t colamd_recommended (int32_t nnz, int32_t n_row, int32_t n_col) ; + size_t colamd_l_recommended (int64_t nnz, + int64_t n_row, int64_t n_col) ; Purpose: @@ -99,19 +104,16 @@ is optional. Not needed for symamd, which dynamically allocates its own memory. - Note that in v2.4 and earlier, these routines returned int or long. - They now return a value of type size_t. - Arguments (all input arguments): - int nnz ; Number of nonzeros in the matrix A. This must + int32_t nnz ; Number of nonzeros in the matrix A. This must be the same value as p [n_col] in the call to colamd - otherwise you will get a wrong value of the recommended memory to use. - int n_row ; Number of rows in the matrix A. + int32_t n_row ; Number of rows in the matrix A. - int n_col ; Number of columns in the matrix A. + int32_t n_col ; Number of columns in the matrix A. ---------------------------------------------------------------------------- colamd_set_defaults: @@ -171,12 +173,12 @@ C syntax: #include "colamd.h" - int colamd (int n_row, int n_col, int Alen, int *A, int *p, - double knobs [COLAMD_KNOBS], int stats [COLAMD_STATS]) ; - SuiteSparse_long colamd_l (SuiteSparse_long n_row, - SuiteSparse_long n_col, SuiteSparse_long Alen, - SuiteSparse_long *A, SuiteSparse_long *p, double knobs - [COLAMD_KNOBS], SuiteSparse_long stats [COLAMD_STATS]) ; + int colamd (int32_t n_row, int32_t n_col, int32_t Alen, int32_t *A, int32_t *p, + double knobs [COLAMD_KNOBS], int32_t stats [COLAMD_STATS]) ; + int colamd_l (int64_t n_row, + int64_t n_col, int64_t Alen, + int64_t *A, int64_t *p, double knobs + [COLAMD_KNOBS], int64_t stats [COLAMD_STATS]) ; Purpose: @@ -191,19 +193,19 @@ Arguments: - int n_row ; Input argument. + int32_t n_row ; Input argument. Number of rows in the matrix A. Restriction: n_row >= 0. Colamd returns FALSE if n_row is negative. - int n_col ; Input argument. + int32_t n_col ; Input argument. Number of columns in the matrix A. Restriction: n_col >= 0. Colamd returns FALSE if n_col is negative. - int Alen ; Input argument. + int32_t Alen ; Input argument. Restriction (see note): Alen >= 2*nnz + 6*(n_col+1) + 4*(n_row+1) + n_col @@ -219,7 +221,7 @@ for integer overflow, and thus is not recommended. Use the colamd_recommended routine instead. - int A [Alen] ; Input argument, undefined on output. + int32_t A [Alen] ; Input argument, undefined on output. A is an integer array of size Alen. Alen must be at least as large as the bare minimum value given above, but this is very @@ -243,7 +245,7 @@ The contents of A are modified during ordering, and are undefined on output. - int p [n_col+1] ; Both input and output argument. + int32_t p [n_col+1] ; Both input and output argument. p is an integer array of size n_col+1. On input, it holds the "pointers" for the column form of the matrix A. Column c of @@ -267,7 +269,7 @@ See colamd_set_defaults for a description. - int stats [COLAMD_STATS] ; Output argument. + int32_t stats [COLAMD_STATS] ; Output argument. Statistics on the ordering, and error status. See colamd.h for related definitions. @@ -367,9 +369,9 @@ #include "colamd.h" #define ALEN 100 - int A [ALEN] = {0, 1, 4, 2, 4, 0, 1, 2, 3, 1, 3} ; - int p [ ] = {0, 3, 5, 9, 11} ; - int stats [COLAMD_STATS] ; + int32_t A [ALEN] = {0, 1, 4, 2, 4, 0, 1, 2, 3, 1, 3} ; + int32_t p [ ] = {0, 3, 5, 9, 11} ; + int32_t stats [COLAMD_STATS] ; colamd (5, 4, ALEN, A, p, (double *) NULL, stats) ; The permutation is returned in the array p, and A is destroyed. @@ -381,12 +383,12 @@ C syntax: #include "colamd.h" - int symamd (int n, int *A, int *p, int *perm, - double knobs [COLAMD_KNOBS], int stats [COLAMD_STATS], + int symamd (int32_t n, int32_t *A, int32_t *p, int32_t *perm, + double knobs [COLAMD_KNOBS], int32_t stats [COLAMD_STATS], void (*allocate) (size_t, size_t), void (*release) (void *)) ; - SuiteSparse_long symamd_l (SuiteSparse_long n, SuiteSparse_long *A, - SuiteSparse_long *p, SuiteSparse_long *perm, double knobs - [COLAMD_KNOBS], SuiteSparse_long stats [COLAMD_STATS], void + int symamd_l (int64_t n, int64_t *A, + int64_t *p, int64_t *perm, double knobs + [COLAMD_KNOBS], int64_t stats [COLAMD_STATS], void (*allocate) (size_t, size_t), void (*release) (void *)) ; Purpose: @@ -406,13 +408,13 @@ Arguments: - int n ; Input argument. + int32_t n ; Input argument. Number of rows and columns in the symmetrix matrix A. Restriction: n >= 0. Symamd returns FALSE if n is negative. - int A [nnz] ; Input argument. + int32_t A [nnz] ; Input argument. A is an integer array of size nnz, where nnz = p [n]. @@ -428,7 +430,7 @@ The contents of A are not modified. - int p [n+1] ; Input argument. + int32_t p [n+1] ; Input argument. p is an integer array of size n+1. On input, it holds the "pointers" for the column form of the matrix A. Column c of @@ -440,7 +442,7 @@ The contents of p are not modified. - int perm [n+1] ; Output argument. + int32_t perm [n+1] ; Output argument. On output, if symamd returns TRUE, the array perm holds the permutation P, where perm [0] is the first index in the new @@ -455,7 +457,7 @@ See colamd_set_defaults for a description. - int stats [COLAMD_STATS] ; Output argument. + int32_t stats [COLAMD_STATS] ; Output argument. Statistics on the ordering, and error status. See colamd.h for related definitions. @@ -553,8 +555,8 @@ C syntax: #include "colamd.h" - colamd_report (int stats [COLAMD_STATS]) ; - colamd_l_report (SuiteSparse_long stats [COLAMD_STATS]) ; + colamd_report (int32_t stats [COLAMD_STATS]) ; + colamd_l_report (int64_t stats [COLAMD_STATS]) ; Purpose: @@ -564,7 +566,7 @@ Arguments: - int stats [COLAMD_STATS] ; Input only. Statistics from colamd. + int32_t stats [COLAMD_STATS] ; Input only. Statistics from colamd. ---------------------------------------------------------------------------- @@ -574,8 +576,8 @@ C syntax: #include "colamd.h" - symamd_report (int stats [COLAMD_STATS]) ; - symamd_l_report (SuiteSparse_long stats [COLAMD_STATS]) ; + symamd_report (int32_t stats [COLAMD_STATS]) ; + symamd_l_report (int64_t stats [COLAMD_STATS]) ; Purpose: @@ -585,7 +587,7 @@ Arguments: - int stats [COLAMD_STATS] ; Input only. Statistics from symamd. + int32_t stats [COLAMD_STATS] ; Input only. Statistics from symamd. */ @@ -637,33 +639,21 @@ /* ========================================================================== */ #include "colamd.h" -#include -#include - -#ifdef MATLAB_MEX_FILE -#include "mex.h" -#include "matrix.h" -#endif /* MATLAB_MEX_FILE */ - -#if !defined (NPRINT) || !defined (NDEBUG) -#include -#endif #ifndef NULL #define NULL ((void *) 0) #endif /* ========================================================================== */ -/* === int or SuiteSparse_long ============================================== */ +/* === int32_t or int64_t ============================================== */ /* ========================================================================== */ #ifdef DLONG -#define Int SuiteSparse_long -#define ID SuiteSparse_long_id -#define Int_MAX SuiteSparse_long_max - -#define UnsignedInt SuiteSparse_unsigned_long +#define Int int64_t +#define UInt uint64_t +#define ID "%" PRId64 +#define Int_MAX INT64_MAX #define COLAMD_recommended colamd_l_recommended #define COLAMD_set_defaults colamd_l_set_defaults @@ -674,11 +664,10 @@ #else -#define Int int +#define Int int32_t +#define UInt uint32_t #define ID "%d" -#define Int_MAX INT_MAX - -#define UnsignedInt unsigned int +#define Int_MAX INT32_MAX #define COLAMD_recommended colamd_recommended #define COLAMD_set_defaults colamd_set_defaults @@ -750,9 +739,8 @@ typedef struct Colamd_Row_struct /* === Definitions ========================================================== */ /* ========================================================================== */ -/* Routines are either PUBLIC (user-callable) or PRIVATE (not user-callable) */ -#define PUBLIC -#define PRIVATE static +/* Routines are either user-callable or PRIVATE (not user-callable) */ +#define PRIVATE static #define DENSE_DEGREE(alpha,n) \ ((Int) MAX (16.0, (alpha) * sqrt ((double) (n)))) @@ -1033,7 +1021,7 @@ static size_t t_mult (size_t a, size_t k, int *ok) ((t_mult (t_add (n_row, 1, ok), sizeof (Colamd_Row), ok) / sizeof (Int))) -PUBLIC size_t COLAMD_recommended /* returns recommended value of Alen. */ +size_t COLAMD_recommended /* returns recommended value of Alen. */ ( /* === Parameters ======================================================= */ @@ -1055,7 +1043,6 @@ PUBLIC size_t COLAMD_recommended /* returns recommended value of Alen. */ s = t_add (s, r, &ok) ; s = t_add (s, n_col, &ok) ; /* elbow room */ s = t_add (s, nnz/5, &ok) ; /* elbow room */ - ok = ok && (s < Int_MAX) ; return (ok ? s : 0) ; } @@ -1087,7 +1074,7 @@ PUBLIC size_t COLAMD_recommended /* returns recommended value of Alen. */ */ -PUBLIC void COLAMD_set_defaults +void COLAMD_set_defaults ( /* === Parameters ======================================================= */ @@ -1116,7 +1103,7 @@ PUBLIC void COLAMD_set_defaults /* === symamd =============================================================== */ /* ========================================================================== */ -PUBLIC Int SYMAMD_MAIN /* return TRUE if OK, FALSE otherwise */ +int SYMAMD_MAIN /* return TRUE if OK, FALSE otherwise */ ( /* === Parameters ======================================================= */ @@ -1436,7 +1423,7 @@ PUBLIC Int SYMAMD_MAIN /* return TRUE if OK, FALSE otherwise */ (AQ)'(AQ) = LL' remains sparse. */ -PUBLIC Int COLAMD_MAIN /* returns TRUE if successful, FALSE otherwise*/ +int COLAMD_MAIN /* returns TRUE if successful, FALSE otherwise*/ ( /* === Parameters ======================================================= */ @@ -1554,7 +1541,7 @@ PUBLIC Int COLAMD_MAIN /* returns TRUE if successful, FALSE otherwise*/ need = t_add (need, Col_size, &ok) ; need = t_add (need, Row_size, &ok) ; - if (!ok || need > (size_t) Alen || need > Int_MAX) + if (!ok || need > (size_t) Alen) { /* not enough space in array A to perform the ordering */ stats [COLAMD_STATUS] = COLAMD_ERROR_A_too_small ; @@ -1605,7 +1592,7 @@ PUBLIC Int COLAMD_MAIN /* returns TRUE if successful, FALSE otherwise*/ /* === colamd_report ======================================================== */ /* ========================================================================== */ -PUBLIC void COLAMD_report +void COLAMD_report ( Int stats [COLAMD_STATS] ) @@ -1618,7 +1605,7 @@ PUBLIC void COLAMD_report /* === symamd_report ======================================================== */ /* ========================================================================== */ -PUBLIC void SYMAMD_report +void SYMAMD_report ( Int stats [COLAMD_STATS] ) @@ -2197,7 +2184,7 @@ PRIVATE Int find_ordering /* return the number of garbage collections */ Int col ; /* a column index */ Int max_score ; /* maximum possible score */ Int cur_score ; /* score of current column */ - UnsignedInt hash ; /* hash value for supernode detection */ + UInt hash ; /* hash value for supernode detection */ Int head_column ; /* head of hash bucket */ Int first_col ; /* first column in hash bucket */ Int tag_mark ; /* marker value for mark array */ @@ -3159,8 +3146,9 @@ PRIVATE void print_report Int i1, i2, i3 ; - SUITESPARSE_PRINTF (("\n%s version %d.%d, %s: ", method, - COLAMD_MAIN_VERSION, COLAMD_SUB_VERSION, COLAMD_DATE)) ; + SUITESPARSE_PRINTF (("\n%s version %d.%d.%d, %s: ", method, + COLAMD_MAIN_VERSION, COLAMD_SUB_VERSION, COLAMD_SUBSUB_VERSION, + COLAMD_DATE)) ; if (!stats) { diff --git a/ThirdParty/SuiteSparse/COLAMD/Source/colamd_l.c b/ThirdParty/SuiteSparse/COLAMD/Source/colamd_l.c new file mode 100644 index 0000000000..ddc06451db --- /dev/null +++ b/ThirdParty/SuiteSparse/COLAMD/Source/colamd_l.c @@ -0,0 +1,13 @@ +//------------------------------------------------------------------------------ +// COLAMD/Source/colamd_l.c: int64_t version of colamd +//------------------------------------------------------------------------------ + +// COLAMD, Copyright (c) 1998-2022, Timothy A. Davis and Stefan Larimore, +// All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + +#define DLONG +#include "colamd.c" + diff --git a/ThirdParty/SuiteSparse/COLAMD/build/.gitignore b/ThirdParty/SuiteSparse/COLAMD/build/.gitignore new file mode 100644 index 0000000000..52e15321b7 --- /dev/null +++ b/ThirdParty/SuiteSparse/COLAMD/build/.gitignore @@ -0,0 +1,4 @@ +# Ignore all files except this file. +* +*/ +!.gitignore diff --git a/ThirdParty/SuiteSparse/COLAMD/cmake_modules/FindCOLAMD.cmake b/ThirdParty/SuiteSparse/COLAMD/cmake_modules/FindCOLAMD.cmake new file mode 100644 index 0000000000..00e8a9ac0f --- /dev/null +++ b/ThirdParty/SuiteSparse/COLAMD/cmake_modules/FindCOLAMD.cmake @@ -0,0 +1,129 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/COLAMD/cmake_modules/FindCOLAMD.cmake +#------------------------------------------------------------------------------- + +# The following copyright and license applies to just this file only, not to +# the library itself: +# FindCOLAMD.cmake, Copyright (c) 2022-2023, Timothy A. Davis. All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# Finds the COLAMD include file and compiled library and sets: + +# COLAMD_INCLUDE_DIR - where to find colamd.h +# COLAMD_LIBRARY - dynamic COLAMD library +# COLAMD_STATIC - static COLAMD library +# COLAMD_LIBRARIES - libraries when using COLAMD +# COLAMD_FOUND - true if COLAMD found + +# set ``COLAMD_ROOT`` to a COLAMD installation root to +# tell this module where to look. + +# All the Find*.cmake files in SuiteSparse are installed by 'make install' into +# /usr/local/lib/cmake/SuiteSparse (where '/usr/local' is the +# ${CMAKE_INSTALL_PREFIX}). To access this file, place the following commands +# in your CMakeLists.txt file. See also SuiteSparse/Example/CMakeLists.txt: +# +# set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} +# ${CMAKE_INSTALL_PREFIX}/lib/cmake/SuiteSparse ) + +#------------------------------------------------------------------------------- + +# include files for COLAMD +find_path ( COLAMD_INCLUDE_DIR + NAMES colamd.h + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/COLAMD + HINTS ${CMAKE_SOURCE_DIR}/../COLAMD + PATH_SUFFIXES include Include +) + +# dynamic COLAMD library (or static if no dynamic library was built) +find_library ( COLAMD_LIBRARY + NAMES colamd colamd_static + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/COLAMD + HINTS ${CMAKE_SOURCE_DIR}/../COLAMD + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( MSVC ) + set ( STATIC_NAME colamd_static ) +else ( ) + set ( STATIC_NAME colamd ) + set ( save ${CMAKE_FIND_LIBRARY_SUFFIXES} ) + set ( CMAKE_FIND_LIBRARY_SUFFIXES + ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES} ) +endif ( ) + +# static COLAMD library +find_library ( COLAMD_STATIC + NAMES ${STATIC_NAME} + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/COLAMD + HINTS ${CMAKE_SOURCE_DIR}/../COLAMD + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( NOT MSVC ) + # restore the CMAKE_FIND_LIBRARY_SUFFIXES variable + set ( CMAKE_FIND_LIBRARY_SUFFIXES ${save} ) +endif ( ) + +# get version of the library from the dynamic library name +get_filename_component ( COLAMD_LIBRARY ${COLAMD_LIBRARY} REALPATH ) +get_filename_component ( COLAMD_FILENAME ${COLAMD_LIBRARY} NAME ) +string ( + REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" + COLAMD_VERSION + ${COLAMD_FILENAME} +) + +# set ( COLAMD_VERSION "" ) +if ( EXISTS "${COLAMD_INCLUDE_DIR}" AND NOT COLAMD_VERSION ) + # if the version does not appear in the filename, read the include file + file ( STRINGS ${COLAMD_INCLUDE_DIR}/colamd.h COLAMD_MAJOR_STR + REGEX "define COLAMD_MAIN_VERSION" ) + file ( STRINGS ${COLAMD_INCLUDE_DIR}/colamd.h COLAMD_MINOR_STR + REGEX "define COLAMD_SUB_VERSION" ) + file ( STRINGS ${COLAMD_INCLUDE_DIR}/colamd.h COLAMD_PATCH_STR + REGEX "define COLAMD_SUBSUB_VERSION" ) + message ( STATUS "major: ${COLAMD_MAJOR_STR}" ) + message ( STATUS "minor: ${COLAMD_MINOR_STR}" ) + message ( STATUS "patch: ${COLAMD_PATCH_STR}" ) + string ( REGEX MATCH "[0-9]+" COLAMD_MAJOR ${COLAMD_MAJOR_STR} ) + string ( REGEX MATCH "[0-9]+" COLAMD_MINOR ${COLAMD_MINOR_STR} ) + string ( REGEX MATCH "[0-9]+" COLAMD_PATCH ${COLAMD_PATCH_STR} ) + set (COLAMD_VERSION "${COLAMD_MAJOR}.${COLAMD_MINOR}.${COLAMD_PATCH}") +endif ( ) + +set (COLAMD_LIBRARIES ${COLAMD_LIBRARY}) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args ( COLAMD + REQUIRED_VARS COLAMD_LIBRARY COLAMD_INCLUDE_DIR + VERSION_VAR COLAMD_VERSION +) + +mark_as_advanced ( + COLAMD_INCLUDE_DIR + COLAMD_LIBRARY + COLAMD_STATIC + COLAMD_LIBRARIES +) + +if ( COLAMD_FOUND ) + message ( STATUS "COLAMD version: ${COLAMD_VERSION}" ) + message ( STATUS "COLAMD include: ${COLAMD_INCLUDE_DIR}" ) + message ( STATUS "COLAMD library: ${COLAMD_LIBRARY}" ) + message ( STATUS "COLAMD static: ${COLAMD_STATIC}" ) +else ( ) + message ( STATUS "COLAMD not found" ) + set ( COLAMD_INCLUDE_DIR "" ) + set ( COLAMD_LIBRARIES "" ) + set ( COLAMD_LIBRARY "" ) + set ( COLAMD_STATIC "" ) +endif ( ) + diff --git a/ThirdParty/SuiteSparse/CONTRIBUTING.md b/ThirdParty/SuiteSparse/CONTRIBUTING.md new file mode 100644 index 0000000000..a81e104cf1 --- /dev/null +++ b/ThirdParty/SuiteSparse/CONTRIBUTING.md @@ -0,0 +1,18 @@ +# Contributing to SuiteSparse + +To add an issue for a bug report (gasp!) or a feature request, +you can use the issue tracker on github.com, at +[`https://github.com/DrTimothyAldenDavis/SuiteSparse/issues`] +(https://github.com/DrTimothyAldenDavis/SuiteSparse/issues). + +To contribute code, you can submit a pull request. To do so, +you must first agree to the Contributor License Agreement +[`CONTRIBUTOR-LICENSE.txt`](CONTRIBUTOR-LICENSE.txt). +Print a copy of the txt file (as a PDF), sign and date it, +and email it to me at DrTimothyAldenDavis@gmail.com. Pull +requests will only be included into SuiteSparse after I receive +your email with the signed PDF. + +Do not submit a pull request to the default branch. +Instead, use the dev or dev2 branches. + diff --git a/ThirdParty/SuiteSparse/CONTRIBUTOR-LICENSE.txt b/ThirdParty/SuiteSparse/CONTRIBUTOR-LICENSE.txt index cc0fe876cd..7cd19eec69 100644 --- a/ThirdParty/SuiteSparse/CONTRIBUTOR-LICENSE.txt +++ b/ThirdParty/SuiteSparse/CONTRIBUTOR-LICENSE.txt @@ -164,3 +164,14 @@ Us Timothy A. Davis, and all SuiteSparse co-authors (varies according to the SuiteSparse package) + +You: + + Your Name (printed): + + + Your Signature: + + + Date: + diff --git a/ThirdParty/SuiteSparse/CSparse_to_CXSparse b/ThirdParty/SuiteSparse/CSparse_to_CXSparse deleted file mode 100755 index 21be29b216..0000000000 --- a/ThirdParty/SuiteSparse/CSparse_to_CXSparse +++ /dev/null @@ -1,342 +0,0 @@ -#! /usr/bin/perl -# Constructs the CXSparse package from CSparse, adding four different sets of -# functions (int/cs_long_t, and double/complex). Backward compatible -# with CSparse. No MATLAB interface is provided for CXSparse, however. -# -# To create CXSparse from CSparse, the ./CXSparse directory should not (yet) -# exist. Use the following commands, where CSparse is the CSparse directory: -# -# ./CSparse_to_CXSparse CSparse CXSparse CXSparse_newfiles.tar.gz -# cd CXSparse/Demo -# make > cs_demo.out -# -# Alternatively, use "make cx" in the SuiteSparse directory. -# -# Created by David Bateman, Feb. 2006, David dot Bateman atsign motorola dot -# com, and released by him to Tim Davis' copyright. Modified by Tim Davis, -# 2006-2012, http://www.suitesparse.com. - -use strict; -use Cwd; -use File::Find; -use File::Basename; -use Text::Wrap; -use FileHandle; -use IPC::Open3; - -my $in_dir = @ARGV[0]; -my $out_dir = @ARGV[1]; -my $tar_file = @ARGV[2]; - -#------------------------------------------------------------------------------- -# copy all files from CSparse to CXSparse -#------------------------------------------------------------------------------- - -system ("cp -pr $in_dir $out_dir") ; - -#------------------------------------------------------------------------------- -# Add the new files from the tar file given by the third argument -#------------------------------------------------------------------------------- - -my $old_pwd = cwd(); -chdir($out_dir); -system ("tar xpBvzf $old_pwd/$tar_file"); -chdir($old_pwd); - -#------------------------------------------------------------------------------- -# Convert Demo/* files -#------------------------------------------------------------------------------- - -# convert demo *.[ch] files into the four different versions (di, dl, ci, cl) -my @demo_files = ('demo1.c', 'demo2.c', 'demo3.c', 'demo.c', 'demo.h') ; - -foreach my $fff ( @demo_files ) -{ - my $infile = sprintf ("%s/Demo/cs_%s", $in_dir, $fff) ; - - # create the plain version - my $outfile = sprintf ("%s/Demo/cs_%s", $out_dir, $fff) ; - printf ("%s to %s\n", $infile, $outfile) ; - if (open (OUT, ">$outfile")) - { - if (open (IN, $infile)) - { - while () - { - # change csi to int - s/\bcsi\b/int/g; - print OUT $_; - } - close (IN); - } - close (OUT); - } - - # create di version - my $outfile = sprintf ("%s/Demo/cs_di_%s", $out_dir, $fff) ; - printf ("%s to %s\n", $infile, $outfile) ; - if (open (OUT, ">$outfile")) - { - if (open (IN, $infile)) - { - while () - { - # change csi to int - s/\bcsi\b/int/g; - # change all "cs*" names to "cs_di*", except #include "cs.h" - s/\bcs/cs_di/g ; - s/cs_di\.h/cs.h/ ; - print OUT $_; - } - close (IN); - } - close (OUT); - } - - # create dl version - my $outfile = sprintf ("%s/Demo/cs_dl_%s", $out_dir, $fff) ; - printf ("%s to %s\n", $infile, $outfile) ; - if (open (OUT, ">$outfile")) - { - if (open (IN, $infile)) - { - while () - { - # change csi to cs_long_t - s/\bcsi\b/cs_long_t/g; - # change all "cs*" names to "cs_dl*", except #include "cs.h" - s/\bcs/cs_dl/g ; - s/cs_dl_long_t/cs_long_t/g; - s/cs_dl\.h/cs.h/ ; - print OUT $_; - } - close (IN); - } - close (OUT); - } - - # create ci version - my $outfile = sprintf ("%s/Demo/cs_ci_%s", $out_dir, $fff) ; - printf ("%s to %s\n", $infile, $outfile) ; - if (open (OUT, ">$outfile")) - { - if (open (IN, $infile)) - { - while () - { - # change csi to int - s/\bcsi\b/int/g; - # change all "cs*" names to "cs_ci*", except #include "cs.h" - s/\bcs/cs_ci/g ; - s/cs_ci_long_t/cs_long_t/g; - s/cs_ci\.h/cs.h/ ; - # fabs becomes cabs - s/fabs/cabs/g; - # change double to cs_complex_t - s/\bdouble\b/cs_complex_t/g; - # (double) typecasts stay double - s/\(cs_complex_t\) /(double) /g; - # tic, toc, tol, and norm are double, not cs_complex_t - s/cs_complex_t norm/double norm/; - s/cs_complex_t tic/double tic/; - s/cs_complex_t toc \(cs_complex_t/double toc (double/; - s/cs_complex_t s = tic/double s = tic/; - s/cs_complex_t tol/double tol/; - # cumsum, S->lnz, S->unz are double - s/cs_complex_t lnz/double lnz/; - s/cs_complex_t unz/double unz/; - s/cs_complex_t cs_cumsum/double cs_cumsum/; - # local variable declarations that stay double - s/, / ;\n double / ; - print OUT $_; - } - close (IN); - } - close (OUT); - } - - # create cl version - my $outfile = sprintf ("%s/Demo/cs_cl_%s", $out_dir, $fff) ; - printf ("%s to %s\n", $infile, $outfile) ; - if (open (OUT, ">$outfile")) - { - if (open (IN, $infile)) - { - while () - { - # change csi to cs_long_t - s/\bcsi\b/cs_long_t/g; - # change all "cs*" names to "cs_cl*", except #include "cs.h" - s/\bcs/cs_cl/g ; - s/cs_cl_long_t/cs_long_t/g; - s/cs_cl\.h/cs.h/ ; - # fabs becomes cabs - s/fabs/cabs/g; - # change double to cs_complex_t - s/\bdouble\b/cs_complex_t/g; - # (double) typecasts stay double - s/\(cs_complex_t\) /(double) /g; - # tic, toc, tol, and norm are double, not cs_complex_t - s/cs_complex_t norm/double norm/; - s/cs_complex_t tic/double tic/; - s/cs_complex_t toc \(cs_complex_t/double toc (double/; - s/cs_complex_t s = tic/double s = tic/; - s/cs_complex_t tol/double tol/; - # cumsum, S->lnz, S->unz are double - s/cs_complex_t lnz/double lnz/; - s/cs_complex_t unz/double unz/; - s/cs_complex_t cs_cumsum/double cs_cumsum/; - # local variable declarations that stay double - s/, / ;\n double / ; - print OUT $_; - } - close (IN); - } - close (OUT); - } -} - -#------------------------------------------------------------------------------- -# Convert Source/*.c files (except cs_house.c, cs_print.c, and cs_load.c) -#------------------------------------------------------------------------------- - -# note that cs.h, cs_house.c, cs_updown.c, ... -# are not included in this list -my @src_files = ('Source/cs_add.c', 'Source/cs_amd.c', 'Source/cs_chol.c', - 'Source/cs_cholsol.c', 'Source/cs_counts.c', 'Source/cs_cumsum.c', - 'Source/cs_dfs.c', 'Source/cs_dmperm.c', 'Source/cs_droptol.c', - 'Source/cs_dropzeros.c', 'Source/cs_dupl.c', 'Source/cs_entry.c', - 'Source/cs_etree.c', 'Source/cs_fkeep.c', 'Source/cs_gaxpy.c', - 'Source/cs_happly.c', 'Source/cs_ipvec.c', - 'Source/cs_lsolve.c', 'Source/cs_ltsolve.c', 'Source/cs_lu.c', - 'Source/cs_lusol.c', 'Source/cs_malloc.c', 'Source/cs_maxtrans.c', - 'Source/cs_multiply.c', 'Source/cs_norm.c', 'Source/cs_permute.c', - 'Source/cs_pinv.c', 'Source/cs_post.c', - 'Source/cs_pvec.c', 'Source/cs_qr.c', 'Source/cs_qrsol.c', - 'Source/cs_scatter.c', 'Source/cs_scc.c', 'Source/cs_schol.c', - 'Source/cs_sqr.c', 'Source/cs_symperm.c', 'Source/cs_tdfs.c', - 'Source/cs_transpose.c', 'Source/cs_compress.c', - 'Source/cs_usolve.c', 'Source/cs_util.c', 'Source/cs_utsolve.c', - 'Source/cs_reach.c', 'Source/cs_spsolve.c', 'Source/cs_leaf.c', - 'Source/cs_ereach.c', 'Source/cs_randperm.c' ) ; - -foreach my $file ( @src_files ) -{ - my $infile = sprintf ("%s/%s", $in_dir, $file) ; - my $outfile = sprintf ("%s/%s", $out_dir, $file) ; - my $fbase = basename($file,('.c')); - - if (open(OUT,">$outfile")) - { - if (open(IN,$infile)) - { - # my $qrsol_beta_seen = 0; - while () - { - - # change the name of the package (for cs_print.c) - s/CSparse/CXSparse/g; - - # fabs becomes CS_ABS - s/fabs/CS_ABS/g; - - # change csi to CS_INT - s/\bcsi\b/CS_INT/g; - - # change double to CS_ENTRY - s/\bdouble\b/CS_ENTRY/g; - - # (double) and (double *) typecasts stay double, - # tol and vnz for cs_vcount stays double - s/\(CS_ENTRY\) /(double) /g; - s/\(CS_ENTRY \*\) /(double \*) /; - s/CS_ENTRY tol/double tol/; - s/CS_ENTRY \*vnz/double \*vnz/; - - # local variable declarations that stay double - s/, / ;\n double / ; - - #--------------------------------------------------------------- - # Special cases. Some undo changes made above. - #--------------------------------------------------------------- - - # cs_mex.c - if ($fbase =~ /cs_mex/) - { - s/matrix must be CS_ENTRY/matrix must be double/; - s/A->p =/A->p = (CS_INT *)/; - s/A->i =/A->i = (CS_INT *)/; - s/, A->p/, (mwIndex *) A->p/; - s/, A->i/, (mwIndex *) A->i/; - } - - # fix comments in cs_add_mex.c and cs_permute_mex.c - if ($fbase =~ /cs_add_mex/ || $fbase =~ /cs_permute_mex/) - { - s/via CS_ENTRY transpose/via double transpose/; - } - - # cs_chol - if ($fbase =~ /cs_chol/) - { - s/\(d <= 0\)/(CS_REAL (d) <= 0 || CS_IMAG (d) != 0)\n\t /; - s/lki \* lki/lki * CS_CONJ (lki)/; - s/ = lki/ = CS_CONJ (lki)/; - } - - # cs_norm - if ($fbase =~ /cs_norm/) - { - s/^CS_ENTRY cs_norm/double cs_norm/; - } - - # cs_cumsum - if ($fbase =~ /cs_cumsum/) - { - s/CS_ENTRY/double/; - } - - # cs_transpose - if ($fbase =~ /cs_transpose/) - { - s/Ax \[p\]/(values > 0) ? CS_CONJ (Ax [p]) : Ax [p]/; - } - - # cs_symperm - if ($fbase =~ /cs_symperm/) - { - s/Ax \[p\]/(i2 <= j2) ? Ax [p] : CS_CONJ (Ax [p])/; - } - - # cs_qr - if ($fbase =~ /cs_qr/) - { - s/n, sizeof \(CS_ENTRY\)/n, sizeof (double)/; - } - - # cs_happly - if ($fbase =~ /cs_happly/) - { - s/^(.*tau.*)(Vx\s*\[p\])/$1CS_CONJ ($2)/; - s/CS_ENTRY beta/double beta/; - } - - # cs_ltsolve - if ($fbase =~ /cs_ltsolve/) - { - s/(Lx \[.*?\])(\s+[\*;])/CS_CONJ ($1)$2/; - } - - # cs_utsolve - if ($fbase =~ /cs_utsolve/) - { - s/(Ux \[.*?\])(\s+[\*;])/CS_CONJ ($1)$2/; - } - - print OUT $_; - } - close (IN); - } - close (OUT); - } -} diff --git a/ThirdParty/SuiteSparse/ChangeLog b/ThirdParty/SuiteSparse/ChangeLog index 8546812983..06fe8950bc 100644 --- a/ThirdParty/SuiteSparse/ChangeLog +++ b/ThirdParty/SuiteSparse/ChangeLog @@ -1,3 +1,201 @@ +Jan 20, 2023: version 7.0.1 + + * GraphBLAS v7.4.3: debug was left on in GrB_Matrix_removeElement + +Jan 17, 2023: version 7.0.0 + + * SuiteSparse_config: now v7.0.0 + * SuiteSparse_config struct: removed from external visibility to simplify + the Windows build, so that no global data is externally visible. + This requires a major version number increase from v6.x to v7.x for the + SuiteSparse meta-package (which has the same version number as + SuiteSparse_config). Added get/set methods to SuiteSparse_config to + access the contents of the struct. + * NFORTRAN: option added to ignore any Fortran methods, even if a Fortran + compiler is available. + * port of new cmake-based build system to Windows + * UMFPACK 6.1.0: copy/serialize/deserialize methods: added new methods to + copy, serialize, and deserialize the Numeric and Symbolic objects. By + Will Kimmerer, revised by T. Davis. + +Dec 29, 2022: SuiteSparse 6.0.4 + + * NFORTRAN: option added to disable Fortran entirely + * GraphBLAS v7.4.1: global free pool disabled, and GrB_mxm heuristics + revised. + +Dec 23, 2022: SuiteSparse 6.0.3 + + * GraphBLAS v7.4.0: added non-va_arg get/set methods. + * Mongoose v3.0.3: change in build for test coverage + +Dec 9, 2022: SuiteSparse 6.0.2 + + * minor change to build system for nearly all packages: (except CSparse, + ssget, and MATLAB_Tools): allows static linkage of all libraries. + Fortran no longer required. + * AMD 3.0.2: Fortran no longer required (amd.f and amdbar.f skipped); + minor change to build system + * BTF 2.0.2: minor change to build system + * CAMD 3.0,2: minor change to build system + * CCOLAMD 3.0.2: minor change to build system + * CHOLMOD 4.0.2: Fortran no longer required; minor change to build system + * CXSparse 4.0.2: minor change to build system + * GPUQREngine 2.0.2: minor change to build system + * GraphBLAS 7.3.3: -latomic added if needed, using ANSI C11 atomic functions + for gcc (atomic_compare_exachange_weak instead of __atomic_* variants), + chunk factor revised for GrB_mxm (generic saxpy3 method); + minor change to build system + * KLU 2.0.2: Fortran no longer required; minor change to build system + * LDL 3.0.2: minor change to build system + * Mongoose 3.0.2: fixed matrix download in python test scripts (no change + to the compiled library itself, other than the version/date); + minor change to build system + * RBio 3.0.2: minor change to build system + * SPEX 2.0.2: minor change to build system + * SPQR 3.0.2: Fortran no longer required; minor change to build system + * SuiteSparse_GPURuntime 2.0.2: minor change to build system + * SuiteSparse_config 6.0.2: override C-to-Fortran interface handling if + no Fortran compiler found; minor change to build system + * UMFPACK 6.0.2: Fortran no longer required; minor change to build system + * Example: simple package that illustrates how to use SuiteSparse + Find*.cmake modules in cmake. + * not changed from SuiteSparse v6.0.1: ssget, CSparse, MATLAB_Tools + +Nov 12, 2022: SuiteSparse 6.0.1 + + * BLAS: C prototypes for the Fortan BLAS were unintentionally exposed to + the user application. Removed. If you want to use them, see the + instructions in SuiteSparse_config.h. + +Nov 12, 2022: SuiteSparse 6.0.0 + + * major update: using CMake build system for all packages + * CMake Find*: all packages now have a Find*.cmake. See + SuiteSparse_config/cmake_modules. + * integers: int (32-bit) and SuiteSparse_long (nominally 64-bit) replaced + with int32_t and int64_t. The SuiteSparse_long #define has been + deprecated and removed. Replace its use with int64_t in any code that + uses SuiteSparse v6.0.0 or later. This is unlikely to change any + use of any SuiteSparse package, but since it's possible that + SuiteSparse_long was 32-bits on some platforms, the SO_VERSIION of + all packages has been increased by one. + * UMFPACK: new options to support ParU. Single umfpack.h include file. + * CHOLMOD: Single cholmod.h include file. + * SuiteSparse/metis-5.1.0: now embedded into CHOLMOD, in a different + name space. No longer an independent library. + * SPDX License Identifier: added to each file. No change in license. + * BLAS/LAPACK interface: now supports any Fortran BLAS/LAPACK, with + either 32-bit (default) or 64-bit integers, via FindBLAS.cmake. + * SPEX: replaces SLIP_LU + +Aug 25, 2022, SuiteSparse 5.13.0 + + * GraphBLAS v7.2.0: see GraphBLAS/Doc/ChangeLog for details. + * performance: more compact serialization (ZSTD added, now the + default compression method). + * MATLAB interface: faster linear indexing, reshape, bandwidth, + istril, istriu, isbanded, isdiag. C(I,J)=A can now grow the + size of C. + * features: reshape methods, cube root operator, isStoredElement + * bugs: a minor bug; user-defined types were incorrectly limited to + 128 bytes in size in v7.0.3. + +Apr 10, 2022, SuiteSparse 5.12.0 + + * GraphBLAS v7.0.3: see GraphBLAS/Doc/ChangeLog for details. + * performance: GrB_mxm, GrB_assign, and transpose + * bug fix: vector iterator for bitmap + * revised ACM TOMS submission: Doc/toms_parallel_grb2.pdf + * spec bug: GrB_Matrix_diag was implemented incorrectly, + thus requiring a version v7.x + +Mar 14, 2022, SuiteSparse 5.11.0 + + * GraphBLAS v6.2.5: see GraphBLAS/Doc/ChangeLog for changes. + Primary ones highlighted here: + * v2.0 API: v6.x complies with the v2.0 C API of the GraphBLAS Spec. + Note that GrB_wait, GrB_Info are now different than in the v1.3 + C API Specification (and in v5.x of SuiteSparse:GraphBLAS). + * GxB_Iterator: to iterate over rows/cols/entries of a matrix or vector + * GxB_eWiseUnion: like eWiseAdd but with the op always applied + * GxB_Matrix/Vector_sort: to sort the vectors of a matrix + * better performance: for sparse-times-dense and dense-times-sparse, + in particular; also other cases for GrB_mxm, up to 10x faster. + * Apple Silicon: port @GrB to Octave 7 (thanks to Gabor Szarnyas) + * added cpu_features: by Google + * added LZ4/LZ4HC: compression library, http://www.lz4.org (BSD 2), + v1.9.3, Copyright (c) 2011-2016, Yann Collet, All Rights Reserved. + * iso-valued matrices and vectors: to exploit the common case of + an unweighted graph + * bug fixes: 4 bugs fixed since SuiteSparse 5.10.1 with + GraphBLAS v5.0.5. 12 other bugs appeared in the interim but + appeared in versions after v5.0.5 but fixed before ever + affecting SuiteSparse itself. + +May 17, 2021, SuiteSparse 5.10.1 + + * CUDA: remove sm_30 from SuiteSparse_config.mk + * GraphBLAS v5.0.5: minor bug fix + * minor changes to Makefiles + +May 16, 2021, SuiteSparse 5.10.0 + + * GraphBLAS v5.0.4: many new features, much faster performance + +Mar 3, 2021, SuiteSparse 5.9.0 + + * GraphBLAS v4.0.3: many new features, much faster performance + +July 14, 2020, SuiteSparse 5.8.1 + + * SLIP_LU v1.0.2: resolved issue #51 + * GraphBLAS v3.3.3: bug fix (GraphBLAS issue #13) + +July 2, 2020, SuiteSparse 5.8.0 + + * SLIP_LU v1.0.1 added: for solving Ax=b exactly. Requires + the GNU GMP and MPRF libraries. + * GraphBLAS v3.3.1: see the GraphBLAS/Doc/Changlog + * replaced UFget with ssget: affects nearly all packages: + UMFPACK, KLU, CHOLMOD, CXSparse/CSparse, etc, + but their version numbers are left unchanged since it affects + the MATLAB tests only, not the compiled libraries. + * ssget v2.2.0: better URL redirects + * updates to SuiteSparse build system + +Apr 8, 2020, SuiteSparse 5.7.2 + + * GraphBLAS v3.2.2: port to Microsoft Windows (with MS Visual Studio) + +Feb 20, 2020, SuiteSparse 5.7.1 + + * SuiteSparse_config: update version number + * Makefile: fixed install issue with README.txt + +Feb 20, 2020, SuiteSparse 5.7.0 + + * GraphBLAS 3.2.0: better performance, new ANY and PAIR operators, + structural mask, GrB_DESC_* from 1.3 C API Specification. + * CHOLMOD 3.0.14: minor update to cholmod_check to print a matrix + * added: CONTRIBUTIING.md, CODE_OF_CONDUCT.md, README.md. + +Oct 21, 2019, SuiteSparse 5.6.0 + + * GraphBLAS 3.1.1: OpenMP parallelism and MATLAB interface + +Oct 20, 2019, SuiteSparse 5.5.0 + + * GraphBLAS 2.3.5: Collected Algorithm of the ACM + * UMFPACK 5.7.9: fix for compiling in MATLAB R2018b; BLAS library + * SPQR, CHOLMOD: fix to *_make.m for compiling in MATLAB; same version + * KLU: fix to Tcov/Makefile; no change to version number + * CXSparse 3.2.0: version was incorrect in CXSparse/Include/cs.h; + the corresponding CSparse v3.2.0 had the correct version information + in its cs.h include file. + * ssget and MATLAB_Tools/SuiteSparseCollection: update to sparse.tamu.edu + * Mongoose 2.0.4: update to sparse.tamu.edu + Dec 28, 2018: SuiteSparse 5.4.0 * GraphBLAS 2.2.2: many upgrades and new features, a few bug fixes diff --git a/ThirdParty/SuiteSparse/Contents.m b/ThirdParty/SuiteSparse/Contents.m deleted file mode 100644 index af9e7978a0..0000000000 --- a/ThirdParty/SuiteSparse/Contents.m +++ /dev/null @@ -1,151 +0,0 @@ -% Welcome to SuiteSparse : a Suite of Sparse matrix packages, containing a -% collection of sparse matrix packages authored or co-authored by Tim Davis. -% Only the primary MATLAB functions are listed below. -% -% Example: -% SuiteSparse_install -% compiles and installs all of SuiteSparse, and runs several demos and tests. -% -%------------------------------------------------------------------------------- -% Ordering methods and graph partitioners: -%------------------------------------------------------------------------------- -% -% amd2 - approximate minimum degree ordering. -% colamd2 - column approximate minimum degree ordering. -% symamd2 - symmetrix approximate min degree ordering based on colamd. -% camd - constrained amd. -% ccolamd - constrained colamd. -% csymamd - constrained symamd. -% edgecut - Mongoose graph partitioner -% -%------------------------------------------------------------------------------- -% CHOLMOD: a sparse supernodal Cholesky update/downdate package: -%------------------------------------------------------------------------------- -% -% cholmod2 - computes x=A\b when A is symmetric and positive definite. -% chol2 - same as MATLAB chol(sparse(A)), just faster. -% lchol - computes an LL' factorization. -% ldlchol - computes an LDL' factorization. -% ldlupdate - updates an LDL' factorization. -% resymbol - recomputes symbolic LL or LDL' factorization. -% ldlsolve - solves Ax=b using an LDL' factorization. -% ldlsplit - splits LD into L and D. -% metis - interface to METIS node-nested-dissection. -% nesdis - interface to CHOLMOD's nested-dissection (based on METIS). -% septree - prune a separator tree. -% bisect - interface to METIS' node bisector. -% analyze - order and analyze using CHOLMOD. -% etree2 - same as MATLAB "etree", just faster and more reliable. -% sparse2 - same as MATLAB "sparse", just faster. -% symbfact2 - same as MATLAB "symbfact", just faster and more reliable. -% sdmult - same as MATLAB S*F or S'*F (S sparse, F full), just faster. -% ldl_normest - compute error in LDL' factorization. -% lu_normest - compute error in LU factorization. -% mread - read a sparse matrix in Matrix Market format -% mwrite - write a sparse matrix in Matrix Market format -% spsym - determine the symmetry of a sparse matrix -% -%------------------------------------------------------------------------------- -% CSPARSE / CXSPARSE: a Concise Sparse matrix package: -%------------------------------------------------------------------------------- -% -% Matrices used in CSparse must in general be either sparse and real, or -% dense vectors. Ordering methods can accept any sparse matrix. CXSparse -% supports complex matrices and 64-bit MATLAB; it is installed by default. -% -% cs_add - sparse matrix addition. -% cs_amd - approximate minimum degree ordering. -% cs_chol - sparse Cholesky factorization. -% cs_cholsol - solve A*x=b using a sparse Cholesky factorization. -% cs_counts - column counts for sparse Cholesky factor L. -% cs_dmperm - maximum matching or Dulmage-Mendelsohn permutation. -% cs_dmsol - x=A\b using the coarse Dulmage-Mendelsohn decomposition. -% cs_dmspy - plot the Dulmage-Mendelsohn decomposition of a matrix. -% cs_droptol - remove small entries from a sparse matrix. -% cs_esep - find an edge separator of a symmetric matrix A -% cs_etree - elimination tree of A or A'*A. -% cs_gaxpy - sparse matrix times vector. -% cs_lsolve - solve a sparse lower triangular system L*x=b. -% cs_ltsolve - solve a sparse upper triangular system L'*x=b. -% cs_lu - sparse LU factorization, with fill-reducing ordering. -% cs_lusol - solve Ax=b using LU factorization. -% cs_make - compiles CSparse for use in MATLAB. -% cs_multiply - sparse matrix multiply. -% cs_nd - generalized nested dissection ordering. -% cs_nsep - find a node separator of a symmetric matrix A. -% cs_permute - permute a sparse matrix. -% cs_print - print the contents of a sparse matrix. -% cs_qr - sparse QR factorization. -% cs_qleft - apply Householder vectors on the left. -% cs_qright - apply Householder vectors on the right. -% cs_qrsol - solve a sparse least-squares problem. -% cs_randperm - random permutation. -% cs_sep - convert an edge separator into a node separator. -% cs_scc - strongly-connected components of a square sparse matrix. -% cs_scc2 - cs_scc, or connected components of a bipartite graph. -% cs_sparse - convert a triplet form into a sparse matrix. -% cs_sqr - symbolic sparse QR factorization. -% cs_symperm - symmetric permutation of a symmetric matrix. -% cs_transpose - transpose a sparse matrix. -% cs_updown - rank-1 update/downdate of a sparse Cholesky factorization. -% cs_usolve - solve a sparse upper triangular system U*x=b. -% cs_utsolve - solve a sparse lower triangular system U'*x=b. -% cspy - plot a sparse matrix in color. -% ccspy - plot the connected components of a matrix. -% -%------------------------------------------------------------------------------- -% LDL: Sparse LDL factorization: -%------------------------------------------------------------------------------- -% -% ldlsparse - LDL' factorization of a real, sparse, symmetric matrix. -% ldlrow - an m-file description of the algorithm used by LDL. -% -%------------------------------------------------------------------------------- -% UMFPACK: the Unsymmetric MultiFrontal Package: -%------------------------------------------------------------------------------- -% -% umfpack2 - computes x=A\b, x=A/b, or lu (A) for a sparse matrix A -% umfpack_details - details on all the options for using umfpack in MATLAB -% umfpack_report - prints optional control settings and statistics -% umfpack_btf - factorize A using a block triangular form -% umfpack_solve - x = A\b or x = b/A -% lu_normest - estimates norm (L*U-A,1) without forming L*U-A -% (duplicate of CHOLMOD/lu_normest, for completeness) -% luflop - given L and U, computes # of flops required -% -%------------------------------------------------------------------------------- -% SuiteSparseQR: multifrontal rank-revealing sparse QR -%------------------------------------------------------------------------------- -% -% spqr - sparse QR -% spqr_solve - x=A\b using SuiteSparseQR -% spqr_qmult - y=Q*x, Q'*x, x*Q, or x*Q' using Q in Householder form -% -%------------------------------------------------------------------------------- -% Other packages: -%------------------------------------------------------------------------------- -% -% MATLAB_Tools various MATLAB tools, most in M, some as C mexFunctions: -% -% ssmult sparse matrix times sparse matrix -% meshnd nested dissection of regular 2D and 3D meshes -% linfactor solve Ax=b using LU or CHOL -% dimacs10 MATLAB interface for the DIMACS10 collection -% factorize object-oriented system solver -% sparseinv sparse inverse subset -% spqr_rank toolbox for sparse rank-deficient matrices -% -% SuiteSparseCollection for managing the SuiteSparse Matrix Collection -% RBio for reading/writing Rutherford/Boeing sparse matrices -% ssget MATLAB interface to the SuiteSparse Matrix Collection -% GraphBLAS graph algorithms via sparse linear algebra (graphblas.org), -% does not yet have a MATLAB interface -% -%------------------------------------------------------------------------------- -% -% For help on compiling SuiteSparse or the demos, testing functions, etc., -% please see the help for each individual package. -% -% Copyright 2018, Timothy A. Davis, http://www.suitesparse.com. - -help SuiteSparse diff --git a/ThirdParty/SuiteSparse/KLU/CMakeLists.txt b/ThirdParty/SuiteSparse/KLU/CMakeLists.txt new file mode 100644 index 0000000000..f2e88576e3 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/CMakeLists.txt @@ -0,0 +1,309 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/KLU/CMakeLists.txt: cmake for KLU +#------------------------------------------------------------------------------- + +# KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +# Authors: Timothy A. Davis and Ekanathan Palamadai. +# SPDX-License-Identifier: LGPL-2.1+ + +#------------------------------------------------------------------------------- +# get the version +#------------------------------------------------------------------------------- + +cmake_minimum_required ( VERSION 3.19 ) + +set ( KLU_DATE "Jan 17, 2023" ) +set ( KLU_VERSION_MAJOR 2 ) +set ( KLU_VERSION_MINOR 0 ) +set ( KLU_VERSION_SUB 3 ) + +message ( STATUS "Building KLU version: v" + ${KLU_VERSION_MAJOR}. + ${KLU_VERSION_MINOR}. + ${KLU_VERSION_SUB} " (" ${KLU_DATE} ")" ) + +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${CMAKE_SOURCE_DIR}/cmake_modules + ${CMAKE_SOURCE_DIR}/../BTF/cmake_modules + ${CMAKE_SOURCE_DIR}/../AMD/cmake_modules + ${CMAKE_SOURCE_DIR}/../COLAMD/cmake_modules + ${CMAKE_SOURCE_DIR}/../CAMD/cmake_modules + ${CMAKE_SOURCE_DIR}/../CCOLAMD/cmake_modules + ${CMAKE_SOURCE_DIR}/../CHOLMOD/cmake_modules + ${CMAKE_SOURCE_DIR}/../SuiteSparse_config/cmake_modules ) + +include ( SuiteSparsePolicy ) + +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( klu + VERSION "${KLU_VERSION_MAJOR}.${KLU_VERSION_MINOR}.${KLU_VERSION_SUB}" + LANGUAGES C ) + +#------------------------------------------------------------------------------- +# find library dependencies +#------------------------------------------------------------------------------- + +find_package ( SuiteSparse_config 7.0.0 REQUIRED ) +find_package ( BTF 2.0.3 REQUIRED ) +find_package ( COLAMD 3.0.3 REQUIRED ) +find_package ( AMD 3.0.3 REQUIRED ) + +option ( NCHOLMOD "ON: do not use CHOLMOD. OFF (default): use CHOLMOD" off ) + +if ( NOT NCHOLMOD ) + # look for CHOLMOD (optional fill-reducing orderings) + find_package ( CHOLMOD 4.0.3 ) + find_package ( CHOLMOD_CUDA 4.0.3 ) + # look for CHOLMOD's dependencies: AMD and COLAMD are required. CAMD and + # CCOLAMD are optional, but must be found if CHOLMOD was built with them. + find_package ( CAMD 3.0.3 ) + find_package ( CCOLAMD 3.0.3 ) + if ( NOT CHOLMOD_FOUND OR NOT AMD_FOUND OR NOT COLAMD_FOUND ) + # CHOLMOD not found so disable it + set ( NCHOLMOD true ) + endif ( ) +endif ( ) + +if ( NCHOLMOD ) + # tell KLU that CHOLMOD is not available + message ( STATUS "CHOLMOD not found or not requested" ) + add_compile_definitions ( NCHOLMOD ) +else ( ) + message ( STATUS "Using CHOLMOD for addtional pre-ordering options" ) +endif ( ) + +#------------------------------------------------------------------------------- +# configure files +#------------------------------------------------------------------------------- + +configure_file ( "Config/klu.h.in" + "${PROJECT_SOURCE_DIR}/Include/klu.h" + NEWLINE_STYLE LF ) +configure_file ( "Config/klu_version.tex.in" + "${PROJECT_SOURCE_DIR}/Doc/klu_version.tex" + NEWLINE_STYLE LF ) + +#------------------------------------------------------------------------------- +# include directories +#------------------------------------------------------------------------------- + +include_directories ( Source Include User ${SUITESPARSE_CONFIG_INCLUDE_DIR} + ${AMD_INCLUDE_DIR} ${COLAMD_INCLUDE_DIR} ${BTF_INCLUDE_DIR} ) + +#------------------------------------------------------------------------------- +# dynamic klu library properties +#------------------------------------------------------------------------------- + +file ( GLOB KLU_SOURCES "Source/*.c" ) + +add_library ( klu SHARED ${KLU_SOURCES} ) + +set_target_properties ( klu PROPERTIES + VERSION ${KLU_VERSION_MAJOR}.${KLU_VERSION_MINOR}.${KLU_VERSION_SUB} + C_STANDARD_REQUIRED 11 + SOVERSION ${KLU_VERSION_MAJOR} + PUBLIC_HEADER "Include/klu.h" + WINDOWS_EXPORT_ALL_SYMBOLS ON ) + +#------------------------------------------------------------------------------- +# static klu library properties +#------------------------------------------------------------------------------- + +if ( NOT NSTATIC ) + add_library ( klu_static STATIC ${KLU_SOURCES} ) + + set_target_properties ( klu_static PROPERTIES + VERSION ${KLU_VERSION_MAJOR}.${KLU_VERSION_MINOR}.${KLU_VERSION_SUB} + C_STANDARD_REQUIRED 11 + OUTPUT_NAME klu + SOVERSION ${KLU_VERSION_MAJOR} ) + + if ( MSVC ) + set_target_properties ( klu_static PROPERTIES + OUTPUT_NAME klu_static ) + endif ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# klu_cholmod library properties +#------------------------------------------------------------------------------- + +if ( NOT NCHOLMOD ) + + file ( GLOB KLU_CHOLMOD_SOURCES "User/*.c" ) + + add_library ( klu_cholmod SHARED ${KLU_CHOLMOD_SOURCES} ) + include_directories ( ${CHOLMOD_INCLUDE_DIR} ) + + set_target_properties ( klu_cholmod PROPERTIES + VERSION ${KLU_VERSION_MAJOR}.${KLU_VERSION_MINOR}.${KLU_VERSION_SUB} + C_STANDARD_REQUIRED 11 + SOVERSION ${KLU_VERSION_MAJOR} + PUBLIC_HEADER "User/klu_cholmod.h" ) + + if ( NOT NSTATIC ) + add_library ( klu_cholmod_static STATIC ${KLU_CHOLMOD_SOURCES} ) + + set_target_properties ( klu_cholmod_static PROPERTIES + VERSION ${KLU_VERSION_MAJOR}.${KLU_VERSION_MINOR}.${KLU_VERSION_SUB} + C_STANDARD_REQUIRED 11 + OUTPUT_NAME klu_cholmod + SOVERSION ${KLU_VERSION_MAJOR} ) + + if ( MSVC ) + set_target_properties ( klu_cholmod_static PROPERTIES + OUTPUT_NAME klu_cholmod_static ) + endif ( ) + endif ( ) + +endif ( ) + +#------------------------------------------------------------------------------- +# add the library dependencies +#------------------------------------------------------------------------------- + +# suitesparseconfig: +target_link_libraries ( klu PUBLIC ${SUITESPARSE_CONFIG_LIBRARIES} ) +if ( NOT NSTATIC ) + target_link_libraries ( klu_static PUBLIC ${SUITESPARSE_CONFIG_STATIC} ) +endif ( ) + +# libm: +if ( NOT WIN32 ) + target_link_libraries ( klu PUBLIC m ) + if ( NOT NSTATIC ) + target_link_libraries ( klu_static PUBLIC m ) + endif ( ) +endif ( ) + +# amd: +target_link_libraries ( klu PUBLIC ${AMD_LIBRARIES} ) +if ( NOT NSTATIC ) + target_link_libraries ( klu_static PUBLIC ${AMD_STATIC} ) +endif ( ) + +# colamd: +target_link_libraries ( klu PUBLIC ${COLAMD_LIBRARIES} ) +if ( NOT NSTATIC ) + target_link_libraries ( klu_static PUBLIC ${COLAMD_STATIC} ) +endif ( ) + +# btf: +target_link_libraries ( klu PUBLIC ${BTF_LIBRARIES} ) +if ( NOT NSTATIC ) + target_link_libraries ( klu_static PUBLIC ${BTF_STATIC} ) +endif ( ) + +if ( NOT NCHOLMOD ) + + # cholmod: + # link with CHOLMOD and its dependencies, both required and optional + target_link_libraries ( klu PUBLIC + ${CHOLMOD_LIBRARIES} ${CHOLMOD_CUDA_LIBRARIES} + ${AMD_LIBRARIES} ${COLAMD_LIBRARIES} + ${CAMD_LIBRARIES} ${CCOLAMD_LIBRARIES} ) + target_link_libraries ( klu_cholmod PUBLIC + ${CHOLMOD_LIBRARIES} ${CHOLMOD_CUDA_LIBRARIES} + ${AMD_LIBRARIES} ${COLAMD_LIBRARIES} + ${CAMD_LIBRARIES} ${CCOLAMD_LIBRARIES} ) + if ( NOT NSTATIC ) + target_link_libraries ( klu_static PUBLIC + ${CHOLMOD_STATIC} ${CHOLMOD_CUDA_STATIC} + ${AMD_STATIC} ${COLAMD_STATIC} + ${CAMD_STATIC} ${CCOLAMD_STATIC} ) + target_link_libraries ( klu_cholmod_static PUBLIC + ${CHOLMOD_STATIC} ${CHOLMOD_CUDA_STATIC} + ${AMD_STATIC} ${COLAMD_STATIC} + ${CAMD_STATIC} ${CCOLAMD_STATIC} ) + endif ( ) + + # klu: + target_link_libraries ( klu_cholmod PUBLIC klu ${BTF_LIBRARIES} ) + if ( NOT NSTATIC ) + target_link_libraries ( klu_cholmod_static PUBLIC + klu_static ${BTF_STATIC} ) + endif ( ) + +endif ( ) + +#------------------------------------------------------------------------------- +# KLU installation location +#------------------------------------------------------------------------------- + +install ( TARGETS klu + LIBRARY DESTINATION ${SUITESPARSE_LIBDIR} + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} + RUNTIME DESTINATION ${SUITESPARSE_BINDIR} + PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} ) +install ( FILES + ${CMAKE_SOURCE_DIR}/cmake_modules/FindKLU.cmake + ${CMAKE_SOURCE_DIR}/cmake_modules/FindKLU_CHOLMOD.cmake + DESTINATION ${SUITESPARSE_LIBDIR}/cmake/SuiteSparse + COMPONENT Development ) + +if ( NOT NSTATIC ) + install ( TARGETS klu_static + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} ) +endif ( ) + +if ( NOT NCHOLMOD ) + install ( TARGETS klu_cholmod + LIBRARY DESTINATION ${SUITESPARSE_LIBDIR} + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} + RUNTIME DESTINATION ${SUITESPARSE_BINDIR} + PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} ) + if ( NOT NSTATIC ) + install ( TARGETS klu_cholmod_static + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} ) + endif ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# Demo library and programs +#------------------------------------------------------------------------------- + +option ( DEMO "ON: Build the demo programs. OFF (default): do not build the demo programs." off ) +if ( DEMO ) + + #--------------------------------------------------------------------------- + # demo library + #--------------------------------------------------------------------------- + + message ( STATUS "Also compiling the demos in KLU/Demo" ) + + #--------------------------------------------------------------------------- + # Demo programs + #--------------------------------------------------------------------------- + + add_executable ( klu_simple "Demo/klu_simple.c" ) + if ( NOT NCHOLMOD ) + add_executable ( kludemo "Demo/kludemo.c" ) + add_executable ( kluldemo "Demo/kluldemo.c" ) + endif ( ) + + # Libraries required for Demo programs + target_link_libraries ( klu_simple PUBLIC klu ) + if ( NOT NCHOLMOD ) + target_link_libraries ( kludemo PUBLIC klu_cholmod ) + target_link_libraries ( kluldemo PUBLIC klu_cholmod ) + endif ( ) + +else ( ) + + message ( STATUS "Skipping the demos in KLU/Demo" ) + +endif ( ) + +#------------------------------------------------------------------------------- +# report status +#------------------------------------------------------------------------------- + +include ( SuiteSparseReport ) + diff --git a/ThirdParty/SuiteSparse/include/klu.h b/ThirdParty/SuiteSparse/KLU/Config/klu.h.in similarity index 71% rename from ThirdParty/SuiteSparse/include/klu.h rename to ThirdParty/SuiteSparse/KLU/Config/klu.h.in index 07611f72da..769a82aa6f 100644 --- a/ThirdParty/SuiteSparse/include/klu.h +++ b/ThirdParty/SuiteSparse/KLU/Config/klu.h.in @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === klu include file ===================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu.h: include file for KLU +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Include file for user programs that call klu_* routines */ @@ -34,7 +40,7 @@ typedef struct double *Lnz ; /* size n, but only Lnz [0..nblocks-1] is used */ /* computed for all orderings: */ - int + int32_t n, /* input matrix A is n-by-n */ nz, /* # entries in input matrix */ *P, /* size n */ @@ -43,11 +49,11 @@ typedef struct nzoff, /* nz in off-diagonal blocks */ nblocks, /* number of blocks */ maxblock, /* size of largest block */ - ordering, /* ordering used (AMD, COLAMD, or GIVEN) */ + ordering, /* ordering used (0:AMD, 1:COLAMD, 2:given, ... */ do_btf ; /* whether or not BTF preordering was requested */ /* only computed if BTF preordering requested */ - int structural_rank ; /* 0 to n-1 if the matrix is structurally rank + int32_t structural_rank ; /* 0 to n-1 if the matrix is structurally rank * deficient. -1 if not computed. n if the matrix has * full structural rank */ @@ -57,7 +63,7 @@ typedef struct /* 64-bit version (otherwise same as above) */ { double symmetry, est_flops, lnz, unz ; double *Lnz ; - SuiteSparse_long n, nz, *P, *Q, *R, nzoff, nblocks, maxblock, ordering, + int64_t n, nz, *P, *Q, *R, nzoff, nblocks, maxblock, ordering, do_btf, structural_rank ; } klu_l_symbolic ; @@ -71,20 +77,20 @@ typedef struct /* LU factors of each block, the pivot row permutation, and the * entries in the off-diagonal blocks */ - int n ; /* A is n-by-n */ - int nblocks ; /* number of diagonal blocks */ - int lnz ; /* actual nz in L, including diagonal */ - int unz ; /* actual nz in U, including diagonal */ - int max_lnz_block ; /* max actual nz in L in any one block, incl. diag */ - int max_unz_block ; /* max actual nz in U in any one block, incl. diag */ - int *Pnum ; /* size n. final pivot permutation */ - int *Pinv ; /* size n. inverse of final pivot permutation */ + int32_t n ; /* A is n-by-n */ + int32_t nblocks ; /* number of diagonal blocks */ + int32_t lnz ; /* actual nz in L, including diagonal */ + int32_t unz ; /* actual nz in U, including diagonal */ + int32_t max_lnz_block ; /* max actual nz in L in any one block, incl. diag */ + int32_t max_unz_block ; /* max actual nz in U in any one block, incl. diag */ + int32_t *Pnum ; /* size n. final pivot permutation */ + int32_t *Pinv ; /* size n. inverse of final pivot permutation */ /* LU factors of each block */ - int *Lip ; /* size n. pointers into LUbx[block] for L */ - int *Uip ; /* size n. pointers into LUbx[block] for U */ - int *Llen ; /* size n. Llen [k] = # of entries in kth column of L */ - int *Ulen ; /* size n. Ulen [k] = # of entries in kth column of U */ + int32_t *Lip ; /* size n. pointers into LUbx[block] for L */ + int32_t *Uip ; /* size n. pointers into LUbx[block] for U */ + int32_t *Llen ; /* size n. Llen [k] = # of entries in kth column of L */ + int32_t *Ulen ; /* size n. Ulen [k] = # of entries in kth column of U */ void **LUbx ; /* L and U indices and entries (excl. diagonal of U) */ size_t *LUsize ; /* size of each LUbx [block], in sizeof (Unit) */ void *Udiag ; /* diagonal of U */ @@ -96,19 +102,19 @@ typedef struct size_t worksize ; /* size (in bytes) of Work */ void *Work ; /* workspace */ void *Xwork ; /* alias into Numeric->Work */ - int *Iwork ; /* alias into Numeric->Work */ + int32_t *Iwork ; /* alias into Numeric->Work */ /* off-diagonal entries in a conventional compressed-column sparse matrix */ - int *Offp ; /* size n+1, column pointers */ - int *Offi ; /* size nzoff, row indices */ + int32_t *Offp ; /* size n+1, column pointers */ + int32_t *Offi ; /* size nzoff, row indices */ void *Offx ; /* size nzoff, numerical values */ - int nzoff ; + int32_t nzoff ; } klu_numeric ; typedef struct /* 64-bit version (otherwise same as above) */ { - SuiteSparse_long n, nblocks, lnz, unz, max_lnz_block, max_unz_block, *Pnum, + int64_t n, nblocks, lnz, unz, max_lnz_block, max_unz_block, *Pnum, *Pinv, *Lip, *Uip, *Llen, *Ulen ; void **LUbx ; size_t *LUsize ; @@ -116,10 +122,10 @@ typedef struct /* 64-bit version (otherwise same as above) */ double *Rs ; size_t worksize ; void *Work, *Xwork ; - SuiteSparse_long *Iwork ; - SuiteSparse_long *Offp, *Offi ; + int64_t *Iwork ; + int64_t *Offp, *Offi ; void *Offx ; - SuiteSparse_long nzoff ; + int64_t nzoff ; } klu_l_numeric ; @@ -154,7 +160,8 @@ typedef struct klu_common_struct * 0: none, 1: sum, 2: max */ /* pointer to user ordering function */ - int (*user_order) (int, int *, int *, int *, struct klu_common_struct *) ; + int32_t (*user_order) (int32_t, int32_t *, int32_t *, int32_t *, + struct klu_common_struct *) ; /* pointer to user data, passed unchanged as the last parameter to the * user ordering function (optional, the user function need not use this @@ -177,23 +184,23 @@ typedef struct klu_common_struct int status ; /* KLU_OK if OK, < 0 if error */ int nrealloc ; /* # of reallocations of L and U */ - int structural_rank ; /* 0 to n-1 if the matrix is structurally rank + int32_t structural_rank ; /* 0 to n-1 if the matrix is structurally rank * deficient (as determined by maxtrans). -1 if not computed. n if the * matrix has full structural rank. This is computed by klu_analyze * if a BTF preordering is requested. */ - int numerical_rank ; /* First k for which a zero U(k,k) was found, + int32_t numerical_rank ; /* First k for which a zero U(k,k) was found, * if the matrix was singular (in the range 0 to n-1). n if the matrix * has full rank. This is not a true rank-estimation. It just reports * where the first zero pivot was found. -1 if not computed. * Computed by klu_factor and klu_refactor. */ - int singular_col ; /* n if the matrix is not singular. If in the + int32_t singular_col ; /* n if the matrix is not singular. If in the * range 0 to n-1, this is the column index of the original matrix A that * corresponds to the column of U that contains a zero diagonal entry. * -1 if not computed. Computed by klu_factor and klu_refactor. */ - int noffdiag ; /* # of off-diagonal pivots, -1 if not computed */ + int32_t noffdiag ; /* # of off-diagonal pivots, -1 if not computed */ double flops ; /* actual factorization flop count, from klu_flops */ double rcond ; /* crude reciprocal condition est., from klu_rcond */ @@ -210,14 +217,12 @@ typedef struct klu_l_common_struct /* 64-bit version (otherwise same as above)*/ { double tol, memgrow, initmem_amd, initmem, maxwork ; - SuiteSparse_long btf, ordering, scale ; - SuiteSparse_long (*user_order) (SuiteSparse_long, SuiteSparse_long *, - SuiteSparse_long *, SuiteSparse_long *, + int btf, ordering, scale ; + int64_t (*user_order) (int64_t, int64_t *, int64_t *, int64_t *, struct klu_l_common_struct *) ; void *user_data ; - SuiteSparse_long halt_if_singular ; - SuiteSparse_long status, nrealloc, structural_rank, numerical_rank, - singular_col, noffdiag ; + int halt_if_singular, status, nrealloc ; + int64_t structural_rank, numerical_rank, singular_col, noffdiag ; double flops, rcond, condest, rgrowth, work ; size_t memusage, mempeak ; @@ -232,7 +237,7 @@ int klu_defaults klu_common *Common ) ; -SuiteSparse_long klu_l_defaults (klu_l_common *Common) ; +int klu_l_defaults (klu_l_common *Common) ; /* -------------------------------------------------------------------------- */ /* klu_analyze: orders and analyzes a matrix */ @@ -244,14 +249,14 @@ SuiteSparse_long klu_l_defaults (klu_l_common *Common) ; klu_symbolic *klu_analyze ( /* inputs, not modified */ - int n, /* A is n-by-n */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t n, /* A is n-by-n */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ klu_common *Common ) ; -klu_l_symbolic *klu_l_analyze (SuiteSparse_long, SuiteSparse_long *, - SuiteSparse_long *, klu_l_common *Common) ; +klu_l_symbolic *klu_l_analyze (int64_t, int64_t *, int64_t *, + klu_l_common *Common) ; /* -------------------------------------------------------------------------- */ @@ -265,17 +270,16 @@ klu_l_symbolic *klu_l_analyze (SuiteSparse_long, SuiteSparse_long *, klu_symbolic *klu_analyze_given ( /* inputs, not modified */ - int n, /* A is n-by-n */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ - int P [ ], /* size n, user's row permutation (may be NULL) */ - int Q [ ], /* size n, user's column permutation (may be NULL) */ + int32_t n, /* A is n-by-n */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ + int32_t P [ ], /* size n, user's row permutation (may be NULL) */ + int32_t Q [ ], /* size n, user's column permutation (may be NULL) */ klu_common *Common ) ; -klu_l_symbolic *klu_l_analyze_given (SuiteSparse_long, SuiteSparse_long *, - SuiteSparse_long *, SuiteSparse_long *, SuiteSparse_long *, - klu_l_common *) ; +klu_l_symbolic *klu_l_analyze_given (int64_t, int64_t *, int64_t *, int64_t *, + int64_t *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -285,8 +289,8 @@ klu_l_symbolic *klu_l_analyze_given (SuiteSparse_long, SuiteSparse_long *, klu_numeric *klu_factor /* returns KLU_OK if OK, < 0 if error */ ( /* inputs, not modified */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* size nz, numerical values */ klu_symbolic *Symbolic, klu_common *Common @@ -295,19 +299,19 @@ klu_numeric *klu_factor /* returns KLU_OK if OK, < 0 if error */ klu_numeric *klu_z_factor /* returns KLU_OK if OK, < 0 if error */ ( /* inputs, not modified */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* size 2*nz, numerical values (real,imag pairs) */ klu_symbolic *Symbolic, klu_common *Common ) ; -/* long / real version */ -klu_l_numeric *klu_l_factor (SuiteSparse_long *, SuiteSparse_long *, double *, +/* int64_t / real version */ +klu_l_numeric *klu_l_factor (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_common *) ; -/* long / complex version */ -klu_l_numeric *klu_zl_factor (SuiteSparse_long *, SuiteSparse_long *, double *, +/* int64_t / complex version */ +klu_l_numeric *klu_zl_factor (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_common *) ; @@ -320,8 +324,8 @@ int klu_solve /* inputs, not modified */ klu_symbolic *Symbolic, klu_numeric *Numeric, - int ldim, /* leading dimension of B */ - int nrhs, /* number of right-hand-sides */ + int32_t ldim, /* leading dimension of B */ + int32_t nrhs, /* number of right-hand-sides */ /* right-hand-side on input, overwritten with solution to Ax=b on output */ double B [ ], /* size ldim*nrhs */ @@ -333,19 +337,19 @@ int klu_z_solve /* inputs, not modified */ klu_symbolic *Symbolic, klu_numeric *Numeric, - int ldim, /* leading dimension of B */ - int nrhs, /* number of right-hand-sides */ + int32_t ldim, /* leading dimension of B */ + int32_t nrhs, /* number of right-hand-sides */ /* right-hand-side on input, overwritten with solution to Ax=b on output */ double B [ ], /* size 2*ldim*nrhs */ klu_common *Common ) ; -SuiteSparse_long klu_l_solve (klu_l_symbolic *, klu_l_numeric *, - SuiteSparse_long, SuiteSparse_long, double *, klu_l_common *) ; +int klu_l_solve (klu_l_symbolic *, klu_l_numeric *, + int64_t, int64_t, double *, klu_l_common *) ; -SuiteSparse_long klu_zl_solve (klu_l_symbolic *, klu_l_numeric *, - SuiteSparse_long, SuiteSparse_long, double *, klu_l_common *) ; +int klu_zl_solve (klu_l_symbolic *, klu_l_numeric *, + int64_t, int64_t, double *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -357,8 +361,8 @@ int klu_tsolve /* inputs, not modified */ klu_symbolic *Symbolic, klu_numeric *Numeric, - int ldim, /* leading dimension of B */ - int nrhs, /* number of right-hand-sides */ + int32_t ldim, /* leading dimension of B */ + int32_t nrhs, /* number of right-hand-sides */ /* right-hand-side on input, overwritten with solution to Ax=b on output */ double B [ ], /* size ldim*nrhs */ @@ -370,8 +374,8 @@ int klu_z_tsolve /* inputs, not modified */ klu_symbolic *Symbolic, klu_numeric *Numeric, - int ldim, /* leading dimension of B */ - int nrhs, /* number of right-hand-sides */ + int32_t ldim, /* leading dimension of B */ + int32_t nrhs, /* number of right-hand-sides */ /* right-hand-side on input, overwritten with solution to Ax=b on output */ double B [ ], /* size 2*ldim*nrhs */ @@ -380,12 +384,11 @@ int klu_z_tsolve ) ; -SuiteSparse_long klu_l_tsolve (klu_l_symbolic *, klu_l_numeric *, - SuiteSparse_long, SuiteSparse_long, double *, klu_l_common *) ; +int klu_l_tsolve (klu_l_symbolic *, klu_l_numeric *, + int64_t, int64_t, double *, klu_l_common *) ; -SuiteSparse_long klu_zl_tsolve (klu_l_symbolic *, klu_l_numeric *, - SuiteSparse_long, SuiteSparse_long, double *, SuiteSparse_long, - klu_l_common * ) ; +int klu_zl_tsolve (klu_l_symbolic *, klu_l_numeric *, + int64_t, int64_t, double *, int, klu_l_common * ) ; /* -------------------------------------------------------------------------- */ @@ -395,8 +398,8 @@ SuiteSparse_long klu_zl_tsolve (klu_l_symbolic *, klu_l_numeric *, int klu_refactor /* return TRUE if successful, FALSE otherwise */ ( /* inputs, not modified */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* size nz, numerical values */ klu_symbolic *Symbolic, /* input, and numerical values modified on output */ @@ -407,8 +410,8 @@ int klu_refactor /* return TRUE if successful, FALSE otherwise */ int klu_z_refactor /* return TRUE if successful, FALSE otherwise */ ( /* inputs, not modified */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* size 2*nz, numerical values */ klu_symbolic *Symbolic, /* input, and numerical values modified on output */ @@ -416,10 +419,10 @@ int klu_z_refactor /* return TRUE if successful, FALSE otherwise */ klu_common *Common ) ; -SuiteSparse_long klu_l_refactor (SuiteSparse_long *, SuiteSparse_long *, +int klu_l_refactor (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; -SuiteSparse_long klu_zl_refactor (SuiteSparse_long *, SuiteSparse_long *, +int klu_zl_refactor (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; @@ -433,7 +436,7 @@ int klu_free_symbolic klu_common *Common ) ; -SuiteSparse_long klu_l_free_symbolic (klu_l_symbolic **, klu_l_common *) ; +int klu_l_free_symbolic (klu_l_symbolic **, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -455,8 +458,8 @@ int klu_z_free_numeric klu_common *Common ) ; -SuiteSparse_long klu_l_free_numeric (klu_l_numeric **, klu_l_common *) ; -SuiteSparse_long klu_zl_free_numeric (klu_l_numeric **, klu_l_common *) ; +int klu_l_free_numeric (klu_l_numeric **, klu_l_common *) ; +int klu_zl_free_numeric (klu_l_numeric **, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -483,10 +486,8 @@ int klu_z_sort klu_common *Common ) ; -SuiteSparse_long klu_l_sort (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; -SuiteSparse_long klu_zl_sort (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; +int klu_l_sort (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; +int klu_zl_sort (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -511,10 +512,8 @@ int klu_z_flops klu_common *Common ) ; -SuiteSparse_long klu_l_flops (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; -SuiteSparse_long klu_zl_flops (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; +int klu_l_flops (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; +int klu_zl_flops (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -536,8 +535,8 @@ SuiteSparse_long klu_zl_flops (klu_l_symbolic *, klu_l_numeric *, int klu_rgrowth ( - int Ap [ ], - int Ai [ ], + int32_t Ap [ ], + int32_t Ai [ ], double Ax [ ], klu_symbolic *Symbolic, klu_numeric *Numeric, @@ -546,18 +545,18 @@ int klu_rgrowth int klu_z_rgrowth ( - int Ap [ ], - int Ai [ ], + int32_t Ap [ ], + int32_t Ai [ ], double Ax [ ], klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common /* Common->rgrowth = reciprocal pivot growth */ ) ; -SuiteSparse_long klu_l_rgrowth (SuiteSparse_long *, SuiteSparse_long *, +int klu_l_rgrowth (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; -SuiteSparse_long klu_zl_rgrowth (SuiteSparse_long *, SuiteSparse_long *, +int klu_zl_rgrowth (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; @@ -571,7 +570,7 @@ SuiteSparse_long klu_zl_rgrowth (SuiteSparse_long *, SuiteSparse_long *, int klu_condest ( - int Ap [ ], /* size n+1, column pointers, not modified */ + int32_t Ap [ ], /* size n+1, column pointers, not modified */ double Ax [ ], /* size nz = Ap[n], numerical values, not modified*/ klu_symbolic *Symbolic, /* symbolic analysis, not modified */ klu_numeric *Numeric, /* numeric factorization, not modified */ @@ -580,17 +579,17 @@ int klu_condest int klu_z_condest ( - int Ap [ ], + int32_t Ap [ ], double Ax [ ], /* size 2*nz */ klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common /* result returned in Common->condest */ ) ; -SuiteSparse_long klu_l_condest (SuiteSparse_long *, double *, klu_l_symbolic *, +int klu_l_condest (int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; -SuiteSparse_long klu_zl_condest (SuiteSparse_long *, double *, klu_l_symbolic *, +int klu_zl_condest (int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; @@ -612,12 +611,8 @@ int klu_z_rcond klu_common *Common /* result in Common->rcond */ ) ; -SuiteSparse_long klu_l_rcond (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; - -SuiteSparse_long klu_zl_rcond (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; - +int klu_l_rcond (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; +int klu_zl_rcond (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ /* klu_scale */ @@ -627,14 +622,14 @@ int klu_scale /* return TRUE if successful, FALSE otherwise */ ( /* inputs, not modified */ int scale, /* <0: none, no error check; 0: none, 1: sum, 2: max */ - int n, - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t n, + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* outputs, not defined on input */ double Rs [ ], /* workspace, not defined on input or output */ - int W [ ], /* size n, can be NULL */ + int32_t W [ ], /* size n, can be NULL */ klu_common *Common ) ; @@ -642,24 +637,22 @@ int klu_z_scale /* return TRUE if successful, FALSE otherwise */ ( /* inputs, not modified */ int scale, /* <0: none, no error check; 0: none, 1: sum, 2: max */ - int n, - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t n, + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* outputs, not defined on input */ double Rs [ ], /* workspace, not defined on input or output */ - int W [ ], /* size n, can be NULL */ + int32_t W [ ], /* size n, can be NULL */ klu_common *Common ) ; -SuiteSparse_long klu_l_scale (SuiteSparse_long, SuiteSparse_long, - SuiteSparse_long *, SuiteSparse_long *, double *, - double *, SuiteSparse_long *, klu_l_common *) ; +int klu_l_scale (int, int64_t, int64_t *, int64_t *, double *, + double *, int64_t *, klu_l_common *) ; -SuiteSparse_long klu_zl_scale (SuiteSparse_long, SuiteSparse_long, - SuiteSparse_long *, SuiteSparse_long *, double *, - double *, SuiteSparse_long *, klu_l_common *) ; +int klu_zl_scale (int, int64_t, int64_t *, int64_t *, double *, + double *, int64_t *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -675,31 +668,31 @@ int klu_extract /* returns TRUE if successful, FALSE otherwise */ /* outputs, either allocated on input, or ignored otherwise */ /* L */ - int *Lp, /* size n+1 */ - int *Li, /* size Numeric->lnz */ + int32_t *Lp, /* size n+1 */ + int32_t *Li, /* size Numeric->lnz */ double *Lx, /* size Numeric->lnz */ /* U */ - int *Up, /* size n+1 */ - int *Ui, /* size Numeric->unz */ + int32_t *Up, /* size n+1 */ + int32_t *Ui, /* size Numeric->unz */ double *Ux, /* size Numeric->unz */ /* F */ - int *Fp, /* size n+1 */ - int *Fi, /* size Numeric->nzoff */ + int32_t *Fp, /* size n+1 */ + int32_t *Fi, /* size Numeric->nzoff */ double *Fx, /* size Numeric->nzoff */ /* P, row permutation */ - int *P, /* size n */ + int32_t *P, /* size n */ /* Q, column permutation */ - int *Q, /* size n */ + int32_t *Q, /* size n */ /* Rs, scale factors */ double *Rs, /* size n */ /* R, block boundaries */ - int *R, /* size Symbolic->nblocks+1 (nblocks is at most n) */ + int32_t *R, /* size Symbolic->nblocks+1 (nblocks is at most n) */ klu_common *Common ) ; @@ -714,51 +707,51 @@ int klu_z_extract /* returns TRUE if successful, FALSE otherwise */ /* outputs, all of which must be allocated on input */ /* L */ - int *Lp, /* size n+1 */ - int *Li, /* size nnz(L) */ + int32_t *Lp, /* size n+1 */ + int32_t *Li, /* size nnz(L) */ double *Lx, /* size nnz(L) */ double *Lz, /* size nnz(L) for the complex case, ignored if real */ /* U */ - int *Up, /* size n+1 */ - int *Ui, /* size nnz(U) */ + int32_t *Up, /* size n+1 */ + int32_t *Ui, /* size nnz(U) */ double *Ux, /* size nnz(U) */ double *Uz, /* size nnz(U) for the complex case, ignored if real */ /* F */ - int *Fp, /* size n+1 */ - int *Fi, /* size nnz(F) */ + int32_t *Fp, /* size n+1 */ + int32_t *Fi, /* size nnz(F) */ double *Fx, /* size nnz(F) */ double *Fz, /* size nnz(F) for the complex case, ignored if real */ /* P, row permutation */ - int *P, /* size n */ + int32_t *P, /* size n */ /* Q, column permutation */ - int *Q, /* size n */ + int32_t *Q, /* size n */ /* Rs, scale factors */ double *Rs, /* size n */ /* R, block boundaries */ - int *R, /* size Symbolic->nblocks+1 (nblocks is at most n) */ + int32_t *R, /* size Symbolic->nblocks+1 (nblocks is at most n) */ klu_common *Common ) ; -SuiteSparse_long klu_l_extract (klu_l_numeric *, klu_l_symbolic *, - SuiteSparse_long *, SuiteSparse_long *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, - SuiteSparse_long *, klu_l_common *) ; +int klu_l_extract (klu_l_numeric *, klu_l_symbolic *, + int64_t *, int64_t *, double *, + int64_t *, int64_t *, double *, + int64_t *, int64_t *, double *, + int64_t *, int64_t *, double *, + int64_t *, klu_l_common *) ; -SuiteSparse_long klu_zl_extract (klu_l_numeric *, klu_l_symbolic *, - SuiteSparse_long *, SuiteSparse_long *, double *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, - SuiteSparse_long *, klu_l_common *) ; +int klu_zl_extract (klu_l_numeric *, klu_l_symbolic *, + int64_t *, int64_t *, double *, double *, + int64_t *, int64_t *, double *, double *, + int64_t *, int64_t *, double *, double *, + int64_t *, int64_t *, double *, + int64_t *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -797,7 +790,9 @@ void *klu_realloc /* returns pointer to reallocated block */ ) ; void *klu_l_malloc (size_t, size_t, klu_l_common *) ; + void *klu_l_free (void *, size_t, size_t, klu_l_common *) ; + void *klu_l_realloc (size_t, size_t, size_t, void *, klu_l_common *) ; @@ -819,11 +814,12 @@ void *klu_l_realloc (size_t, size_t, size_t, void *, klu_l_common *) ; * #endif */ -#define KLU_DATE "Mar 12, 2018" +#define KLU_DATE "@KLU_DATE@" +#define KLU_MAIN_VERSION @KLU_VERSION_MAJOR@ +#define KLU_SUB_VERSION @KLU_VERSION_MINOR@ +#define KLU_SUBSUB_VERSION @KLU_VERSION_SUB@ + #define KLU_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) -#define KLU_MAIN_VERSION 1 -#define KLU_SUB_VERSION 3 -#define KLU_SUBSUB_VERSION 9 #define KLU_VERSION KLU_VERSION_CODE(KLU_MAIN_VERSION,KLU_SUB_VERSION) #ifdef __cplusplus diff --git a/ThirdParty/SuiteSparse/KLU/Config/klu_version.tex.in b/ThirdParty/SuiteSparse/KLU/Config/klu_version.tex.in new file mode 100644 index 0000000000..83ad518a77 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Config/klu_version.tex.in @@ -0,0 +1,2 @@ +% version of SuiteSparse/KLU +\date{VERSION @KLU_VERSION_MAJOR@.@KLU_VERSION_MINOR@.@KLU_VERSION_SUB@, @KLU_DATE@} diff --git a/ThirdParty/SuiteSparse/KLU/Demo/Makefile b/ThirdParty/SuiteSparse/KLU/Demo/Makefile deleted file mode 100644 index 51b0a479e9..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Demo/Makefile +++ /dev/null @@ -1,63 +0,0 @@ -# KLU Demo Makefile - -default: all - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -CLIB = $(LDFLAGS) -L../../lib -lklu -lbtf -lamd -lcolamd -lsuitesparseconfig \ - $(LIB_WITH_PARTITION) $(LDLIBS) - -CHOLMOD_LIB = -lcholmod -CHOLMOD = $(CHOLMOD_LIB) $(LAPACK) $(BLAS) - -ifneq ($(GPU_CONFIG),) -CHOLMOD += $(CUDART_LIB) $(CUBLAS_LIB) -endif - -I = -I../../include - -all: library klu_simple kludemo kluldemo - - ./klu_simple - - ./kludemo < ../Matrix/1c.mtx - - ./kludemo < ../Matrix/arrowc.mtx - - ./kludemo < ../Matrix/arrow.mtx - - ./kludemo < ../Matrix/impcol_a.mtx - - ./kludemo < ../Matrix/w156.mtx - - ./kludemo < ../Matrix/ctina.mtx - - ./kluldemo < ../Matrix/1c.mtx - - ./kluldemo < ../Matrix/arrowc.mtx - - ./kluldemo < ../Matrix/arrow.mtx - - ./kluldemo < ../Matrix/impcol_a.mtx - - ./kluldemo < ../Matrix/w156.mtx - - ./kluldemo < ../Matrix/ctina.mtx - -library: - ( cd ../../SuiteSparse_config ; $(MAKE) ) - ( cd ../Lib ; $(MAKE) ) - ( cd ../../BTF ; $(MAKE) library ) - ( cd ../../AMD ; $(MAKE) library ) - ( cd ../../COLAMD ; $(MAKE) library ) - ( cd ../../CHOLMOD ; $(MAKE) library ) - - ( cd ../../CAMD ; $(MAKE) ) - - ( cd ../../CCOLAMD ; $(MAKE) ) - - ( cd ../.. ; $(MAKE) metis ) - -purge: distclean - -distclean: clean - - $(RM) kludemo kluldemo klu_simple - - $(RM) -r $(PURGE) - -clean: - - $(RM) -r $(CLEAN) - -kludemo: kludemo.c Makefile - $(CC) $(CF) $(I) kludemo.c -o kludemo $(CLIB) $(CHOLMOD) - -kluldemo: kludemo.c Makefile - $(CC) $(CF) $(I) kluldemo.c -o kluldemo $(CLIB) $(CHOLMOD) - -klu_simple: klu_simple.c Makefile - $(CC) $(CF) $(I) klu_simple.c -o klu_simple $(CLIB) - - ./klu_simple - diff --git a/ThirdParty/SuiteSparse/KLU/Demo/klu_simple.c b/ThirdParty/SuiteSparse/KLU/Demo/klu_simple.c deleted file mode 100644 index 7530d40fb7..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Demo/klu_simple.c +++ /dev/null @@ -1,27 +0,0 @@ -/* klu_simple: a simple KLU demo; solution is x = (1,2,3,4,5) */ - -#include -#include "klu.h" - -int n = 5 ; -int Ap [ ] = {0, 2, 5, 9, 10, 12} ; -int Ai [ ] = { 0, 1, 0, 2, 4, 1, 2, 3, 4, 2, 1, 4} ; -double Ax [ ] = {2., 3., 3., -1., 4., 4., -3., 1., 2., 2., 6., 1.} ; -double b [ ] = {8., 45., -3., 3., 19.} ; - -int main (void) -{ - klu_symbolic *Symbolic ; - klu_numeric *Numeric ; - klu_common Common ; - int i ; - klu_defaults (&Common) ; - Symbolic = klu_analyze (n, Ap, Ai, &Common) ; - Numeric = klu_factor (Ap, Ai, Ax, Symbolic, &Common) ; - klu_solve (Symbolic, Numeric, 5, 1, b, &Common) ; - klu_free_symbolic (&Symbolic, &Common) ; - klu_free_numeric (&Numeric, &Common) ; - for (i = 0 ; i < n ; i++) printf ("x [%d] = %g\n", i, b [i]) ; - return (0) ; -} - diff --git a/ThirdParty/SuiteSparse/KLU/Demo/klu_simple.out b/ThirdParty/SuiteSparse/KLU/Demo/klu_simple.out deleted file mode 100644 index 309065014c..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Demo/klu_simple.out +++ /dev/null @@ -1,5 +0,0 @@ -x [0] = 1 -x [1] = 2 -x [2] = 3 -x [3] = 4 -x [4] = 5 diff --git a/ThirdParty/SuiteSparse/KLU/Demo/kludemo.c b/ThirdParty/SuiteSparse/KLU/Demo/kludemo.c deleted file mode 100644 index b6b2295015..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Demo/kludemo.c +++ /dev/null @@ -1,326 +0,0 @@ -/* ========================================================================== */ -/* === KLU DEMO ============================================================= */ -/* ========================================================================== */ - -/* Read in a Matrix Market matrix (using CHOLMOD) and solve a linear system. */ - -#include -#include -#include "klu.h" - -/* for handling complex matrices */ -#define REAL(X,i) (X [2*(i)]) -#define IMAG(X,i) (X [2*(i)+1]) -#define CABS(X,i) (sqrt (REAL (X,i) * REAL (X,i) + IMAG (X,i) * IMAG (X,i))) - -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) - -/* ========================================================================== */ -/* === klu_backslash ======================================================== */ -/* ========================================================================== */ - -static int klu_backslash /* return 1 if successful, 0 otherwise */ -( - /* --- input ---- */ - int n, /* A is n-by-n */ - int *Ap, /* size n+1, column pointers */ - int *Ai, /* size nz = Ap [n], row indices */ - double *Ax, /* size nz, numerical values */ - int isreal, /* nonzero if A is real, 0 otherwise */ - double *B, /* size n, right-hand-side */ - - /* --- output ---- */ - double *X, /* size n, solution to Ax=b */ - double *R, /* size n, residual r = b-A*x */ - - /* --- scalar output --- */ - int *lunz, /* nnz (L+U+F) */ - double *rnorm, /* norm (b-A*x,1) / norm (A,1) */ - - /* --- workspace - */ - - klu_common *Common /* default parameters and statistics */ -) -{ - double anorm = 0, asum ; - klu_symbolic *Symbolic ; - klu_numeric *Numeric ; - int i, j, p ; - - if (!Ap || !Ai || !Ax || !B || !X || !B) return (0) ; - - /* ---------------------------------------------------------------------- */ - /* symbolic ordering and analysis */ - /* ---------------------------------------------------------------------- */ - - Symbolic = klu_analyze (n, Ap, Ai, Common) ; - if (!Symbolic) return (0) ; - - if (isreal) - { - - /* ------------------------------------------------------------------ */ - /* factorization */ - /* ------------------------------------------------------------------ */ - - Numeric = klu_factor (Ap, Ai, Ax, Symbolic, Common) ; - if (!Numeric) - { - klu_free_symbolic (&Symbolic, Common) ; - return (0) ; - } - - /* ------------------------------------------------------------------ */ - /* statistics (not required to solve Ax=b) */ - /* ------------------------------------------------------------------ */ - - klu_rgrowth (Ap, Ai, Ax, Symbolic, Numeric, Common) ; - klu_condest (Ap, Ax, Symbolic, Numeric, Common) ; - klu_rcond (Symbolic, Numeric, Common) ; - klu_flops (Symbolic, Numeric, Common) ; - *lunz = Numeric->lnz + Numeric->unz - n + - ((Numeric->Offp) ? (Numeric->Offp [n]) : 0) ; - - /* ------------------------------------------------------------------ */ - /* solve Ax=b */ - /* ------------------------------------------------------------------ */ - - for (i = 0 ; i < n ; i++) - { - X [i] = B [i] ; - } - klu_solve (Symbolic, Numeric, n, 1, X, Common) ; - - /* ------------------------------------------------------------------ */ - /* compute residual, rnorm = norm(b-Ax,1) / norm(A,1) */ - /* ------------------------------------------------------------------ */ - - for (i = 0 ; i < n ; i++) - { - R [i] = B [i] ; - } - for (j = 0 ; j < n ; j++) - { - asum = 0 ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - /* R (i) -= A (i,j) * X (j) */ - R [Ai [p]] -= Ax [p] * X [j] ; - asum += fabs (Ax [p]) ; - } - anorm = MAX (anorm, asum) ; - } - *rnorm = 0 ; - for (i = 0 ; i < n ; i++) - { - *rnorm = MAX (*rnorm, fabs (R [i])) ; - } - - /* ------------------------------------------------------------------ */ - /* free numeric factorization */ - /* ------------------------------------------------------------------ */ - - klu_free_numeric (&Numeric, Common) ; - - } - else - { - - /* ------------------------------------------------------------------ */ - /* statistics (not required to solve Ax=b) */ - /* ------------------------------------------------------------------ */ - - Numeric = klu_z_factor (Ap, Ai, Ax, Symbolic, Common) ; - if (!Numeric) - { - klu_free_symbolic (&Symbolic, Common) ; - return (0) ; - } - - /* ------------------------------------------------------------------ */ - /* statistics */ - /* ------------------------------------------------------------------ */ - - klu_z_rgrowth (Ap, Ai, Ax, Symbolic, Numeric, Common) ; - klu_z_condest (Ap, Ax, Symbolic, Numeric, Common) ; - klu_z_rcond (Symbolic, Numeric, Common) ; - klu_z_flops (Symbolic, Numeric, Common) ; - *lunz = Numeric->lnz + Numeric->unz - n + - ((Numeric->Offp) ? (Numeric->Offp [n]) : 0) ; - - /* ------------------------------------------------------------------ */ - /* solve Ax=b */ - /* ------------------------------------------------------------------ */ - - for (i = 0 ; i < 2*n ; i++) - { - X [i] = B [i] ; - } - klu_z_solve (Symbolic, Numeric, n, 1, X, Common) ; - - /* ------------------------------------------------------------------ */ - /* compute residual, rnorm = norm(b-Ax,1) / norm(A,1) */ - /* ------------------------------------------------------------------ */ - - for (i = 0 ; i < 2*n ; i++) - { - R [i] = B [i] ; - } - for (j = 0 ; j < n ; j++) - { - asum = 0 ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - /* R (i) -= A (i,j) * X (j) */ - i = Ai [p] ; - REAL (R,i) -= REAL(Ax,p) * REAL(X,j) - IMAG(Ax,p) * IMAG(X,j) ; - IMAG (R,i) -= IMAG(Ax,p) * REAL(X,j) + REAL(Ax,p) * IMAG(X,j) ; - asum += CABS (Ax, p) ; - } - anorm = MAX (anorm, asum) ; - } - *rnorm = 0 ; - for (i = 0 ; i < n ; i++) - { - *rnorm = MAX (*rnorm, CABS (R, i)) ; - } - - /* ------------------------------------------------------------------ */ - /* free numeric factorization */ - /* ------------------------------------------------------------------ */ - - klu_z_free_numeric (&Numeric, Common) ; - } - - /* ---------------------------------------------------------------------- */ - /* free symbolic analysis, and residual */ - /* ---------------------------------------------------------------------- */ - - klu_free_symbolic (&Symbolic, Common) ; - return (1) ; -} - - -/* ========================================================================== */ -/* === klu_demo ============================================================= */ -/* ========================================================================== */ - -/* Given a sparse matrix A, set up a right-hand-side and solve X = A\b */ - -static void klu_demo (int n, int *Ap, int *Ai, double *Ax, int isreal) -{ - double rnorm ; - klu_common Common ; - double *B, *X, *R ; - int i, lunz ; - - printf ("KLU: %s, version: %d.%d.%d\n", KLU_DATE, KLU_MAIN_VERSION, - KLU_SUB_VERSION, KLU_SUBSUB_VERSION) ; - - /* ---------------------------------------------------------------------- */ - /* set defaults */ - /* ---------------------------------------------------------------------- */ - - klu_defaults (&Common) ; - - /* ---------------------------------------------------------------------- */ - /* create a right-hand-side */ - /* ---------------------------------------------------------------------- */ - - if (isreal) - { - /* B = 1 + (1:n)/n */ - B = klu_malloc (n, sizeof (double), &Common) ; - X = klu_malloc (n, sizeof (double), &Common) ; - R = klu_malloc (n, sizeof (double), &Common) ; - if (B) - { - for (i = 0 ; i < n ; i++) - { - B [i] = 1 + ((double) i+1) / ((double) n) ; - } - } - } - else - { - /* real (B) = 1 + (1:n)/n, imag(B) = (n:-1:1)/n */ - B = klu_malloc (n, 2 * sizeof (double), &Common) ; - X = klu_malloc (n, 2 * sizeof (double), &Common) ; - R = klu_malloc (n, 2 * sizeof (double), &Common) ; - if (B) - { - for (i = 0 ; i < n ; i++) - { - REAL (B, i) = 1 + ((double) i+1) / ((double) n) ; - IMAG (B, i) = ((double) n-i) / ((double) n) ; - } - } - } - - /* ---------------------------------------------------------------------- */ - /* X = A\b using KLU and print statistics */ - /* ---------------------------------------------------------------------- */ - - if (!klu_backslash (n, Ap, Ai, Ax, isreal, B, X, R, &lunz, &rnorm, &Common)) - { - printf ("KLU failed\n") ; - } - else - { - printf ("n %d nnz(A) %d nnz(L+U+F) %d resid %g\n" - "recip growth %g condest %g rcond %g flops %g\n", - n, Ap [n], lunz, rnorm, Common.rgrowth, Common.condest, - Common.rcond, Common.flops) ; - } - - /* ---------------------------------------------------------------------- */ - /* free the problem */ - /* ---------------------------------------------------------------------- */ - - if (isreal) - { - klu_free (B, n, sizeof (double), &Common) ; - klu_free (X, n, sizeof (double), &Common) ; - klu_free (R, n, sizeof (double), &Common) ; - } - else - { - klu_free (B, 2*n, sizeof (double), &Common) ; - klu_free (X, 2*n, sizeof (double), &Common) ; - klu_free (R, 2*n, sizeof (double), &Common) ; - } - printf ("peak memory usage: %g bytes\n\n", (double) (Common.mempeak)) ; -} - - -/* ========================================================================== */ -/* === main ================================================================= */ -/* ========================================================================== */ - -/* Read in a sparse matrix in Matrix Market format using CHOLMOD, and then - * solve Ax=b with KLU. Note that CHOLMOD is only used to read the matrix. */ - -#include "cholmod.h" - -int main (void) -{ - cholmod_sparse *A ; - cholmod_common ch ; - cholmod_start (&ch) ; - A = cholmod_read_sparse (stdin, &ch) ; - if (A) - { - if (A->nrow != A->ncol || A->stype != 0 - || (!(A->xtype == CHOLMOD_REAL || A->xtype == CHOLMOD_COMPLEX))) - { - printf ("invalid matrix\n") ; - } - else - { - klu_demo (A->nrow, A->p, A->i, A->x, A->xtype == CHOLMOD_REAL) ; - } - cholmod_free_sparse (&A, &ch) ; - } - cholmod_finish (&ch) ; - return (0) ; -} diff --git a/ThirdParty/SuiteSparse/KLU/Demo/kludemo.out b/ThirdParty/SuiteSparse/KLU/Demo/kludemo.out deleted file mode 100644 index d132681f11..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Demo/kludemo.out +++ /dev/null @@ -1,78 +0,0 @@ -./klu_simple -x [0] = 1 -x [1] = 2 -x [2] = 3 -x [3] = 4 -x [4] = 5 -./kludemo < ../Matrix/1c.mtx -KLU: June 3, 2015, version: 1.3.3 -n 1 nnz(A) 1 nnz(L+U+F) 1 resid 0 -recip growth 1 condest 1 rcond 1 flops 0 -peak memory usage: 492 bytes - -./kludemo < ../Matrix/arrowc.mtx -KLU: June 3, 2015, version: 1.3.3 -n 100 nnz(A) 298 nnz(L+U+F) 298 resid 1.68007e-14 -recip growth 0.019999 condest 295.99 rcond 0.019999 flops 297 -peak memory usage: 32244 bytes - -./kludemo < ../Matrix/arrow.mtx -KLU: June 3, 2015, version: 1.3.3 -n 100 nnz(A) 298 nnz(L+U+F) 298 resid 1.77636e-15 -recip growth 0.0204082 condest 303 rcond 0.0204082 flops 297 -peak memory usage: 20412 bytes - -./kludemo < ../Matrix/impcol_a.mtx -KLU: June 3, 2015, version: 1.3.3 -n 207 nnz(A) 572 nnz(L+U+F) 615 resid 6.98492e-10 -recip growth 0.00957447 condest 4.35093e+07 rcond 4.5277e-05 flops 259 -peak memory usage: 34276 bytes - -./kludemo < ../Matrix/w156.mtx -KLU: June 3, 2015, version: 1.3.3 -n 156 nnz(A) 362 nnz(L+U+F) 396 resid 6.23816e-08 -recip growth 0.00889922 condest 1.79787e+09 rcond 0.000124785 flops 175 -peak memory usage: 39516 bytes - -./kludemo < ../Matrix/ctina.mtx -KLU: June 3, 2015, version: 1.3.3 -n 11 nnz(A) 36 nnz(L+U+F) 45 resid 4.44089e-16 -recip growth 1 condest 56 rcond 1 flops 73 -peak memory usage: 4268 bytes - -./kluldemo < ../Matrix/1c.mtx -KLU: June 3, 2015, version: 1.3.3 -n 1 nnz(A) 1 nnz(L+U+F) 1 resid 0 -recip growth 1 condest 1 rcond 1 flops 0 -peak memory usage: 600 bytes - -./kluldemo < ../Matrix/arrowc.mtx -KLU: June 3, 2015, version: 1.3.3 -n 100 nnz(A) 298 nnz(L+U+F) 298 resid 1.68007e-14 -recip growth 0.019999 condest 295.99 rcond 0.019999 flops 297 -peak memory usage: 39000 bytes - -./kluldemo < ../Matrix/arrow.mtx -KLU: June 3, 2015, version: 1.3.3 -n 100 nnz(A) 298 nnz(L+U+F) 298 resid 1.77636e-15 -recip growth 0.0204082 condest 303 rcond 0.0204082 flops 297 -peak memory usage: 29584 bytes - -./kluldemo < ../Matrix/impcol_a.mtx -KLU: June 3, 2015, version: 1.3.3 -n 207 nnz(A) 572 nnz(L+U+F) 615 resid 6.98492e-10 -recip growth 0.00957447 condest 4.35093e+07 rcond 4.5277e-05 flops 259 -peak memory usage: 44800 bytes - -./kluldemo < ../Matrix/w156.mtx -KLU: June 3, 2015, version: 1.3.3 -n 156 nnz(A) 362 nnz(L+U+F) 396 resid 6.23816e-08 -recip growth 0.00889922 condest 1.79787e+09 rcond 0.000124785 flops 175 -peak memory usage: 47480 bytes - -./kluldemo < ../Matrix/ctina.mtx -KLU: June 3, 2015, version: 1.3.3 -n 11 nnz(A) 36 nnz(L+U+F) 45 resid 4.44089e-16 -recip growth 1 condest 56 rcond 1 flops 73 -peak memory usage: 5144 bytes - diff --git a/ThirdParty/SuiteSparse/KLU/Demo/kluldemo.c b/ThirdParty/SuiteSparse/KLU/Demo/kluldemo.c deleted file mode 100644 index ccf064476a..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Demo/kluldemo.c +++ /dev/null @@ -1,329 +0,0 @@ -/* ========================================================================== */ -/* === KLU DEMO (long integer version) ====================================== */ -/* ========================================================================== */ - -/* Read in a Matrix Market matrix (using CHOLMOD) and solve a linear system. - * SuiteSparse_long is normally a "long", but it becomes "_int64" on Windows 64. */ - -#include -#include -#include "klu.h" -#define Long SuiteSparse_long - -/* for handling complex matrices */ -#define REAL(X,i) (X [2*(i)]) -#define IMAG(X,i) (X [2*(i)+1]) -#define CABS(X,i) (sqrt (REAL (X,i) * REAL (X,i) + IMAG (X,i) * IMAG (X,i))) - -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) - -/* ========================================================================== */ -/* === klu_l_backslash ====================================================== */ -/* ========================================================================== */ - -static Long klu_l_backslash /* return 1 if successful, 0 otherwise */ -( - /* --- input ---- */ - Long n, /* A is n-by-n */ - Long *Ap, /* size n+1, column pointers */ - Long *Ai, /* size nz = Ap [n], row indices */ - double *Ax, /* size nz, numerical values */ - Long isreal, /* nonzero if A is real, 0 otherwise */ - double *B, /* size n, right-hand-side */ - - /* --- output ---- */ - double *X, /* size n, solution to Ax=b */ - double *R, /* size n, residual r = b-A*x */ - - /* --- scalar output --- */ - Long *lunz, /* nnz (L+U+F) */ - double *rnorm, /* norm (b-A*x,1) / norm (A,1) */ - - /* --- workspace - */ - - klu_l_common *Common /* default parameters and statistics */ -) -{ - double anorm = 0, asum ; - klu_l_symbolic *Symbolic ; - klu_l_numeric *Numeric ; - Long i, j, p ; - - if (!Ap || !Ai || !Ax || !B || !X || !B) return (0) ; - - /* ---------------------------------------------------------------------- */ - /* symbolic ordering and analysis */ - /* ---------------------------------------------------------------------- */ - - Symbolic = klu_l_analyze (n, Ap, Ai, Common) ; - if (!Symbolic) return (0) ; - - if (isreal) - { - - /* ------------------------------------------------------------------ */ - /* factorization */ - /* ------------------------------------------------------------------ */ - - Numeric = klu_l_factor (Ap, Ai, Ax, Symbolic, Common) ; - if (!Numeric) - { - klu_l_free_symbolic (&Symbolic, Common) ; - return (0) ; - } - - /* ------------------------------------------------------------------ */ - /* statistics (not required to solve Ax=b) */ - /* ------------------------------------------------------------------ */ - - klu_l_rgrowth (Ap, Ai, Ax, Symbolic, Numeric, Common) ; - klu_l_condest (Ap, Ax, Symbolic, Numeric, Common) ; - klu_l_rcond (Symbolic, Numeric, Common) ; - klu_l_flops (Symbolic, Numeric, Common) ; - *lunz = Numeric->lnz + Numeric->unz - n + - ((Numeric->Offp) ? (Numeric->Offp [n]) : 0) ; - - /* ------------------------------------------------------------------ */ - /* solve Ax=b */ - /* ------------------------------------------------------------------ */ - - for (i = 0 ; i < n ; i++) - { - X [i] = B [i] ; - } - klu_l_solve (Symbolic, Numeric, n, 1, X, Common) ; - - /* ------------------------------------------------------------------ */ - /* compute residual, rnorm = norm(b-Ax,1) / norm(A,1) */ - /* ------------------------------------------------------------------ */ - - for (i = 0 ; i < n ; i++) - { - R [i] = B [i] ; - } - for (j = 0 ; j < n ; j++) - { - asum = 0 ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - /* R (i) -= A (i,j) * X (j) */ - R [Ai [p]] -= Ax [p] * X [j] ; - asum += fabs (Ax [p]) ; - } - anorm = MAX (anorm, asum) ; - } - *rnorm = 0 ; - for (i = 0 ; i < n ; i++) - { - *rnorm = MAX (*rnorm, fabs (R [i])) ; - } - - /* ------------------------------------------------------------------ */ - /* free numeric factorization */ - /* ------------------------------------------------------------------ */ - - klu_l_free_numeric (&Numeric, Common) ; - - } - else - { - - /* ------------------------------------------------------------------ */ - /* statistics (not required to solve Ax=b) */ - /* ------------------------------------------------------------------ */ - - Numeric = klu_zl_factor (Ap, Ai, Ax, Symbolic, Common) ; - if (!Numeric) - { - klu_l_free_symbolic (&Symbolic, Common) ; - return (0) ; - } - - /* ------------------------------------------------------------------ */ - /* statistics */ - /* ------------------------------------------------------------------ */ - - klu_zl_rgrowth (Ap, Ai, Ax, Symbolic, Numeric, Common) ; - klu_zl_condest (Ap, Ax, Symbolic, Numeric, Common) ; - klu_zl_rcond (Symbolic, Numeric, Common) ; - klu_zl_flops (Symbolic, Numeric, Common) ; - *lunz = Numeric->lnz + Numeric->unz - n + - ((Numeric->Offp) ? (Numeric->Offp [n]) : 0) ; - - /* ------------------------------------------------------------------ */ - /* solve Ax=b */ - /* ------------------------------------------------------------------ */ - - for (i = 0 ; i < 2*n ; i++) - { - X [i] = B [i] ; - } - klu_zl_solve (Symbolic, Numeric, n, 1, X, Common) ; - - /* ------------------------------------------------------------------ */ - /* compute residual, rnorm = norm(b-Ax,1) / norm(A,1) */ - /* ------------------------------------------------------------------ */ - - for (i = 0 ; i < 2*n ; i++) - { - R [i] = B [i] ; - } - for (j = 0 ; j < n ; j++) - { - asum = 0 ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - /* R (i) -= A (i,j) * X (j) */ - i = Ai [p] ; - REAL (R,i) -= REAL(Ax,p) * REAL(X,j) - IMAG(Ax,p) * IMAG(X,j) ; - IMAG (R,i) -= IMAG(Ax,p) * REAL(X,j) + REAL(Ax,p) * IMAG(X,j) ; - asum += CABS (Ax, p) ; - } - anorm = MAX (anorm, asum) ; - } - *rnorm = 0 ; - for (i = 0 ; i < n ; i++) - { - *rnorm = MAX (*rnorm, CABS (R, i)) ; - } - - /* ------------------------------------------------------------------ */ - /* free numeric factorization */ - /* ------------------------------------------------------------------ */ - - klu_zl_free_numeric (&Numeric, Common) ; - } - - /* ---------------------------------------------------------------------- */ - /* free symbolic analysis, and residual */ - /* ---------------------------------------------------------------------- */ - - klu_l_free_symbolic (&Symbolic, Common) ; - return (1) ; -} - - -/* ========================================================================== */ -/* === klu_l_demo =========================================================== */ -/* ========================================================================== */ - -/* Given a sparse matrix A, set up a right-hand-side and solve X = A\b */ - -static void klu_l_demo (Long n, Long *Ap, Long *Ai, double *Ax, Long isreal) -{ - double rnorm ; - klu_l_common Common ; - double *B, *X, *R ; - Long i, lunz ; - - printf ("KLU: %s, version: %d.%d.%d\n", KLU_DATE, KLU_MAIN_VERSION, - KLU_SUB_VERSION, KLU_SUBSUB_VERSION) ; - - /* ---------------------------------------------------------------------- */ - /* set defaults */ - /* ---------------------------------------------------------------------- */ - - klu_l_defaults (&Common) ; - - /* ---------------------------------------------------------------------- */ - /* create a right-hand-side */ - /* ---------------------------------------------------------------------- */ - - if (isreal) - { - /* B = 1 + (1:n)/n */ - B = klu_l_malloc (n, sizeof (double), &Common) ; - X = klu_l_malloc (n, sizeof (double), &Common) ; - R = klu_l_malloc (n, sizeof (double), &Common) ; - if (B) - { - for (i = 0 ; i < n ; i++) - { - B [i] = 1 + ((double) i+1) / ((double) n) ; - } - } - } - else - { - /* real (B) = 1 + (1:n)/n, imag(B) = (n:-1:1)/n */ - B = klu_l_malloc (n, 2 * sizeof (double), &Common) ; - X = klu_l_malloc (n, 2 * sizeof (double), &Common) ; - R = klu_l_malloc (n, 2 * sizeof (double), &Common) ; - if (B) - { - for (i = 0 ; i < n ; i++) - { - REAL (B, i) = 1 + ((double) i+1) / ((double) n) ; - IMAG (B, i) = ((double) n-i) / ((double) n) ; - } - } - } - - /* ---------------------------------------------------------------------- */ - /* X = A\b using KLU and print statistics */ - /* ---------------------------------------------------------------------- */ - - if (!klu_l_backslash (n, Ap, Ai, Ax, isreal, B, X, R, &lunz, &rnorm, - &Common)) - { - printf ("KLU failed\n") ; - } - else - { - printf ("n %ld nnz(A) %ld nnz(L+U+F) %ld resid %g\n" - "recip growth %g condest %g rcond %g flops %g\n", - n, Ap [n], lunz, rnorm, Common.rgrowth, Common.condest, - Common.rcond, Common.flops) ; - } - - /* ---------------------------------------------------------------------- */ - /* free the problem */ - /* ---------------------------------------------------------------------- */ - - if (isreal) - { - klu_l_free (B, n, sizeof (double), &Common) ; - klu_l_free (X, n, sizeof (double), &Common) ; - klu_l_free (R, n, sizeof (double), &Common) ; - } - else - { - klu_l_free (B, 2*n, sizeof (double), &Common) ; - klu_l_free (X, 2*n, sizeof (double), &Common) ; - klu_l_free (R, 2*n, sizeof (double), &Common) ; - } - printf ("peak memory usage: %g bytes\n\n", (double) (Common.mempeak)) ; -} - - -/* ========================================================================== */ -/* === main ================================================================= */ -/* ========================================================================== */ - -/* Read in a sparse matrix in Matrix Market format using CHOLMOD, and then - * solve Ax=b with KLU. Note that CHOLMOD is only used to read the matrix. */ - -#include "cholmod.h" - -int main (void) -{ - cholmod_sparse *A ; - cholmod_common ch ; - cholmod_l_start (&ch) ; - A = cholmod_l_read_sparse (stdin, &ch) ; - if (A) - { - if (A->nrow != A->ncol || A->stype != 0 - || (!(A->xtype == CHOLMOD_REAL || A->xtype == CHOLMOD_COMPLEX))) - { - printf ("invalid matrix\n") ; - } - else - { - klu_l_demo (A->nrow, A->p, A->i, A->x, A->xtype == CHOLMOD_REAL) ; - } - cholmod_l_free_sparse (&A, &ch) ; - } - cholmod_l_finish (&ch) ; - return (0) ; -} diff --git a/ThirdParty/SuiteSparse/KLU/Doc/ChangeLog b/ThirdParty/SuiteSparse/KLU/Doc/ChangeLog index 70a1b4f97d..b4a4edabeb 100644 --- a/ThirdParty/SuiteSparse/KLU/Doc/ChangeLog +++ b/ThirdParty/SuiteSparse/KLU/Doc/ChangeLog @@ -1,3 +1,18 @@ +Jan 17, 2023: version 2.0.3 + + * SuiteSparse_config: now v7.0.0 + +Dec 9, 2022: version 2.0.2 + + * minor change to build system + * Fortran: no longer required to build KLU + +Nov 12, 2022: version 2.0.0 + + * using CMake build system + * integers: int (32-bit) and SuiteSparse_long (nominally 64-bit) replaced + with int32_t and int64_t. + Mar 12, 2018: version 1.3.9 * swapped arguments for KLU_malloc; not a bug, just more readable now diff --git a/ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.pdf b/ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.pdf deleted file mode 100644 index d5ae2f2a24..0000000000 Binary files a/ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.pdf and /dev/null differ diff --git a/ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.tex b/ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.tex index 7ec756ed75..8ed9466291 100644 --- a/ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.tex +++ b/ThirdParty/SuiteSparse/KLU/Doc/KLU_UserGuide.tex @@ -1,4 +1,5 @@ \documentclass[11pt]{article} +\batchmode \newcommand{\m}[1]{{\bf{#1}}} % for matrices and vectors \newcommand{\tr}{^{\sf T}} % transpose @@ -26,7 +27,7 @@ } \and Eka Palamadai Natarajan} -\date{VERSION 1.3.9, Mar 12, 2018} +\input{klu_version.tex} \maketitle %------------------------------------------------------------------------------ @@ -50,7 +51,7 @@ \section{License and Copyright} %------------------------------------------------------------------------------ -KLU, Copyright\copyright 2004-2011 University of Florida. +KLU, Copyright\copyright 2004-2022 University of Florida. All Rights Reserved. KLU is available under alternate licenses; contact T. Davis for details. @@ -308,20 +309,18 @@ \section{Using KLU and BTF in a C program} %------------------------------------------------------------------------------ KLU and BTF include the following C-callable functions. Each function is -available in two or four versions: with {\tt int} or {\tt long} integers, and +available in two or four versions: with \verb'int32_t' or \verb'int64_t' integers, and (for functions that deal with numerical values), with {\tt double} or complex -{\tt double} values. The {\tt long} integer is actually a {\tt SuiteSparse\_long}, -which is typically a {\tt long}, defined with a {\tt \#define} statement. It -becomes an {\tt \_\_int64} on Microsoft Windows 64, however. +{\tt double} values. -The usage of real and complex, and {\tt int} and {\tt SuiteSparse\_long}, must not be +The usage of real and complex, and \verb'int32_t' and \verb'int64_t', must not be mixed, except that some functions can be used for both real and complex cases. %------------------------------------------------------------------------------ \subsection{KLU Common object} %------------------------------------------------------------------------------ -The {\tt klu\_common} object ({\tt klu\_l\_common} for the {\tt SuiteSparse\_long} +The {\tt klu\_common} object ({\tt klu\_l\_common} for the \verb'int64_t' version) contains user-definable parameters and statistics returned from KLU functions. This object appears in every KLU function as the last parameter. Details are given in the {\tt klu.h} include file, which also @@ -366,17 +365,17 @@ \subsection{KLU Common object} \item {\tt user\_order}: a pointer to a function that can be provided by the application that uses KLU, to redefine the fill-reducing ordering used by KLU -for each diagonal block. The {\tt int} and {\tt SuiteSparse\_long} prototypes must be +for each diagonal block. The \verb'int32_t' and \verb'int64_t' prototypes must be as follows: {\footnotesize \begin{verbatim} -int my_ordering_function (int n, int Ap [ ], int Ai [ ], int Perm [ ], klu_common *Common) ; +int32_t my_ordering_function (int32_t n, + int32_t Ap [ ], int32_t Ai [ ], int32_t Perm [ ], klu_common *Common) ; -SuiteSparse_long my_long_ordering_function (SuiteSparse_long n, - SuiteSparse_long Ap [ ], SuiteSparse_long Ai [ ], - SuiteSparse_long Perm [ ], klu_l_common *Common); +int64_t my_long_ordering_function (int64_t n, + int64_t Ap [ ], int64_t Ai [ ], int64_t Perm [ ], klu_l_common *Common) ; \end{verbatim} } @@ -416,7 +415,7 @@ \subsection{KLU Symbolic object} KLU performs its sparse LU factorization in two steps. The first is purely symbolic, and does not depend on the numerical values. This analysis returns a -{\tt klu\_symbolic} object ({\tt klu\_l\_symbolic} in the {\tt SuiteSparse\_long} +{\tt klu\_symbolic} object ({\tt klu\_l\_symbolic} in the \verb'int64_t' version). The {\tt Symbolic} object contains a pre-ordering which combines the block triangular form with the fill-reducing ordering, and an estimate of the number of nonzeros in the factors of each block. Its size is thus modest, only @@ -437,12 +436,6 @@ \subsection{KLU Numeric object} \subsection{A sparse matrix in KLU} %------------------------------------------------------------------------------ -% From here on, only the {\tt int} version is described. In the {\tt SuiteSparse\_long} -% version, the function names change slightly ({\tt klu\_factor} becomes -% {\tt klu\_l\_factor}, and the {\tt int}/complex version {\tt klu\_z\_factor} -% becomes {\tt klu\_zl\_factor}, for example). For more details on the -% {\tt SuiteSparse\_long} version, refer to Section~\ref{klu_include}. - The input matrix provided to KLU is in sparse compressed-column form, which is the same data structure used internally in MATLAB, except that the version used here allows for the row indices to appear in any ordering, and this version @@ -499,9 +492,8 @@ \subsection{{\tt klu\_defaults}: set default parameters} #include "klu.h" - SuiteSparse_long ok ; klu_l_common Common ; - ok = klu_l_defaults (&Common) ; /* real or complex */ + int ok = klu_l_defaults (&Common) ; /* real or complex */ \end{verbatim} } @@ -520,14 +512,14 @@ \subsection{{\tt klu\_analyze}: order and analyze a matrix} {\footnotesize \begin{verbatim} #include "klu.h" - int n, Ap [n+1], Ai [nz] ; + int32_t n, Ap [n+1], Ai [nz] ; klu_symbolic *Symbolic ; klu_common Common ; Symbolic = klu_analyze (n, Ap, Ai, &Common) ; /* real or complex */ #include "klu.h" - SuiteSparse_long n, Ap [n+1], Ai [nz] ; + int64_t n, Ap [n+1], Ai [nz] ; klu_l_symbolic *Symbolic ; klu_l_common Common ; Symbolic = klu_l_analyze (n, Ap, Ai, &Common) ; /* real or complex */ @@ -548,14 +540,14 @@ \subsection{{\tt klu\_analyze\_given}: order and analyze a matrix} {\footnotesize \begin{verbatim} #include "klu.h" - int n, Ap [n+1], Ai [nz], P [n], Q [n] ; + int32_t n, Ap [n+1], Ai [nz], P [n], Q [n] ; klu_symbolic *Symbolic ; klu_common Common ; Symbolic = klu_analyze_given (n, Ap, Ai, P, Q, &Common) ; /* real or complex */ #include "klu.h" - SuiteSparse_long n, Ap [n+1], Ai [nz], P [n], Q [n] ; + int64_t n, Ap [n+1], Ai [nz], P [n], Q [n] ; klu_l_symbolic *Symbolic ; klu_l_common Common ; Symbolic = klu_l_analyze_given (n, Ap, Ai, P, Q, &Common) ; /* real or complex */ @@ -574,7 +566,7 @@ \subsection{{\tt klu\_factor}: numerical factorization} {\footnotesize \begin{verbatim} #include "klu.h" - int Ap [n+1], Ai [nz] ; + int32_t Ap [n+1], Ai [nz] ; double Ax [nz], Az [2*nz] ; klu_symbolic *Symbolic ; klu_numeric *Numeric ; @@ -584,7 +576,7 @@ \subsection{{\tt klu\_factor}: numerical factorization} #include "klu.h" - SuiteSparse_long Ap [n+1], Ai [nz] ; + int64_t Ap [n+1], Ai [nz] ; double Ax [nz], Az [2*nz] ; klu_l_symbolic *Symbolic ; klu_l_numeric *Numeric ; @@ -610,7 +602,7 @@ \subsection{{\tt klu\_solve}: solve a linear system} {\footnotesize \begin{verbatim} #include "klu.h" - int ldim, nrhs, ok ; + int32_t ldim, nrhs ; int ok ; double B [ldim*nrhs], Bz [2*ldim*nrhs] ; klu_symbolic *Symbolic ; klu_numeric *Numeric ; @@ -620,7 +612,7 @@ \subsection{{\tt klu\_solve}: solve a linear system} #include "klu.h" - SuiteSparse_long ldim, nrhs, ok ; + int64_t ldim, nrhs ; int ok ; double B [ldim*nrhs], Bz [2*ldim*nrhs] ; klu_symbolic *Symbolic ; klu_numeric *Numeric ; @@ -642,7 +634,7 @@ \subsection{{\tt klu\_tsolve}: solve a transposed linear system} {\footnotesize \begin{verbatim} #include "klu.h" - int ldim, nrhs, ok ; + int32_t ldim, nrhs ; int ok ; double B [ldim*nrhs], Bz [2*ldim*nrhs] ; klu_symbolic *Symbolic ; klu_numeric *Numeric ; @@ -652,7 +644,7 @@ \subsection{{\tt klu\_tsolve}: solve a transposed linear system} #include "klu.h" - SuiteSparse_long ldim, nrhs, ok ; + int64_t ldim, nrhs ; int ok ; double B [ldim*nrhs], Bz [2*ldim*nrhs] ; klu_symbolic *Symbolic ; klu_numeric *Numeric ; @@ -681,7 +673,7 @@ \subsection{{\tt klu\_refactor}: numerical refactorization} {\footnotesize \begin{verbatim} #include "klu.h" - int ok, Ap [n+1], Ai [nz] ; + int ok ; int32_t Ap [n+1], Ai [nz] ; double Ax [nz], Az [2*nz] ; klu_symbolic *Symbolic ; klu_numeric *Numeric ; @@ -691,7 +683,7 @@ \subsection{{\tt klu\_refactor}: numerical refactorization} #include "klu.h" - SuiteSparse_long ok, Ap [n+1], Ai [nz] ; + int ok ; int64_t Ap [n+1], Ai [nz] ; double Ax [nz], Az [2*nz] ; klu_l_symbolic *Symbolic ; klu_l_numeric *Numeric ; @@ -776,7 +768,7 @@ \subsection{{\tt klu\_sort}: sort the columns of L and U} #include "klu.h" - SuiteSparse_long ok ; + int ok ; klu_l_symbolic *Symbolic ; klu_l_numeric *Numeric ; klu_l_common Common ; @@ -806,7 +798,7 @@ \subsection{{\tt klu\_flops}: determine the flop count} #include "klu.h" - SuiteSparse_long ok ; + int ok ; klu_l_symbolic *Symbolic ; klu_l_numeric *Numeric ; klu_l_common Common ; @@ -836,7 +828,7 @@ \subsection{{\tt klu\_rgrowth}: determine the pivot growth} {\footnotesize \begin{verbatim} #include "klu.h" - int ok, Ap [n+1], Ai [nz] ; + int ok ; int32_t Ap [n+1], Ai [nz] ; double Ax [nz], Az [2*nz] ; klu_symbolic *Symbolic ; klu_numeric *Numeric ; @@ -846,7 +838,7 @@ \subsection{{\tt klu\_rgrowth}: determine the pivot growth} #include "klu.h" - SuiteSparse_long ok, Ap [n+1], Ai [nz] ; + int ok ; int64_t Ap [n+1], Ai [nz] ; double Ax [nz], Az [2*nz] ; klu_l_symbolic *Symbolic ; klu_l_numeric *Numeric ; @@ -870,7 +862,7 @@ \subsection{{\tt klu\_condest}: accurate condition number estimation} {\footnotesize \begin{verbatim} #include "klu.h" - int ok, Ap [n+1] ; + int ok ; int32_t Ap [n+1] ; double Ax [nz], Az [2*nz] ; klu_symbolic *Symbolic ; klu_numeric *Numeric ; @@ -880,7 +872,7 @@ \subsection{{\tt klu\_condest}: accurate condition number estimation} #include "klu.h" - SuiteSparse_long ok, Ap [n+1] ; + int ok ; int64_t Ap [n+1] ; double Ax [nz], Az [2*nz] ; klu_l_symbolic *Symbolic ; klu_l_numeric *Numeric ; @@ -915,7 +907,7 @@ \subsection{{\tt klu\_rcond}: cheap reciprocal condition number estimation} #include "klu.h" - SuiteSparse_long ok ; + int ok ; klu_l_symbolic *Symbolic ; klu_l_numeric *Numeric ; klu_l_common Common ; @@ -952,7 +944,7 @@ \subsection{{\tt klu\_scale}: scale and check a sparse matrix} {\footnotesize \begin{verbatim} #include "klu.h" - int scale, ok, n, Ap [n+1], Ai [nz], W [n] ; + int scale, ok ; int32_t n, Ap [n+1], Ai [nz], W [n] ; double Ax [nz], Az [2*nz], Rs [n] ; klu_common Common ; ok = klu_scale (scale, n, Ap, Ai, Ax, Symbolic, Numeric, &Common) ; /* real */ @@ -960,7 +952,7 @@ \subsection{{\tt klu\_scale}: scale and check a sparse matrix} #include "klu.h" - SuiteSparse_long scale, ok, n, Ap [n+1], Ai [nz], W [n] ; + int scale, ok ; int64_t n, Ap [n+1], Ai [nz], W [n] ; double Ax [nz], Az [2*nz], Rs [n] ; klu_l_common Common ; ok = klu_l_scale (scale, n, Ap, Ai, Ax, Symbolic, Numeric, &Common) ; /* real */ @@ -993,7 +985,8 @@ \subsection{{\tt klu\_extract}: extract the LU factorization} {\footnotesize \begin{verbatim} #include "klu.h" - int ok, Lp [n+1], Li [lnz], Up [n+1], Ui [unz], Fp [n+1], Fi [nzoff], P [n], Q [n], R [n] ; + int ok ; + int32_t Lp [n+1], Li [lnz], Up [n+1], Ui [unz], Fp [n+1], Fi [nzoff], P [n], Q [n], R [n] ; double Lx [lnz], Lz [lnz], Ux [unz], Uz [unz], Fx [nzoff], Fz [nzoff], Rs [n] ; klu_symbolic *Symbolic ; klu_numeric *Numeric ; @@ -1005,7 +998,8 @@ \subsection{{\tt klu\_extract}: extract the LU factorization} #include "klu.h" - SuiteSparse_long ok, Lp [n+1], Li [lnz], Up [n+1], Ui [unz], Fp [n+1], + int ok ; + int64_t Lp [n+1], Li [lnz], Up [n+1], Ui [unz], Fp [n+1], Fi [nzoff], P [n], Q [n], R [n] ; double Lx [lnz], Lz [lnz], Ux [unz], Uz [unz], Fx [nzoff], Fz [nzoff], Rs [n] ; klu_l_symbolic *Symbolic ; @@ -1063,8 +1057,8 @@ \subsection{{\tt klu\_malloc}, {\tt klu\_free}, {\tt klu\_realloc}: \subsection{{\tt btf\_maxtrans}: maximum transversal} %------------------------------------------------------------------------------- -The BTF package includes three user-callable functions (each with {\tt int} -and {\tt SuiteSparse\_long} versions). They do not need to be called directly by an +The BTF package includes three user-callable functions (each with \verb'int32_t' +and \verb'int64_t' versions). They do not need to be called directly by an application that uses KLU. KLU will call these functions to perform the permutation into upper block triangular form. @@ -1090,12 +1084,12 @@ \subsection{{\tt btf\_maxtrans}: maximum transversal} {\footnotesize \begin{verbatim} - int nrow, ncol, Ap [ncol+1], Ai [nz], Match [nrow], Work [5*ncol], nmatch ; + int32_t nrow, ncol, Ap [ncol+1], Ai [nz], Match [nrow], Work [5*ncol], nmatch ; double maxwork, work ; nmatch = btf_maxtrans (nrow, ncol, Ap, Ai, maxwork, &work, Match, Work) ; - SuiteSparse_long nrow, ncol, Ap [ncol+1], Ai [nz], Match [nrow], Work [5*ncol], nmatch ; + int64_t nrow, ncol, Ap [ncol+1], Ai [nz], Match [nrow], Work [5*ncol], nmatch ; double maxwork, work ; nmatch = btf_l_maxtrans (nrow, ncol, Ap, Ai, maxwork, &work, Match, Work) ; \end{verbatim} @@ -1118,11 +1112,11 @@ \subsection{{\tt btf\_strongcomp}: strongly connected components} {\footnotesize \begin{verbatim} - int n, Ap [n+1], Ai [nz], Q [n], P [n], R [n+1], Work [4*n], ncomp ; + int32_t n, Ap [n+1], Ai [nz], Q [n], P [n], R [n+1], Work [4*n], ncomp ; ncomp = btf_strongcomp (n, Ap, Ai, Q, P, R, Work) ; - SuiteSparse_long n, Ap [n+1], Ai [nz], Q [n], P [n], R [n+1], Work [4*n], ncomp ; + int64_t n, Ap [n+1], Ai [nz], Q [n], P [n], R [n+1], Work [4*n], ncomp ; ncomp = btf_l_strongcomp (n, Ap, Ai, Q, P, R, Work) ; \end{verbatim} } @@ -1146,12 +1140,12 @@ \subsection{{\tt btf\_order}: permutation to block triangular form} {\footnotesize \begin{verbatim} - int n, Ap [n+1], Ai [nz], P [n], Q [n], R [n+1], nfound, Work [5*n], ncomp, nfound ; + int32_t n, Ap [n+1], Ai [nz], P [n], Q [n], R [n+1], nfound, Work [5*n], ncomp, nfound ; double maxwork, work ; ncomp = btf_order (n, Ap, Ai, maxwork, &work, P, Q, R, &nfound, Work) ; - SuiteSparse_long n, Ap [n+1], Ai [nz], P [n], Q [n], R [n+1], nfound, Work [5*n], ncomp, nfound ; + int64_t n, Ap [n+1], Ai [nz], P [n], Q [n], R [n+1], nfound, Work [5*n], ncomp, nfound ; double maxwork, work ; ncomp = btf_l_order (n, Ap, Ai, maxwork, &work, P, Q, R, &nfound, Work) ; \end{verbatim} @@ -1212,8 +1206,7 @@ \subsection{Sample C programs that use KLU} matrix). For a more complete program that uses KLU, see {\tt KLU/Demo/kludemo.c} for an -{\tt int} version, and {\tt KLU/Demo/kluldemo.c} for a version that uses {\tt -SuiteSparse\_long} instead. The top-level main routine uses CHOLMOD to read in a +\verb'int32_t' version, and {\tt KLU/Demo/kluldemo.c} for a version that uses \verb'int64_t' instead. The top-level main routine uses CHOLMOD to read in a compressed-column sparse matrix from a Matrix Market file, because KLU does not include such a function. Otherwise, no CHOLMOD functions are used. Unlike {\tt klu\_simple.c}, CHOLMOD is required to run the {\tt kludemo.c} and {\tt @@ -1224,20 +1217,14 @@ \section{Installation} \label{Install} %------------------------------------------------------------------------------ -Installation of the C-callable interface requires the {\tt make} utility, in -Linux/Unix. Alternatively, you can use the Cygwin {\tt make} in Windows. +Installation of the C-callable interface requires the {\tt cmake} utility. The MATLAB installation in any platform, including Windows is simple; just type {\tt klu\_install} to compile and install KLU, BTF, AMD, and COLAMD. -For {\tt make}, system-dependent configurations are in the {\tt -../SuiteSparse\_config/SuiteSparse\_config.mk} file. -You can edit that file to customize the -compilation, but it now automatically detecs your system (Linux, Mac, etc). -So it's not likely that you will need to edit that file. - +An optional \verb'Makefile' is provided to simplify the use of \verb'cmake'. To compile and install the C-callable KLU, BTF, AMD, and COLAMD libraries, go -to the {\tt KLU} directory and type {\tt make}. The KLU and BTF libraries are -placed in {\tt KLU/Lib/libklu.*} and {\tt BTF/Lib/libbtf.*}. +to the {\tt SuiteSparse} directory and type {\tt make}. The KLU and BTF libraries are +placed in {\tt KLU/build/libklu.*} and {\tt BTF/build/libbtf.*}. Two KLU demo programs will be compiled and tested in the {\tt KLU/Demo} directory. You can compare the output of {\tt make} with the results in the KLU distribution, {\tt @@ -1245,21 +1232,21 @@ \section{Installation} Typing {\tt make clean} will remove all but the final compiled libraries and demo programs. Typing {\tt make purge} or {\tt make distclean} removes all -files not in the original distribution. If you compile KLU or BTF and then -later change the {\tt ../SuiteSparse\_config/SuiteSparse\_config.mk} -file then you should type {\tt -make purge} and then {\tt make} to recompile. +files not in the original distribution. When you compile your program that uses the C-callable KLU library, you need to -add the {\tt KLU/Lib/libklu.*}, {\tt BTF/Lib/libbtf.*}, {\tt AMD/Lib/libamd.*}, -and {\tt COLAMD/Lib/libcolamd.*} libraries, and you need to tell your compiler to +add the {\tt KLU/build/libklu.*}, {\tt BTF/build/libbtf.*}, {\tt AMD/build/libamd.*}, +and {\tt COLAMD/build/libcolamd.*} libraries, and you need to tell your compiler to look in the {\tt KLU/Include} and {\tt BTF/Include} directory for include -files. -Alternatively, do {\tt make install}, and KLU will be installed in +files. If using \verb'cmake', each package includes scripts for \verb'find_library'. +Alternatively, do {\tt make install}, and KLU will be installed (on Linux/Mac) in /usr/local/lib and /usr/local/include, and documentation is placed in /usr/local/doc. These installation locations can be changed; see {\tt SuiteSparse/README.txt} for details. +To install in \verb'SuiteSparse/lib' +and \verb'SuiteSparse/include', use \verb'make local ; make install'. + If all you want to use is the KLU mexFunction in MATLAB, you can skip the use of the {\tt make} command entirely. Simply type {\tt klu\_install} in the MATLAB command window while in the {\tt KLU/MATLAB} directory. This works on diff --git a/ThirdParty/SuiteSparse/KLU/Doc/License.txt b/ThirdParty/SuiteSparse/KLU/Doc/License.txt index 82113cabc5..e1394b017b 100644 --- a/ThirdParty/SuiteSparse/KLU/Doc/License.txt +++ b/ThirdParty/SuiteSparse/KLU/Doc/License.txt @@ -1,5 +1,7 @@ -KLU, Copyright (C) 2004-2013, University of Florida -by Timothy A. Davis and Ekanathan Palamadai. +KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +Authors: Timothy A. Davis and Ekanathan Palamadai. +SPDX-License-Identifier: LGPL-2.1+ + KLU is also available under other licenses; contact authors for details. http://www.suitesparse.com diff --git a/ThirdParty/SuiteSparse/KLU/Doc/Makefile b/ThirdParty/SuiteSparse/KLU/Doc/Makefile index a275b4be59..9f1f09fc95 100644 --- a/ThirdParty/SuiteSparse/KLU/Doc/Makefile +++ b/ThirdParty/SuiteSparse/KLU/Doc/Makefile @@ -2,43 +2,32 @@ # KLU Makefile for creating the user guide #------------------------------------------------------------------------------ -default: dist - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -#------------------------------------------------------------------------------ -# Remove all but the files in the original distribution -#------------------------------------------------------------------------------ - -clean: - - $(RM) -r $(CLEAN) - -purge: distclean - -distclean: clean - - $(RM) -r $(PURGE) - -#------------------------------------------------------------------------------ -# Create the User Guide and Quick Start Guide -#------------------------------------------------------------------------------ +dist: KLU_UserGuide.pdf + - $(RM) *.aux *.bbl *.blg *.log *.toc + - $(RM) klu_simple_c.tex klu_h.tex btf_h.tex KLU_UserGuide.pdf: KLU_UserGuide.tex KLU_UserGuide.bib \ - ../Include/klu.h ../../BTF/Include/btf.h Makefile - echo '\\begin{verbatim}' > klu_h.tex + ../Include/klu.h ../../BTF/Include/btf.h Makefile klu_version.tex + printf '\\begin{verbatim}\n' > klu_h.tex expand -8 ../Include/klu.h >> klu_h.tex - echo '\\end{verbatim}' >> klu_h.tex - echo '\\begin{verbatim}' > btf_h.tex + printf '\\end{verbatim}\n' >> klu_h.tex + printf '\\begin{verbatim}\n' > btf_h.tex expand -8 ../../BTF/Include/btf.h >> btf_h.tex - echo '\\end{verbatim}' >> btf_h.tex - echo '\\begin{verbatim}' > klu_simple_c.tex + printf '\\end{verbatim}\n' >> btf_h.tex + printf '\\begin{verbatim}\n' > klu_simple_c.tex expand -8 ../Demo/klu_simple.c >> klu_simple_c.tex - echo '\\end{verbatim}' >> klu_simple_c.tex + printf '\\end{verbatim}\n' >> klu_simple_c.tex pdflatex KLU_UserGuide bibtex KLU_UserGuide pdflatex KLU_UserGuide pdflatex KLU_UserGuide -dist: KLU_UserGuide.pdf +# Remove all but the files in the original distribution +clean: - $(RM) *.aux *.bbl *.blg *.log *.toc - $(RM) klu_simple_c.tex klu_h.tex btf_h.tex +purge: clean + +distclean: clean + diff --git a/ThirdParty/SuiteSparse/KLU/Doc/klu_version.tex b/ThirdParty/SuiteSparse/KLU/Doc/klu_version.tex new file mode 100644 index 0000000000..f15e030533 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Doc/klu_version.tex @@ -0,0 +1,2 @@ +% version of SuiteSparse/KLU +\date{VERSION 2.0.3, Jan 17, 2023} diff --git a/ThirdParty/SuiteSparse/KLU/Doc/palamadai_e.pdf b/ThirdParty/SuiteSparse/KLU/Doc/palamadai_e.pdf deleted file mode 100644 index 6896e0ed12..0000000000 Binary files a/ThirdParty/SuiteSparse/KLU/Doc/palamadai_e.pdf and /dev/null differ diff --git a/ThirdParty/SuiteSparse/KLU/Include/klu.h b/ThirdParty/SuiteSparse/KLU/Include/klu.h index 07611f72da..80204ecf75 100644 --- a/ThirdParty/SuiteSparse/KLU/Include/klu.h +++ b/ThirdParty/SuiteSparse/KLU/Include/klu.h @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === klu include file ===================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu.h: include file for KLU +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Include file for user programs that call klu_* routines */ @@ -34,7 +40,7 @@ typedef struct double *Lnz ; /* size n, but only Lnz [0..nblocks-1] is used */ /* computed for all orderings: */ - int + int32_t n, /* input matrix A is n-by-n */ nz, /* # entries in input matrix */ *P, /* size n */ @@ -43,11 +49,11 @@ typedef struct nzoff, /* nz in off-diagonal blocks */ nblocks, /* number of blocks */ maxblock, /* size of largest block */ - ordering, /* ordering used (AMD, COLAMD, or GIVEN) */ + ordering, /* ordering used (0:AMD, 1:COLAMD, 2:given, ... */ do_btf ; /* whether or not BTF preordering was requested */ /* only computed if BTF preordering requested */ - int structural_rank ; /* 0 to n-1 if the matrix is structurally rank + int32_t structural_rank ; /* 0 to n-1 if the matrix is structurally rank * deficient. -1 if not computed. n if the matrix has * full structural rank */ @@ -57,7 +63,7 @@ typedef struct /* 64-bit version (otherwise same as above) */ { double symmetry, est_flops, lnz, unz ; double *Lnz ; - SuiteSparse_long n, nz, *P, *Q, *R, nzoff, nblocks, maxblock, ordering, + int64_t n, nz, *P, *Q, *R, nzoff, nblocks, maxblock, ordering, do_btf, structural_rank ; } klu_l_symbolic ; @@ -71,20 +77,20 @@ typedef struct /* LU factors of each block, the pivot row permutation, and the * entries in the off-diagonal blocks */ - int n ; /* A is n-by-n */ - int nblocks ; /* number of diagonal blocks */ - int lnz ; /* actual nz in L, including diagonal */ - int unz ; /* actual nz in U, including diagonal */ - int max_lnz_block ; /* max actual nz in L in any one block, incl. diag */ - int max_unz_block ; /* max actual nz in U in any one block, incl. diag */ - int *Pnum ; /* size n. final pivot permutation */ - int *Pinv ; /* size n. inverse of final pivot permutation */ + int32_t n ; /* A is n-by-n */ + int32_t nblocks ; /* number of diagonal blocks */ + int32_t lnz ; /* actual nz in L, including diagonal */ + int32_t unz ; /* actual nz in U, including diagonal */ + int32_t max_lnz_block ; /* max actual nz in L in any one block, incl. diag */ + int32_t max_unz_block ; /* max actual nz in U in any one block, incl. diag */ + int32_t *Pnum ; /* size n. final pivot permutation */ + int32_t *Pinv ; /* size n. inverse of final pivot permutation */ /* LU factors of each block */ - int *Lip ; /* size n. pointers into LUbx[block] for L */ - int *Uip ; /* size n. pointers into LUbx[block] for U */ - int *Llen ; /* size n. Llen [k] = # of entries in kth column of L */ - int *Ulen ; /* size n. Ulen [k] = # of entries in kth column of U */ + int32_t *Lip ; /* size n. pointers into LUbx[block] for L */ + int32_t *Uip ; /* size n. pointers into LUbx[block] for U */ + int32_t *Llen ; /* size n. Llen [k] = # of entries in kth column of L */ + int32_t *Ulen ; /* size n. Ulen [k] = # of entries in kth column of U */ void **LUbx ; /* L and U indices and entries (excl. diagonal of U) */ size_t *LUsize ; /* size of each LUbx [block], in sizeof (Unit) */ void *Udiag ; /* diagonal of U */ @@ -96,19 +102,19 @@ typedef struct size_t worksize ; /* size (in bytes) of Work */ void *Work ; /* workspace */ void *Xwork ; /* alias into Numeric->Work */ - int *Iwork ; /* alias into Numeric->Work */ + int32_t *Iwork ; /* alias into Numeric->Work */ /* off-diagonal entries in a conventional compressed-column sparse matrix */ - int *Offp ; /* size n+1, column pointers */ - int *Offi ; /* size nzoff, row indices */ + int32_t *Offp ; /* size n+1, column pointers */ + int32_t *Offi ; /* size nzoff, row indices */ void *Offx ; /* size nzoff, numerical values */ - int nzoff ; + int32_t nzoff ; } klu_numeric ; typedef struct /* 64-bit version (otherwise same as above) */ { - SuiteSparse_long n, nblocks, lnz, unz, max_lnz_block, max_unz_block, *Pnum, + int64_t n, nblocks, lnz, unz, max_lnz_block, max_unz_block, *Pnum, *Pinv, *Lip, *Uip, *Llen, *Ulen ; void **LUbx ; size_t *LUsize ; @@ -116,10 +122,10 @@ typedef struct /* 64-bit version (otherwise same as above) */ double *Rs ; size_t worksize ; void *Work, *Xwork ; - SuiteSparse_long *Iwork ; - SuiteSparse_long *Offp, *Offi ; + int64_t *Iwork ; + int64_t *Offp, *Offi ; void *Offx ; - SuiteSparse_long nzoff ; + int64_t nzoff ; } klu_l_numeric ; @@ -154,7 +160,8 @@ typedef struct klu_common_struct * 0: none, 1: sum, 2: max */ /* pointer to user ordering function */ - int (*user_order) (int, int *, int *, int *, struct klu_common_struct *) ; + int32_t (*user_order) (int32_t, int32_t *, int32_t *, int32_t *, + struct klu_common_struct *) ; /* pointer to user data, passed unchanged as the last parameter to the * user ordering function (optional, the user function need not use this @@ -177,23 +184,23 @@ typedef struct klu_common_struct int status ; /* KLU_OK if OK, < 0 if error */ int nrealloc ; /* # of reallocations of L and U */ - int structural_rank ; /* 0 to n-1 if the matrix is structurally rank + int32_t structural_rank ; /* 0 to n-1 if the matrix is structurally rank * deficient (as determined by maxtrans). -1 if not computed. n if the * matrix has full structural rank. This is computed by klu_analyze * if a BTF preordering is requested. */ - int numerical_rank ; /* First k for which a zero U(k,k) was found, + int32_t numerical_rank ; /* First k for which a zero U(k,k) was found, * if the matrix was singular (in the range 0 to n-1). n if the matrix * has full rank. This is not a true rank-estimation. It just reports * where the first zero pivot was found. -1 if not computed. * Computed by klu_factor and klu_refactor. */ - int singular_col ; /* n if the matrix is not singular. If in the + int32_t singular_col ; /* n if the matrix is not singular. If in the * range 0 to n-1, this is the column index of the original matrix A that * corresponds to the column of U that contains a zero diagonal entry. * -1 if not computed. Computed by klu_factor and klu_refactor. */ - int noffdiag ; /* # of off-diagonal pivots, -1 if not computed */ + int32_t noffdiag ; /* # of off-diagonal pivots, -1 if not computed */ double flops ; /* actual factorization flop count, from klu_flops */ double rcond ; /* crude reciprocal condition est., from klu_rcond */ @@ -210,14 +217,12 @@ typedef struct klu_l_common_struct /* 64-bit version (otherwise same as above)*/ { double tol, memgrow, initmem_amd, initmem, maxwork ; - SuiteSparse_long btf, ordering, scale ; - SuiteSparse_long (*user_order) (SuiteSparse_long, SuiteSparse_long *, - SuiteSparse_long *, SuiteSparse_long *, + int btf, ordering, scale ; + int64_t (*user_order) (int64_t, int64_t *, int64_t *, int64_t *, struct klu_l_common_struct *) ; void *user_data ; - SuiteSparse_long halt_if_singular ; - SuiteSparse_long status, nrealloc, structural_rank, numerical_rank, - singular_col, noffdiag ; + int halt_if_singular, status, nrealloc ; + int64_t structural_rank, numerical_rank, singular_col, noffdiag ; double flops, rcond, condest, rgrowth, work ; size_t memusage, mempeak ; @@ -232,7 +237,7 @@ int klu_defaults klu_common *Common ) ; -SuiteSparse_long klu_l_defaults (klu_l_common *Common) ; +int klu_l_defaults (klu_l_common *Common) ; /* -------------------------------------------------------------------------- */ /* klu_analyze: orders and analyzes a matrix */ @@ -244,14 +249,14 @@ SuiteSparse_long klu_l_defaults (klu_l_common *Common) ; klu_symbolic *klu_analyze ( /* inputs, not modified */ - int n, /* A is n-by-n */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t n, /* A is n-by-n */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ klu_common *Common ) ; -klu_l_symbolic *klu_l_analyze (SuiteSparse_long, SuiteSparse_long *, - SuiteSparse_long *, klu_l_common *Common) ; +klu_l_symbolic *klu_l_analyze (int64_t, int64_t *, int64_t *, + klu_l_common *Common) ; /* -------------------------------------------------------------------------- */ @@ -265,17 +270,16 @@ klu_l_symbolic *klu_l_analyze (SuiteSparse_long, SuiteSparse_long *, klu_symbolic *klu_analyze_given ( /* inputs, not modified */ - int n, /* A is n-by-n */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ - int P [ ], /* size n, user's row permutation (may be NULL) */ - int Q [ ], /* size n, user's column permutation (may be NULL) */ + int32_t n, /* A is n-by-n */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ + int32_t P [ ], /* size n, user's row permutation (may be NULL) */ + int32_t Q [ ], /* size n, user's column permutation (may be NULL) */ klu_common *Common ) ; -klu_l_symbolic *klu_l_analyze_given (SuiteSparse_long, SuiteSparse_long *, - SuiteSparse_long *, SuiteSparse_long *, SuiteSparse_long *, - klu_l_common *) ; +klu_l_symbolic *klu_l_analyze_given (int64_t, int64_t *, int64_t *, int64_t *, + int64_t *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -285,8 +289,8 @@ klu_l_symbolic *klu_l_analyze_given (SuiteSparse_long, SuiteSparse_long *, klu_numeric *klu_factor /* returns KLU_OK if OK, < 0 if error */ ( /* inputs, not modified */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* size nz, numerical values */ klu_symbolic *Symbolic, klu_common *Common @@ -295,19 +299,19 @@ klu_numeric *klu_factor /* returns KLU_OK if OK, < 0 if error */ klu_numeric *klu_z_factor /* returns KLU_OK if OK, < 0 if error */ ( /* inputs, not modified */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* size 2*nz, numerical values (real,imag pairs) */ klu_symbolic *Symbolic, klu_common *Common ) ; -/* long / real version */ -klu_l_numeric *klu_l_factor (SuiteSparse_long *, SuiteSparse_long *, double *, +/* int64_t / real version */ +klu_l_numeric *klu_l_factor (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_common *) ; -/* long / complex version */ -klu_l_numeric *klu_zl_factor (SuiteSparse_long *, SuiteSparse_long *, double *, +/* int64_t / complex version */ +klu_l_numeric *klu_zl_factor (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_common *) ; @@ -320,8 +324,8 @@ int klu_solve /* inputs, not modified */ klu_symbolic *Symbolic, klu_numeric *Numeric, - int ldim, /* leading dimension of B */ - int nrhs, /* number of right-hand-sides */ + int32_t ldim, /* leading dimension of B */ + int32_t nrhs, /* number of right-hand-sides */ /* right-hand-side on input, overwritten with solution to Ax=b on output */ double B [ ], /* size ldim*nrhs */ @@ -333,19 +337,19 @@ int klu_z_solve /* inputs, not modified */ klu_symbolic *Symbolic, klu_numeric *Numeric, - int ldim, /* leading dimension of B */ - int nrhs, /* number of right-hand-sides */ + int32_t ldim, /* leading dimension of B */ + int32_t nrhs, /* number of right-hand-sides */ /* right-hand-side on input, overwritten with solution to Ax=b on output */ double B [ ], /* size 2*ldim*nrhs */ klu_common *Common ) ; -SuiteSparse_long klu_l_solve (klu_l_symbolic *, klu_l_numeric *, - SuiteSparse_long, SuiteSparse_long, double *, klu_l_common *) ; +int klu_l_solve (klu_l_symbolic *, klu_l_numeric *, + int64_t, int64_t, double *, klu_l_common *) ; -SuiteSparse_long klu_zl_solve (klu_l_symbolic *, klu_l_numeric *, - SuiteSparse_long, SuiteSparse_long, double *, klu_l_common *) ; +int klu_zl_solve (klu_l_symbolic *, klu_l_numeric *, + int64_t, int64_t, double *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -357,8 +361,8 @@ int klu_tsolve /* inputs, not modified */ klu_symbolic *Symbolic, klu_numeric *Numeric, - int ldim, /* leading dimension of B */ - int nrhs, /* number of right-hand-sides */ + int32_t ldim, /* leading dimension of B */ + int32_t nrhs, /* number of right-hand-sides */ /* right-hand-side on input, overwritten with solution to Ax=b on output */ double B [ ], /* size ldim*nrhs */ @@ -370,8 +374,8 @@ int klu_z_tsolve /* inputs, not modified */ klu_symbolic *Symbolic, klu_numeric *Numeric, - int ldim, /* leading dimension of B */ - int nrhs, /* number of right-hand-sides */ + int32_t ldim, /* leading dimension of B */ + int32_t nrhs, /* number of right-hand-sides */ /* right-hand-side on input, overwritten with solution to Ax=b on output */ double B [ ], /* size 2*ldim*nrhs */ @@ -380,12 +384,11 @@ int klu_z_tsolve ) ; -SuiteSparse_long klu_l_tsolve (klu_l_symbolic *, klu_l_numeric *, - SuiteSparse_long, SuiteSparse_long, double *, klu_l_common *) ; +int klu_l_tsolve (klu_l_symbolic *, klu_l_numeric *, + int64_t, int64_t, double *, klu_l_common *) ; -SuiteSparse_long klu_zl_tsolve (klu_l_symbolic *, klu_l_numeric *, - SuiteSparse_long, SuiteSparse_long, double *, SuiteSparse_long, - klu_l_common * ) ; +int klu_zl_tsolve (klu_l_symbolic *, klu_l_numeric *, + int64_t, int64_t, double *, int, klu_l_common * ) ; /* -------------------------------------------------------------------------- */ @@ -395,8 +398,8 @@ SuiteSparse_long klu_zl_tsolve (klu_l_symbolic *, klu_l_numeric *, int klu_refactor /* return TRUE if successful, FALSE otherwise */ ( /* inputs, not modified */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* size nz, numerical values */ klu_symbolic *Symbolic, /* input, and numerical values modified on output */ @@ -407,8 +410,8 @@ int klu_refactor /* return TRUE if successful, FALSE otherwise */ int klu_z_refactor /* return TRUE if successful, FALSE otherwise */ ( /* inputs, not modified */ - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* size 2*nz, numerical values */ klu_symbolic *Symbolic, /* input, and numerical values modified on output */ @@ -416,10 +419,10 @@ int klu_z_refactor /* return TRUE if successful, FALSE otherwise */ klu_common *Common ) ; -SuiteSparse_long klu_l_refactor (SuiteSparse_long *, SuiteSparse_long *, +int klu_l_refactor (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; -SuiteSparse_long klu_zl_refactor (SuiteSparse_long *, SuiteSparse_long *, +int klu_zl_refactor (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; @@ -433,7 +436,7 @@ int klu_free_symbolic klu_common *Common ) ; -SuiteSparse_long klu_l_free_symbolic (klu_l_symbolic **, klu_l_common *) ; +int klu_l_free_symbolic (klu_l_symbolic **, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -455,8 +458,8 @@ int klu_z_free_numeric klu_common *Common ) ; -SuiteSparse_long klu_l_free_numeric (klu_l_numeric **, klu_l_common *) ; -SuiteSparse_long klu_zl_free_numeric (klu_l_numeric **, klu_l_common *) ; +int klu_l_free_numeric (klu_l_numeric **, klu_l_common *) ; +int klu_zl_free_numeric (klu_l_numeric **, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -483,10 +486,8 @@ int klu_z_sort klu_common *Common ) ; -SuiteSparse_long klu_l_sort (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; -SuiteSparse_long klu_zl_sort (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; +int klu_l_sort (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; +int klu_zl_sort (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -511,10 +512,8 @@ int klu_z_flops klu_common *Common ) ; -SuiteSparse_long klu_l_flops (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; -SuiteSparse_long klu_zl_flops (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; +int klu_l_flops (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; +int klu_zl_flops (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -536,8 +535,8 @@ SuiteSparse_long klu_zl_flops (klu_l_symbolic *, klu_l_numeric *, int klu_rgrowth ( - int Ap [ ], - int Ai [ ], + int32_t Ap [ ], + int32_t Ai [ ], double Ax [ ], klu_symbolic *Symbolic, klu_numeric *Numeric, @@ -546,18 +545,18 @@ int klu_rgrowth int klu_z_rgrowth ( - int Ap [ ], - int Ai [ ], + int32_t Ap [ ], + int32_t Ai [ ], double Ax [ ], klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common /* Common->rgrowth = reciprocal pivot growth */ ) ; -SuiteSparse_long klu_l_rgrowth (SuiteSparse_long *, SuiteSparse_long *, +int klu_l_rgrowth (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; -SuiteSparse_long klu_zl_rgrowth (SuiteSparse_long *, SuiteSparse_long *, +int klu_zl_rgrowth (int64_t *, int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; @@ -571,7 +570,7 @@ SuiteSparse_long klu_zl_rgrowth (SuiteSparse_long *, SuiteSparse_long *, int klu_condest ( - int Ap [ ], /* size n+1, column pointers, not modified */ + int32_t Ap [ ], /* size n+1, column pointers, not modified */ double Ax [ ], /* size nz = Ap[n], numerical values, not modified*/ klu_symbolic *Symbolic, /* symbolic analysis, not modified */ klu_numeric *Numeric, /* numeric factorization, not modified */ @@ -580,17 +579,17 @@ int klu_condest int klu_z_condest ( - int Ap [ ], + int32_t Ap [ ], double Ax [ ], /* size 2*nz */ klu_symbolic *Symbolic, klu_numeric *Numeric, klu_common *Common /* result returned in Common->condest */ ) ; -SuiteSparse_long klu_l_condest (SuiteSparse_long *, double *, klu_l_symbolic *, +int klu_l_condest (int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; -SuiteSparse_long klu_zl_condest (SuiteSparse_long *, double *, klu_l_symbolic *, +int klu_zl_condest (int64_t *, double *, klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; @@ -612,12 +611,8 @@ int klu_z_rcond klu_common *Common /* result in Common->rcond */ ) ; -SuiteSparse_long klu_l_rcond (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; - -SuiteSparse_long klu_zl_rcond (klu_l_symbolic *, klu_l_numeric *, - klu_l_common *) ; - +int klu_l_rcond (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; +int klu_zl_rcond (klu_l_symbolic *, klu_l_numeric *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ /* klu_scale */ @@ -627,14 +622,14 @@ int klu_scale /* return TRUE if successful, FALSE otherwise */ ( /* inputs, not modified */ int scale, /* <0: none, no error check; 0: none, 1: sum, 2: max */ - int n, - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t n, + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* outputs, not defined on input */ double Rs [ ], /* workspace, not defined on input or output */ - int W [ ], /* size n, can be NULL */ + int32_t W [ ], /* size n, can be NULL */ klu_common *Common ) ; @@ -642,24 +637,22 @@ int klu_z_scale /* return TRUE if successful, FALSE otherwise */ ( /* inputs, not modified */ int scale, /* <0: none, no error check; 0: none, 1: sum, 2: max */ - int n, - int Ap [ ], /* size n+1, column pointers */ - int Ai [ ], /* size nz, row indices */ + int32_t n, + int32_t Ap [ ], /* size n+1, column pointers */ + int32_t Ai [ ], /* size nz, row indices */ double Ax [ ], /* outputs, not defined on input */ double Rs [ ], /* workspace, not defined on input or output */ - int W [ ], /* size n, can be NULL */ + int32_t W [ ], /* size n, can be NULL */ klu_common *Common ) ; -SuiteSparse_long klu_l_scale (SuiteSparse_long, SuiteSparse_long, - SuiteSparse_long *, SuiteSparse_long *, double *, - double *, SuiteSparse_long *, klu_l_common *) ; +int klu_l_scale (int, int64_t, int64_t *, int64_t *, double *, + double *, int64_t *, klu_l_common *) ; -SuiteSparse_long klu_zl_scale (SuiteSparse_long, SuiteSparse_long, - SuiteSparse_long *, SuiteSparse_long *, double *, - double *, SuiteSparse_long *, klu_l_common *) ; +int klu_zl_scale (int, int64_t, int64_t *, int64_t *, double *, + double *, int64_t *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -675,31 +668,31 @@ int klu_extract /* returns TRUE if successful, FALSE otherwise */ /* outputs, either allocated on input, or ignored otherwise */ /* L */ - int *Lp, /* size n+1 */ - int *Li, /* size Numeric->lnz */ + int32_t *Lp, /* size n+1 */ + int32_t *Li, /* size Numeric->lnz */ double *Lx, /* size Numeric->lnz */ /* U */ - int *Up, /* size n+1 */ - int *Ui, /* size Numeric->unz */ + int32_t *Up, /* size n+1 */ + int32_t *Ui, /* size Numeric->unz */ double *Ux, /* size Numeric->unz */ /* F */ - int *Fp, /* size n+1 */ - int *Fi, /* size Numeric->nzoff */ + int32_t *Fp, /* size n+1 */ + int32_t *Fi, /* size Numeric->nzoff */ double *Fx, /* size Numeric->nzoff */ /* P, row permutation */ - int *P, /* size n */ + int32_t *P, /* size n */ /* Q, column permutation */ - int *Q, /* size n */ + int32_t *Q, /* size n */ /* Rs, scale factors */ double *Rs, /* size n */ /* R, block boundaries */ - int *R, /* size Symbolic->nblocks+1 (nblocks is at most n) */ + int32_t *R, /* size Symbolic->nblocks+1 (nblocks is at most n) */ klu_common *Common ) ; @@ -714,51 +707,51 @@ int klu_z_extract /* returns TRUE if successful, FALSE otherwise */ /* outputs, all of which must be allocated on input */ /* L */ - int *Lp, /* size n+1 */ - int *Li, /* size nnz(L) */ + int32_t *Lp, /* size n+1 */ + int32_t *Li, /* size nnz(L) */ double *Lx, /* size nnz(L) */ double *Lz, /* size nnz(L) for the complex case, ignored if real */ /* U */ - int *Up, /* size n+1 */ - int *Ui, /* size nnz(U) */ + int32_t *Up, /* size n+1 */ + int32_t *Ui, /* size nnz(U) */ double *Ux, /* size nnz(U) */ double *Uz, /* size nnz(U) for the complex case, ignored if real */ /* F */ - int *Fp, /* size n+1 */ - int *Fi, /* size nnz(F) */ + int32_t *Fp, /* size n+1 */ + int32_t *Fi, /* size nnz(F) */ double *Fx, /* size nnz(F) */ double *Fz, /* size nnz(F) for the complex case, ignored if real */ /* P, row permutation */ - int *P, /* size n */ + int32_t *P, /* size n */ /* Q, column permutation */ - int *Q, /* size n */ + int32_t *Q, /* size n */ /* Rs, scale factors */ double *Rs, /* size n */ /* R, block boundaries */ - int *R, /* size Symbolic->nblocks+1 (nblocks is at most n) */ + int32_t *R, /* size Symbolic->nblocks+1 (nblocks is at most n) */ klu_common *Common ) ; -SuiteSparse_long klu_l_extract (klu_l_numeric *, klu_l_symbolic *, - SuiteSparse_long *, SuiteSparse_long *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, - SuiteSparse_long *, klu_l_common *) ; +int klu_l_extract (klu_l_numeric *, klu_l_symbolic *, + int64_t *, int64_t *, double *, + int64_t *, int64_t *, double *, + int64_t *, int64_t *, double *, + int64_t *, int64_t *, double *, + int64_t *, klu_l_common *) ; -SuiteSparse_long klu_zl_extract (klu_l_numeric *, klu_l_symbolic *, - SuiteSparse_long *, SuiteSparse_long *, double *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, double *, - SuiteSparse_long *, SuiteSparse_long *, double *, - SuiteSparse_long *, klu_l_common *) ; +int klu_zl_extract (klu_l_numeric *, klu_l_symbolic *, + int64_t *, int64_t *, double *, double *, + int64_t *, int64_t *, double *, double *, + int64_t *, int64_t *, double *, double *, + int64_t *, int64_t *, double *, + int64_t *, klu_l_common *) ; /* -------------------------------------------------------------------------- */ @@ -797,7 +790,9 @@ void *klu_realloc /* returns pointer to reallocated block */ ) ; void *klu_l_malloc (size_t, size_t, klu_l_common *) ; + void *klu_l_free (void *, size_t, size_t, klu_l_common *) ; + void *klu_l_realloc (size_t, size_t, size_t, void *, klu_l_common *) ; @@ -819,11 +814,12 @@ void *klu_l_realloc (size_t, size_t, size_t, void *, klu_l_common *) ; * #endif */ -#define KLU_DATE "Mar 12, 2018" +#define KLU_DATE "Jan 17, 2023" +#define KLU_MAIN_VERSION 2 +#define KLU_SUB_VERSION 0 +#define KLU_SUBSUB_VERSION 3 + #define KLU_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) -#define KLU_MAIN_VERSION 1 -#define KLU_SUB_VERSION 3 -#define KLU_SUBSUB_VERSION 9 #define KLU_VERSION KLU_VERSION_CODE(KLU_MAIN_VERSION,KLU_SUB_VERSION) #ifdef __cplusplus diff --git a/ThirdParty/SuiteSparse/KLU/Include/klu_internal.h b/ThirdParty/SuiteSparse/KLU/Include/klu_internal.h index f3d63c89e1..60fa514a3a 100644 --- a/ThirdParty/SuiteSparse/KLU/Include/klu_internal.h +++ b/ThirdParty/SuiteSparse/KLU/Include/klu_internal.h @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU/Include/klu_internal.h =========================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Include/klu_internal.h: internal include file for KLU +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* For internal use in KLU routines only, not for user programs */ @@ -31,11 +37,7 @@ /* ========================================================================== */ -#include #include -#include -#include -#include #undef ASSERT #ifndef NDEBUG diff --git a/ThirdParty/SuiteSparse/KLU/Include/klu_version.h b/ThirdParty/SuiteSparse/KLU/Include/klu_version.h index e762a435c1..f2d4915c97 100644 --- a/ThirdParty/SuiteSparse/KLU/Include/klu_version.h +++ b/ThirdParty/SuiteSparse/KLU/Include/klu_version.h @@ -1,14 +1,24 @@ +//------------------------------------------------------------------------------ +// KLU/Include/klu_version.h: internal include file for KLU +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ + #ifndef _KLU_VERSION_H #define _KLU_VERSION_H #ifdef DLONG -#define Int SuiteSparse_long -#define Int_id SuiteSparse_long_id -#define Int_MAX SuiteSparse_long_max +#define Int int64_t +#define Int_id "%" PRId64 +#define Int_MAX INT64_MAX #else -#define Int int +#define Int int32_t #define Int_id "%d" -#define Int_MAX INT_MAX +#define Int_MAX INT32_MAX #endif #define NPRINT @@ -41,6 +51,7 @@ #ifdef DLONG +// zl: complex int64_t #define KLU_scale klu_zl_scale #define KLU_solve klu_zl_solve #define KLU_tsolve klu_zl_tsolve @@ -64,6 +75,7 @@ #else +// z: complex int32_t #define KLU_scale klu_z_scale #define KLU_solve klu_z_solve #define KLU_tsolve klu_z_tsolve @@ -91,6 +103,7 @@ #ifdef DLONG +// l: int64_t #define KLU_scale klu_l_scale #define KLU_solve klu_l_solve #define KLU_tsolve klu_l_tsolve @@ -114,6 +127,7 @@ #else +// no prefix: int32_t #define KLU_scale klu_scale #define KLU_solve klu_solve #define KLU_tsolve klu_tsolve @@ -142,6 +156,7 @@ #ifdef DLONG +// l: int64_t #define KLU_analyze klu_l_analyze #define KLU_analyze_given klu_l_analyze_given #define KLU_alloc_symbolic klu_l_alloc_symbolic @@ -166,6 +181,7 @@ #else +// no prefiex: int64_t #define KLU_analyze klu_analyze #define KLU_analyze_given klu_analyze_given #define KLU_alloc_symbolic klu_alloc_symbolic @@ -305,10 +321,10 @@ typedef double Unit ; that possibility. ANSI C *does* guarantee that an array of structs has the same size as n times the size of one struct. - The ANSI C99 version of the C language includes a "double _Complex" type. + The ANSI C11 version of the C language includes a "double complex" type. It should be possible in that case to do the following: - #define Entry double _Complex + #define Entry double complex and remove the Double_Complex struct. The macros, below, could then be replaced with instrinsic operators. Note that the #define Real and @@ -355,7 +371,7 @@ typedef Double_Complex Unit ; #define SPLIT(sz) ((sz) != (double *) NULL) /* c = (s1) + (s2)*i, if s2 is null, then X is in "packed" format (compatible - * with Entry and ANSI C99 double _Complex type). */ + * with Entry and ANSI C11 double complex type). */ /*#define ASSIGN(c,s1,s2,p,split) \ { \ if (split) \ diff --git a/ThirdParty/SuiteSparse/KLU/Lib/Makefile b/ThirdParty/SuiteSparse/KLU/Lib/Makefile deleted file mode 100644 index 2dc62cb4ac..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Lib/Makefile +++ /dev/null @@ -1,291 +0,0 @@ -#------------------------------------------------------------------------------- -# KLU Lib/Makefile -#------------------------------------------------------------------------------- - -LIBRARY = libklu -VERSION = 1.3.8 -SO_VERSION = 1 - -default: library - -ccode: all - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -# KLU depends on BTF, AMD, COLAMD, and SuiteSparse_config -LDLIBS += -lamd -lcolamd -lbtf -lsuitesparseconfig - -# compile and install in SuiteSparse/lib -library: - $(MAKE) install INSTALL=$(SUITESPARSE) - -# for testing only: -# TEST = -DTESTING - -C = $(CC) $(CF) - -INC = ../Include/klu.h ../Include/klu_internal.h ../Include/klu_version.h \ - ../../SuiteSparse_config/SuiteSparse_config.h - -I = -I../../AMD/Include -I../../COLAMD/Include -I../../BTF/Include \ - -I../Include -I../../SuiteSparse_config - -all: library - -KLU_D = klu_d.o klu_d_kernel.o klu_d_dump.o \ - klu_d_factor.o klu_d_free_numeric.o klu_d_solve.o \ - klu_d_scale.o klu_d_refactor.o \ - klu_d_tsolve.o klu_d_diagnostics.o klu_d_sort.o klu_d_extract.o - -KLU_Z = klu_z.o klu_z_kernel.o klu_z_dump.o \ - klu_z_factor.o klu_z_free_numeric.o klu_z_solve.o \ - klu_z_scale.o klu_z_refactor.o \ - klu_z_tsolve.o klu_z_diagnostics.o klu_z_sort.o klu_z_extract.o - -KLU_L = klu_l.o klu_l_kernel.o klu_l_dump.o \ - klu_l_factor.o klu_l_free_numeric.o klu_l_solve.o \ - klu_l_scale.o klu_l_refactor.o \ - klu_l_tsolve.o klu_l_diagnostics.o klu_l_sort.o klu_l_extract.o - -KLU_ZL = klu_zl.o klu_zl_kernel.o klu_zl_dump.o \ - klu_zl_factor.o klu_zl_free_numeric.o klu_zl_solve.o \ - klu_zl_scale.o klu_zl_refactor.o \ - klu_zl_tsolve.o klu_zl_diagnostics.o klu_zl_sort.o klu_zl_extract.o - -COMMON = \ - klu_free_symbolic.o klu_defaults.o klu_analyze_given.o \ - klu_analyze.o klu_memory.o \ - klu_l_free_symbolic.o klu_l_defaults.o klu_l_analyze_given.o \ - klu_l_analyze.o klu_l_memory.o - -OBJ = $(COMMON) $(KLU_D) $(KLU_Z) $(KLU_L) $(KLU_ZL) - -static: $(AR_TARGET) - -$(AR_TARGET): $(OBJ) - $(ARCHIVE) $@ $^ - - $(RANLIB) $@ - -$(OBJ): $(INC) - -#------------------------------------------------------------------------------- - -klu_d.o: ../Source/klu.c - $(C) -c $(I) $< -o $@ - -klu_z.o: ../Source/klu.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -klu_d_kernel.o: ../Source/klu_kernel.c - $(C) -c $(I) $< -o $@ - -klu_z_kernel.o: ../Source/klu_kernel.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -klu_d_sort.o: ../Source/klu_sort.c - $(C) -c $(I) $< -o $@ - -klu_z_sort.o: ../Source/klu_sort.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -klu_d_diagnostics.o: ../Source/klu_diagnostics.c - $(C) -c $(I) $< -o $@ - -klu_z_diagnostics.o: ../Source/klu_diagnostics.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -klu_d_dump.o: ../Source/klu_dump.c - $(C) -c $(I) $< -o $@ - -klu_z_dump.o: ../Source/klu_dump.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -klu_d_factor.o: ../Source/klu_factor.c - $(C) -c $(I) $< -o $@ - -klu_z_factor.o: ../Source/klu_factor.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -klu_d_free_numeric.o: ../Source/klu_free_numeric.c - $(C) -c $(I) $< -o $@ - -klu_z_free_numeric.o: ../Source/klu_free_numeric.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -klu_d_extract.o: ../Source/klu_extract.c - $(C) -c $(I) $< -o $@ - -klu_z_extract.o: ../Source/klu_extract.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -klu_d_refactor.o: ../Source/klu_refactor.c - $(C) -c $(I) $< -o $@ - -klu_z_refactor.o: ../Source/klu_refactor.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -klu_d_scale.o: ../Source/klu_scale.c - $(C) -c $(I) $< -o $@ - -klu_z_scale.o: ../Source/klu_scale.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -klu_d_solve.o: ../Source/klu_solve.c - $(C) -c $(I) $< -o $@ - -klu_z_solve.o: ../Source/klu_solve.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -klu_d_tsolve.o: ../Source/klu_tsolve.c - $(C) -c $(I) $< -o $@ - -klu_z_tsolve.o: ../Source/klu_tsolve.c - $(C) -c -DCOMPLEX $(I) $< -o $@ - -#------------------------------------------------------------------------------- - -klu_analyze.o: ../Source/klu_analyze.c - $(C) -c $(I) $< -o $@ - -klu_analyze_given.o: ../Source/klu_analyze_given.c - $(C) -c $(I) $< -o $@ - -klu_defaults.o: ../Source/klu_defaults.c - $(C) -c $(I) $< -o $@ - -klu_free_symbolic.o: ../Source/klu_free_symbolic.c - $(C) -c $(I) $< -o $@ - -klu_memory.o: ../Source/klu_memory.c - $(C) -c $(I) $< -o $@ - -#------------------------------------------------------------------------------- - -purge: distclean - -distclean: clean - - $(RM) -r $(PURGE) - -clean: - - $(RM) -r $(CLEAN) - -#------------------------------------------------------------------------------- - -klu_l.o: ../Source/klu.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl.o: ../Source/klu.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -klu_l_kernel.o: ../Source/klu_kernel.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl_kernel.o: ../Source/klu_kernel.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -klu_l_sort.o: ../Source/klu_sort.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl_sort.o: ../Source/klu_sort.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -klu_l_diagnostics.o: ../Source/klu_diagnostics.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl_diagnostics.o: ../Source/klu_diagnostics.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -klu_l_dump.o: ../Source/klu_dump.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl_dump.o: ../Source/klu_dump.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -klu_l_factor.o: ../Source/klu_factor.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl_factor.o: ../Source/klu_factor.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -klu_l_free_numeric.o: ../Source/klu_free_numeric.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl_free_numeric.o: ../Source/klu_free_numeric.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -klu_l_extract.o: ../Source/klu_extract.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl_extract.o: ../Source/klu_extract.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -klu_l_refactor.o: ../Source/klu_refactor.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl_refactor.o: ../Source/klu_refactor.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -klu_l_scale.o: ../Source/klu_scale.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl_scale.o: ../Source/klu_scale.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -klu_l_solve.o: ../Source/klu_solve.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl_solve.o: ../Source/klu_solve.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -klu_l_tsolve.o: ../Source/klu_tsolve.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_zl_tsolve.o: ../Source/klu_tsolve.c - $(C) -c -DCOMPLEX -DDLONG $(I) $< -o $@ - -#------------------------------------------------------------------------------- - -klu_l_analyze.o: ../Source/klu_analyze.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_l_analyze_given.o: ../Source/klu_analyze_given.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_l_defaults.o: ../Source/klu_defaults.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_l_free_symbolic.o: ../Source/klu_free_symbolic.c - $(C) -c -DDLONG $(I) $< -o $@ - -klu_l_memory.o: ../Source/klu_memory.c - $(C) -c -DDLONG $(I) $< -o $@ - -#------------------------------------------------------------------------------- - -# install KLU -install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET) - -$(INSTALL_LIB)/$(SO_TARGET): $(OBJ) - @mkdir -p $(INSTALL_LIB) - @mkdir -p $(INSTALL_INCLUDE) - @mkdir -p $(INSTALL_DOC) - $(CC) $(SO_OPTS) $^ -o $@ $(LDLIBS) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) ) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) ) - $(CP) ../Include/klu.h $(INSTALL_INCLUDE) - $(CP) ../Doc/KLU_UserGuide.pdf $(INSTALL_DOC) - $(CP) ../README.txt $(INSTALL_DOC)/KLU_README.txt - chmod 755 $(INSTALL_LIB)/$(SO_TARGET) - chmod 644 $(INSTALL_INCLUDE)/klu.h - chmod 644 $(INSTALL_DOC)/KLU_UserGuide.pdf - chmod 644 $(INSTALL_DOC)/KLU_README.txt - -# uninstall KLU -uninstall: - $(RM) $(INSTALL_LIB)/$(SO_TARGET) - $(RM) $(INSTALL_LIB)/$(SO_PLAIN) - $(RM) $(INSTALL_LIB)/$(SO_MAIN) - $(RM) $(INSTALL_INCLUDE)/klu.h - $(RM) $(INSTALL_DOC)/KLU_UserGuide.pdf - $(RM) $(INSTALL_DOC)/KLU_README.txt - diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/Contents.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Contents.m deleted file mode 100644 index ee6c1802db..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/Contents.m +++ /dev/null @@ -1,16 +0,0 @@ -% KLU: a "Clark Kent" LU factorization algorithm -% -% klu - sparse left-looking LU factorization, using a block triangular form. -% klu_install - compiles and installs the KLU, BTF, AMD, and COLAMD mexFunctions -% klu_demo - KLU demo -% klu_make - compiles the KLU mexFunctions -% -% Example: -% -% LU = klu (A) ; -% x = klu (A, '\', b) ; -% x = klu (LU, '\', b) ; -% -% Copyright 2004-2009, Univ. of Florida -% KLU Version 1.0. - diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/klu_test.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/klu_test.m deleted file mode 100644 index f6f0ceb9ba..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/klu_test.m +++ /dev/null @@ -1,18 +0,0 @@ -function klu_test (nmat) -%klu_test KLU test -% Example: -% klu_test -% -% See also klu - -% Copyright 2004-2012, University of Florida - -if (nargin < 1) - nmat = 200 ; -end - -test1 (nmat) ; -test2 (nmat) ; -test3 ; -test4 (nmat) ; -test5 ; diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test1.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test1.m deleted file mode 100644 index 8c8e493a23..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test1.m +++ /dev/null @@ -1,114 +0,0 @@ -function test1 (nmat) -%test1: KLU test -% Example: -% test1 -% -% See also klu - -% Copyright 2004-2012, University of Florida - -clear functions -% rand ('state', 0) ; - -index = UFget ; -f = find (index.nrows == index.ncols & index.isReal) ; -[ignore i] = sort (index.nnz (f)) ; %#ok -f = f (i) ; - -h = waitbar (0, 'KLU test 1 of 5') ; - -if (nargin < 1) - nmat = 500 ; -end -nmat = min (nmat, length (f)) ; - -% just use the first 100 matrices -nmat = min (nmat, 100) ; - -f = f (1:nmat) ; - -% f = 274 -% f = 101 ; % MATLAB condest is poor - -nmat = length (f) ; - -conds_klu = ones (1,nmat) ; -conds_matlab = ones (1,nmat) ; - -clf - -% try - - for k = 1:nmat - - waitbar (k/nmat, h) ; - - i = f (k) ; -% try - c = -1 ; - blocks = 0 ; - rho = 0 ; - c2 = 0 ; - r1 = 0 ; - r2 = 0 ; - err = 0 ; - - Prob = UFget (i,index) ; - A = Prob.A ; - c = condest (A) ; - fprintf ('condest %8.2e :', c) ; - if (c > 1e20) - fprintf ('skipped\n') ; - continue - end - % klu (A) - % [L,U,p,q,R,F,r,info] = klu (A) ; - - [LU, info, c2] = klu (A) ; - - L = LU.L ; - U = LU.U ; - p = LU.p ; - q = LU.q ; - R = LU.R ; - F = LU.F ; - r = LU.r ; - blocks = length (r) - 1 ; - - n = size (A,1) ; - b = rand (n,1) ; - x = klu (LU,'\',b) ; - err = norm (A*x-b,1) / norm (A,1) ; - - % info - rho = lu_normest (R\A(p,q) - F, L, U) ; - r1 = info.rcond ; - r2 = full (min (abs (diag (U))) / max (abs (diag (U)))) ; - - if (r1 ~= r2) - fprintf ('!\n') ; - pause - end - - conds_klu (k) = c2 ; - conds_matlab (k) = c ; - -% catch me -% disp (me.message) ; -% end - - fprintf (... - 'blocks %6d err %8.2e %8.2e rcond %8.2e %8.2e err %8.2e\n', ... - blocks, rho, c2, r1, r2, err) ; - - end - - k = nmat ; - plot (1:k, log10 (conds_klu (1:k) ./ conds_matlab (1:k)), 'o') ; - drawnow - -% catch me -% disp (me.message) ; -% end - -close (h) ; diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test2.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test2.m deleted file mode 100644 index aad51228fe..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test2.m +++ /dev/null @@ -1,173 +0,0 @@ -function test2 (nmat) -%test2: KLU test -% Example: -% test2 -% See also klu - -% Copyright 2004-2012, University of Florida - -clear functions -% rand ('state', 0) ; -% warning ('off', 'MATLAB:singularMatrix') ; -% warning ('off', 'MATLAB:nearlySingularMatrix') ; -% warning ('off', 'MATLAB:divideByZero') ; - -index = UFget ; -f = find (index.nrows == index.ncols) ; -[ignore i] = sort (index.nnz (f)) ; %#ok -f = f (i) ; - -if (nargin < 1) - nmat = 500 ; -end -nmat = min (nmat, length (f)) ; -f = f (1:nmat) ; - -if (~isempty (strfind (computer, '64'))) - is64 = 1 ; -else - is64 = 0 ; -end - -Tklu = 1e-6 * ones (2*nmat,1) ; -Tmatlab = zeros (2*nmat,1) ; -Tcsparse = zeros (2*nmat,1) ; -LUnz = zeros (2*nmat, 1) ; -k = 0 ; - -h = waitbar (0, 'KLU test 2 of 5') ; - -clf - -% try - - for kk = 1:nmat - - Prob = UFget (f (kk), index) ; - - waitbar (kk/nmat, h) ; - - disp (Prob) ; - if (isfield (Prob, 'kind')) - if (~isempty (strfind (Prob.kind, 'subsequent'))) - fprintf ('skip ...\n') ; - continue - end - end - A = Prob.A ; - - for do_complex = 0:1 - - k = k + 1 ; - if (do_complex) - A = sprand (A) + 1i * sprand (A) ; - end - - try - [L,U,p,q] = lu (A, 'vector') ; - catch %#ok - % older version of MATLAB, which doesn't have 'vector' option - [L,U,P,Q] = lu (A) ; - [p ignore1 ignore2] = find (P') ; %#ok - [q ignore1 ignore2] = find (Q) ; %#ok - clear ignore1 ignore2 P Q - end - - LU.L = L ; - LU.U = U ; - if (is64) - LU.p = int64 (p) ; - LU.q = int64 (q) ; - else - LU.p = int32 (p) ; - LU.q = int32 (q) ; - end - LUnz (k) = nnz (L) + nnz (U) ; - - n = size (A,1) ; - - do_klu = (nnz (diag (U)) == n) ; - if (do_klu) - - fprintf ('klu...\n') ; - err = 0 ; - erc = 0 ; - er2 = 0 ; - for nrhs = 10:-1:1 - - b = rand (n,nrhs) ; - - tic ; - x = klu (LU,'\',b) ; - Tklu (k) = max (1e-6, toc) ; - - tic ; - y = U \ (L \ b (p,:)) ; - y (q,:) = y ; - Tmatlab (k) = max (1e-6, toc) ; - - if (nrhs == 1 & isreal (U) & isreal (L) & isreal (b)) %#ok - tic ; - z = cs_usolve (U, cs_lsolve (L, b (p))) ; - z (q) = z ; - Tcsparse (k) = max (1e-6, toc) ; - erc = norm (A*z-b,1) / norm (A,1) ; - end - - err = max (err, norm (A*x-b,1) / norm (A,1)) ; - er2 = max (er2, norm (A*y-b,1) / norm (A,1)) ; - if (err > 100*er2) - fprintf ('error %g %g\n', err, er2) ; - error ('?') ; - end - end - - fprintf ('klu... with randomized scaling for L\n') ; - er3 = 0 ; - er4 = 0 ; - D = spdiags (rand (n,1), 0, n, n) ; - LU.L = D * L ; - A2 = D * A (p,q) ; - if (is64) - LU.p = int64 (1:n) ; - LU.q = int64 (1:n) ; - else - LU.p = int32 (1:n) ; - LU.q = int32 (1:n) ; - end - for nrhs = 1:10 - b = rand (n,nrhs) ; - x = klu (LU,'\',b) ; - y = U \ (LU.L \ b) ; - er3 = max (er3, norm (A2*x-b,1) / norm (A,1)) ; - er4 = max (er4, norm (A2*y-b,1) / norm (A,1)) ; - if (er3 > 1e3*er4) - fprintf ('error %g %g\n', er3, er4) ; - error ('?') ; - end - end - - - else - err = Inf ; - er2 = Inf ; - erc = Inf ; - end - - lumax = max (LUnz (1:k)) ; - loglog (... - LUnz (1:k), Tmatlab (1:k) ./ Tklu (1:k), 'o', ... - LUnz (1:k), Tcsparse (1:k) ./ Tklu (1:k), 'x', ... - [20 lumax], [1 1], 'r-') ; - axis ([20 lumax .1 20]) ; - drawnow - - fprintf ('err %g %g %g\n', err, er2, erc) ; - end - end - -% catch me -% disp (me.message) ; -% end - -close (h) ; diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test3.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test3.m deleted file mode 100644 index f0a48212f6..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test3.m +++ /dev/null @@ -1,61 +0,0 @@ -function test3 -%test3: KLU test -% Example: -% test3 -% See also klu - -% Copyright 2004-2012, University of Florida - -h = waitbar (1/12, 'KLU test 3 of 5') ; - -% rand ('state', 0) ; - -load west0479 -A = west0479 ; -% A = sparse (rand (4)) ; -% A (3:4, 1:2) = 0 ; - -n = size (A,1) ; -b = rand (n,1) ; -spparms ('spumoni',2) -x = A\b ; -spparms ('spumoni',0) -fprintf ('MATLAB resid %g\n', norm (A*x-b,1)) ; - -[LU,info,cond_estimate] = klu (A) ; -fprintf ('\nLU = \n') ; disp (LU) ; -fprintf ('\ninfo = \n') ; disp (info) ; -fprintf ('KLU condest %g\n', cond_estimate) ; -matlab_condest = condest (A) ; -matlab_cond = cond (full (A)) ; -fprintf ('MATLAB condest %g cond %g\n', matlab_condest, matlab_cond) ; - -for nrhs = 1:10 - waitbar (nrhs/12, h) ; - b = rand (n,nrhs) ; - x = klu (LU,'\',b) ; - fprintf ('nrhs: %d resid: %g\n', ... - nrhs, norm (A*x-b,1) / norm (A,1)) ; -end - -[x,info,cond_estimate] = klu (A, '\', b) ; %#ok -fprintf ('\ninfo = \n') ; disp (info) ; -fprintf ('KLU cond_estimate %g\n', cond_estimate) ; - -waitbar (11/12, h) ; - -[x,info] = klu (A, '\', b, struct ('ordering',1)) ; %#ok -fprintf ('\ninfo = \n') ; disp (info) ; -[x,info,cond_estimate] = klu (A, '\', b, struct ('ordering',2)) ; %#ok -fprintf ('\ninfo = \n') ; disp (info) ; -try - [x,info,cond_estimate] = klu (A, '\', b, struct ('ordering',3)) ; %#ok - fprintf ('\ninfo = \n') ; disp (info) ; - [x,info,cond_estimate] = klu (A, '\', b, struct ('ordering',4)) ; %#ok - fprintf ('\ninfo = \n') ; disp (info) ; -catch me - disp (me.message) ; - fprintf ('test with CHOLMOD skipped (CHOLMOD or METIS not installed)\n') ; -end - -close (h) ; diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test4.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test4.m deleted file mode 100644 index 5534de2051..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test4.m +++ /dev/null @@ -1,213 +0,0 @@ -function test4 (nmat) -%test4: KLU test -% Example: -% test4 -% See also klu - -% Copyright 2004-2012, University of Florida - -% rand ('state', 0) ; -% warning ('off', 'MATLAB:singularMatrix') ; -% warning ('off', 'MATLAB:nearlySingularMatrix') ; -% warning ('off', 'KLU:rcond') ; -% warning ('off', 'MATLAB:Axes:NegativeDataInLogAxis') ; - -index = UFget ; -f = find (index.nrows == index.ncols & index.isReal & index.amd_lnz > 0) ; -[ignore i] = sort (index.amd_lnz (f)) ; %#ok -f = f (i) ; -% f = f (1:100) ; - -if (nargin < 1) - nmat = 500 ; -end -nmat = min (nmat, length (f)) ; -f = f (1:nmat) ; - -if (1) - Tlu = -ones (nmat,1) ; - Tklu = -ones (nmat,1) ; - Tklu2 = -ones (nmat,1) ; - LUnz = -ones (nmat,1) ; - k = 0 ; -end - -if (~isempty (strfind (computer, '64'))) - is64 = 1 ; -else - is64 = 0 ; -end - -% 589: Sieber - -h = waitbar (0, 'KLU test 4 of 5') ; - -clf - -% try - - for kk = 1:nmat - - Prob = UFget (f (kk), index) ; - - waitbar (kk/nmat, h) ; - - disp (Prob) ; - if (isfield (Prob, 'kind')) - if (~isempty (strfind (Prob.kind, 'subsequent'))) - fprintf ('skip ...\n') ; - continue - end - if (~isempty (strfind (Prob.kind, 'random'))) - fprintf ('skip ...\n') ; - continue - end - end - k = k + 1 ; - A = Prob.A ; - n = size (A,1) ; - err1 = 0 ; - err2 = 0 ; - err4 = 0 ; - terr1 = 0 ; - terr2 = 0 ; - terr4 = 0 ; - - - for do_imag = 0:1 - if (do_imag) - A = sprand (A) + 1i * sprand (A) ; - end - - % compare with UMFPACK - try - tic - [L,U,p,q,R1] = lu (A, 'vector') ; - t1 = max (1e-6, toc) ; - catch %#ok - % older version of MATLAB, which doesn't have 'vector' option - tic - [L,U,P,Q] = lu (A) ; - t1 = max (1e-6, toc) ; - [p ignore1 ignore2] = find (P') ; %#ok - [q ignore1 ignore2] = find (Q) ; %#ok - clear ignore1 ignore2 P Q - R1 = speye (n) ; - end - - if (Tlu (k) == -1) - Tlu (k) = t1 ; - LUnz (k) = nnz (L) + nnz (U) ; - end - - % note that the scaling R1 and R2 are different with KLU and UMFPACK - % UMFPACK: L*U-P*(R1\A)*Q - % KLU: L*U-R2\(P*A*Q) - % - % R1 and R2 are related, via P, where R2 = P*R*P', or equivalently - % R2 = R1 (p,p). - - rcond = min (abs (diag (U))) / max (abs (diag (U))) ; - if (rcond < 1e-15) - fprintf ('skip...\n') ; - break ; - end - - F.L = L ; - F.U = U ; - if (is64) - F.p = int64(p) ; - F.q = int64(q) ; - else - F.p = int32(p) ; - F.q = int32(q) ; - end - - F.R = R1(p,p) ; - b = rand (n,1) ; - x = klu (F, '\', b) ; - y = klu (b', '/', F) ; - - fprintf ('solve with klu %g\n', ... - norm (A*x-b,1)/norm(A,1)) ; - fprintf ('solve with klu %g transpose\n', ... - norm (y*A-b',1)/norm(A,1)) ; - - - for nrhs = 1:10 - for do_b_imag = 0:1 - b = rand (n, nrhs) ; - if (do_b_imag) - b = b + 1i * rand (n, nrhs) ; - end - - % KLU backslash - tic ; - x = klu (A,'\',b) ; - t2 = max (1e-6, toc) ; - - % KLU slash - xt = klu (b','/',A) ; - - % KLU backslash with precomputed LU - tic - LU = klu (A) ; - z = klu (LU,'\',b) ; - t4 = max (1e-6, toc) ; - - % KLU slash with precomputed LU - zt = klu (b','/',LU) ; - - % UMFPACK - tic - rb = R1 \ b ; - y = U \ (L \ rb (p,:)) ; - y (q,:) = y ; - t3 = max (1e-6, toc) ; - - yt = (L' \ (U' \ b (q,:))) ; - yt (p,:) = yt ; - yt = R1 \ yt ; - yt = yt' ; - - if (Tklu (k) == -1) - Tlu (k) = Tlu (k) + t3 ; - Tklu (k) = t2 ; - Tklu2 (k) = t4 ; - end - - err1 = max (err1, norm (A*x-b,1) / norm (A,1)) ; - err2 = max (err2, norm (A*y-b,1) / norm (A,1)) ; - err4 = max (err4, norm (A*z-b,1) / norm (A,1)) ; - - terr1 = max (terr1, norm (xt*A-b',1) / norm (A,1)) ; - terr2 = max (terr2, norm (yt*A-b',1) / norm (A,1)) ; - terr4 = max (terr4, norm (zt*A-b',1) / norm (A,1)) ; - end - end - end - - fprintf ('err %g %g %g\n', err1, err2, err4) ; - if (err1 > 1e4*err2 | err4 > 1e4*err2) %#ok - fprintf ('warning: KLU inaccurate!\n') - end - - fprintf ('terr %g %g %g\n', terr1, terr2, terr4) ; - if (terr1 > 1e4*terr2 | terr4 > 1e4*terr2) %#ok - fprintf ('warning: KLU T inaccurate!\n') - end - - lunzmax = max (LUnz (1:k)) ; - loglog ( ... - LUnz (1:k), Tklu (1:k) ./ Tlu (1:k), 'o', ... - LUnz (1:k), Tklu2 (1:k) ./ Tlu (1:k), 'x', ... - [10 lunzmax], [1 1], 'r-') ; - drawnow - - end - -% catch me -% disp (me.message) ; -% end - -close (h) ; diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test5.m b/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test5.m deleted file mode 100644 index 9457c4c81f..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/Test/test5.m +++ /dev/null @@ -1,174 +0,0 @@ -function test5 -%test5: KLU test -% Example: -% test5 -% -% test circuit matrices in the UF sparse matrix collection. -% -% See also klu - -% Copyright 2004-2012, University of Florida - -do_diary = 0 ; - -if (do_diary) - diary off - s = date ; - t = clock ; - s = sprintf ('diary test5_%s_%d-%d-%d.txt\n', s, t (4), t(5), fix(t(6))); - eval (s) ; -end - -% ATandT frequency-domain circuits, exclude these: -% freq = [ 283 284 285 286 ] ; - -% sorted in order of MATLAB 7.3 x=A\b time on storm -% (AMD Opteron, 64-bit, 8GB mem, 2 cores) -circ = [ -1195 % Rajat/rajat11 n: 135 nz 665 -1198 % Rajat/rajat14 n: 180 nz 1475 -1189 % Rajat/rajat05 n: 301 nz 1250 -1169 % Sandia/oscil_trans_01 n: 430 nz 1614 -1112 % Sandia/oscil_dcop_01 n: 430 nz 1544 -1346 % Rajat/rajat19 n: 1157 nz 3699 -1199 % Hamrle/Hamrle1 n: 32 nz 98 -1106 % Sandia/fpga_trans_01 n: 1220 nz 7382 -1188 % Rajat/rajat04 n: 1041 nz 8725 -1055 % Sandia/fpga_dcop_01 n: 1220 nz 5892 -1108 % Sandia/init_adder1 n: 1813 nz 11156 -1196 % Rajat/rajat12 n: 1879 nz 12818 -1053 % Sandia/adder_trans_01 n: 1814 nz 14579 -539 % Hamm/add20 n: 2395 nz 13151 -371 % Bomhof/circuit_2 n: 4510 nz 21199 -540 % Hamm/add32 n: 4960 nz 19848 -1186 % Rajat/rajat02 n: 1960 nz 11187 -466 % Grund/meg4 n: 5860 nz 25258 -465 % Grund/meg1 n: 2904 nz 58142 -370 % Bomhof/circuit_1 n: 2624 nz 35823 -1200 % Hamrle/Hamrle2 n: 5952 nz 22162 -1197 % Rajat/rajat13 n: 7598 nz 48762 -1187 % Rajat/rajat03 n: 7602 nz 32653 -372 % Bomhof/circuit_3 n: 12127 nz 48137 -1185 % Rajat/rajat01 n: 6833 nz 43250 -1183 % IBM_Austin/coupled n: 11341 nz 97193 -1376 % Rajat/rajat27 n: 20640 nz 97353 -543 % Hamm/memplus n: 17758 nz 99147 -1109 % Sandia/mult_dcop_01 n: 25187 nz 193276 -1371 % Rajat/rajat22 n: 39899 nz 195429 -1375 % Rajat/rajat26 n: 51032 nz 247528 -1414 % IBM_EDA/ckt11752_tr_0 n: 49702 nz 332807 -541 % Hamm/bcircuit n: 68902 nz 375558 -1413 % IBM_EDA/ckt11752_dc_1 n: 49702 nz 333029 -542 % Hamm/hcircuit n: 105676 nz 513072 -1316 % Rajat/rajat15 n: 37261 nz 443573 -1190 % Rajat/rajat06 n: 10922 nz 46983 -1191 % Rajat/rajat07 n: 14842 nz 63913 -1372 % Rajat/rajat23 n: 110355 nz 555441 -373 % Bomhof/circuit_4 n: 80209 nz 307604 -544 % Hamm/scircuit n: 170998 nz 958936 -1412 % AMD/G2_circuit n: 150102 nz 726674 is this solid state device? -1415 % Sandia/ASIC_100k n: 99340 nz 940621 -1416 % Sandia/ASIC_100ks n: 99190 nz 578890 -1420 % Sandia/ASIC_680ks n: 682712 nz 1693767 -1192 % Rajat/rajat08 n: 19362 nz 83443 -1193 % Rajat/rajat09 n: 24482 nz 105573 -1323 % IBM_EDA/trans4 n: 116835 nz 749800 -1320 % IBM_EDA/dc1 n: 116835 nz 766396 -1194 % Rajat/rajat10 n: 30202 nz 130303 -1418 % Sandia/ASIC_320ks n: 321671 nz 1316085 -1417 % Sandia/ASIC_320k n: 321821 nz 1931828 -1343 % Rajat/rajat16 n: 94294 nz 476766 -1345 % Rajat/rajat18 n: 94294 nz 479151 -1344 % Rajat/rajat17 n: 94294 nz 479246 -1377 % Rajat/rajat28 n: 87190 nz 606489 -1369 % Rajat/rajat20 n: 86916 nz 604299 -1374 % Rajat/rajat25 n: 87190 nz 606489 -1370 % Rajat/rajat21 n: 411676 nz 1876011 -1419 % Sandia/ASIC_680k n: 682862 nz 2638997 -% these are large, so are skipped for this test: -% 1396 % Rajat/rajat29 n: 643994 nz 3760246 -% 1201 % Hamrle/Hamrle3 n: 1447360 nz 5514242 -% 1397 % Rajat/rajat30 n: 643994 nz 6175244 -% 1421 % AMD/G3_circuit n: 1585478 nz 7660826 -% 1398 % Rajat/rajat31 n: 4690002 nz 20316253 -% 1373 % Rajat/rajat24 n: 358172 nz 1946979 -]' ; - -fprintf ('Running KLU on %d circuits.\n', length (circ)) ; - -index = UFget ; - -opts_noscale.scale = -1 ; -opts_sum.scale = 1 ; -opts_max.scale = 2 ; % default scaling - -h = waitbar (0, 'KLU test 5 of 5') ; -nmat = length (circ) ; - -try - - for kk = 1:nmat - - k = circ (kk) ; - Prob = UFget (k, index) ; - - waitbar (kk/nmat, h) ; - - A = Prob.A ; - n = size (A,1) ; - b = rand (n,1) ; - fprintf ('\n%d : %s n: %d nz %d\n', k, Prob.name, n, nnz (A)) ; - - try - tic ; - x2 = klu (A, '\', b, opts_noscale) ; - t2 = toc ; - e2 = norm (A*x2-b) ; - catch %#ok - t2 = inf ; - e2 = inf ; - end - fprintf ('KLU no scale: err %8.2e t: %8.4f\n', e2, t2) ; - - try - tic ; - x4 = klu (A, '\', b, opts_max) ; - t4 = toc ; - e4 = norm (A*x4-b) ; - catch %#ok - t4 = inf ; - e4 = inf ; - end - fprintf ('KLU max scale: err %8.2e t: %8.4f\n', e4, t4) ; - - try - tic ; - x3 = klu (A, '\', b, opts_sum) ; - t3 = toc ; - e3 = norm (A*x3-b) ; - catch %#ok - t3 = inf ; - e3 = inf ; - end - fprintf ('KLU sum scale: err %8.2e t: %8.4f\n', e3, t3) ; - - tic - x1 = A\b ; - t1 = toc ; - e1 = norm (A*x1-b) ; - fprintf ('matlab: err %8.2e t: %8.4f\n', e1, t1) ; - - fprintf (' speedup %8.2f\n', t1 / t4) ; - clear Prob - - if (do_diary) - diary off - diary on - end - end - -catch me - disp (me.message) ; -end - -close (h) ; diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/klu.m b/ThirdParty/SuiteSparse/KLU/MATLAB/klu.m deleted file mode 100644 index 73794fd803..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/klu.m +++ /dev/null @@ -1,72 +0,0 @@ -function [LU_or_x,info,c] = klu (A,operation,b,opts) %#ok -%KLU sparse left-looking LU factorization, using a block triangular form. -% -% Example: -% LU = klu (A) factorizes R\A(p,q) into L*U+F, returning a struct -% x = klu (A,'\',b) x = A\b, using KLU -% x = klu (b,'/',A) x = b/A, using KLU -% x = klu (LU,'\',b) x = A\b, where LU = klu(A) -% x = klu (b,'/',LU) x = b/A, where LU = klu(A) -% -% KLU(A) factorizes a square sparse matrix, L*U+F = R\A(p,q), where L and U -% are the factors of the diagonal blocks of the block, F are the entries -% above the diagonal blocks. r corresponds to the 3rd output of dmperm; it -% specifies where the block boundaries are. The kth block consists of -% rows/columns r(k) to r(k+1)-1 of A(p,q). -% -% Note that the use of the scale factor R differs between KLU and UMFPACK -% (and the LU function, which is based on UMFPACK). In LU, the factorization -% is L*U = P*(R1\A)*Q; in KLU it is L*U+F = R2\(P*A*Q). R1 and R2 are related -% via R2 = P*R1*P', or equivalently R2 = R1(p,p). -% -% The LU output is a struct containing members L, U, p, q, R, F, and r. -% -% opts is an optional input struct which appears as the last input argument. -% Entries not present are set to their defaults: -% -% default -% opts.tol 0.001 partial pivoting tolerance; valid range 0 to 1. -% opts.btf 1 use block triangular form (BTF) if nonzero -% opts.ordering 0 how each block is ordered: -% 0: AMD, 1: COLAMD, 2: natural, -% 3: CHOLMOD's ordering of (A'*A), -% 4: CHOLMOD's ordering of (A+A') -% opts.scale 2 1: R = diag(sum(abs(A)')), row-sum -% 2: R = diag(max(abs(A)')), max in each row -% otherwise: none (R=I) -% opts.maxwork 0 if > 0, limit work in BTF ordering to -% opts.maxwork*nnz(A); no limit if <= 0. -% -% The CHOLMOD ordering is to try AMD (for A+A') or COLAMD (for A'*A) -% first. If the fill-in with AMD or COLAMD is high, METIS is tried (on -% A+A' or A'*A), and the best ordering found is selected. CHOLMOD, METIS, -% CAMD, and CCOLAMD are required. If not available, only ordering options -% 0, 1, and 2 may be used (AMD and COLAMD are always required by KLU). -% -% Two optional outputs, [LU,info,c] = klu (A) or [x,info,c] = klu (A,'\',b) -% provide statistics about the factorization: -% -% info.noffdiag number of off-diagonal pivots chosen (after preordering) -% info.nrealloc number of memory reallocations of L and U -% info.rcond a very cheap estimate of 1/(condition number) -% info.rgrowth reciprocal pivot growth -% info.flops flop count -% info.nblocks # of blocks in BTF form (1 if not computed) -% info.ordering AMD, COLAMD, natural, cholmod(AA'), cholmod(A+A') -% info.scale scaling (<=0: none, 1: sum, 2: max) -% info.lnz nnz(L), including diagonal -% info.unz nnz(U), including diagonal -% info.offnz nnz(F) -% info.tol pivot tolerance used -% info.memory peak memory usage in bytes -% c the same as MATLAB's condest -% -% info and c are relevant only if the matrix is factorized (LU = klu (A), -% x = klu (A,'/',b), or x = klu (b,'/',A) usages). -% -% See also BTF, LU, DMPERM, CONDEST, CHOLMOD, AMD, COLAMD, CAMD, CCOLAMD. - -% Copyright 2004-2009, Univ. of Florida -% http://www.suitesparse.com - -error ('klu mexFunction not found') ; diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/klu_demo.m b/ThirdParty/SuiteSparse/KLU/MATLAB/klu_demo.m deleted file mode 100644 index 9c5c912655..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/klu_demo.m +++ /dev/null @@ -1,79 +0,0 @@ -function klu_demo -% KLU demo -% -% Example: -% klu_demo -% -% See also klu, btf - -% Copyright 2004-2009, Univ. of Florida - -load west0479 -A = west0479 ; - -n = size (A,1) ; -b = rand (n,1) ; - -clf -subplot (2,2,1) ; -spy (A) -title ('west0479') ; - -subplot (2,2,2) ; -[p, q, r] = btf (A) ; -drawbtf (A, p, q, r) ; -title ('BTF form') ; - -[x,info,c] = klu (A, '\', b) ; -matlab_condest = condest (A) ; -matlab_cond = cond (full (A)) ; -fprintf ('MATLAB condest: %g KLU condest: %g cond: %g\n', ... - matlab_condest, c, matlab_cond) ; - -fprintf ('\nKLU with scaling, AMD ordering and condition number estimate:\n') ; -[LU,info] = klu (A, struct ('ordering',0, 'scale', 1)) ; -x = klu (LU, '\', b) ; -resid = norm (A*x-b,1) / norm (A,1) ; -rgrowth = full (min (max (abs ((LU.R \ A (LU.p,LU.q)) - LU.F)) ./ ... - max (abs (LU.U)))) ; -fprintf ('resid: %g KLU condest: %g rgrowth: %g\n', resid, c, rgrowth) ; -disp (info) ; - -subplot (2,2,3) ; -spy (LU.L + LU.U + LU.F) ; -title ('KLU+AMD factors') ; - -fprintf ('\nKLU with COLAMD ordering\n') ; -[LU,info] = klu (A, struct ('ordering',1)) ; -x = klu (LU, '\', b) ; -resid = norm (A*x-b,1) / norm (A,1) ; -fprintf ('resid: %g\n', resid) ; -disp (info) ; - -subplot (2,2,4) ; -spy (LU.L + LU.U + LU.F) ; -title ('KLU+COLAMD factors') ; - -fprintf ('\nKLU with natural ordering (lots of fillin)\n') ; -[x,info] = klu (A, '\', b, struct ('ordering',2)) ; -resid = norm (A*x-b,1) / norm (A,1) ; -fprintf ('resid: %g\n', resid) ; -disp (info) ; - -try - - fprintf ('\nKLU with CHOLMOD(A''*A) ordering\n') ; - [x,info] = klu (A, '\', b, struct ('ordering',3)) ; - resid = norm (A*x-b,1) / norm (A,1) ; - fprintf ('resid: %g\n', resid) ; - disp (info) ; - - fprintf ('\nKLU with CHOLMOD(A+A'') ordering\n') ; - [x,info] = klu (A, '\', b, struct ('ordering',4)) ; - resid = norm (A*x-b,1) / norm (A,1) ; - fprintf ('resid: %g\n', resid) ; - disp (info) ; - -catch - fprintf ('KLU test with CHOLMOD skipped (CHOLMOD not installed)\n') ; -end diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/klu_demo.m.out b/ThirdParty/SuiteSparse/KLU/MATLAB/klu_demo.m.out deleted file mode 100644 index 20991b51e1..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/klu_demo.m.out +++ /dev/null @@ -1,88 +0,0 @@ -klu_demo -MATLAB condest: 1.42443e+12 KLU condest: 1.42443e+12 cond: 3.25816e+11 - -KLU with scaling, AMD ordering and condition number estimate: -resid: 7.8484e-13 KLU condest: 1.42443e+12 rgrowth: 1.85769e-05 - noffdiag: 12 - nrealloc: 0 - rcond: 7.1253e-09 - rgrowth: 1.8577e-05 - flops: 31592 - nblocks: 166 - ordering: 0 - scale: 1 - lnz: 1923 - unz: 1892 - offnz: 450 - tol: 1.0000e-03 - memory: 136748 - - -KLU with COLAMD ordering -resid: 3.91883e-11 - noffdiag: 14 - nrealloc: 0 - rcond: 9.1888e-10 - rgrowth: 4.3963e-08 - flops: 42513 - nblocks: 166 - ordering: 1 - scale: 2 - lnz: 1956 - unz: 2490 - offnz: 450 - tol: 1.0000e-03 - memory: 397692 - - -KLU with natural ordering (lots of fillin) -resid: 2.42321e-11 - noffdiag: 437 - nrealloc: 0 - rcond: 6.4525e-08 - rgrowth: 1.7654e-04 - flops: 328911 - nblocks: 2 - ordering: 2 - scale: 2 - lnz: 7846 - unz: 7332 - offnz: 40 - tol: 1.0000e-03 - memory: 453556 - - -KLU with CHOLMOD(A'*A) ordering -resid: 2.22827e-13 - noffdiag: 24 - nrealloc: 0 - rcond: 4.1814e-09 - rgrowth: 1.0676e-04 - flops: 36747 - nblocks: 166 - ordering: 3 - scale: 2 - lnz: 2020 - unz: 2227 - offnz: 450 - tol: 1.0000e-03 - memory: 191132 - - -KLU with CHOLMOD(A+A') ordering -resid: 1.45166e-12 - noffdiag: 13 - nrealloc: 0 - rcond: 3.9046e-11 - rgrowth: 2.4378e-06 - flops: 31925 - nblocks: 166 - ordering: 4 - scale: 2 - lnz: 2000 - unz: 1878 - offnz: 450 - tol: 1.0000e-03 - memory: 136044 - -diary off diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/klu_install.m b/ThirdParty/SuiteSparse/KLU/MATLAB/klu_install.m deleted file mode 100644 index fff7521843..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/klu_install.m +++ /dev/null @@ -1,56 +0,0 @@ -function klu_install (metis_path) -%KLU_INSTALL compiles and installs the KLU, BTF, AMD, and COLAMD mexFunctions -% -% Example: -% klu_install -% -% KLU relies on AMD, COLAMD, and BTF for its ordering options, and can -% optionally use CHOLMOD, CCOLAMD, CAMD, and METIS as well. By default, -% CHOLMOD, CCOLAMD, CAMD, and METIS are compiled and used by KLU. -% -% You must type the klu_install command while in the KLU/MATLAB directory. -% -% See also klu, btf - -% Copyright 2004-2016, Univ. of Florida - -if (nargin < 1) - metis_path = ['../../metis-5.1.0'] ; -end - -% compile KLU and add to the path -klu_make (metis_path) ; -klu_path = pwd ; -addpath (klu_path) - -fprintf ('\nNow compiling the AMD, COLAMD, and BTF mexFunctions:\n') ; - -% compile BTF and add to the path -cd ../../BTF/MATLAB -btf_make -btf_path = pwd ; -addpath (btf_path) - -% compile AMD and add to the path -cd ../../AMD/MATLAB -amd_make -amd_path = pwd ; -addpath (amd_path) - -% compile COLAMD and add to the path -cd ../../COLAMD/MATLAB -colamd_make -colamd_path = pwd ; -addpath (colamd_path) - -cd (klu_path) - -fprintf ('\nThe following paths have been added. You may wish to add them\n') ; -fprintf ('permanently, using the MATLAB pathtool command.\n') ; -fprintf ('%s\n', klu_path) ; -fprintf ('%s\n', amd_path) ; -fprintf ('%s\n', colamd_path) ; -fprintf ('%s\n', btf_path) ; - -fprintf ('\nTo try your new mexFunctions, cut-and-paste this command:\n') ; -fprintf ('klu_demo, btf_demo, amd_demo, colamd_demo\n') ; diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/klu_make.m b/ThirdParty/SuiteSparse/KLU/MATLAB/klu_make.m deleted file mode 100644 index 72fe8eeae9..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/klu_make.m +++ /dev/null @@ -1,402 +0,0 @@ -function klu_make (metis_path) -%KLU_MAKE compiles the KLU mexFunctions -% -% Example: -% klu_make -% -% KLU relies on AMD, COLAMD, and BTF for its ordering options, and can -% optionally use CHOLMOD, CCOLAMD, CAMD, and METIS as well. -% -% You must type the klu_make command while in the KLU/MATLAB directory. -% -% See also klu. - -% Copyright 2004-2016, Univ. of Florida - -if (nargin < 1) - metis_path = '../../metis-5.1.0' ; -end -with_cholmod = exist (metis_path, 'dir') ; - -details = 0 ; % if 1, print details of each command - -d = '' ; -if (~isempty (strfind (computer, '64'))) - % 64-bit MATLAB - d = '-largeArrayDims' ; -end - -% MATLAB 8.3.0 now has a -silent option to keep 'mex' from burbling too much -if (~verLessThan ('matlab', '8.3.0')) - d = ['-silent ' d] ; -end - -fprintf ('Compiling KLU ') ; -kk = 0 ; - -include = '-I. -I../../AMD/Include -I../../COLAMD/Include -I../Include -I../../SuiteSparse_config -I../../BTF/Include' ; - -if (with_cholmod) - include = [include ' -I../../CCOLAMD/Include -I../../CAMD/Include -I../../CHOLMOD/Include -I../../SuiteSparse_config -I../User'] ; - include = [include ' -I' metis_path '/include'] ; - include = [include ' -I' metis_path '/GKlib'] ; - include = [include ' -I' metis_path '/libmetis'] ; -end - -% do not attempt to compile CHOLMOD with large file support (not needed) -include = [include ' -DNLARGEFILE'] ; - -% fix the METIS 4.0.1 rename.h file -if (with_cholmod) - fprintf ('with CHOLMOD, CAMD, CCOLAMD, and METIS\n') ; - include = ['-DNSUPERNODAL -DNMODIFY -DNMATRIXOPS -DNCHECK ' include] ; -else - fprintf ('without CHOLMOD, CAMD, CCOLAMD, and METIS\n') ; - include = ['-DNCHOLMOD ' include] ; -end - -suitesparse_src = { '../../SuiteSparse_config/SuiteSparse_config' } ; - -amd_src = { ... - '../../AMD/Source/amd_1', ... - '../../AMD/Source/amd_2', ... - '../../AMD/Source/amd_aat', ... - '../../AMD/Source/amd_control', ... - '../../AMD/Source/amd_defaults', ... - '../../AMD/Source/amd_dump', ... - '../../AMD/Source/amd_global', ... - '../../AMD/Source/amd_info', ... - '../../AMD/Source/amd_order', ... - '../../AMD/Source/amd_postorder', ... - '../../AMD/Source/amd_post_tree', ... - '../../AMD/Source/amd_preprocess', ... - '../../AMD/Source/amd_valid' } ; - -colamd_src = { - '../../COLAMD/Source/colamd' } ; - -if (with_cholmod) - - camd_src = { ... - '../../CAMD/Source/camd_1', ... - '../../CAMD/Source/camd_2', ... - '../../CAMD/Source/camd_aat', ... - '../../CAMD/Source/camd_control', ... - '../../CAMD/Source/camd_defaults', ... - '../../CAMD/Source/camd_dump', ... - '../../CAMD/Source/camd_global', ... - '../../CAMD/Source/camd_info', ... - '../../CAMD/Source/camd_order', ... - '../../CAMD/Source/camd_postorder', ... - '../../CAMD/Source/camd_preprocess', ... - '../../CAMD/Source/camd_valid' } ; - - ccolamd_src = { - '../../CCOLAMD/Source/ccolamd' } ; - - metis_src = { - 'GKlib/b64', ... - 'GKlib/blas', ... - 'GKlib/csr', ... - 'GKlib/error', ... - 'GKlib/evaluate', ... - 'GKlib/fkvkselect', ... - 'GKlib/fs', ... - 'GKlib/getopt', ... - 'GKlib/gkregex', ... - 'GKlib/graph', ... - 'GKlib/htable', ... - 'GKlib/io', ... - 'GKlib/itemsets', ... - 'GKlib/mcore', ... - 'GKlib/memory', ... - 'GKlib/omp', ... - 'GKlib/pdb', ... - 'GKlib/pqueue', ... - 'GKlib/random', ... - 'GKlib/rw', ... - 'GKlib/seq', ... - 'GKlib/sort', ... - 'GKlib/string', ... - 'GKlib/timers', ... - 'GKlib/tokenizer', ... - 'GKlib/util', ... - 'libmetis/auxapi', ... - 'libmetis/balance', ... - 'libmetis/bucketsort', ... - 'libmetis/checkgraph', ... - 'libmetis/coarsen', ... - 'libmetis/compress', ... - 'libmetis/contig', ... - 'libmetis/debug', ... - 'libmetis/fm', ... - 'libmetis/fortran', ... - 'libmetis/frename', ... - 'libmetis/gklib', ... - 'libmetis/graph', ... - 'libmetis/initpart', ... - 'libmetis/kmetis', ... - 'libmetis/kwayfm', ... - 'libmetis/kwayrefine', ... - 'libmetis/mcutil', ... - 'libmetis/mesh', ... - 'libmetis/meshpart', ... - 'libmetis/minconn', ... - 'libmetis/mincover', ... - 'libmetis/mmd', ... - 'libmetis/ometis', ... - 'libmetis/options', ... - 'libmetis/parmetis', ... - 'libmetis/pmetis', ... - 'libmetis/refine', ... - 'libmetis/separator', ... - 'libmetis/sfm', ... - 'libmetis/srefine', ... - 'libmetis/stat', ... - 'libmetis/timing', ... - 'libmetis/util', ... - 'libmetis/wspace', ... - } ; - - for i = 1:length (metis_src) - metis_src {i} = [metis_path '/' metis_src{i}] ; - end - - cholmod_src = { - '../../CHOLMOD/Core/cholmod_aat', ... - '../../CHOLMOD/Core/cholmod_add', ... - '../../CHOLMOD/Core/cholmod_band', ... - '../../CHOLMOD/Core/cholmod_change_factor', ... - '../../CHOLMOD/Core/cholmod_common', ... - '../../CHOLMOD/Core/cholmod_complex', ... - '../../CHOLMOD/Core/cholmod_copy', ... - '../../CHOLMOD/Core/cholmod_dense', ... - '../../CHOLMOD/Core/cholmod_error', ... - '../../CHOLMOD/Core/cholmod_factor', ... - '../../CHOLMOD/Core/cholmod_memory', ... - '../../CHOLMOD/Core/cholmod_sparse', ... - '../../CHOLMOD/Core/cholmod_transpose', ... - '../../CHOLMOD/Core/cholmod_triplet', ... - '../../CHOLMOD/Cholesky/cholmod_amd', ... - '../../CHOLMOD/Cholesky/cholmod_analyze', ... - '../../CHOLMOD/Cholesky/cholmod_colamd', ... - '../../CHOLMOD/Cholesky/cholmod_etree', ... - '../../CHOLMOD/Cholesky/cholmod_postorder', ... - '../../CHOLMOD/Cholesky/cholmod_rowcolcounts', ... - '../../CHOLMOD/Partition/cholmod_ccolamd', ... - '../../CHOLMOD/Partition/cholmod_csymamd', ... - '../../CHOLMOD/Partition/cholmod_camd', ... - '../../CHOLMOD/Partition/cholmod_metis', ... - '../../CHOLMOD/Partition/cholmod_nesdis' } ; - -else - camd_src = { } ; - ccolamd_src = { } ; - metis_src = { } ; - cholmod_src = { } ; -end - -btf_src = { - '../../BTF/Source/btf_maxtrans', ... - '../../BTF/Source/btf_order', ... - '../../BTF/Source/btf_strongcomp' } ; - -klu_src = { - '../Source/klu_free_symbolic', ... - '../Source/klu_defaults', ... - '../Source/klu_analyze_given', ... - '../Source/klu_analyze', ... - '../Source/klu_memory' } ; - -if (with_cholmod) - klu_src = [klu_src { '../User/klu_l_cholmod' }] ; %#ok -end - -klu_zlsrc = { - '../Source/klu', ... - '../Source/klu_kernel', ... - '../Source/klu_dump', ... - '../Source/klu_factor', ... - '../Source/klu_free_numeric', ... - '../Source/klu_solve', ... - '../Source/klu_scale', ... - '../Source/klu_refactor', ... - '../Source/klu_tsolve', ... - '../Source/klu_diagnostics', ... - '../Source/klu_sort', ... - '../Source/klu_extract', ... - } ; - -klu_lobj = { - 'klu_l', ... - 'klu_l_kernel', ... - 'klu_l_dump', ... - 'klu_l_factor', ... - 'klu_l_free_numeric', ... - 'klu_l_solve', ... - 'klu_l_scale', ... - 'klu_l_refactor', ... - 'klu_l_tsolve', ... - 'klu_l_diagnostics', ... - 'klu_l_sort', ... - 'klu_l_extract', ... - } ; - -klu_zlobj = { - 'klu_zl', ... - 'klu_zl_kernel', ... - 'klu_zl_dump', ... - 'klu_zl_factor', ... - 'klu_zl_free_numeric', ... - 'klu_zl_solve', ... - 'klu_zl_scale', ... - 'klu_zl_refactor', ... - 'klu_zl_tsolve', ... - 'klu_zl_diagnostics', ... - 'klu_zl_sort', ... - 'klu_zl_extract', ... - } ; - -try - % ispc does not appear in MATLAB 5.3 - pc = ispc ; -catch - % if ispc fails, assume we are on a Windows PC if it's not unix - pc = ~isunix ; -end - -if (pc) - % Windows does not have drand48 and srand48, required by METIS. Use - % drand48 and srand48 in CHOLMOD/MATLAB/Windows/rand48.c instead. - obj_extension = '.obj' ; - cholmod_src = [cholmod_src {'../../CHOLMOD/MATLAB/Windows/rand48'}] ; - include = [include ' -I../../CHOLMOD/MATLAB/Windows'] ; -else - obj_extension = '.o' ; -end - -% compile each library source file -obj = ' ' ; - -source = [suitesparse_src amd_src btf_src klu_src colamd_src] ; -if (with_cholmod) - source = [metis_src ccolamd_src camd_src cholmod_src source] ; -end - -for f = source - ff = f {1} ; - if (isequal (ff, [metis_path '/GKlib/util'])) - % special case, since a file with the same name also exists in libmetis - copyfile ([ff '.c'], 'GKlib_util.c', 'f') ; - ff = 'GKlib_util' ; - o = 'GKlib_util' ; - elseif (isequal (ff, [metis_path '/GKlib/graph'])) - % special case, since a file with the same name also exist in libmetis - copyfile ([ff '.c'], 'GKlib_graph.c', 'f') ; - ff = 'GKlib_graph' ; - o = 'GKlib_graph' ; - else - slash = strfind (ff, '/') ; - if (isempty (slash)) - slash = 1 ; - else - slash = slash (end) + 1 ; - end - o = ff (slash:end) ; - end - % fprintf ('%s\n', o) ; - o = [o obj_extension] ; - obj = [obj ' ' o] ; %#ok - s = sprintf ('mex %s -DDLONG -O %s -c %s.c', d, include, ff) ; - kk = do_cmd (s, kk, details) ; -end - -for k = 1:length(klu_zlsrc) - ff = klu_zlsrc {k} ; - slash = strfind (ff, '/') ; - if (isempty (slash)) - slash = 1 ; - else - slash = slash (end) + 1 ; - end - o = ff (slash:end) ; - s = sprintf ('mex %s -DDLONG -O %s -c %s.c', d, include, ff) ; - kk = do_cmd (s, kk, details) ; - lobj = klu_lobj {k} ; - obj = [obj ' ' lobj obj_extension] ; %#ok - mvfile ([o obj_extension], [lobj obj_extension]) ; - s = sprintf ('mex %s -DDLONG -DCOMPLEX -O %s -c %s.c', d, include, ff) ; - kk = do_cmd (s, kk, details) ; - zlobj = klu_zlobj {k} ; - obj = [obj ' ' zlobj obj_extension] ; %#ok - mvfile ([o obj_extension], [zlobj obj_extension]) ; -end - -% compile the KLU mexFunction -s = sprintf ('mex %s -DDLONG -O %s -output klu klu_mex.c', d, include) ; -s = [s obj] ; %#ok - -if (~(ispc || ismac)) - % for POSIX timing routine - s = [s ' -lrt'] ; -end - -kk = do_cmd (s, kk, details) ; - -% clean up -s = ['delete ' obj] ; -do_cmd (s, kk, details) ; - -rmfile ('GKlib_util.c') ; -rmfile ('GKlib_graph.c') ; - -fprintf ('\nKLU successfully compiled\n') ; - -%------------------------------------------------------------------------------- - -function rmfile (file) -% rmfile: delete a file, but only if it exists -if (length (dir (file)) > 0) %#ok - delete (file) ; -end - -%------------------------------------------------------------------------------- - -function cpfile (src, dst) -% cpfile: copy the src file to the filename dst, overwriting dst if it exists -rmfile (dst) -if (length (dir (src)) == 0) %#ok - fprintf ('File does not exist: %s\n', src) ; - error ('File does not exist') ; -end -try - copyfile (src, dst) ; -catch ME - % ignore errors of the form "cp: preserving permissions: ... - % Operation not supported". rethrow all other errors. - if (isempty (strfind (ME.message, 'Operation not supported'))) - rethrow (ME) ; - end -end - -%------------------------------------------------------------------------------- - -function mvfile (src, dst) -% mvfile: move the src file to the filename dst, overwriting dst if it exists -cpfile (src, dst) ; -rmfile (src) ; - -%------------------------------------------------------------------------------- -function kk = do_cmd (s, kk, details) -%DO_CMD: evaluate a command, and either print it or print a "." -if (details) - fprintf ('%s\n', s) ; -else - if (mod (kk, 60) == 0) - fprintf ('\n') ; - end - kk = kk + 1 ; - fprintf ('.') ; -end -eval (s) ; - diff --git a/ThirdParty/SuiteSparse/KLU/MATLAB/klu_mex.c b/ThirdParty/SuiteSparse/KLU/MATLAB/klu_mex.c deleted file mode 100644 index f19f8a3cef..0000000000 --- a/ThirdParty/SuiteSparse/KLU/MATLAB/klu_mex.c +++ /dev/null @@ -1,1974 +0,0 @@ -/* ========================================================================== */ -/* === klu mexFunction ====================================================== */ -/* ========================================================================== */ - -/* KLU: a MATLAB interface to a "Clark Kent" sparse LU factorization algorithm. - - 3 or 4 input arguments: factorize and solve, returning the solution: - - x = klu (A, '\', b) - x = klu (A, '\', b, opts) - x = klu (b, '/', A) - x = klu (b, '/', A, opts) - - A can be the LU struct, instead: - - x = klu (LU, '\', b) - x = klu (LU, '\', b, opts) - x = klu (b, '/', LU) - x = klu (b, '/', LU, opts) - - where LU is a struct containing members: L, U, p, q, R, F, and r. Only L - and U are required. The factorization is L*U+F = R\A(p,q), where r defines - the block boundaries of the BTF form, and F contains the entries in the - upper block triangular part. - - with 1 or 2 input arguments: factorize, returning the LU struct: - - LU = klu (A) - LU = klu (A, opts) - - 2nd optional output: info, which is only meaningful if A was factorized. - - A must be square. b can be a matrix, but it cannot be sparse. - - Obscure options, mainly for testing: - - opts.memgrow 1.2 when L and U need to grow, inc. by this ratio. - valid range: 1 or more. - opts.imemamd 1.2 initial size of L and U with AMD or other - symmetric ordering is 1.2*nnz(L)+n; - valid range 1 or more. - opts.imem 10 initial size of L and U is 10*nnz(A)+n if a - symmetric ordering not used; valid range 1 or - more -*/ - -/* ========================================================================== */ - -#include "klu.h" -#include -#define Long SuiteSparse_long - -#ifndef NCHOLMOD -#include "klu_cholmod.h" -#endif - -#include "mex.h" -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#define ABS(x) (((x) < 0) ? -(x) : (x)) -#define STRING_MATCH(s1,s2) (strcmp ((s1), (s2)) == 0) - -/* Complex division. This uses ACM Algo 116, by R. L. Smith, 1962. */ -/* Note that c cannot be the same variable as a or b */ -#define DIV(cx,cz,ax,az,bx,bz) \ -{ \ - double r, den ; \ - if (ABS (bx) >= ABS (bz)) \ - { \ - r = bz / bx ; \ - den = bx + r * bz ; \ - cx = (ax + az * r) / den ; \ - cz = (az - ax * r) / den ; \ - } \ - else \ - { \ - r = bx / bz ; \ - den = r * bx + bz ; \ - cx = (ax * r + az) / den ; \ - cz = (az * r - ax) / den ; \ - } \ -} - -/* complex multiply/subtract, c -= a*b */ -/* Note that c cannot be the same variable as a or b */ -#define MULT_SUB(cx,cz,ax,az,bx,bz) \ -{ \ - cx -= ax * bx - az * bz ; \ - cz -= az * bx + ax * bz ; \ -} - -/* complex multiply/subtract, c -= a*conj(b) */ -/* Note that c cannot be the same variable as a or b */ -#define MULT_SUB_CONJ(cx,cz,ax,az,bx,bz) \ -{ \ - cx -= ax * bx + az * bz ; \ - cz -= az * bx - ax * bz ; \ -} - -/* ========================================================================== */ -/* === klu mexFunction ====================================================== */ -/* ========================================================================== */ - -void mexFunction -( - int nargout, - mxArray *pargout [ ], - int nargin, - const mxArray *pargin [ ] -) -{ - double ukk, lkk, rs, s, lik, uik, x [4], offik, z, ukkz, lkkz, sz, wx, wz ; - double *X, *B, *Xz, *Xx, *Bx, *Bz, *A, *Ax, *Az, *Lx, *Ux, *Rs, *Offx, *Wx, - *Uz, *Lz, *Offz, *Wz, *W, *Xi, *Bi ; - Long *Ap, *Ai, *Lp, *Li, *Up, *Ui, *P, *Q, *R, *Rp, *Ri, *Offp, *Offi ; - char *operator ; - mxArray *L_matlab, *U_matlab, *p_matlab, *q_matlab, *R_matlab, *F_matlab, - *r_matlab, *field ; - const mxArray *A_matlab = NULL, *LU_matlab, *B_matlab = NULL, *opts_matlab ; - klu_l_symbolic *Symbolic ; - klu_l_numeric *Numeric ; - klu_l_common Common ; - Long n = 0, k, nrhs = 0, do_solve, do_factorize, symmetric, - A_complex = 0, B_complex, nz, do_transpose = 0, p, pend, nblocks, - R1 [2], chunk, nr, i, j, block, k1, k2, nk, bn = 0, ordering ; - int mx_int ; - static const char *fnames [ ] = { - "noffdiag", /* # of off-diagonal pivots */ - "nrealloc", /* # of memory reallocations */ - "rcond", /* cheap reciprocal number estimate */ - "rgrowth", /* reciprocal pivot growth */ - "flops", /* flop count */ - "nblocks", /* # of blocks in BTF form (1 if not computed) */ - "ordering", /* AMD, COLAMD, natural, cholmod(AA'), cholmod(A+A') */ - "scale", /* scaling (<=0: none, 1: sum, 2: max */ - "lnz", /* nnz(L), including diagonal */ - "unz", /* nnz(U), including diagonal */ - "offnz", /* nnz(F), including diagonal */ - "tol", /* pivot tolerance used */ - "memory" /* peak memory usage */ - }, - *LUnames [ ] = { "L", "U", "p", "q", "R", "F", "r" } ; - - /* ---------------------------------------------------------------------- */ - /* get inputs */ - /* ---------------------------------------------------------------------- */ - - if (nargin < 1 || nargin > 4 || nargout > 3) - { - mexErrMsgTxt ( - "Usage: x = klu(A,'\',b), x = klu(A,'/',b) or LU = klu(A)") ; - } - - /* return the solution x, or just do LU factorization */ - do_solve = (nargin > 2) ; - - /* determine size of the MATLAB integer */ - if (sizeof (Long) == sizeof (INT32_T)) - { - mx_int = mxINT32_CLASS ; - } - else - { - mx_int = mxINT64_CLASS ; - } - - if (do_solve) - { - - /* ------------------------------------------------------------------ */ - /* slash or backslash */ - /* ------------------------------------------------------------------ */ - - /* usage, where opts is the optional 4th input argument: - x = klu (A, '\', b) - x = klu (LU, '\', b) - x = klu (b, '/', A) - x = klu (b, '/', LU) - */ - - /* determine the operator, slash (/) or backslash (\) */ - if (!mxIsChar (pargin [1])) - { - mexErrMsgTxt ("invalid operator") ; - } - operator = mxArrayToString (pargin [1]) ; - if (STRING_MATCH (operator, "\\")) - { - do_transpose = 0 ; - A_matlab = pargin [0] ; - B_matlab = pargin [2] ; - nrhs = mxGetN (B_matlab) ; - bn = mxGetM (B_matlab) ; - } - else if (STRING_MATCH (operator, "/")) - { - do_transpose = 1 ; - A_matlab = pargin [2] ; - B_matlab = pargin [0] ; - nrhs = mxGetM (B_matlab) ; - bn = mxGetN (B_matlab) ; - } - else - { - mexErrMsgTxt ("invalid operator") ; - } - - if (mxIsSparse (B_matlab)) - { - mexErrMsgTxt ("B cannot be sparse") ; - } - - opts_matlab = (nargin > 3) ? pargin [3] : NULL ; - - /* determine if the factorization needs to be performed */ - do_factorize = !mxIsStruct (A_matlab) ; - if (do_factorize) - { - LU_matlab = NULL ; - } - else - { - LU_matlab = A_matlab ; - A_matlab = NULL ; - } - - } - else - { - - /* ------------------------------------------------------------------ */ - /* factorize A and return LU factorization */ - /* ------------------------------------------------------------------ */ - - /* usage, where opts in the optional 2nd input argument: - LU = klu (A) - */ - - LU_matlab = NULL ; - A_matlab = pargin [0] ; - B_matlab = NULL ; - opts_matlab = (nargin > 1) ? pargin [1] : NULL ; - do_factorize = 1 ; - if (mxIsStruct (A_matlab)) - { - mexErrMsgTxt ("invalid input, A must be a sparse matrix") ; - } - } - - /* ---------------------------------------------------------------------- */ - /* get options and set Common defaults */ - /* ---------------------------------------------------------------------- */ - - klu_l_defaults (&Common) ; - - /* factorization options */ - if (opts_matlab != NULL && mxIsStruct (opts_matlab)) - { - if ((field = mxGetField (opts_matlab, 0, "tol")) != NULL) - { - Common.tol = mxGetScalar (field) ; - } - if ((field = mxGetField (opts_matlab, 0, "memgrow")) != NULL) - { - Common.memgrow = mxGetScalar (field) ; - } - if ((field = mxGetField (opts_matlab, 0, "imemamd")) != NULL) - { - Common.initmem_amd = mxGetScalar (field) ; - } - if ((field = mxGetField (opts_matlab, 0, "imem")) != NULL) - { - Common.initmem = mxGetScalar (field) ; - } - if ((field = mxGetField (opts_matlab, 0, "btf")) != NULL) - { - Common.btf = mxGetScalar (field) ; - } - if ((field = mxGetField (opts_matlab, 0, "ordering")) != NULL) - { - Common.ordering = mxGetScalar (field) ; - } - if ((field = mxGetField (opts_matlab, 0, "scale")) != NULL) - { - Common.scale = mxGetScalar (field) ; - } - if ((field = mxGetField (opts_matlab, 0, "maxwork")) != NULL) - { - Common.maxwork = mxGetScalar (field) ; - } - } - - if (Common.ordering < 0 || Common.ordering > 4) - { - mexErrMsgTxt ("invalid ordering option") ; - } - ordering = Common.ordering ; - -#ifndef NCHOLMOD - /* ordering option 3,4 becomes KLU option 3, with symmetric 0 or 1 */ - symmetric = (Common.ordering == 4) ; - if (symmetric) Common.ordering = 3 ; - Common.user_order = klu_l_cholmod ; - Common.user_data = &symmetric ; -#else - /* CHOLMOD, METIS, CAMD, CCOLAMD, not available */ - if (Common.ordering > 2) - { - mexErrMsgTxt ("invalid ordering option") ; - } -#endif - - if (Common.scale < 1 || Common.scale > 2) - { - Common.scale = -1 ; /* no scaling, and no error checking either */ - } - - /* ---------------------------------------------------------------------- */ - /* factorize, if needed */ - /* ---------------------------------------------------------------------- */ - - if (do_factorize) - { - - /* get input matrix A to factorize */ - n = mxGetN (A_matlab) ; - if (!mxIsSparse (A_matlab) || n != mxGetM (A_matlab) || n == 0) - { - mexErrMsgTxt ("A must be sparse, square, and non-empty") ; - } - - Ap = (Long *) mxGetJc (A_matlab) ; - Ai = (Long *) mxGetIr (A_matlab) ; - Ax = mxGetPr (A_matlab) ; - Az = mxGetPi (A_matlab) ; - nz = Ap [n] ; - A_complex = mxIsComplex (A_matlab) ; - - if (do_solve && (n != bn || nrhs == 0)) - { - mexErrMsgTxt ("B must be non-empty with same number of rows as A") ; - } - - /* ------------------------------------------------------------------ */ - /* analyze */ - /* ------------------------------------------------------------------ */ - - Symbolic = klu_l_analyze (n, Ap, Ai, &Common) ; - if (Symbolic == (klu_l_symbolic *) NULL) - { - mexErrMsgTxt ("klu symbolic analysis failed") ; - } - - /* ------------------------------------------------------------------ */ - /* factorize */ - /* ------------------------------------------------------------------ */ - - if (A_complex) - { - /* A is complex */ - A = mxMalloc (nz * 2 * sizeof (double)) ; - for (k = 0 ; k < nz ; k++) - { - A [2*k ] = Ax [k] ; /* real part */ - A [2*k+1] = Az [k] ; /* imaginary part */ - } - Numeric = klu_zl_factor (Ap, Ai, A, Symbolic, &Common) ; - if (nargout > 1) - { - /* flops and rgrowth, if requested */ - klu_zl_flops (Symbolic, Numeric, &Common) ; - klu_zl_rgrowth (Ap, Ai, A, Symbolic, Numeric, &Common) ; - } - mxFree (A) ; - } - else - { - /* A is real */ - Numeric = klu_l_factor (Ap, Ai, Ax, Symbolic, &Common) ; - if (nargout > 1) - { - /* flops, if requested */ - klu_l_flops (Symbolic, Numeric, &Common) ; - klu_l_rgrowth (Ap, Ai, Ax, Symbolic, Numeric, &Common) ; - } - } - if (Common.status != KLU_OK) - { - mexErrMsgTxt ("klu numeric factorization failed") ; - } - - /* ------------------------------------------------------------------ */ - /* compute cheap condition number estimate */ - /* ------------------------------------------------------------------ */ - - if (A_complex) - { - klu_zl_rcond (Symbolic, Numeric, &Common) ; - } - else - { - klu_l_rcond (Symbolic, Numeric, &Common) ; - } - - /* ------------------------------------------------------------------ */ - /* return info, if requested */ - /* ------------------------------------------------------------------ */ - -#define INFO(i,x) \ - mxSetFieldByNumber (pargout [1], 0, i, mxCreateDoubleScalar (x)) - - if (nargout > 1) - { - pargout [1] = mxCreateStructMatrix (1, 1, 13, fnames) ; - INFO (0, Common.noffdiag) ; - INFO (1, Common.nrealloc) ; - INFO (2, Common.rcond) ; - INFO (3, Common.rgrowth) ; - INFO (4, Common.flops) ; - INFO (5, Symbolic->nblocks) ; - INFO (6, ordering) ; - INFO (7, Common.scale) ; - INFO (8, Numeric->lnz) ; - INFO (9, Numeric->unz) ; - INFO (10, Numeric->nzoff) ; - INFO (11, Common.tol) ; - INFO (12, Common.mempeak) ; - } - if (nargout > 2) - { - /* this is done separately, since it's costly */ - klu_l_condest (Ap, Ax, Symbolic, Numeric, &Common) ; - pargout [2] = mxCreateDoubleMatrix (1, 1, mxREAL) ; - Wx = mxGetPr (pargout [2]) ; - Wx [0] = Common.condest ; - } - - } - else - { - /* create an empty "info" and "condest" output */ - if (nargout > 1) - { - pargout [1] = mxCreateDoubleMatrix (0, 0, mxREAL) ; - } - if (nargout > 2) - { - pargout [2] = mxCreateDoubleMatrix (0, 0, mxREAL) ; - } - } - - /* ---------------------------------------------------------------------- */ - /* solve, or return LU factorization */ - /* ---------------------------------------------------------------------- */ - - if (do_solve) - { - - /* ------------------------------------------------------------------ */ - /* solve, x = klu ( ... ) usage */ - /* ------------------------------------------------------------------ */ - - B_complex = mxIsComplex (B_matlab) ; - - if (do_factorize) - { - - /* -------------------------------------------------------------- */ - /* solve using KLU factors computed above */ - /* -------------------------------------------------------------- */ - - /* klu (A,'\',b) or klu (b,'/',A) usage */ - - /* create X */ - if (do_transpose) - { - pargout [0] = mxCreateDoubleMatrix (nrhs, n, - (A_complex || B_complex) ? mxCOMPLEX : mxREAL) ; - } - else - { - pargout [0] = mxCreateDoubleMatrix (n, nrhs, - (A_complex || B_complex) ? mxCOMPLEX : mxREAL) ; - } - - if (A_complex) - { - - /* ---------------------------------------------------------- */ - /* A is complex, but B might be real */ - /* ---------------------------------------------------------- */ - - X = mxMalloc (n * nrhs * 2 * sizeof (double)) ; - Bx = mxGetPr (B_matlab) ; - Bz = mxGetPi (B_matlab) ; - - if (do_transpose) - { - - /* X = B', merge and transpose B */ - for (j = 0 ; j < nrhs ; j++) - { - for (i = 0 ; i < n ; i++) - { - X [2*(i+j*n) ] = Bx [j+i*nrhs] ; /* real */ - X [2*(i+j*n)+1] = Bz ? (-Bz [j+i*nrhs]) : 0 ; - } - } - - /* solve A'x=b (complex conjugate) */ - klu_zl_tsolve (Symbolic, Numeric, n, nrhs, X, 1, &Common) ; - - /* split and transpose the solution */ - Xx = mxGetPr (pargout [0]) ; - Xz = mxGetPi (pargout [0]) ; - for (j = 0 ; j < nrhs ; j++) - { - for (i = 0 ; i < n ; i++) - { - Xx [j+i*nrhs] = X [2*(i+j*n) ] ; /* real part */ - Xz [j+i*nrhs] = -X [2*(i+j*n)+1] ; /* imag part */ - } - } - - } - else - { - - /* X = B, but create merged X from a split B */ - for (k = 0 ; k < n*nrhs ; k++) - { - X [2*k ] = Bx [k] ; /* real part */ - X [2*k+1] = Bz ? (Bz [k]) : 0 ; /* imaginary part */ - } - - /* solve Ax=b */ - klu_zl_solve (Symbolic, Numeric, n, nrhs, X, &Common) ; - - /* split the solution into real and imaginary parts */ - Xx = mxGetPr (pargout [0]) ; - Xz = mxGetPi (pargout [0]) ; - for (k = 0 ; k < n*nrhs ; k++) - { - Xx [k] = X [2*k ] ; /* real part */ - Xz [k] = X [2*k+1] ; /* imaginary part */ - } - } - - mxFree (X) ; - } - else - { - - if (do_transpose) - { - - /* solve in chunks of 4 columns at a time */ - W = mxMalloc (n * MAX (nrhs,4) * sizeof (double)) ; - X = mxGetPr (pargout [0]) ; - B = mxGetPr (B_matlab) ; - Xi = mxGetPi (pargout [0]) ; - Bi = mxGetPi (B_matlab) ; - - for (chunk = 0 ; chunk < nrhs ; chunk += 4) - { - - /* A is real: real(X) = real(b) / real(A) */ - Long chunksize = MIN (nrhs - chunk, 4) ; - for (j = 0 ; j < chunksize ; j++) - { - for (i = 0 ; i < n ; i++) - { - W [i+j*n] = B [i*nrhs+j] ; - } - } - klu_l_tsolve (Symbolic, Numeric, n, chunksize, W, - &Common) ; - for (j = 0 ; j < chunksize ; j++) - { - for (i = 0 ; i < n ; i++) - { - X [i*nrhs+j] = W [i+j*n] ; - } - } - X += 4 ; - B += 4 ; - - if (B_complex) - { - /* B is complex: imag(X) = imag(B) / real(A) */ - - for (j = 0 ; j < chunksize ; j++) - { - for (i = 0 ; i < n ; i++) - { - W [i+j*n] = Bi [i*nrhs+j] ; - } - } - klu_l_tsolve (Symbolic, Numeric, n, chunksize, W, - &Common) ; - for (j = 0 ; j < chunksize ; j++) - { - for (i = 0 ; i < n ; i++) - { - Xi [i*nrhs+j] = W [i+j*n] ; - } - } - Xi += 4 ; - Bi += 4 ; - } - - } - mxFree (W) ; - - } - else - { - - /* A is real: real(X) = real(A) \ real(b) */ - X = mxGetPr (pargout [0]) ; - B = mxGetPr (B_matlab) ; - for (k = 0 ; k < n*nrhs ; k++) - { - X [k] = B [k] ; - } - klu_l_solve (Symbolic, Numeric, n, nrhs, X, &Common) ; - if (B_complex) - { - /* B is complex: imag(X) = real(A) \ imag(B) */ - X = mxGetPi (pargout [0]) ; - B = mxGetPi (B_matlab) ; - for (k = 0 ; k < n*nrhs ; k++) - { - X [k] = B [k] ; - } - klu_l_solve (Symbolic, Numeric, n, nrhs, X, &Common) ; - } - } - } - - /* -------------------------------------------------------------- */ - /* free Symbolic and Numeric objects */ - /* -------------------------------------------------------------- */ - - klu_l_free_symbolic (&Symbolic, &Common) ; - if (A_complex) - { - klu_zl_free_numeric (&Numeric, &Common) ; - } - else - { - klu_l_free_numeric (&Numeric, &Common) ; - } - - } - else - { - - /* -------------------------------------------------------------- */ - /* solve using LU struct given on input */ - /* -------------------------------------------------------------- */ - - /* the factorization is L*U+F = R\A(p,q), where L*U is block - diagonal, and F contains the entries in the upper block - triangular part */ - - L_matlab = mxGetField (LU_matlab, 0, "L") ; - U_matlab = mxGetField (LU_matlab, 0, "U") ; - p_matlab = mxGetField (LU_matlab, 0, "p") ; - q_matlab = mxGetField (LU_matlab, 0, "q") ; - R_matlab = mxGetField (LU_matlab, 0, "R") ; - F_matlab = mxGetField (LU_matlab, 0, "F") ; - r_matlab = mxGetField (LU_matlab, 0, "r") ; - - if (!L_matlab || !U_matlab || !mxIsSparse (L_matlab) || - !mxIsSparse (U_matlab)) - { - mexErrMsgTxt ("invalid LU struct") ; - } - - n = mxGetM (L_matlab) ; - if (n != mxGetN (L_matlab) || - n != mxGetM (U_matlab) || n != mxGetN (U_matlab) - /* ... */ - ) - { - mexErrMsgTxt ("invalid LU struct") ; - } - - if (n != bn || nrhs == 0) - { - mexErrMsgTxt ( - "B must be non-empty with same number of rows as L and U") ; - } - - /* get L */ - if (!mxIsSparse (L_matlab) || - n != mxGetM (L_matlab) || n != mxGetN (L_matlab)) - { - mexErrMsgTxt ("LU.L must be sparse and same size as A") ; - } - - Lp = (Long *) mxGetJc (L_matlab) ; - Li = (Long *) mxGetIr (L_matlab) ; - Lx = mxGetPr (L_matlab) ; - Lz = mxGetPi (L_matlab) ; - - /* get U */ - if (!mxIsSparse (U_matlab) || - n != mxGetM (U_matlab) || n != mxGetN (U_matlab)) - { - mexErrMsgTxt ("LU.U must be sparse and same size as A") ; - } - Up = (Long *) mxGetJc (U_matlab) ; - Ui = (Long *) mxGetIr (U_matlab) ; - Ux = mxGetPr (U_matlab) ; - Uz = mxGetPi (U_matlab) ; - - /* get p */ - if (p_matlab) - { - if (mxGetNumberOfElements (p_matlab) != n - || mxIsSparse (p_matlab) - || mxGetClassID (p_matlab) != mx_int) - { - mexErrMsgTxt ("P invalid") ; - } - P = (Long *) mxGetData (p_matlab) ; - for (k = 0 ; k < n ; k++) - { - if (P [k] < 1 || P [k] > n) mexErrMsgTxt ("P invalid") ; - } - } - else - { - /* no P, use identity instead */ - P = NULL ; - } - - /* get q */ - if (q_matlab) - { - if (mxGetNumberOfElements (q_matlab) != n - || mxIsSparse (q_matlab) - || mxGetClassID (q_matlab) != mx_int) - { - mexErrMsgTxt ("Q invalid") ; - } - Q = (Long *) mxGetData (q_matlab) ; - for (k = 0 ; k < n ; k++) - { - if (Q [k] < 1 || Q [k] > n) mexErrMsgTxt ("Q invalid.") ; - } - } - else - { - /* no Q, use identity instead */ - Q = NULL ; - } - - /* get r */ - R1 [0] = 1 ; - R1 [1] = n+1 ; - if (r_matlab) - { - nblocks = mxGetNumberOfElements (r_matlab) - 1 ; - if (nblocks < 1 || nblocks > n || mxIsSparse (r_matlab) - || mxGetClassID (r_matlab) != mx_int) - { - mexErrMsgTxt ("r invalid") ; - } - R = (Long *) mxGetData (r_matlab) ; - if (R [0] != 1) mexErrMsgTxt ("r invalid") ; - for (k = 1 ; k <= nblocks ; k++) - { - if (R [k] <= R [k-1] || R [k] > n+1) - { - mexErrMsgTxt ("rinvalid") ; - } - } - if (R [nblocks] != n+1) mexErrMsgTxt ("r invalid") ; - } - else - { - /* no r */ - nblocks = 1 ; - R = R1 ; - } - - /* get R, scale factors */ - if (R_matlab) - { - /* ensure R is sparse, real, and has the right size */ - if (!mxIsSparse (R_matlab) || - n != mxGetM (R_matlab) || n != mxGetN (R_matlab)) - { - mexErrMsgTxt ("LU.R must be sparse and same size as A") ; - } - Rp = (Long *) mxGetJc (R_matlab) ; - Rs = mxGetPr (R_matlab) ; - if (Rp [n] != n) - { - mexErrMsgTxt ("LU.R invalid, must be diagonal") ; - } - } - else - { - /* no scale factors */ - Rs = NULL ; - } - - /* get F, off diagonal entries */ - if (F_matlab) - { - if (!mxIsSparse (F_matlab) || - n != mxGetM (F_matlab) || n != mxGetN (F_matlab)) - { - mexErrMsgTxt ("LU.F must be sparse and same size as A") ; - } - Offp = (Long *) mxGetJc (F_matlab) ; - Offi = (Long *) mxGetIr (F_matlab) ; - Offx = mxGetPr (F_matlab) ; - Offz = mxGetPi (F_matlab) ; - } - else - { - /* no off-diagonal entries */ - Offp = NULL ; - Offi = NULL ; - Offx = NULL ; - Offz = NULL ; - } - - /* -------------------------------------------------------------- */ - /* solve */ - /* -------------------------------------------------------------- */ - - if (mxIsComplex (L_matlab) || mxIsComplex (U_matlab) || - (F_matlab && mxIsComplex (F_matlab)) || B_complex) - { - - /* ========================================================== */ - /* === complex case ========================================= */ - /* ========================================================== */ - - /* create X */ - if (do_transpose) - { - pargout [0] = mxCreateDoubleMatrix (nrhs, n, mxCOMPLEX) ; - } - else - { - pargout [0] = mxCreateDoubleMatrix (n, nrhs, mxCOMPLEX) ; - } - Xx = mxGetPr (pargout [0]) ; - Xz = mxGetPi (pargout [0]) ; - - Bx = mxGetPr (B_matlab) ; - Bz = mxGetPi (B_matlab) ; - - /* get workspace */ - Wx = mxMalloc (n * sizeof (double)) ; - Wz = mxMalloc (n * sizeof (double)) ; - - /* ---------------------------------------------------------- */ - /* do just one row/column of the right-hand-side at a time */ - /* ---------------------------------------------------------- */ - - if (do_transpose) - { - - for (chunk = 0 ; chunk < nrhs ; chunk++) - { - - /* -------------------------------------------------- */ - /* transpose and permute right hand side, W = Q'*B' */ - /* -------------------------------------------------- */ - - for (k = 0 ; k < n ; k++) - { - i = Q ? (Q [k] - 1) : k ; - Wx [k] = Bx [i*nrhs] ; - Wz [k] = Bz ? (-Bz [i*nrhs]) : 0 ; - } - - /* -------------------------------------------------- */ - /* solve W = (L*U + Off)'\W */ - /* -------------------------------------------------- */ - - for (block = 0 ; block < nblocks ; block++) - { - - /* ---------------------------------------------- */ - /* block of size nk, rows/columns k1 to k2-1 */ - /* ---------------------------------------------- */ - - k1 = R [block] - 1 ; /* R is 1-based */ - k2 = R [block+1] - 1 ; - nk = k2 - k1 ; - - /* ---------------------------------------------- */ - /* block back-substitution for off-diagonal-block */ - /* ---------------------------------------------- */ - - if (block > 0 && Offp != NULL) - { - for (k = k1 ; k < k2 ; k++) - { - pend = Offp [k+1] ; - for (p = Offp [k] ; p < pend ; p++) - { - i = Offi [p] ; - /* W [k] -= W [i] * conj(Off [p]) ; */ - z = Offz ? Offz [p] : 0 ; - MULT_SUB_CONJ (Wx [k], Wz [k], - Wx [i], Wz [i], Offx [p], z) ; - } - } - } - - - /* solve the block system */ - if (nk == 1) - { - - /* W [k1] /= conj (L(k1,k1)) ; */ - p = Lp [k1] ; - s = Lx [p] ; - sz = Lz ? (-Lz [p]) : 0 ; - DIV (wx, wz, Wx [k1], Wz [k1], s, sz) ; - Wx [k1] = wx ; - Wz [k1] = wz ; - - /* W [k1] /= conj (U(k1,k1)) ; */ - p = Up [k1] ; - s = Ux [p] ; - sz = Uz ? (-Uz [p]) : 0 ; - DIV (wx, wz, Wx [k1], Wz [k1], s, sz) ; - Wx [k1] = wx ; - Wz [k1] = wz ; - - } - else - { - - /* ------------------------------------------ */ - /* W = U'\W and then W=L'\W */ - /* ------------------------------------------ */ - - /* W = U'\W */ - for (k = k1 ; k < k2 ; k++) - { - pend = Up [k+1] - 1 ; - /* w = W [k] */ - wx = Wx [k] ; - wz = Wz [k] ; - for (p = Up [k] ; p < pend ; p++) - { - i = Ui [p] ; - /* w -= W [i] * conj(U [p]) */ - z = Uz ? Uz [p] : 0 ; - MULT_SUB_CONJ (wx, wz, - Wx [i], Wz [i], Ux [p], z) ; - } - /* W [k] = w / conj(ukk) ; */ - ukk = Ux [pend] ; - ukkz = Uz ? (-Uz [pend]) : 0 ; - DIV (Wx [k], Wz [k], wx, wz, ukk, ukkz) ; - } - - /* W = L'\W */ - for (k = k2-1 ; k >= k1 ; k--) - { - p = Lp [k] ; - pend = Lp [k+1] ; - /* w = W [k] */ - wx = Wx [k] ; - wz = Wz [k] ; - lkk = Lx [p] ; - lkkz = Lz ? (-Lz [p]) : 0 ; - for (p++ ; p < pend ; p++) - { - i = Li [p] ; - /* w -= W [i] * conj (Lx [p]) ; */ - z = Lz ? Lz [p] : 0 ; - MULT_SUB_CONJ (wx, wz, - Wx [i], Wz [i], Lx [p], z) ; - } - /* W [k] = w / conj(lkk) ; */ - DIV (Wx [k], Wz [k], wx, wz, lkk, lkkz) ; - } - } - } - - /* -------------------------------------------------- */ - /* scale, permute, and tranpose: X = (P*(R\W))' */ - /* -------------------------------------------------- */ - - if (Rs == NULL) - { - /* no scaling */ - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - Xx [i*nrhs] = Wx [k] ; - Xz [i*nrhs] = Wz ? (-Wz [k]) : 0 ; - } - } - else - { - /* with scaling */ - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - rs = Rs [k] ; - Xx [i*nrhs] = Wx [k] / rs ; - Xz [i*nrhs] = Wz ? (-Wz [k] / rs) : 0 ; - } - } - - /* -------------------------------------------------- */ - /* go to the next row of B and X */ - /* -------------------------------------------------- */ - - Xx++ ; - Xz++ ; - Bx++ ; - if (Bz) Bz++ ; - } - - } - else - { - - for (chunk = 0 ; chunk < nrhs ; chunk++) - { - - /* -------------------------------------------------- */ - /* scale and permute the right hand side, W = P*(R\B) */ - /* -------------------------------------------------- */ - - if (Rs == NULL) - { - /* no scaling */ - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - Wx [k] = Bx [i] ; - Wz [k] = Bz ? Bz [i] : 0 ; - } - } - else - { - /* with scaling */ - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - rs = Rs [k] ; - Wx [k] = Bx [i] / rs ; - Wz [k] = Bz ? (Bz [i] / rs) : 0 ; - } - } - - /* -------------------------------------------------- */ - /* solve W = (L*U + Off)\W */ - /* -------------------------------------------------- */ - - for (block = nblocks-1 ; block >= 0 ; block--) - { - - /* ---------------------------------------------- */ - /* block of size nk, rows/columns k1 to k2-1 */ - /* ---------------------------------------------- */ - - k1 = R [block] - 1 ; /* R is 1-based */ - k2 = R [block+1] - 1 ; - nk = k2 - k1 ; - - /* solve the block system */ - if (nk == 1) - { - - /* W [k1] /= L(k1,k1) ; */ - p = Lp [k1] ; - s = Lx [p] ; - sz = Lz ? Lz [p] : 0 ; - DIV (wx, wz, Wx [k1], Wz [k1], s, sz) ; - Wx [k1] = wx ; - Wz [k1] = wz ; - - /* W [k1] /= U(k1,k1) ; */ - p = Up [k1] ; - s = Ux [p] ; - sz = Uz ? Uz [p] : 0 ; - DIV (wx, wz, Wx [k1], Wz [k1], s, sz) ; - Wx [k1] = wx ; - Wz [k1] = wz ; - - } - else - { - - /* ------------------------------------------ */ - /* W = L\W and then W=U\W */ - /* ------------------------------------------ */ - - /* W = L\W */ - for (k = k1 ; k < k2 ; k++) - { - p = Lp [k] ; - pend = Lp [k+1] ; - lkk = Lx [p] ; - lkkz = Lz ? Lz [p] : 0 ; - /* w = W [k] / lkk ; */ - DIV (wx, wz, Wx [k], Wz [k], lkk, lkkz) ; - Wx [k] = wx ; - Wz [k] = wz ; - for (p++ ; p < pend ; p++) - { - i = Li [p] ; - /* W [i] -= Lx [p] * w ; */ - z = Lz ? Lz [p] : 0 ; - MULT_SUB (Wx [i], Wz [i], Lx [p], z, - wx, wz) ; - } - } - - /* W = U\W */ - for (k = k2-1 ; k >= k1 ; k--) - { - pend = Up [k+1] - 1 ; - ukk = Ux [pend] ; - ukkz = Uz ? Uz [pend] : 0 ; - /* w = W [k] / ukk ; */ - DIV (wx, wz, Wx [k], Wz [k], ukk, ukkz) ; - Wx [k] = wx ; - Wz [k] = wz ; - for (p = Up [k] ; p < pend ; p++) - { - i = Ui [p] ; - /* W [i] -= U [p] * w ; */ - z = Uz ? Uz [p] : 0 ; - MULT_SUB (Wx [i], Wz [i], Ux [p], z, - wx, wz) ; - } - } - } - - /* ---------------------------------------------- */ - /* block back-substitution for off-diagonal-block */ - /* ---------------------------------------------- */ - - if (block > 0 && Offp != NULL) - { - for (k = k1 ; k < k2 ; k++) - { - pend = Offp [k+1] ; - wx = Wx [k] ; - wz = Wz [k] ; - for (p = Offp [k] ; p < pend ; p++) - { - i = Offi [p] ; - /* W [Offi [p]] -= Offx [p] * w ; */ - z = Offz ? Offz [p] : 0 ; - MULT_SUB (Wx [i], Wz [i], Offx [p], z, - wx, wz) ; - } - } - } - } - - /* -------------------------------------------------- */ - /* permute the result, X = Q*W */ - /* -------------------------------------------------- */ - - for (k = 0 ; k < n ; k++) - { - i = Q ? (Q [k] - 1) : k ; - Xx [i] = Wx [k] ; - Xz [i] = Wz [k] ; - } - - /* -------------------------------------------------- */ - /* go to the next column of B and X */ - /* -------------------------------------------------- */ - - Xx += n ; - Xz += n ; - Bx += n ; - if (Bz) Bz += n ; - } - } - - /* free workspace */ - mxFree (Wx) ; - mxFree (Wz) ; - - } - else - { - - /* ========================================================== */ - /* === real case ============================================ */ - /* ========================================================== */ - - /* create X */ - if (do_transpose) - { - pargout [0] = mxCreateDoubleMatrix (nrhs, n, mxREAL) ; - } - else - { - pargout [0] = mxCreateDoubleMatrix (n, nrhs, mxREAL) ; - } - - Xx = mxGetPr (pargout [0]) ; - Bx = mxGetPr (B_matlab) ; - - if (do_transpose) - { - - /* ------------------------------------------------------ */ - /* solve in chunks of one row at a time */ - /* ------------------------------------------------------ */ - - /* get workspace */ - Wx = mxMalloc (n * sizeof (double)) ; - - for (chunk = 0 ; chunk < nrhs ; chunk++) - { - - /* -------------------------------------------------- */ - /* transpose and permute right hand side, W = Q'*B' */ - /* -------------------------------------------------- */ - - for (k = 0 ; k < n ; k++) - { - i = Q ? (Q [k] - 1) : k ; - Wx [k] = Bx [i*nrhs] ; - } - - /* -------------------------------------------------- */ - /* solve W = (L*U + Off)'\W */ - /* -------------------------------------------------- */ - - for (block = 0 ; block < nblocks ; block++) - { - - /* ---------------------------------------------- */ - /* block of size nk, rows/columns k1 to k2-1 */ - /* ---------------------------------------------- */ - - k1 = R [block] - 1 ; /* R is 1-based */ - k2 = R [block+1] - 1 ; - nk = k2 - k1 ; - - /* ---------------------------------------------- */ - /* block back-substitution for off-diagonal-block */ - /* ---------------------------------------------- */ - - if (block > 0 && Offp != NULL) - { - for (k = k1 ; k < k2 ; k++) - { - pend = Offp [k+1] ; - for (p = Offp [k] ; p < pend ; p++) - { - Wx [k] -= Wx [Offi [p]] * Offx [p] ; - } - } - } - - /* solve the block system */ - if (nk == 1) - { - Wx [k1] /= Lx [Lp [k1]] ; - Wx [k1] /= Ux [Up [k1]] ; - } - else - { - - /* ------------------------------------------ */ - /* W = U'\W and then W=L'\W */ - /* ------------------------------------------ */ - - /* W = U'\W */ - for (k = k1 ; k < k2 ; k++) - { - pend = Up [k+1] - 1 ; - for (p = Up [k] ; p < pend ; p++) - { - Wx [k] -= Wx [Ui [p]] * Ux [p] ; - } - Wx [k] /= Ux [pend] ; - } - - /* W = L'\W */ - for (k = k2-1 ; k >= k1 ; k--) - { - p = Lp [k] ; - pend = Lp [k+1] ; - lkk = Lx [p] ; - for (p++ ; p < pend ; p++) - { - Wx [k] -= Wx [Li [p]] * Lx [p] ; - } - Wx [k] /= lkk ; - } - } - } - - /* -------------------------------------------------- */ - /* scale, permute, and tranpose: X = (P*(R\W))' */ - /* -------------------------------------------------- */ - - if (Rs == NULL) - { - /* no scaling */ - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - Xx [i*nrhs] = Wx [k] ; - } - } - else - { - /* with scaling */ - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - rs = Rs [k] ; - Xx [i*nrhs] = Wx [k] / rs ; - } - } - - /* -------------------------------------------------- */ - /* go to the next row of B and X */ - /* -------------------------------------------------- */ - - Xx++ ; - Bx++ ; - } - - } - else - { - - /* ------------------------------------------------------ */ - /* solve in chunks of 4 columns at a time */ - /* ------------------------------------------------------ */ - - /* get workspace */ - Wx = mxMalloc (n * MAX (4, nrhs) * sizeof (double)) ; - - for (chunk = 0 ; chunk < nrhs ; chunk += 4) - { - /* -------------------------------------------------- */ - /* get the size of the current chunk */ - /* -------------------------------------------------- */ - - nr = MIN (nrhs - chunk, 4) ; - - /* -------------------------------------------------- */ - /* scale and permute the right hand side, W = P*(R\B) */ - /* -------------------------------------------------- */ - - if (Rs == NULL) - { - - /* no scaling */ - switch (nr) - { - - case 1: - - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - Wx [k] = Bx [i] ; - } - break ; - - case 2: - - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - Wx [2*k ] = Bx [i ] ; - Wx [2*k + 1] = Bx [i + n ] ; - } - break ; - - case 3: - - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - Wx [3*k ] = Bx [i ] ; - Wx [3*k + 1] = Bx [i + n ] ; - Wx [3*k + 2] = Bx [i + n*2] ; - } - break ; - - case 4: - - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - Wx [4*k ] = Bx [i ] ; - Wx [4*k + 1] = Bx [i + n ] ; - Wx [4*k + 2] = Bx [i + n*2] ; - Wx [4*k + 3] = Bx [i + n*3] ; - } - break ; - } - - } - else - { - - switch (nr) - { - - case 1: - - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - rs = Rs [k] ; - Wx [k] = Bx [i] / rs ; - } - break ; - - case 2: - - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - rs = Rs [k] ; - Wx [2*k ] = Bx [i ] / rs ; - Wx [2*k + 1] = Bx [i + n ] / rs ; - } - break ; - - case 3: - - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - rs = Rs [k] ; - Wx [3*k ] = Bx [i ] / rs ; - Wx [3*k + 1] = Bx [i + n ] / rs ; - Wx [3*k + 2] = Bx [i + n*2] / rs ; - } - break ; - - case 4: - - for (k = 0 ; k < n ; k++) - { - i = P ? (P [k] - 1) : k ; - rs = Rs [k] ; - Wx [4*k ] = Bx [i ] / rs ; - Wx [4*k + 1] = Bx [i + n ] / rs ; - Wx [4*k + 2] = Bx [i + n*2] / rs ; - Wx [4*k + 3] = Bx [i + n*3] / rs ; - } - break ; - } - } - - /* -------------------------------------------------- */ - /* solve W = (L*U + Off)\W */ - /* -------------------------------------------------- */ - - for (block = nblocks-1 ; block >= 0 ; block--) - { - - /* ---------------------------------------------- */ - /* block of size nk is rows/columns k1 to k2-1 */ - /* ---------------------------------------------- */ - - k1 = R [block] - 1 ; /* R is 1-based */ - k2 = R [block+1] - 1 ; - nk = k2 - k1 ; - - /* solve the block system */ - if (nk == 1) - { - - /* this is not done if L comes from KLU, since - in that case, L is unit lower triangular */ - s = Lx [Lp [k1]] ; - if (s != 1.0) switch (nr) - { - case 1: - Wx [k1] /= s ; - break ; - case 2: - Wx [2*k1] /= s ; - Wx [2*k1 + 1] /= s ; - break ; - case 3: - Wx [3*k1] /= s ; - Wx [3*k1 + 1] /= s ; - Wx [3*k1 + 2] /= s ; - break ; - case 4: - Wx [4*k1] /= s ; - Wx [4*k1 + 1] /= s ; - Wx [4*k1 + 2] /= s ; - Wx [4*k1 + 3] /= s ; - break ; - } - - s = Ux [Up [k1]] ; - if (s != 1.0) switch (nr) - { - case 1: - Wx [k1] /= s ; - break ; - case 2: - Wx [2*k1] /= s ; - Wx [2*k1 + 1] /= s ; - break ; - case 3: - Wx [3*k1] /= s ; - Wx [3*k1 + 1] /= s ; - Wx [3*k1 + 2] /= s ; - break ; - case 4: - Wx [4*k1] /= s ; - Wx [4*k1 + 1] /= s ; - Wx [4*k1 + 2] /= s ; - Wx [4*k1 + 3] /= s ; - break ; - } - - } - else - { - - /* ------------------------------------------ */ - /* W = L\W and then W=U\W */ - /* ------------------------------------------ */ - - switch (nr) - { - - case 1: - /* W = L\W */ - for (k = k1 ; k < k2 ; k++) - { - p = Lp [k] ; - pend = Lp [k+1] ; - lkk = Lx [p++] ; - x [0] = Wx [k] / lkk ; - Wx [k] = x [0] ; - for ( ; p < pend ; p++) - { - Wx [Li [p]] -= Lx [p] * x [0] ; - } - } - - /* W = U\W */ - for (k = k2-1 ; k >= k1 ; k--) - { - pend = Up [k+1] - 1 ; - ukk = Ux [pend] ; - x [0] = Wx [k] / ukk ; - Wx [k] = x [0] ; - for (p = Up [k] ; p < pend ; p++) - { - Wx [Ui [p]] -= Ux [p] * x [0] ; - } - } - break ; - - case 2: - - /* W = L\W */ - for (k = k1 ; k < k2 ; k++) - { - p = Lp [k] ; - pend = Lp [k+1] ; - lkk = Lx [p++] ; - x [0] = Wx [2*k ] / lkk ; - x [1] = Wx [2*k + 1] / lkk ; - Wx [2*k ] = x [0] ; - Wx [2*k + 1] = x [1] ; - for ( ; p < pend ; p++) - { - i = Li [p] ; - lik = Lx [p] ; - Wx [2*i ] -= lik * x [0] ; - Wx [2*i + 1] -= lik * x [1] ; - } - } - - /* W = U\W */ - for (k = k2-1 ; k >= k1 ; k--) - { - pend = Up [k+1] - 1 ; - ukk = Ux [pend] ; - x [0] = Wx [2*k ] / ukk ; - x [1] = Wx [2*k + 1] / ukk ; - Wx [2*k ] = x [0] ; - Wx [2*k + 1] = x [1] ; - for (p = Up [k] ; p < pend ; p++) - { - i = Ui [p] ; - uik = Ux [p] ; - Wx [2*i ] -= uik * x [0] ; - Wx [2*i + 1] -= uik * x [1] ; - } - } - break ; - - case 3: - - /* W = L\W */ - for (k = k1 ; k < k2 ; k++) - { - p = Lp [k] ; - pend = Lp [k+1] ; - lkk = Lx [p++] ; - x [0] = Wx [3*k ] / lkk ; - x [1] = Wx [3*k + 1] / lkk ; - x [2] = Wx [3*k + 2] / lkk ; - Wx [3*k ] = x [0] ; - Wx [3*k + 1] = x [1] ; - Wx [3*k + 2] = x [2] ; - for ( ; p < pend ; p++) - { - i = Li [p] ; - lik = Lx [p] ; - Wx [3*i ] -= lik * x [0] ; - Wx [3*i + 1] -= lik * x [1] ; - Wx [3*i + 2] -= lik * x [2] ; - } - } - - /* W = U\W */ - for (k = k2-1 ; k >= k1 ; k--) - { - pend = Up [k+1] - 1 ; - ukk = Ux [pend] ; - x [0] = Wx [3*k ] / ukk ; - x [1] = Wx [3*k + 1] / ukk ; - x [2] = Wx [3*k + 2] / ukk ; - Wx [3*k ] = x [0] ; - Wx [3*k + 1] = x [1] ; - Wx [3*k + 2] = x [2] ; - for (p = Up [k] ; p < pend ; p++) - { - i = Ui [p] ; - uik = Ux [p] ; - Wx [3*i ] -= uik * x [0] ; - Wx [3*i + 1] -= uik * x [1] ; - Wx [3*i + 2] -= uik * x [2] ; - } - } - break ; - - case 4: - - /* W = L\W */ - for (k = k1 ; k < k2 ; k++) - { - p = Lp [k] ; - pend = Lp [k+1] ; - lkk = Lx [p++] ; - x [0] = Wx [4*k ] / lkk ; - x [1] = Wx [4*k + 1] / lkk ; - x [2] = Wx [4*k + 2] / lkk ; - x [3] = Wx [4*k + 3] / lkk ; - Wx [4*k ] = x [0] ; - Wx [4*k + 1] = x [1] ; - Wx [4*k + 2] = x [2] ; - Wx [4*k + 3] = x [3] ; - for ( ; p < pend ; p++) - { - i = Li [p] ; - lik = Lx [p] ; - Wx [4*i ] -= lik * x [0] ; - Wx [4*i + 1] -= lik * x [1] ; - Wx [4*i + 2] -= lik * x [2] ; - Wx [4*i + 3] -= lik * x [3] ; - } - } - - /* Wx = U\Wx */ - for (k = k2-1 ; k >= k1 ; k--) - { - pend = Up [k+1] - 1 ; - ukk = Ux [pend] ; - x [0] = Wx [4*k ] / ukk ; - x [1] = Wx [4*k + 1] / ukk ; - x [2] = Wx [4*k + 2] / ukk ; - x [3] = Wx [4*k + 3] / ukk ; - Wx [4*k ] = x [0] ; - Wx [4*k + 1] = x [1] ; - Wx [4*k + 2] = x [2] ; - Wx [4*k + 3] = x [3] ; - for (p = Up [k] ; p < pend ; p++) - { - i = Ui [p] ; - uik = Ux [p] ; - Wx [4*i ] -= uik * x [0] ; - Wx [4*i + 1] -= uik * x [1] ; - Wx [4*i + 2] -= uik * x [2] ; - Wx [4*i + 3] -= uik * x [3] ; - } - } - break ; - } - } - - /* ---------------------------------------------- */ - /* block back-substitution for off-diagonal-block */ - /* ---------------------------------------------- */ - - if (block > 0 && Offp != NULL) - { - switch (nr) - { - - case 1: - - for (k = k1 ; k < k2 ; k++) - { - pend = Offp [k+1] ; - x [0] = Wx [k] ; - for (p = Offp [k] ; p < pend ; p++) - { - Wx [Offi [p]] -= Offx[p] * x[0]; - } - } - break ; - - case 2: - - for (k = k1 ; k < k2 ; k++) - { - pend = Offp [k+1] ; - x [0] = Wx [2*k ] ; - x [1] = Wx [2*k + 1] ; - for (p = Offp [k] ; p < pend ; p++) - { - i = Offi [p] ; - offik = Offx [p] ; - Wx [2*i ] -= offik * x [0] ; - Wx [2*i + 1] -= offik * x [1] ; - } - } - break ; - - case 3: - - for (k = k1 ; k < k2 ; k++) - { - pend = Offp [k+1] ; - x [0] = Wx [3*k ] ; - x [1] = Wx [3*k + 1] ; - x [2] = Wx [3*k + 2] ; - for (p = Offp [k] ; p < pend ; p++) - { - i = Offi [p] ; - offik = Offx [p] ; - Wx [3*i ] -= offik * x [0] ; - Wx [3*i + 1] -= offik * x [1] ; - Wx [3*i + 2] -= offik * x [2] ; - } - } - break ; - - case 4: - - for (k = k1 ; k < k2 ; k++) - { - pend = Offp [k+1] ; - x [0] = Wx [4*k ] ; - x [1] = Wx [4*k + 1] ; - x [2] = Wx [4*k + 2] ; - x [3] = Wx [4*k + 3] ; - for (p = Offp [k] ; p < pend ; p++) - { - i = Offi [p] ; - offik = Offx [p] ; - Wx [4*i ] -= offik * x [0] ; - Wx [4*i + 1] -= offik * x [1] ; - Wx [4*i + 2] -= offik * x [2] ; - Wx [4*i + 3] -= offik * x [3] ; - } - } - break ; - } - } - } - - /* -------------------------------------------------- */ - /* permute the result, X = Q*W */ - /* -------------------------------------------------- */ - - switch (nr) - { - - case 1: - - for (k = 0 ; k < n ; k++) - { - i = Q ? (Q [k] - 1) : k ; - Xx [i] = Wx [k] ; - } - break ; - - case 2: - - for (k = 0 ; k < n ; k++) - { - i = Q ? (Q [k] - 1) : k ; - Xx [i ] = Wx [2*k ] ; - Xx [i + n ] = Wx [2*k + 1] ; - } - break ; - - case 3: - - for (k = 0 ; k < n ; k++) - { - i = Q ? (Q [k] - 1) : k ; - Xx [i ] = Wx [3*k ] ; - Xx [i + n ] = Wx [3*k + 1] ; - Xx [i + n*2] = Wx [3*k + 2] ; - } - break ; - - case 4: - - for (k = 0 ; k < n ; k++) - { - i = Q ? (Q [k] - 1) : k ; - Xx [i ] = Wx [4*k ] ; - Xx [i + n ] = Wx [4*k + 1] ; - Xx [i + n*2] = Wx [4*k + 2] ; - Xx [i + n*3] = Wx [4*k + 3] ; - } - break ; - } - - /* -------------------------------------------------- */ - /* go to the next chunk of B and X */ - /* -------------------------------------------------- */ - - Xx += n*4 ; - Bx += n*4 ; - } - } - - /* free workspace */ - mxFree (Wx) ; - } - - } - - } - else - { - - /* ------------------------------------------------------------------ */ - /* LU = klu (A) usage; extract factorization */ - /* ------------------------------------------------------------------ */ - - /* sort the row indices in each column of L and U */ - if (A_complex) - { - klu_zl_sort (Symbolic, Numeric, &Common) ; - } - else - { - klu_l_sort (Symbolic, Numeric, &Common) ; - } - - /* L */ - L_matlab = mxCreateSparse (n, n, Numeric->lnz, - A_complex ? mxCOMPLEX: mxREAL) ; - Lp = (Long *) mxGetJc (L_matlab) ; - Li = (Long *) mxGetIr (L_matlab) ; - Lx = mxGetPr (L_matlab) ; - Lz = mxGetPi (L_matlab) ; - - /* U */ - U_matlab = mxCreateSparse (n, n, Numeric->unz, - A_complex ? mxCOMPLEX: mxREAL) ; - Up = (Long *) mxGetJc (U_matlab) ; - Ui = (Long *) mxGetIr (U_matlab) ; - Ux = mxGetPr (U_matlab) ; - Uz = mxGetPi (U_matlab) ; - - /* p */ - p_matlab = mxCreateNumericMatrix (1, n, mx_int, mxREAL) ; - P = (Long *) mxGetData (p_matlab) ; - - /* q */ - q_matlab = mxCreateNumericMatrix (1, n, mx_int, mxREAL) ; - Q = (Long *) mxGetData (q_matlab) ; - - /* R, as a sparse diagonal matrix */ - R_matlab = mxCreateSparse (n, n, n+1, mxREAL) ; - Rp = (Long *) mxGetJc (R_matlab) ; - Ri = (Long *) mxGetIr (R_matlab) ; - Rs = mxGetPr (R_matlab) ; - for (k = 0 ; k <= n ; k++) - { - Rp [k] = k ; - Ri [k] = k ; - } - - /* F, off diagonal blocks */ - F_matlab = mxCreateSparse (n, n, Numeric->nzoff, - A_complex ? mxCOMPLEX: mxREAL) ; - Offp = (Long *) mxGetJc (F_matlab) ; - Offi = (Long *) mxGetIr (F_matlab) ; - Offx = mxGetPr (F_matlab) ; - Offz = mxGetPi (F_matlab) ; - - /* r, block boundaries */ - nblocks = Symbolic->nblocks ; - r_matlab = mxCreateNumericMatrix (1, nblocks+1, mx_int, mxREAL) ; - R = (Long *) mxGetData (r_matlab) ; - - /* extract the LU factorization from KLU Numeric and Symbolic objects */ - if (A_complex) - { - klu_zl_extract (Numeric, Symbolic, Lp, Li, Lx, Lz, Up, Ui, Ux, Uz, - Offp, Offi, Offx, Offz, P, Q, Rs, R, &Common) ; - } - else - { - klu_l_extract (Numeric, Symbolic, Lp, Li, Lx, Up, Ui, Ux, - Offp, Offi, Offx, P, Q, Rs, R, &Common) ; - } - - /* fix p and q for 1-based indexing */ - for (k = 0 ; k < n ; k++) - { - P [k]++ ; - Q [k]++ ; - } - - /* fix r for 1-based indexing */ - for (k = 0 ; k <= nblocks ; k++) - { - R [k]++ ; - } - - /* create output LU struct */ - pargout [0] = mxCreateStructMatrix (1, 1, 7, LUnames) ; - mxSetFieldByNumber (pargout [0], 0, 0, L_matlab) ; - mxSetFieldByNumber (pargout [0], 0, 1, U_matlab) ; - mxSetFieldByNumber (pargout [0], 0, 2, p_matlab) ; - mxSetFieldByNumber (pargout [0], 0, 3, q_matlab) ; - mxSetFieldByNumber (pargout [0], 0, 4, R_matlab) ; - mxSetFieldByNumber (pargout [0], 0, 5, F_matlab) ; - mxSetFieldByNumber (pargout [0], 0, 6, r_matlab) ; - - /* ------------------------------------------------------------------ */ - /* free Symbolic and Numeric objects */ - /* ------------------------------------------------------------------ */ - - klu_l_free_symbolic (&Symbolic, &Common) ; - klu_l_free_numeric (&Numeric, &Common) ; - } -} diff --git a/ThirdParty/SuiteSparse/KLU/Makefile b/ThirdParty/SuiteSparse/KLU/Makefile index 5737518b85..896ea4a1b6 100644 --- a/ThirdParty/SuiteSparse/KLU/Makefile +++ b/ThirdParty/SuiteSparse/KLU/Makefile @@ -1,53 +1,99 @@ -#------------------------------------------------------------------------------ -# KLU Makefile -#------------------------------------------------------------------------------ +#------------------------------------------------------------------------------- +# SuiteSparse/KLU/Makefile +#------------------------------------------------------------------------------- -SUITESPARSE ?= $(realpath $(CURDIR)/..) -export SUITESPARSE +# KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +# Authors: Timothy A. Davis and Ekanathan Palamadai. +# SPDX-License-Identifier: LGPL-2.1+ -default: all +#------------------------------------------------------------------------------- -include ../SuiteSparse_config/SuiteSparse_config.mk +# A simple Makefile for KLU, which relies on cmake to do the +# actual build. All the work is done in cmake so this Makefile is just for +# convenience. -demos: all +# To compile with an alternate compiler: +# +# make CC=gcc CXX=g++ +# +# To compile/install for system-wide usage: +# +# make +# sudo make install +# +# To compile/install for local usage (SuiteSparse/lib and SuiteSparse/include): +# +# make local +# make install +# +# To clean up the files: +# +# make clean -all: - ( cd Lib ; $(MAKE) ) - ( cd Demo ; $(MAKE) ) +JOBS ?= 8 +default: library + +# default is to install only in /usr/local library: - ( cd Lib ; $(MAKE) ) + ( cd build && cmake $(CMAKE_OPTIONS) .. && cmake --build . -j${JOBS} ) -# compile the static libraries only -static: - ( cd Lib ; $(MAKE) static ) +# install only in SuiteSparse/lib and SuiteSparse/include +local: + ( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=1 .. && cmake --build . -j${JOBS} ) -clean: - ( cd Demo ; $(MAKE) clean ) - ( cd Lib ; $(MAKE) clean ) - ( cd Tcov ; $(MAKE) clean ) - ( cd MATLAB ; $(RM) $(CLEAN) rename.h ) +# install only in /usr/local (default) +global: + ( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=0 .. && cmake --build . -j${JOBS} ) + +debug: + ( cd build && cmake $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug .. && cmake --build . -j${JOBS} ) -distclean: - ( cd Demo ; $(MAKE) distclean ) - ( cd Lib ; $(MAKE) distclean ) - ( cd Tcov ; $(MAKE) distclean ) - ( cd User ; $(MAKE) distclean ) - ( cd MATLAB ; $(RM) $(CLEAN) rename.h *.mex* ) +all: library -purge: distclean +demos: library + ( cd build && cmake $(CMAKE_OPTIONS) -DDEMO=1 .. && cmake --build . -j${JOBS} ) + - ./build/klu_simple + - ./build/kludemo < ./Matrix/1c.mtx + - ./build/kludemo < ./Matrix/arrowc.mtx + - ./build/kludemo < ./Matrix/arrow.mtx + - ./build/kludemo < ./Matrix/impcol_a.mtx + - ./build/kludemo < ./Matrix/w156.mtx + - ./build/kludemo < ./Matrix/ctina.mtx + - ./build/kluldemo < ./Matrix/1c.mtx + - ./build/kluldemo < ./Matrix/arrowc.mtx + - ./build/kluldemo < ./Matrix/arrow.mtx + - ./build/kluldemo < ./Matrix/impcol_a.mtx + - ./build/kluldemo < ./Matrix/w156.mtx + - ./build/kluldemo < ./Matrix/ctina.mtx cov: - ( cd Tcov ; $(MAKE) ) + ( cd Tcov && $(MAKE) ) -# create PDF documents for the original distribution -docs: - ( cd Doc ; $(MAKE) ) +# just compile after running cmake; do not run cmake again +remake: + ( cd build && cmake --build . -j${JOBS} ) + +# just run cmake to set things up +setup: + ( cd build && cmake $(CMAKE_OPTIONS) .. ) -# install KLU install: - ( cd Lib ; $(MAKE) install ) + ( cd build && cmake --install . ) -# uninstall KLU +# remove any installed libraries and #include files uninstall: - ( cd Lib ; $(MAKE) uninstall ) + - xargs rm < build/install_manifest.txt + +# remove all files not in the distribution +clean: + - $(RM) -rf build/* Config/*.tmp MATLAB/*.o MATLAB/*.mex* + ( cd Tcov && $(MAKE) purge ) + +purge: clean + +distclean: clean + +docs: + ( cd Doc && $(MAKE) ) + diff --git a/ThirdParty/SuiteSparse/KLU/Matrix/1c.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/1c.mtx deleted file mode 100644 index b9da424159..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Matrix/1c.mtx +++ /dev/null @@ -1,3 +0,0 @@ -%%MatrixMarket matrix coordinate complex general -1 1 1 -1 1 1 1 diff --git a/ThirdParty/SuiteSparse/KLU/Matrix/GD99_cc.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/GD99_cc.mtx deleted file mode 100644 index 4f5baec19f..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Matrix/GD99_cc.mtx +++ /dev/null @@ -1,152 +0,0 @@ -%%MatrixMarket matrix coordinate complex general -% imaginary part is Pajek/GD99_c, real part is zero -105 105 149 -6 1 0 1 -5 2 0 1 -7 2 0 1 -4 3 0 1 -8 3 0 1 -5 4 0 1 -1 5 0 1 -24 6 0 1 -6 7 0 1 -7 8 0 1 -26 9 0 1 -105 10 0 1 -94 11 0 1 -40 12 0 1 -26 13 0 1 -16 14 0 1 -26 15 0 1 -26 16 0 1 -16 17 0 1 -16 19 0 1 -16 20 0 1 -57 21 0 1 -15 22 0 1 -31 22 0 1 -13 23 0 1 -15 24 0 1 -13 25 0 1 -9 26 0 1 -16 26 0 1 -57 26 0 1 -24 27 0 1 -85 28 0 1 -85 29 0 1 -32 30 0 1 -86 30 0 1 -22 31 0 1 -45 31 0 1 -57 31 0 1 -22 32 0 1 -85 32 0 1 -54 33 0 1 -88 33 0 1 -91 33 0 1 -91 34 0 1 -92 34 0 1 -95 35 0 1 -50 36 0 1 -98 37 0 1 -98 38 0 1 -38 39 0 1 -38 40 0 1 -102 41 0 1 -101 42 0 1 -103 43 0 1 -100 44 0 1 -104 44 0 1 -31 45 0 1 -93 45 0 1 -28 46 0 1 -50 47 0 1 -87 47 0 1 -100 47 0 1 -53 48 0 1 -99 48 0 1 -87 49 0 1 -89 49 0 1 -45 50 0 1 -94 50 0 1 -31 51 0 1 -104 51 0 1 -48 52 0 1 -90 52 0 1 -91 52 0 1 -89 53 0 1 -87 54 0 1 -90 54 0 1 -93 54 0 1 -99 55 0 1 -29 56 0 1 -18 57 0 1 -21 57 0 1 -26 57 0 1 -31 57 0 1 -95 58 0 1 -45 59 0 1 -103 59 0 1 -59 60 0 1 -102 61 0 1 -61 62 0 1 -61 63 0 1 -53 64 0 1 -64 65 0 1 -65 66 0 1 -64 67 0 1 -91 67 0 1 -92 67 0 1 -88 68 0 1 -97 69 0 1 -96 70 0 1 -97 70 0 1 -96 71 0 1 -92 72 0 1 -48 73 0 1 -64 73 0 1 -98 73 0 1 -40 74 0 1 -86 75 0 1 -96 76 0 1 -86 77 0 1 -82 78 0 1 -78 79 0 1 -82 79 0 1 -81 80 0 1 -84 80 0 1 -78 81 0 1 -33 82 0 1 -82 83 0 1 -83 84 0 1 -32 85 0 1 -30 86 0 1 -47 87 0 1 -54 87 0 1 -33 88 0 1 -97 88 0 1 -49 89 0 1 -99 89 0 1 -52 90 0 1 -55 90 0 1 -33 91 0 1 -67 91 0 1 -34 92 0 1 -50 93 0 1 -50 94 0 1 -95 94 0 1 -94 95 0 1 -70 96 0 1 -88 97 0 1 -73 98 0 1 -55 99 0 1 -89 99 0 1 -47 100 0 1 -101 100 0 1 -100 101 0 1 -102 101 0 1 -101 102 0 1 -59 103 0 1 -105 103 0 1 -105 104 0 1 -104 105 0 1 diff --git a/ThirdParty/SuiteSparse/KLU/Matrix/arrow.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/arrow.mtx deleted file mode 100644 index 27419e4a44..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Matrix/arrow.mtx +++ /dev/null @@ -1,300 +0,0 @@ -%%MatrixMarket matrix coordinate integer general -100 100 298 -1 1 2 -2 1 1 -3 1 1 -4 1 1 -5 1 1 -6 1 1 -7 1 1 -8 1 1 -9 1 1 -10 1 1 -11 1 1 -12 1 1 -13 1 1 -14 1 1 -15 1 1 -16 1 1 -17 1 1 -18 1 1 -19 1 1 -20 1 1 -21 1 1 -22 1 1 -23 1 1 -24 1 1 -25 1 1 -26 1 1 -27 1 1 -28 1 1 -29 1 1 -30 1 1 -31 1 1 -32 1 1 -33 1 1 -34 1 1 -35 1 1 -36 1 1 -37 1 1 -38 1 1 -39 1 1 -40 1 1 -41 1 1 -42 1 1 -43 1 1 -44 1 1 -45 1 1 -46 1 1 -47 1 1 -48 1 1 -49 1 1 -50 1 1 -51 1 1 -52 1 1 -53 1 1 -54 1 1 -55 1 1 -56 1 1 -57 1 1 -58 1 1 -59 1 1 -60 1 1 -61 1 1 -62 1 1 -63 1 1 -64 1 1 -65 1 1 -66 1 1 -67 1 1 -68 1 1 -69 1 1 -70 1 1 -71 1 1 -72 1 1 -73 1 1 -74 1 1 -75 1 1 -76 1 1 -77 1 1 -78 1 1 -79 1 1 -80 1 1 -81 1 1 -82 1 1 -83 1 1 -84 1 1 -85 1 1 -86 1 1 -87 1 1 -88 1 1 -89 1 1 -90 1 1 -91 1 1 -92 1 1 -93 1 1 -94 1 1 -95 1 1 -96 1 1 -97 1 1 -98 1 1 -99 1 1 -100 1 1 -1 2 2 -2 2 1 -1 3 1 -3 3 1 -1 4 1 -4 4 1 -1 5 1 -5 5 1 -1 6 1 -6 6 1 -1 7 1 -7 7 1 -1 8 1 -8 8 1 -1 9 1 -9 9 1 -1 10 1 -10 10 1 -1 11 1 -11 11 1 -1 12 1 -12 12 1 -1 13 1 -13 13 1 -1 14 1 -14 14 1 -1 15 1 -15 15 1 -1 16 1 -16 16 1 -1 17 1 -17 17 1 -1 18 1 -18 18 1 -1 19 1 -19 19 1 -1 20 1 -20 20 1 -1 21 1 -21 21 1 -1 22 1 -22 22 1 -1 23 1 -23 23 1 -1 24 1 -24 24 1 -1 25 1 -25 25 1 -1 26 1 -26 26 1 -1 27 1 -27 27 1 -1 28 1 -28 28 1 -1 29 1 -29 29 1 -1 30 1 -30 30 1 -1 31 1 -31 31 1 -1 32 1 -32 32 1 -1 33 1 -33 33 1 -1 34 1 -34 34 1 -1 35 1 -35 35 1 -1 36 1 -36 36 1 -1 37 1 -37 37 1 -1 38 1 -38 38 1 -1 39 1 -39 39 1 -1 40 1 -40 40 1 -1 41 1 -41 41 1 -1 42 1 -42 42 1 -1 43 1 -43 43 1 -1 44 1 -44 44 1 -1 45 1 -45 45 1 -1 46 1 -46 46 1 -1 47 1 -47 47 1 -1 48 1 -48 48 1 -1 49 1 -49 49 1 -1 50 1 -50 50 1 -1 51 1 -51 51 1 -1 52 1 -52 52 1 -1 53 1 -53 53 1 -1 54 1 -54 54 1 -1 55 1 -55 55 1 -1 56 1 -56 56 1 -1 57 1 -57 57 1 -1 58 1 -58 58 1 -1 59 1 -59 59 1 -1 60 1 -60 60 1 -1 61 1 -61 61 1 -1 62 1 -62 62 1 -1 63 1 -63 63 1 -1 64 1 -64 64 1 -1 65 1 -65 65 1 -1 66 1 -66 66 1 -1 67 1 -67 67 1 -1 68 1 -68 68 1 -1 69 1 -69 69 1 -1 70 1 -70 70 1 -1 71 1 -71 71 1 -1 72 1 -72 72 1 -1 73 1 -73 73 1 -1 74 1 -74 74 1 -1 75 1 -75 75 1 -1 76 1 -76 76 1 -1 77 1 -77 77 1 -1 78 1 -78 78 1 -1 79 1 -79 79 1 -1 80 1 -80 80 1 -1 81 1 -81 81 1 -1 82 1 -82 82 1 -1 83 1 -83 83 1 -1 84 1 -84 84 1 -1 85 1 -85 85 1 -1 86 1 -86 86 1 -1 87 1 -87 87 1 -1 88 1 -88 88 1 -1 89 1 -89 89 1 -1 90 1 -90 90 1 -1 91 1 -91 91 1 -1 92 1 -92 92 1 -1 93 1 -93 93 1 -1 94 1 -94 94 1 -1 95 1 -95 95 1 -1 96 1 -96 96 1 -1 97 1 -97 97 1 -1 98 1 -98 98 1 -1 99 1 -99 99 1 -1 100 1 -100 100 1 diff --git a/ThirdParty/SuiteSparse/KLU/Matrix/arrowc.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/arrowc.mtx deleted file mode 100644 index bf4d3c50bf..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Matrix/arrowc.mtx +++ /dev/null @@ -1,300 +0,0 @@ -%%MatrixMarket matrix coordinate complex general -100 100 298 -1 1 0 1 -2 1 1 0 -3 1 1 0 -4 1 1 0 -5 1 1 0 -6 1 1 0 -7 1 1 0 -8 1 1 0 -9 1 1 0 -10 1 1 0 -11 1 1 0 -12 1 1 0 -13 1 1 0 -14 1 1 0 -15 1 1 0 -16 1 1 0 -17 1 1 0 -18 1 1 0 -19 1 1 0 -20 1 1 0 -21 1 1 0 -22 1 1 0 -23 1 1 0 -24 1 1 0 -25 1 1 0 -26 1 1 0 -27 1 1 0 -28 1 1 0 -29 1 1 0 -30 1 1 0 -31 1 1 0 -32 1 1 0 -33 1 1 0 -34 1 1 0 -35 1 1 0 -36 1 1 0 -37 1 1 0 -38 1 1 0 -39 1 1 0 -40 1 1 0 -41 1 1 0 -42 1 1 0 -43 1 1 0 -44 1 1 0 -45 1 1 0 -46 1 1 0 -47 1 1 0 -48 1 1 0 -49 1 1 0 -50 1 1 0 -51 1 1 0 -52 1 1 0 -53 1 1 0 -54 1 1 0 -55 1 1 0 -56 1 1 0 -57 1 1 0 -58 1 1 0 -59 1 1 0 -60 1 1 0 -61 1 1 0 -62 1 1 0 -63 1 1 0 -64 1 1 0 -65 1 1 0 -66 1 1 0 -67 1 1 0 -68 1 1 0 -69 1 1 0 -70 1 1 0 -71 1 1 0 -72 1 1 0 -73 1 1 0 -74 1 1 0 -75 1 1 0 -76 1 1 0 -77 1 1 0 -78 1 1 0 -79 1 1 0 -80 1 1 0 -81 1 1 0 -82 1 1 0 -83 1 1 0 -84 1 1 0 -85 1 1 0 -86 1 1 0 -87 1 1 0 -88 1 1 0 -89 1 1 0 -90 1 1 0 -91 1 1 0 -92 1 1 0 -93 1 1 0 -94 1 1 0 -95 1 1 0 -96 1 1 0 -97 1 1 0 -98 1 1 0 -99 1 1 0 -100 1 1 0 -1 2 2 0 -2 2 1 0 -1 3 1 0 -3 3 1 0 -1 4 1 0 -4 4 1 0 -1 5 1 0 -5 5 1 0 -1 6 1 0 -6 6 1 0 -1 7 1 0 -7 7 1 0 -1 8 1 0 -8 8 1 0 -1 9 1 0 -9 9 1 0 -1 10 1 0 -10 10 1 0 -1 11 1 0 -11 11 1 0 -1 12 1 0 -12 12 1 0 -1 13 1 0 -13 13 1 0 -1 14 1 0 -14 14 1 0 -1 15 1 0 -15 15 1 0 -1 16 1 0 -16 16 1 0 -1 17 1 0 -17 17 1 0 -1 18 1 0 -18 18 1 0 -1 19 1 0 -19 19 1 0 -1 20 1 0 -20 20 1 0 -1 21 1 0 -21 21 1 0 -1 22 1 0 -22 22 1 0 -1 23 1 0 -23 23 1 0 -1 24 1 0 -24 24 1 0 -1 25 1 0 -25 25 1 0 -1 26 1 0 -26 26 1 0 -1 27 1 0 -27 27 1 0 -1 28 1 0 -28 28 1 0 -1 29 1 0 -29 29 1 0 -1 30 1 0 -30 30 1 0 -1 31 1 0 -31 31 1 0 -1 32 1 0 -32 32 1 0 -1 33 1 0 -33 33 1 0 -1 34 1 0 -34 34 1 0 -1 35 1 0 -35 35 1 0 -1 36 1 0 -36 36 1 0 -1 37 1 0 -37 37 1 0 -1 38 1 0 -38 38 1 0 -1 39 1 0 -39 39 1 0 -1 40 1 0 -40 40 1 0 -1 41 1 0 -41 41 1 0 -1 42 1 0 -42 42 1 0 -1 43 1 0 -43 43 1 0 -1 44 1 0 -44 44 1 0 -1 45 1 0 -45 45 1 0 -1 46 1 0 -46 46 1 0 -1 47 1 0 -47 47 1 0 -1 48 1 0 -48 48 1 0 -1 49 1 0 -49 49 1 0 -1 50 1 0 -50 50 1 0 -1 51 1 0 -51 51 1 0 -1 52 1 0 -52 52 1 0 -1 53 1 0 -53 53 1 0 -1 54 1 0 -54 54 1 0 -1 55 1 0 -55 55 1 0 -1 56 1 0 -56 56 1 0 -1 57 1 0 -57 57 1 0 -1 58 1 0 -58 58 1 0 -1 59 1 0 -59 59 1 0 -1 60 1 0 -60 60 1 0 -1 61 1 0 -61 61 1 0 -1 62 1 0 -62 62 1 0 -1 63 1 0 -63 63 1 0 -1 64 1 0 -64 64 1 0 -1 65 1 0 -65 65 1 0 -1 66 1 0 -66 66 1 0 -1 67 1 0 -67 67 1 0 -1 68 1 0 -68 68 1 0 -1 69 1 0 -69 69 1 0 -1 70 1 0 -70 70 1 0 -1 71 1 0 -71 71 1 0 -1 72 1 0 -72 72 1 0 -1 73 1 0 -73 73 1 0 -1 74 1 0 -74 74 1 0 -1 75 1 0 -75 75 1 0 -1 76 1 0 -76 76 1 0 -1 77 1 0 -77 77 1 0 -1 78 1 0 -78 78 1 0 -1 79 1 0 -79 79 1 0 -1 80 1 0 -80 80 1 0 -1 81 1 0 -81 81 1 0 -1 82 1 0 -82 82 1 0 -1 83 1 0 -83 83 1 0 -1 84 1 0 -84 84 1 0 -1 85 1 0 -85 85 1 0 -1 86 1 0 -86 86 1 0 -1 87 1 0 -87 87 1 0 -1 88 1 0 -88 88 1 0 -1 89 1 0 -89 89 1 0 -1 90 1 0 -90 90 1 0 -1 91 1 0 -91 91 1 0 -1 92 1 0 -92 92 1 0 -1 93 1 0 -93 93 1 0 -1 94 1 0 -94 94 1 0 -1 95 1 0 -95 95 1 0 -1 96 1 0 -96 96 1 0 -1 97 1 0 -97 97 1 0 -1 98 1 0 -98 98 1 0 -1 99 1 0 -99 99 1 0 -1 100 1 0 -100 100 1 0 diff --git a/ThirdParty/SuiteSparse/KLU/Matrix/ctina.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/ctina.mtx deleted file mode 100644 index 3773ee1638..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Matrix/ctina.mtx +++ /dev/null @@ -1,39 +0,0 @@ -%%MatrixMarket matrix coordinate complex general -% complex matrix with same nonzero pattern as Pajek/Tina_AskCog -11 11 36 -3 1 0 1 -6 1 0 1 -10 1 0 1 -1 2 0 1 -3 2 0 1 -5 2 0 1 -6 2 0 1 -8 2 0 1 -9 2 0 1 -10 2 0 1 -1 3 0 1 -6 3 0 1 -10 3 0 1 -2 4 0 1 -6 4 0 1 -7 4 0 1 -8 4 0 1 -11 4 0 1 -6 5 0 1 -10 5 0 1 -5 6 0 1 -11 6 0 1 -4 7 0 1 -6 7 0 1 -9 7 0 1 -2 8 0 1 -4 8 0 1 -5 8 0 1 -6 8 0 1 -7 8 0 1 -9 8 0 1 -11 8 0 1 -7 9 0 1 -3 10 0 1 -5 10 0 1 -8 11 0 1 diff --git a/ThirdParty/SuiteSparse/KLU/Matrix/impcol_a.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/impcol_a.mtx deleted file mode 100644 index 49952a6631..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Matrix/impcol_a.mtx +++ /dev/null @@ -1,586 +0,0 @@ -%%MatrixMarket matrix coordinate real general -%------------------------------------------------------------------------------- -% UF Sparse Matrix Collection, Tim Davis -% http://www.cise.ufl.edu/research/sparse/matrices/HB/impcol_a -% name: HB/impcol_a -% [UNSYMMETRIC MATRIX - HEAT EXCHANGER NETWORK (CHEM ENG) ,1982] -% id: 171 -% date: 1982 -% author: D. Bogle -% ed: I. Duff, R. Grimes, J. Lewis -% fields: title A name id date author ed kind -% kind: chemical process simulation problem -%------------------------------------------------------------------------------- -207 207 572 -5 1 -1 -6 1 -1 -8 1 -1 -11 1 .0662129 -12 1 .1634 -1 2 1 -2 2 1 -11 2 -.579712 -12 2 -.422521 -3 3 1 -4 3 1 -10 3 -1 -11 3 17.8775 -12 3 44.1179 -5 4 -1 -65 4 1 -66 4 .5 -1 5 -1 -62 5 -1 -3 6 -1 -64 6 -1 -6 7 680 -7 8 1 -9 9 1 -8 10 1 -14 10 -1 -17 10 .00297937 -18 10 .0247819 -12 11 1 -17 11 -.220568 -18 11 -.808841 -10 12 1 -16 12 -1 -17 12 .804429 -18 12 6.69112 -11 13 .0708967 -12 13 -.0706236 -13 14 -1 -17 14 -.0323714 -18 14 -.00352409 -23 14 -1 -24 14 -1 -17 15 -.779432 -18 15 -.191159 -19 15 1 -20 15 1 -15 16 -1 -17 16 -7.57491 -18 16 -.824638 -21 16 1 -22 16 1 -13 17 1 -31 17 -1 -33 17 -150 -17 18 1 -33 18 -234 -15 19 1 -32 19 -1 -14 20 1 -34 20 -1 -36 20 -126.8 -16 21 1 -17 22 .104857 -18 22 -.0908757 -23 23 -1 -26 23 -1 -29 23 -.0311679 -30 23 -.103571 -19 24 -1 -29 24 -.757389 -30 24 -.625946 -21 25 -1 -28 25 -1 -29 25 -10.7841 -30 25 -35.8356 -24 26 580 -25 27 1 -27 28 1 -26 29 1 -31 29 -1 -33 29 -142.6 -28 30 1 -29 31 -.0979613 -30 31 .0483804 -31 32 1 -33 32 145.6 -33 33 580 -32 34 1 -34 35 -1 -36 35 -161 -38 35 1 -35 36 -1 -40 36 1 -34 37 -1 -36 37 -152.2 -203 37 1 -205 38 1 -34 39 -1 -36 39 -136.3 -197 39 1 -199 40 1 -34 41 -1 -36 41 -108.6 -98 41 1 -100 42 1 -34 43 -1 -36 43 -120.7 -67 43 1 -69 44 1 -34 45 1 -36 45 128 -95 45 1 -96 45 .2 -36 46 680 -92 46 -1 -35 47 1 -94 47 -1 -38 48 -1 -41 48 1.65272 -42 48 2.82163 -47 48 -1 -41 49 -.607865 -42 49 -.263986 -43 49 -1 -40 50 -1 -41 50 36.3599 -42 50 62.0759 -45 50 -1 -37 51 1 -39 52 1 -41 53 .559606 -42 53 -.677581 -47 54 1 -48 54 .7 -53 54 -1 -44 55 -1 -49 55 -1 -46 56 -1 -51 56 -1 -47 57 -1 -48 57 -1 -203 57 -1 -206 57 .478232 -207 57 1.21868 -43 58 1 -44 58 1 -206 58 -.330881 -207 58 -.280695 -45 59 1 -46 59 1 -205 59 -1 -206 59 21.9987 -207 59 56.0594 -48 60 68 -53 61 1 -54 61 .6 -59 61 -1 -50 62 -1 -55 62 -1 -52 63 -1 -57 63 -1 -53 64 -1 -54 64 -1 -197 64 -1 -200 64 .27161 -201 64 .629158 -49 65 1 -50 65 1 -200 65 -.561642 -201 65 -.382811 -51 66 1 -52 66 1 -199 66 -1 -200 66 24.7165 -201 66 57.2534 -54 67 159 -59 68 1 -60 68 .2 -65 68 -1 -56 69 -1 -61 69 -1 -58 70 -1 -63 70 -1 -59 71 -1 -60 71 -1 -98 71 -1 -101 71 .244371 -102 71 1.02444 -55 72 1 -56 72 1 -101 72 -.272351 -102 72 -.432602 -57 73 1 -58 73 1 -100 73 -1 -101 73 11.7298 -102 73 49.1733 -60 74 207 -65 75 -1 -66 75 -1 -67 75 -1 -71 75 .232813 -72 75 .061436 -61 76 1 -62 76 1 -71 76 -.573583 -72 76 -.869891 -63 77 1 -64 77 1 -69 77 -1 -71 77 47.4938 -72 77 12.5329 -66 78 411 -68 79 -1 -71 79 -.341668 -72 79 -.40286 -74 79 1 -70 80 -1 -71 80 -34.1668 -72 80 -40.286 -76 80 1 -68 81 1 -70 82 1 -71 83 -.0459958 -72 83 .0938315 -73 84 -1 -77 84 .179968 -78 84 .0328426 -83 84 -1 -84 84 -1 -77 85 -.53763 -78 85 -.943234 -79 85 1 -80 85 1 -75 86 -1 -77 86 36.7135 -78 86 6.69988 -81 86 1 -82 86 1 -74 87 -1 -77 87 -.311136 -78 87 -.186857 -164 87 1 -76 88 -1 -77 88 -31.1136 -78 88 -18.6857 -166 88 1 -73 89 1 -109 89 -1 -111 89 -201 -75 90 1 -77 91 -.012899 -78 91 .026314 -83 92 1 -84 92 .4 -89 92 -1 -80 93 -1 -85 93 -1 -82 94 -1 -87 94 -1 -83 95 -1 -131 95 -1 -134 95 .0222685 -135 95 .0916503 -79 96 -1 -134 96 -.852598 -135 96 -.686678 -81 97 -1 -133 97 -1 -134 97 6.30198 -135 97 25.937 -84 98 487 -89 99 1 -90 99 .1 -95 99 -1 -86 100 -1 -91 100 -1 -88 101 -1 -93 101 -1 -89 102 -1 -90 102 -1 -104 102 -1 -107 102 .306796 -108 102 1.72865 -85 103 1 -86 103 1 -107 103 -.953179 -108 103 -.478015 -87 104 1 -88 104 1 -106 104 -1 -107 104 14.7262 -108 104 82.9751 -90 105 535 -95 106 -1 -96 106 -1 -122 106 1 -123 106 .6 -91 107 1 -92 107 1 -119 107 -1 -93 108 1 -94 108 1 -121 108 -1 -96 109 680 -97 110 -1 -101 110 -.312836 -102 110 -.082762 -103 110 1 -99 111 -1 -101 111 -31.2836 -102 111 -8.2762 -105 111 1 -97 112 1 -99 113 1 -101 114 .409192 -102 114 -.852483 -104 115 1 -109 115 -1 -111 115 -273.9 -106 116 1 -107 117 .147934 -108 117 -.0810126 -109 118 -1 -111 118 -176.9 -131 118 1 -110 119 -1 -133 119 1 -109 120 -1 -111 120 -209.1 -125 120 1 -127 121 1 -109 122 -1 -111 122 -193 -113 122 1 -111 123 -54 -117 123 1 -115 124 1 -109 125 1 -111 125 197 -161 125 1 -162 125 .6 -111 126 680 -158 126 -1 -110 127 1 -160 127 -1 -113 128 -1 -116 128 .250032 -117 128 .597517 -122 128 -1 -116 129 -.585577 -117 129 -.406865 -118 129 -1 -115 130 -1 -116 130 13.5017 -117 130 32.2659 -120 130 -1 -112 131 1 -202 131 -1 -206 131 -.419796 -207 131 -.122705 -114 132 1 -204 132 -1 -206 132 -41.9796 -207 132 -12.2705 -116 133 .239041 -117 133 -.242126 -122 134 -1 -123 134 -1 -125 134 -1 -128 134 .158767 -129 134 .340658 -118 135 1 -119 135 1 -128 135 -.588216 -129 135 -.353609 -120 136 1 -121 136 1 -127 136 -1 -128 136 14.4478 -129 136 30.9999 -123 137 145 -124 138 -1 -128 138 -.307616 -129 138 -.130446 -190 138 1 -128 139 -.411784 -129 139 -.646391 -194 139 1 -126 140 -1 -128 140 -30.7616 -129 140 -13.0446 -192 140 1 -124 141 1 -196 141 -1 -200 141 -.562373 -201 141 -.225697 -126 142 1 -198 142 -1 -200 142 -56.2373 -201 142 -22.5697 -128 143 .10564 -129 143 -.116088 -130 144 -1 -134 144 -.276727 -135 144 -.171445 -140 144 -1 -141 144 -1 -134 145 -.147402 -135 145 -.313322 -136 145 1 -137 145 1 -132 146 -1 -134 146 -28.7796 -135 146 -17.8303 -138 146 1 -139 146 1 -130 147 1 -154 147 -1 -156 147 -193.6 -132 148 1 -155 148 -1 -134 149 .087773 -135 149 -.0322558 -140 150 -1 -143 150 -1 -146 150 -.0323781 -147 150 -.0683179 -136 151 -1 -146 151 -.60537 -147 151 -.349597 -138 152 -1 -145 152 -1 -146 152 -12.1741 -147 152 -25.6875 -141 153 480 -142 154 1 -144 155 1 -143 156 1 -149 156 -1 -152 156 -.00472003 -153 156 -.0317473 -147 157 1 -152 157 -.934841 -153 157 -.792495 -145 158 1 -151 158 -1 -152 158 -1.77473 -153 158 -11.937 -146 159 -.0203625 -147 159 .0218773 -148 160 1 -150 161 1 -149 162 1 -154 162 -1 -156 162 -198 -153 163 1 -156 163 -376 -151 164 1 -152 165 -.0366465 -153 165 .00813435 -154 166 1 -156 166 197.2 -155 167 1 -161 168 -1 -162 168 -1 -163 168 -1 -167 168 .0165562 -168 168 .00408216 -157 169 1 -158 169 1 -167 169 -.832633 -168 169 -.729721 -159 170 1 -160 170 1 -165 170 -1 -167 170 7.21849 -168 170 1.77982 -161 171 -1 -191 171 -1 -194 171 .00193333 -195 171 .0781847 -157 172 -1 -194 172 -.995803 -195 172 -.705952 -159 173 -1 -193 173 -1 -194 173 .471732 -195 173 19.0771 -162 174 680 -164 175 -1 -167 175 -.0379488 -168 175 -.16853 -170 175 1 -167 176 -.167367 -168 176 -.270279 -174 176 1 -166 177 -1 -167 177 -3.79488 -168 177 -16.853 -172 177 1 -163 178 1 -185 178 -1 -188 178 .0406846 -189 178 .100421 -165 179 1 -187 179 -1 -188 179 17.7385 -189 179 43.7834 -167 180 -.0235888 -168 180 .102847 -169 181 -1 -173 181 .123883 -174 181 .0243372 -191 181 1 -171 182 -1 -173 182 30.2273 -174 182 5.93828 -193 182 1 -170 183 -1 -173 183 -.242234 -174 183 -.211144 -176 183 1 -173 184 -.3775 -174 184 -.0788991 -180 184 1 -172 185 -1 -173 185 -24.2234 -174 185 -21.1144 -178 185 1 -169 186 1 -181 186 -1 -183 186 -281.7 -171 187 1 -182 187 -1 -173 188 -.0173768 -174 188 .0423995 -175 189 -1 -179 189 .0149554 -180 189 .00262203 -181 189 1 -183 189 291 -179 190 -.825997 -180 190 -.904947 -183 190 680 -177 191 -1 -179 191 10.1696 -180 191 1.78298 -182 191 1 -175 192 1 -177 193 1 -179 194 -.00696415 -180 194 .0362189 -181 195 -1 -183 195 -296 -185 195 1 -187 196 1 -184 197 1 -188 198 1 -186 199 1 -188 200 .0382256 -189 200 -.0306734 -194 201 .00264546 -195 201 -.000781169 -196 202 1 -198 203 1 -200 204 .229712 -201 204 -.25243 -202 205 1 -204 206 1 -206 207 .27097 -207 207 -.589066 diff --git a/ThirdParty/SuiteSparse/KLU/Matrix/one.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/one.mtx deleted file mode 100644 index ef09891751..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Matrix/one.mtx +++ /dev/null @@ -1,6 +0,0 @@ -%%MatrixMarket matrix coordinate real general -2 2 4 -1 1 0 -1 2 0 -2 1 0 -2 2 0 diff --git a/ThirdParty/SuiteSparse/KLU/Matrix/onec.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/onec.mtx deleted file mode 100644 index 59c8534cef..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Matrix/onec.mtx +++ /dev/null @@ -1,6 +0,0 @@ -%%MatrixMarket matrix coordinate complex general -2 2 4 -1 1 0 0 -1 2 0 0 -2 1 0 0 -2 2 0 0 diff --git a/ThirdParty/SuiteSparse/KLU/Matrix/two.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/two.mtx deleted file mode 100644 index 7457e818fb..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Matrix/two.mtx +++ /dev/null @@ -1,3 +0,0 @@ -%%MatrixMarket matrix coordinate real general -2 2 1 -1 1 3 diff --git a/ThirdParty/SuiteSparse/KLU/Matrix/w156.mtx b/ThirdParty/SuiteSparse/KLU/Matrix/w156.mtx deleted file mode 100644 index 658309ceea..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Matrix/w156.mtx +++ /dev/null @@ -1,365 +0,0 @@ -%%MatrixMarket matrix coordinate complex general -% complex matrix with the same real part, and same pattern, as HB/west0156 -156 156 362 -147 1 1 -89.00615831818635 -148 2 1 19.968263502718298 -149 2 -.1632648 -21.370801333956592 -59 3 -1.16206 -56.926762937042156 -134 3 -.8122999 -63.520075069490886 -149 3 1 -84.64919515773938 -52 4 1 -98.51526079522304 -53 5 1 57.75659925548426 -54 5 -.2166122 -96.44247397535688 -54 6 1 75.58829308886945 -59 6 -.1 -29.491646321365707 -118 7 1 44.42795357432983 -119 8 1 93.69016787815801 -120 8 -.2113848 -68.86640328523129 -59 9 1 -67.40889160696356 -105 9 .699017 -37.32052633277537 -120 9 1 -94.12369035075191 -150 10 1.009263 -28.474976610167545 -151 10 11.46533 -94.56192034360119 -150 11 .9908224 58.733403730195796 -152 11 -.5284282 99.84615089171123 -153 11 -.4980997 -77.95229509053108 -156 11 -.06675177 24.520231739121968 -152 12 1 -73.48563095366146 -153 13 1 -37.99404220990422 -155 13 -.8429148 -73.0424624342159 -154 14 1 -55.33473746935735 -156 14 -.0344062 -20.690642338915623 -155 15 1 -72.97130102560114 -156 15 -.00102006 -51.78826211728082 -134 16 5.047402 85.50322996314317 -156 16 1 -21.779825201968972 -138 17 -1.052632 2.25255469346175 -141 17 -.6666667 -81.42077676767339 -141 18 1 -95.66021714041189 -143 18 -.4480102 -68.09303466517918 -143 19 -2.988037 68.90318876644317 -143 20 1 75.83069648519695 -145 20 1 -62.60209482759951 -146 20 -1 98.26098380691137 -2 21 -.0535949 42.4059682333364 -144 21 2 74.27292331881648 -131 22 1 -4.0737630474247055 -133 22 -.9965392 -.7990146886149518 -132 23 1 -42.493627158378786 -133 23 -.003460798 -87.811709810653 -133 24 1 -47.506459158247225 -135 24 1 -62.747796590550934 -134 25 1 83.41795736466501 -135 25 1 -75.34426113632455 -137 26 .07513964 -97.31092337989851 -138 26 1 -26.06185629381749 -144 27 -5.47842 39.72822166458327 -145 27 -3.3405 77.86944264650091 -142 28 1 18.754103827151415 -146 28 -1 -68.66182065372685 -121 29 1.006185 -36.66211626227418 -122 29 10.73614 -53.320902834444595 -121 30 .9938532 -98.31558725078405 -123 30 -.5209677 -20.61924162618064 -124 30 -.4971525 29.973626118500405 -127 30 -.07339495 -82.99987875707477 -123 31 1 53.761900651751795 -124 32 1 93.94034099433995 -126 32 -.8391701 42.95944637524101 -125 33 1 56.39236839209942 -127 33 -.0258101 -52.4869835919564 -126 34 1 -60.85384724334488 -127 34 -.00199955 -47.357216964877104 -105 35 -5.396799 42.757012919227776 -127 35 1 95.51994788712943 -109 36 -.5263158 27.42438816918027 -112 36 -.3333333 9.184831019804385 -112 37 1 69.61144488338648 -114 37 -1.265049 60.41953169602192 -114 38 -1.778183 33.66128201334357 -114 39 1 34.19652679396956 -116 39 1 64.12873645714785 -117 39 -1 94.09447492182123 -2 40 -.0535949 -2.615000891619801 -115 40 2 63.49370710939066 -102 41 1 28.314233569200088 -104 41 -.9965392 -38.73012809722005 -103 42 1 32.186426447893 -104 42 -.003460798 -28.396577322438276 -104 43 1 87.63988602024271 -106 43 1 -2.4666050470267376 -105 44 1 -81.8019284512067 -106 44 1 34.7668233724147 -108 45 .1709599 2.976063797565698 -109 45 1 -55.68413072287828 -115 46 -5.47842 45.001874190444255 -116 46 -3.3405 -86.35067780598133 -113 47 1 92.82485367450755 -117 47 -1 -58.46868232626774 -55 48 -1 -67.77635488972467 -111 48 -1 27.644276518549617 -120 48 -1 -99.9543654216764 -118 49 -.5238095 -32.87341132956595 -120 49 -2.325233 -44.9800357067578 -55 50 -.2113848 -91.09449592159396 -56 50 1 -81.22070048053217 -101 50 -1 -18.000520045594502 -120 50 -.2113848 63.37846389879085 -4 51 -1 74.1034143618639 -17 51 -1 -95.48897590879422 -19 51 3.328735e-12 45.435396739586366 -20 51 1 69.60188961279125 -5 52 -1 45.72003820360473 -23 52 1 91.01972665502697 -24 52 1 31.27022211937156 -15 53 -1 48.46102670181145 -17 53 -.2113848 -31.006797219415848 -18 53 1 76.80438993503029 -61 54 -1 -30.551182700157376 -102 54 1 -88.10466389149548 -103 54 1 43.682918215884015 -110 54 -1 91.64285858148136 -117 54 1 -68.63302698512894 -63 55 -1 -16.72937877072226 -107 55 -1 -81.19302620544275 -66 56 -1 -10.010709210238765 -99 56 -1 73.83048511517521 -102 56 1.009514 -21.676555467798853 -113 56 -1.008042 -49.443269787795316 -67 57 -1 -29.123614686250242 -100 57 -1 48.59559363996606 -103 57 106.1112 30.166404491500764 -113 57 -.1547227 87.9586081050228 -60 58 1 66.5598249196907 -76 58 -1 -6.004426629012382 -139 58 1 25.973121452632107 -62 59 1 -88.36243043738105 -136 59 1 8.437479459481146 -64 60 1 -8.854807545659217 -76 60 -.9795877 72.61737844345258 -128 60 1 71.03939394472891 -65 61 1 -5.548863487187949 -76 61 -3.145565 57.38487793395959 -129 61 1 31.19642765119832 -34 62 -.008064516 -99.99202208021522 -36 63 1.974212 -73.75256764965177 -37 63 -.8416949 -1.0250487994832636 -37 64 1 -92.33336856681214 -38 64 -.008525207 -54.512838099295834 -38 65 1 -34.42340854356044 -39 65 -1 79.89375753843836 -47 65 -1 -37.25390248725466 -39 66 1 -49.66479762290302 -40 66 -1 -13.402173664778449 -40 67 1.895931 68.47644730738057 -41 67 -.9987282 -63.10220167747585 -41 68 1 1.6358424738914135 -42 68 2.087875 -9.552066657022863 -42 69 -1 -34.88311211669629 -46 69 -1 -23.984738606508827 -43 70 5.616771 77.29599272885395 -44 70 7.392325 52.252152063678636 -44 71 1 76.75326698731126 -45 71 7.20301 -8.51874880007002 -45 72 -1 59.84045826963149 -46 72 -.3258084 -73.18457603806863 -2 73 -2.146936 -86.93726233197341 -46 73 1 -24.971068398888395 -1 74 -6.821893 -25.29540601492628 -47 74 1 -3.1955205789929164 -91 75 2.431413 93.89184641063227 -93 75 -1 -31.58778114773145 -91 76 -2.431413 -49.4621487710556 -92 76 1 16.977383351584187 -93 77 1 4.740718882261197 -94 77 -1.26 -67.31619071487106 -2 78 -.8858734 -2.7203702821855025 -94 78 2 -.7878501044749853 -95 79 1 68.63881664718761 -96 79 -1 61.23964308235974 -1 80 -.02308312 71.5571192607996 -96 80 1 21.950827565571494 -82 81 1 13.146073550568627 -84 81 .9638 22.379704330589135 -97 81 1 -79.40469554532865 -84 82 .9905759 -68.33681654633787 -98 82 1 -17.27002806448744 -5 83 1.068219 12.082089707594035 -16 83 -1 -46.26454171200754 -6 84 9.305934e-22 56.85083285313337 -7 84 -.19106 -22.425843053832928 -8 84 -.3460553 -93.8032758232799 -7 85 1 17.10036588328181 -9 85 -.2113848 11.711705644935023 -9 86 1 -59.860885505008746 -10 86 -1 -82.51562297274859 -14 86 -1 86.64597186070104 -10 87 1 -48.124005287383966 -11 87 -1 -59.165721082767206 -12 88 1 -90.15831162239165 -13 88 -5.165179 21.23218795450579 -11 89 2.109794 9.269748032162251 -12 89 -.4423309 -80.83251277071686 -2 90 -1.200652 27.39912937614759 -13 90 1 -11.410334391483856 -1 91 -2.151087 -86.72360822705714 -14 91 1 -25.141483188003487 -7 92 -3.221332 -50.17945514204103 -8 92 -.08256881 84.9750583295307 -16 92 1.030078 25.899858515648553 -68 93 .00729927 75.66175530017894 -69 94 .009933775 28.334886205187427 -70 95 2.109489 59.67812719925334 -71 96 1.923841 -12.994792290221335 -72 97 1 96.2280502631985 -76 97 -.9703559 -80.80844033399066 -73 98 1 5.496479792736464 -76 98 -.02964405 9.129164943297008 -74 99 1 -43.131448638051594 -77 99 -.9703559 -25.83946813902346 -75 100 1 -87.06147957359738 -77 100 -.02964405 8.961812886476107 -76 101 1 67.27512065071366 -77 101 1 -70.93560166316104 -79 101 1 -65.69594863822117 -78 102 .009933775 -86.39056354840274 -79 102 -.3 64.80230680396102 -79 103 -3.333333 -73.2058484284056 -81 103 1 76.95725769618616 -2 104 -.3581659 2.947479893374072 -80 104 .9144476 92.7271192399364 -80 105 -2.355064 -75.90106649225966 -81 105 -2.599699 -90.342023563869 -1 106 1 -23.969599224575187 -3 106 -.5 -17.441756388313255 -2 107 1 -19.721740669438702 -3 107 -.5 -15.800573906372883 -3 108 1 -24.609261720375176 -110 109 1 81.46730529244041 -131 109 -.9431611 34.03242893843479 -132 109 -.5 92.36770491956567 -139 109 -1 -67.40413278123356 -146 109 1 49.72988179123301 -107 110 1 -25.186855192188627 -136 110 -1 -9.152697748159888 -99 111 1 -92.28786082587108 -128 111 -1 12.486401290146553 -131 111 -.9521341 -25.537570672597443 -142 111 -1.008042 58.55674146933576 -100 112 1 59.046194569800136 -129 112 -1 -23.417105544732607 -132 112 -53.05558 -49.44203913337082 -142 112 -.1547227 -31.414428806369965 -4 113 1 93.56089866913022 -9 113 -1.098983 -4.038321887840279 -111 113 1 -26.334487417080844 -127 113 -1.006101 52.91343104779358 -15 114 1 -24.570205949318236 -101 114 1 80.06124313084004 -127 114 -.2126745 -63.313589410507554 -17 115 3.875969e-8 -26.336536744115246 -19 115 -1 83.49140785169018 -21 116 -.9939418 3.183211228849636 -23 117 -1 -81.93854756530253 -17 118 2.727302e-20 47.06229753702564 -18 118 -1 -99.05756753456353 -17 119 1 20.62462338921529 -20 119 -1 91.37333280835817 -25 119 -1 -20.513614148643057 -27 119 .9972523 46.310157066657176 -28 119 1.02473 36.92776530123669 -22 120 -.9939418 95.70060448966404 -29 120 1 -59.24296668628066 -30 120 1 18.66056780239591 -24 121 -1 90.31250335814364 -31 121 1 -47.94551850968427 -32 121 1 2.9355241818408873 -17 122 .2113848 27.26637973052666 -25 122 -.2113848 -19.808178764946284 -26 122 1 -2.677737852379014 -19 123 5453728 50.091622636210076 -20 123 -.2113848 -74.7606532733799 -25 124 .9 -91.38750367809608 -27 124 -1 -25.812131278013382 -140 124 -1 38.66042415449142 -156 124 -1.009619 87.16498856941061 -29 125 -1 -4.484878166369444 -153 125 -.5019003 -74.17998047268341 -156 125 -.2294135 -3.2337575851525746 -31 126 -1 89.11943234297857 -137 126 -1 -26.45117330526361 -151 126 1 -34.30288621503337 -25 127 .1897236 54.575096067325134 -26 127 -1 -40.54519558973049 -130 127 -1 -64.42912801819011 -156 127 -.2128317 38.15983229583313 -25 128 .1 -47.211028939720535 -28 128 -1 -8.452188579330155 -33 128 1 68.73848491242163 -38 128 -1.007626 76.29973210306002 -30 129 -1 40.00399128013372 -36 129 -1 51.13819898638041 -38 129 -.2680827 94.90296027698403 -32 130 -1 -19.569463307138236 -34 130 1 -73.74427235921586 -25 131 .02166122 44.94677740033393 -35 131 1 79.903641471542 -38 131 -.2182642 -65.85973708326853 -27 132 .234872 -91.3942617588595 -28 132 -2.113848 -4.168155014702535 -55 133 .9 -81.21274304896602 -140 133 1 30.009966330192217 -149 133 -.7744864 90.45550778420308 -57 134 1.052135 -8.457460121512772 -137 134 .9248604 7.376129401205689 -55 135 .1897236 -86.70257083968079 -130 135 1 -1.2259832834904283 -149 135 -.1632648 -16.491805524055003 -33 136 -1 -41.548589946331724 -48 136 1 -42.06721249302474 -35 137 -1 50.769199337537785 -51 137 1 -80.6408576103972 -48 138 -1 -84.6165978311754 -54 138 -1 44.18300600646185 -55 138 .1 52.982301945926324 -49 139 -1 31.588984823676935 -52 139 -.5238095 62.08170441145384 -54 139 -2.382735 -25.151381648928016 -50 140 -.991453 -38.7537048036034 -58 140 1.06422 -25.86008018285866 -51 141 -1 41.34942373575503 -54 141 -.2166122 -66.32674228356838 -55 141 .02166122 62.744201350248474 -50 142 -.06837607 -6.7543369226229055 -60 143 -1 44.45713521489259 -85 143 175966.4 98.97378279407572 -86 143 -1 -27.499396494334206 -91 143 -2.431413 46.16562887690614 -95 143 -1 29.933482992494255 -69 144 .9900662 36.26781509331472 -70 144 -1.091241 -98.47761599001427 -76 144 -13 30.829860743864714 -78 144 .9900662 89.04702870503172 -87 144 1 22.65420709853554 -88 144 1 56.585595081575036 -62 145 -1 -99.36930257401184 -89 145 1 59.39156971639217 -90 145 -1 28.363331197466945 -64 146 -1 -64.30427579759511 -82 146 -1 5.880145934392633 -84 146 -.9638 -56.25129719765649 -95 146 -1.009514 9.61048763756911 -97 146 -1 -88.35252745679256 -65 147 -1 17.51741912019611 -85 147 1.8672e7 -16.77928832091964 -92 147 -106.1112 -62.7109528243285 -86 148 .7396663 -87.21785589638561 -87 149 -1 -85.04344448822249 -89 150 -.6169444 -37.992508436142 -82 151 .9905759 88.81698357390519 -83 152 1 96.14532626091892 -85 153 -175966.4 11.023098151583245 -86 153 .2603337 97.70512729352296 -88 154 -1 38.311980523494384 -90 155 1 -51.66782743196781 -84 156 .9905759 61.96273642788614 diff --git a/ThirdParty/SuiteSparse/KLU/README.txt b/ThirdParty/SuiteSparse/KLU/README.txt index 708d1bab4f..7030de97a9 100644 --- a/ThirdParty/SuiteSparse/KLU/README.txt +++ b/ThirdParty/SuiteSparse/KLU/README.txt @@ -1,11 +1,12 @@ -KLU, Copyright (C) 2004-2013, University of Florida -by Timothy A. Davis and Ekanathan Palamadai. +KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +Authors: Timothy A. Davis and Ekanathan Palamadai. +SPDX-License-Identifier: LGPL-2.1+ + KLU is also available under other licenses; contact authors for details. http://www.suitesparse.com Requires the AMD, COLAMD, and BTF libraries, in ../AMD, ../COLAMD, and ../BTF, -respectively. Requires the ../SuiteSparse_config/SuiteSparse_config.mk -configuration file. Optionally uses CHOLMOD (KLU/User example ordering). The +respectively. Optionally uses CHOLMOD (KLU/User example ordering). The Tcov tests and the one of the programs in the Demo require CHOLMOD. To compile the libklu.a library, type "make". The compiled library is located @@ -27,7 +28,6 @@ Files in this distribution: Demo example programs that use KLU (requires CHOLMOD) Doc documentation Include include files - Lib compiled library Makefile top-level Makefile MATLAB MATLAB interface Matrix test matrices @@ -35,6 +35,8 @@ Files in this distribution: Source source code Tcov exhaustive test of KLU and BTF User example user ordering function (interface to CHOLMOD) + build where the compiled libraries and demos are placed + Config source file to construct klu.h ./Demo: klu_simple.c a simple demo (does not require CHOLMOD) @@ -42,7 +44,7 @@ Files in this distribution: klu_simple.out output of klu_simple kludemo.c KLU demo (int version) kludemo.out output of "make" in this directory - kluldemo.c KLU demo (SuiteSparse_long version) + kluldemo.c KLU demo (int64_t version) Makefile Makefile for compiling the demo ./Doc: @@ -59,10 +61,6 @@ Files in this distribution: klu_internal.h internal include file, not needed by the user klu_version.h internal include file, not needed by the user -./Lib: - Makefile Makefile for compiling the KLU C-callable library - (with or without CHOLMOD) - ./MATLAB: Contents.m list of MATLAB functions in KLU klu_demo.m MATLAB demo @@ -75,7 +73,7 @@ Files in this distribution: Makefile_no_CHOLMOD Makefile for KLU mexFunction, without CHOLMOD Test MATLAB tests -./MATLAB/Test: KLU tests, requires UFget +./MATLAB/Test: KLU tests, requires ssget test1.m test2.m test3.m @@ -115,17 +113,17 @@ Files in this distribution: ./Tcov: exhaustive test suite; requires Linux/Unix coverage determine statement coverage - klultests KLU SuiteSparse_long tests + klultests KLU int64_t tests klutest.c KLU test program klutests KLU int tests Makefile Makefile for compiling and running the tests README.txt README file for Tcov vklutests KLU int tests, using valgrind - vklultests KLU SuiteSparse_long tests, using valgrind + vklultests KLU int64_t tests, using valgrind ./User: klu_cholmod.c sample KLU user ordering function (int version) klu_cholmod.h include file for klu_cholmod and klu_l_cholmod - klu_l_cholmod.c sample KLU user ordering function (SuiteSparse_long) + klu_l_cholmod.c sample KLU user ordering function (int64_t) Makefile Makefile for compiling the user ordering functions README.txt README for User directory diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu.c b/ThirdParty/SuiteSparse/KLU/Source/klu.c index 6042fcdfc1..7791bf7f0b 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === klu ================================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu: primary factorization and forward/backsolve kernels for KLU +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* KLU: factorizes P*A into L*U, using the Gilbert-Peierls algorithm [1], with * optional symmetric pruning by Eisenstat and Liu [2]. The code is by Tim @@ -33,12 +39,6 @@ * Ai [Ap [j] ... Ap [j+1]-1] and the same range of indices in Ax holds the * numerical values. No duplicate entries are allowed. * - * Copyright 2004-2009, Tim Davis. All rights reserved. See the README - * file for details on permitted use. Note that no code from The MathWorks, - * Inc, or from SuperLU, or from any other source appears here. The code is - * written from scratch, from the algorithmic description in Gilbert & Peierls' - * and Eisenstat & Liu's journal papers [1,2]. - * * If an input permutation Q is provided, the factorization L*U = A (P,Q) * is computed, where P is determined by partial pivoting, and Q is the input * ordering. If the pivot tolerance is less than 1, the "diagonal" entry that diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_analyze.c b/ThirdParty/SuiteSparse/KLU/Source/klu_analyze.c index 2fe81c19ca..bf9a08ddb4 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_analyze.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_analyze.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === klu_analyze ========================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_analyze: symbolic analysis +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Order the matrix using BTF (or not), and then AMD, COLAMD, the natural * ordering, or the user-provided-function on the blocks. Does not support diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_analyze_given.c b/ThirdParty/SuiteSparse/KLU/Source/klu_analyze_given.c index 348c011b3b..a0c2b46c7d 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_analyze_given.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_analyze_given.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === klu_analyze_given ==================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_analyze_given: symbolic analysis with given permutation +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Given an input permutation P and Q, create the Symbolic object. BTF can * be done to modify the user's P and Q (does not perform the max transversal; diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_defaults.c b/ThirdParty/SuiteSparse/KLU/Source/klu_defaults.c index ba2b77ee14..52225655f3 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_defaults.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_defaults.c @@ -1,12 +1,18 @@ -/* ========================================================================== */ -/* === KLU_defaults ========================================================= */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_defaults: default parameters for KLU +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Sets default parameters for KLU */ #include "klu_internal.h" -Int KLU_defaults +int KLU_defaults ( KLU_common *Common ) diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_diagnostics.c b/ThirdParty/SuiteSparse/KLU/Source/klu_diagnostics.c index dc9d288ecc..c8b599fa6f 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_diagnostics.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_diagnostics.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU_diagnostics ====================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_diagnostics: linear algebraic diagnostics +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Linear algebraic diagnostics: * KLU_rgrowth: reciprocal pivot growth, takes O(|A|+|U|) time @@ -22,7 +28,7 @@ * rgrowth = min (max (abs ((R \ A (p,q)) - F))) ./ max (abs (U))) */ -Int KLU_rgrowth /* return TRUE if successful, FALSE otherwise */ +int KLU_rgrowth /* return TRUE if successful, FALSE otherwise */ ( Int *Ap, Int *Ai, @@ -169,7 +175,7 @@ Int KLU_rgrowth /* return TRUE if successful, FALSE otherwise */ * 1-norm pseudospectra, SIAM J. Matrix Anal. Appl., 21(4):1185-1201, 2000. */ -Int KLU_condest /* return TRUE if successful, FALSE otherwise */ +int KLU_condest /* return TRUE if successful, FALSE otherwise */ ( Int Ap [ ], double Ax [ ], @@ -410,7 +416,7 @@ Int KLU_condest /* return TRUE if successful, FALSE otherwise */ /* Compute the flop count for the LU factorization (in Common->flops) */ -Int KLU_flops /* return TRUE if successful, FALSE otherwise */ +int KLU_flops /* return TRUE if successful, FALSE otherwise */ ( KLU_symbolic *Symbolic, KLU_numeric *Numeric, @@ -494,7 +500,7 @@ Int KLU_flops /* return TRUE if successful, FALSE otherwise */ * pivot, or a NaN pivot, rcond will be zero. Takes O(n) time. */ -Int KLU_rcond /* return TRUE if successful, FALSE otherwise */ +int KLU_rcond /* return TRUE if successful, FALSE otherwise */ ( KLU_symbolic *Symbolic, /* input, not modified */ KLU_numeric *Numeric, /* input, not modified */ diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_dump.c b/ThirdParty/SuiteSparse/KLU/Source/klu_dump.c index 8f5590053e..8ce973e8dd 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_dump.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_dump.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU_dump ============================================================= */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_dump: debug routines for KLU +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Debug routines for klu. Only used when NDEBUG is not defined at * compile-time. diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_extract.c b/ThirdParty/SuiteSparse/KLU/Source/klu_extract.c index b009828a7b..d393f18cdb 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_extract.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_extract.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU_extract ========================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_extract: extract the KLU factorization +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Extract KLU factorization into conventional compressed-column matrices. * If any output array is NULL, that part of the LU factorization is not @@ -11,7 +17,7 @@ #include "klu_internal.h" -Int KLU_extract /* returns TRUE if successful, FALSE otherwise */ +int KLU_extract /* returns TRUE if successful, FALSE otherwise */ ( /* inputs: */ KLU_numeric *Numeric, diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_factor.c b/ThirdParty/SuiteSparse/KLU/Source/klu_factor.c index d651f49e13..171b114f49 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_factor.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_factor.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU_factor =========================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_factor: sparse LU factorization +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Factor the matrix, after ordering and analyzing it with KLU_analyze * or KLU_analyze_given. @@ -341,14 +347,14 @@ static void factor2 #ifndef NDEBUG { - PRINTF (("\n ############# KLU_BTF_FACTOR done, nblocks %d\n",nblocks)); + PRINTF (("\n ------------ KLU_BTF_FACTOR done, nblocks %d\n",nblocks)); Entry ss, *Udiag = Numeric->Udiag ; for (block = 0 ; block < nblocks && Common->status == KLU_OK ; block++) { k1 = R [block] ; k2 = R [block+1] ; nk = k2 - k1 ; - PRINTF (("\n======================KLU_factor output: k1 %d k2 %d nk %d\n",k1,k2,nk)) ; + PRINTF (("\n== KLU_factor output: k1 %d k2 %d nk %d\n",k1,k2,nk)) ; if (nk == 1) { PRINTF (("singleton ")) ; diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_free_numeric.c b/ThirdParty/SuiteSparse/KLU/Source/klu_free_numeric.c index cd4f3bdcd9..359219fdd5 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_free_numeric.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_free_numeric.c @@ -1,12 +1,18 @@ -/* ========================================================================== */ -/* === KLU_free_numeric ===================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_free_numeric: free the KLU numeric factorization +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Free the KLU Numeric object. */ #include "klu_internal.h" -Int KLU_free_numeric +int KLU_free_numeric ( KLU_numeric **NumericHandle, KLU_common *Common diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_free_symbolic.c b/ThirdParty/SuiteSparse/KLU/Source/klu_free_symbolic.c index 20b4000e62..3cf8595152 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_free_symbolic.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_free_symbolic.c @@ -1,12 +1,18 @@ -/* ========================================================================== */ -/* === KLU_free_symbolic ==================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_free_symbolic: free the KLU symbolic analysis +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Free the KLU Symbolic object. */ #include "klu_internal.h" -Int KLU_free_symbolic +int KLU_free_symbolic ( KLU_symbolic **SymbolicHandle, KLU_common *Common diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_kernel.c b/ThirdParty/SuiteSparse/KLU/Source/klu_kernel.c index c3a78b40d5..0a425088db 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_kernel.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_kernel.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU_kernel =========================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_kernel: primary sparse LU factorization kernel +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Sparse left-looking LU factorization, with partial pivoting. Based on * Gilbert & Peierl's method, with a non-recursive DFS and with Eisenstat & diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l.c new file mode 100644 index 0000000000..d7d556524d --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l.c: int64_t version of klu +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_analyze.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_analyze.c new file mode 100644 index 0000000000..02eeccf91f --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_analyze.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_analyze.c: int64_t version of klu_analyze +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_analyze.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_analyze_given.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_analyze_given.c new file mode 100644 index 0000000000..77c757b168 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_analyze_given.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_analyze_given.c: int64_t version of klu_analyze_given +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_analyze_given.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_defaults.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_defaults.c new file mode 100644 index 0000000000..c039025438 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_defaults.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_defaults.c: int64_t version of klu_defaults +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_defaults.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_diagnostics.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_diagnostics.c new file mode 100644 index 0000000000..d417da1ee8 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_diagnostics.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_diagnostics.c: int64_t version of klu_diagnostics +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_diagnostics.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_dump.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_dump.c new file mode 100644 index 0000000000..e9a9e56aec --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_dump.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_dump.c: int64_t version of klu_dump +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_dump.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_extract.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_extract.c new file mode 100644 index 0000000000..dee0639c8f --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_extract.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_extract.c: int64_t version of klu_extract +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_extract.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_factor.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_factor.c new file mode 100644 index 0000000000..1ea0818df2 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_factor.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_factor.c: int64_t version of klu_factor +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_factor.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_free_numeric.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_free_numeric.c new file mode 100644 index 0000000000..401a7557c9 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_free_numeric.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_free_numeric.c: int64_t version of klu_free_numeric +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_free_numeric.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_free_symbolic.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_free_symbolic.c new file mode 100644 index 0000000000..10c949c18a --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_free_symbolic.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_free_symbolic.c: int64_t version of klu_free_symbolic +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_free_symbolic.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_kernel.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_kernel.c new file mode 100644 index 0000000000..20497c4d31 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_kernel.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_kernel.c: int64_t version of klu_kernel +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_kernel.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_memory.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_memory.c new file mode 100644 index 0000000000..12a7367a6b --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_memory.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_memory.c: int64_t version of klu_memory +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_memory.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_refactor.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_refactor.c new file mode 100644 index 0000000000..cd49e9e6f3 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_refactor.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_refactor.c: int64_t version of klu_refactor +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_refactor.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_scale.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_scale.c new file mode 100644 index 0000000000..9b5b7793e2 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_scale.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_scale.c: int64_t version of klu_scale +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_scale.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_solve.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_solve.c new file mode 100644 index 0000000000..9811ea944e --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_solve.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_solve.c: int64_t version of klu_solve +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_solve.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_sort.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_sort.c new file mode 100644 index 0000000000..b5eb86d404 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_sort.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_sort.c: int64_t version of klu_sort +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_sort.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_l_tsolve.c b/ThirdParty/SuiteSparse/KLU/Source/klu_l_tsolve.c new file mode 100644 index 0000000000..9b21998e22 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_l_tsolve.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_l_tsolve.c: int64_t version of klu_tsolve +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define DLONG +#include "klu_tsolve.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_memory.c b/ThirdParty/SuiteSparse/KLU/Source/klu_memory.c index d391a0836d..64fac3c4b5 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_memory.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_memory.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU_memory =========================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_memory: memory management for KLU +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* KLU memory management routines: * @@ -78,7 +84,7 @@ void *KLU_malloc /* returns pointer to the newly malloc'd block */ Common->status = KLU_INVALID ; p = NULL ; } - else if (n >= Int_MAX) + else if (sizeof (size_t) > sizeof (Int) && n >= Int_MAX) { /* object is too big to allocate; p[i] where i is an Int will not * be enough. */ @@ -189,7 +195,7 @@ void *KLU_realloc /* returns pointer to reallocated block */ /* A fresh object is being allocated. */ p = KLU_malloc (nnew, size, Common) ; } - else if (nnew >= Int_MAX) + else if (sizeof (size_t) > sizeof (Int) && nnew >= Int_MAX) { /* failure: nnew is too big. Do not change p */ Common->status = KLU_TOO_LARGE ; diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_refactor.c b/ThirdParty/SuiteSparse/KLU/Source/klu_refactor.c index 02539bebd1..b288635719 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_refactor.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_refactor.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU_refactor ========================================================= */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_refactor: factor another matrix (no pivoting) +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Factor the matrix, after ordering and analyzing it with KLU_analyze, and * factoring it once with KLU_factor. This routine cannot do any numerical @@ -15,7 +21,7 @@ /* === KLU_refactor ========================================================= */ /* ========================================================================== */ -Int KLU_refactor /* returns TRUE if successful, FALSE otherwise */ +int KLU_refactor /* returns TRUE if successful, FALSE otherwise */ ( /* inputs, not modified */ Int Ap [ ], /* size n+1, column pointers */ @@ -440,14 +446,14 @@ Int KLU_refactor /* returns TRUE if successful, FALSE otherwise */ ASSERT (KLU_valid (n, Numeric->Offp, Numeric->Offi, Offx)) ; if (Common->status == KLU_OK) { - PRINTF (("\n ########### KLU_BTF_REFACTOR done, nblocks %d\n",nblocks)); + PRINTF (("\n ----------- KLU_BTF_REFACTOR done, nblocks %d\n",nblocks)); for (block = 0 ; block < nblocks ; block++) { k1 = R [block] ; k2 = R [block+1] ; nk = k2 - k1 ; PRINTF (( - "\n================KLU_refactor output: k1 %d k2 %d nk %d\n", + "\n--------------- KLU_refactor output: k1 %d k2 %d nk %d\n", k1, k2, nk)) ; if (nk == 1) { diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_scale.c b/ThirdParty/SuiteSparse/KLU/Source/klu_scale.c index 4796120068..6a61c3a1f9 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_scale.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_scale.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU_scale ============================================================ */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_scale: scale a sparse matrix +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Scale a matrix and check to see if it is valid. Can be called by the user. * This is called by KLU_factor and KLU_refactor. Returns TRUE if the input @@ -16,10 +22,10 @@ #include "klu_internal.h" -Int KLU_scale /* return TRUE if successful, FALSE otherwise */ +int KLU_scale /* return TRUE if successful, FALSE otherwise */ ( /* inputs, not modified */ - Int scale, /* 0: none, 1: sum, 2: max */ + int scale, /* 0: none, 1: sum, 2: max */ Int n, Int Ap [ ], /* size n+1, column pointers */ Int Ai [ ], /* size nz, row indices */ diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_solve.c b/ThirdParty/SuiteSparse/KLU/Source/klu_solve.c index d23a140956..d0904027d8 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_solve.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_solve.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU_solve ============================================================ */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_solve: solve x=A\b using the KLU factorization +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Solve Ax=b using the symbolic and numeric objects from KLU_analyze * (or KLU_analyze_given) and KLU_factor. Note that no iterative refinement is @@ -11,7 +17,7 @@ #include "klu_internal.h" -Int KLU_solve +int KLU_solve ( /* inputs, not modified */ KLU_symbolic *Symbolic, diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_sort.c b/ThirdParty/SuiteSparse/KLU/Source/klu_sort.c index a3ce98f467..3c67c13c62 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_sort.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_sort.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU_sort ============================================================= */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_sort: sorts the L and U factors of KLU +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* sorts the columns of L and U so that the row indices appear in strictly * increasing order. @@ -88,7 +94,7 @@ static void sort (Int n, Int *Xip, Int *Xlen, Unit *LU, Int *Tp, Int *Tj, /* === KLU_sort ============================================================= */ /* ========================================================================== */ -Int KLU_sort +int KLU_sort ( KLU_symbolic *Symbolic, KLU_numeric *Numeric, diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_tsolve.c b/ThirdParty/SuiteSparse/KLU/Source/klu_tsolve.c index c1f10f7083..7aefeffa61 100644 --- a/ThirdParty/SuiteSparse/KLU/Source/klu_tsolve.c +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_tsolve.c @@ -1,6 +1,12 @@ -/* ========================================================================== */ -/* === KLU_tsolve =========================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// KLU/Source/klu_tsolve: solve x=A'\b using the KLU factorization +//------------------------------------------------------------------------------ + +// KLU, Copyright (c) 2004-2022, University of Florida. All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +//------------------------------------------------------------------------------ /* Solve A'x=b using the symbolic and numeric objects from KLU_analyze * (or KLU_analyze_given) and KLU_factor. Note that no iterative refinement is @@ -11,7 +17,7 @@ #include "klu_internal.h" -Int KLU_tsolve +int KLU_tsolve ( /* inputs, not modified */ KLU_symbolic *Symbolic, @@ -23,7 +29,7 @@ Int KLU_tsolve double B [ ], /* size n*nrhs, in column-oriented form, with * leading dimension d. */ #ifdef COMPLEX - Int conj_solve, /* TRUE for conjugate transpose solve, FALSE for + int conj_solve, /* TRUE for conjugate transpose solve, FALSE for * array transpose solve. Used for the complex * case only. */ #endif diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z.c new file mode 100644 index 0000000000..3be6ba6529 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z.c: complex int32_t version of klu +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z_diagnostics.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z_diagnostics.c new file mode 100644 index 0000000000..2204f05977 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z_diagnostics.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z_diagnostics.c: complex int32_t version of klu_diagnostics +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu_diagnostics.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z_dump.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z_dump.c new file mode 100644 index 0000000000..6579b965a3 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z_dump.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z_dump.c: complex int32_t version of klu_dump +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu_dump.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z_extract.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z_extract.c new file mode 100644 index 0000000000..5cf68c1b0a --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z_extract.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z_extract.c: complex int32_t version of klu_extract +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu_extract.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z_factor.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z_factor.c new file mode 100644 index 0000000000..d5f345aa40 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z_factor.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z_factor.c: complex int32_t version of klu_factor +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu_factor.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z_free_numeric.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z_free_numeric.c new file mode 100644 index 0000000000..e6ac863f1a --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z_free_numeric.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z_free_numeric.c: complex int32_t version of klu_free_numeric +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu_free_numeric.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z_kernel.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z_kernel.c new file mode 100644 index 0000000000..4b52d87649 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z_kernel.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z_kernel.c: complex int32_t version of klu_kernel +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu_kernel.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z_refactor.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z_refactor.c new file mode 100644 index 0000000000..0dff84e37e --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z_refactor.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z_refactor.c: complex int32_t version of klu_refactor +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu_refactor.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z_scale.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z_scale.c new file mode 100644 index 0000000000..47ee996790 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z_scale.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z_scale.c: complex int32_t version of klu_scale +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu_scale.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z_solve.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z_solve.c new file mode 100644 index 0000000000..362a77ecb1 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z_solve.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z_solve.c: complex int32_t version of klu_solve +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu_solve.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z_sort.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z_sort.c new file mode 100644 index 0000000000..3f0ea62a32 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z_sort.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z_sort.c: complex int32_t version of klu_sort +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu_sort.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_z_tsolve.c b/ThirdParty/SuiteSparse/KLU/Source/klu_z_tsolve.c new file mode 100644 index 0000000000..d82a1038f1 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_z_tsolve.c @@ -0,0 +1,11 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_z_tsolve.c: complex int32_t version of klu_tsolve +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#include "klu_tsolve.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl.c new file mode 100644 index 0000000000..23dbf2e9b9 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl.c: complex int64_t version of klu +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl_diagnostics.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_diagnostics.c new file mode 100644 index 0000000000..28e8979b1e --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_diagnostics.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl_diagnostics.c: complex int64_t version of klu_diagnostics +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu_diagnostics.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl_dump.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_dump.c new file mode 100644 index 0000000000..4349cd1ebc --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_dump.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl_dump.c: complex int64_t version of klu_dump +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu_dump.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl_extract.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_extract.c new file mode 100644 index 0000000000..9d2725d70f --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_extract.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl_extract.c: complex int64_t version of klu_extract +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu_extract.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl_factor.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_factor.c new file mode 100644 index 0000000000..b259e62ea9 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_factor.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl_factor.c: complex int64_t version of klu_factor +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu_factor.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl_free_numeric.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_free_numeric.c new file mode 100644 index 0000000000..5ab980b57e --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_free_numeric.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl_free_numeric.c: complex int64_t version of klu_free_numeric +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu_free_numeric.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl_kernel.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_kernel.c new file mode 100644 index 0000000000..5ab9c5af1e --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_kernel.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl_kernel.c: complex int64_t version of klu_kernel +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu_kernel.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl_refactor.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_refactor.c new file mode 100644 index 0000000000..d6216515ba --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_refactor.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl_refactor.c: complex int64_t version of klu_refactor +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu_refactor.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl_scale.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_scale.c new file mode 100644 index 0000000000..9a2c697696 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_scale.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl_scale.c: complex int64_t version of klu_scale +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu_scale.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl_solve.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_solve.c new file mode 100644 index 0000000000..20396f6197 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_solve.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl_solve.c: complex int64_t version of klu_solve +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu_solve.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl_sort.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_sort.c new file mode 100644 index 0000000000..5cfcb8c8be --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_sort.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl_sort.c: complex int64_t version of klu_sort +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu_sort.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Source/klu_zl_tsolve.c b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_tsolve.c new file mode 100644 index 0000000000..3a6884c9ba --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/Source/klu_zl_tsolve.c @@ -0,0 +1,12 @@ +//------------------------------------------------------------------------------ +// KLU/Source/klu_zl_tsolve.c: complex int64_t version of klu_tsolve +//------------------------------------------------------------------------------ + +// KLU, Copyright (C) 2004-2022, University of Florida, All Rights Reserved. +// Authors: Timothy A. Davis and Ekanathan Palamadai. +// SPDX-License-Identifier: LGPL-2.1+ + +#define COMPLEX +#define DLONG +#include "klu_tsolve.c" + diff --git a/ThirdParty/SuiteSparse/KLU/Tcov/Makefile b/ThirdParty/SuiteSparse/KLU/Tcov/Makefile deleted file mode 100644 index 787c0a0622..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Tcov/Makefile +++ /dev/null @@ -1,425 +0,0 @@ -# If the libraries (AMD, COLAMD, CAMD, CCOLAMD, metis, and CHOLMOD) are not -# yet built, use "make libs" first. Then "make" to compile and run all tests. -# -# This test requires BTF, METIS, CHOLMOD, AMD, COLAMD, CAMD, and CCOLAMD. - -TCOV=yes - -default: all - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -BLAS = -lrefblas -LAPACK = -llapack - -# CF = -Wall -W -Wshadow -Wmissing-prototypes -Wstrict-prototypes \ -# -Wredundant-decls -Wnested-externs -Wdisabled-optimization \ -# -pedantic -ansi -O3 -pg - -# for statement coverage, picky tests -CF = -Wall -W -Wshadow -Wmissing-prototypes -Wstrict-prototypes \ - -Wredundant-decls -Wnested-externs -Wdisabled-optimization \ - -ansi -g -ftest-coverage -fprofile-arcs -fexceptions \ - -fopenmp - -C = $(CC) $(CF) - -LDLIBS = -L../../lib -lamd -lcolamd -lcholmod -lcamd -lccolamd \ - -lmetis -lsuitesparseconfig \ - $(LAPACK) $(BLAS) $(CUDART_LIB) $(CUBLAS_LIB) -lm -lrt \ - -Wl,-rpath=$(SUITESPARSE)/lib -lstdc++ - -I = -I../../include -I../Include -I../User -I../../BTF/Include - -all: purge libs klutest klultest - - ./klultests > klultests.out - - ./klutests > klutests.out - - ./coverage - -valgrind: purge klutest klultest - - ./vklutests > klutests.out - - ./vklultests > klultests.out - - ./coverage - -libs: - ( cd ../../SuiteSparse_config && $(MAKE) TCOV=yes) - ( cd ../../AMD && $(MAKE) library TCOV=yes) - ( cd ../../COLAMD && $(MAKE) library TCOV=yes) - ( cd ../../CAMD && $(MAKE) library TCOV=yes) - ( cd ../../CCOLAMD && $(MAKE) library TCOV=yes) - ( cd ../.. && $(MAKE) metis ) - ( cd ../../CHOLMOD && $(MAKE) library TCOV=yes) - -purge: distclean - -distclean: clean - - $(RM) klutest klultest *.out cov_*.c - - $(RM) -r $(PURGE) - -clean: - - $(RM) -r $(CLEAN) - -INC = \ - ../Include/klu.h \ - ../Include/klu_internal.h \ - ../Include/klu_version.h - -BTFOBJ = \ - cov_btf_order.o \ - cov_btf_maxtrans.o \ - cov_btf_strongcomp.o \ - -BTFLOBJ = \ - cov_btf_l_order.o \ - cov_btf_l_maxtrans.o \ - cov_btf_l_strongcomp.o - -KLUOBJ = \ - cov_klu_analyze.o \ - cov_klu_analyze_given.o \ - cov_klu_defaults.o \ - cov_klu_free_symbolic.o \ - cov_klu_memory.o \ - cov_klu_d.o \ - cov_klu_d_diagnostics.o \ - cov_klu_d_dump.o \ - cov_klu_d_factor.o \ - cov_klu_d_free_numeric.o \ - cov_klu_d_kernel.o \ - cov_klu_d_extract.o \ - cov_klu_d_refactor.o \ - cov_klu_d_scale.o \ - cov_klu_d_solve.o \ - cov_klu_d_tsolve.o \ - cov_klu_z.o \ - cov_klu_z_diagnostics.o \ - cov_klu_z_dump.o \ - cov_klu_z_factor.o \ - cov_klu_z_free_numeric.o \ - cov_klu_z_kernel.o \ - cov_klu_z_extract.o \ - cov_klu_z_refactor.o \ - cov_klu_z_scale.o \ - cov_klu_z_solve.o \ - cov_klu_z_tsolve.o - -KLULOBJ = \ - cov_klu_l_analyze.o \ - cov_klu_l_analyze_given.o \ - cov_klu_l_defaults.o \ - cov_klu_l_free_symbolic.o \ - cov_klu_l_memory.o \ - cov_klu_l.o \ - cov_klu_l_diagnostics.o \ - cov_klu_l_dump.o \ - cov_klu_l_factor.o \ - cov_klu_l_free_numeric.o \ - cov_klu_l_kernel.o \ - cov_klu_l_extract.o \ - cov_klu_l_refactor.o \ - cov_klu_l_scale.o \ - cov_klu_l_solve.o \ - cov_klu_l_tsolve.o \ - cov_klu_zl.o \ - cov_klu_zl_diagnostics.o \ - cov_klu_zl_dump.o \ - cov_klu_zl_factor.o \ - cov_klu_zl_free_numeric.o \ - cov_klu_zl_kernel.o \ - cov_klu_zl_extract.o \ - cov_klu_zl_refactor.o \ - cov_klu_zl_scale.o \ - cov_klu_zl_solve.o \ - cov_klu_zl_tsolve.o - -KLUCHOLMODOBJ = cov_klu_cholmod.o - -KLUCHOLMODLOBJ = cov_klu_l_cholmod.o - -OBJ = $(BTFOBJ) $(KLUOBJ) $(KLUCHOLMODOBJ) - -LOBJ = $(BTFLOBJ) $(KLULOBJ) $(KLUCHOLMODLOBJ) - -$(OBJ): $(INC) - -$(LOBJ): $(INC) - -klutest: $(OBJ) klutest.c - $(C) $(I) klutest.c -o klutest $(OBJ) $(LDLIBS) - -klultest: $(LOBJ) klutest.c - $(C) -DDLONG $(I) klutest.c -o klultest $(LOBJ) $(LDLIBS) - -.c.o: - $(C) -c $(I) $*.c - -#------------------------------------------------------------------------------- - -cov_klu_d.o: ../Source/klu.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_d.c - $(C) -c $(I) cov_klu_d.c - -cov_klu_z.o: ../Source/klu.c - $(C) -E $(I) -DCOMPLEX $< | $(PRETTY) > cov_klu_z.c - $(C) -c $(I) cov_klu_z.c - -cov_klu_d_kernel.o: ../Source/klu_kernel.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_d_kernel.c - $(C) -c $(I) cov_klu_d_kernel.c - -cov_klu_z_kernel.o: ../Source/klu_kernel.c - $(C) -E $(I) -DCOMPLEX $< | $(PRETTY) > cov_klu_z_kernel.c - $(C) -c $(I) cov_klu_z_kernel.c - -cov_klu_d_diagnostics.o: ../Source/klu_diagnostics.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_d_diagnostics.c - $(C) -c $(I) cov_klu_d_diagnostics.c - -cov_klu_z_diagnostics.o: ../Source/klu_diagnostics.c - $(C) -E $(I) -DCOMPLEX $< | $(PRETTY) > cov_klu_z_diagnostics.c - $(C) -c $(I) cov_klu_z_diagnostics.c - -cov_klu_d_dump.o: ../Source/klu_dump.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_d_dump.c - $(C) -c $(I) cov_klu_d_dump.c - -cov_klu_z_dump.o: ../Source/klu_dump.c - $(C) -E $(I) -DCOMPLEX $< | $(PRETTY) > cov_klu_z_dump.c - $(C) -c $(I) cov_klu_z_dump.c - -cov_klu_d_factor.o: ../Source/klu_factor.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_d_factor.c - $(C) -c $(I) cov_klu_d_factor.c - -cov_klu_z_factor.o: ../Source/klu_factor.c - $(C) -E $(I) -DCOMPLEX $< | $(PRETTY) > cov_klu_z_factor.c - $(C) -c $(I) cov_klu_z_factor.c - -cov_klu_d_free_numeric.o: ../Source/klu_free_numeric.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_d_free_numeric.c - $(C) -c $(I) cov_klu_d_free_numeric.c - -cov_klu_z_free_numeric.o: ../Source/klu_free_numeric.c - $(C) -E $(I) -DCOMPLEX $< | $(PRETTY) > cov_klu_z_free_numeric.c - $(C) -c $(I) cov_klu_z_free_numeric.c - -cov_klu_d_extract.o: ../Source/klu_extract.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_d_extract.c - $(C) -c $(I) cov_klu_d_extract.c - -cov_klu_z_extract.o: ../Source/klu_extract.c - $(C) -E $(I) -DCOMPLEX $< | $(PRETTY) > cov_klu_z_extract.c - $(C) -c $(I) cov_klu_z_extract.c - -cov_klu_d_refactor.o: ../Source/klu_refactor.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_d_refactor.c - $(C) -c $(I) cov_klu_d_refactor.c - -cov_klu_z_refactor.o: ../Source/klu_refactor.c - $(C) -E $(I) -DCOMPLEX $< | $(PRETTY) > cov_klu_z_refactor.c - $(C) -c $(I) cov_klu_z_refactor.c - -cov_klu_d_scale.o: ../Source/klu_scale.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_d_scale.c - $(C) -c $(I) cov_klu_d_scale.c - -cov_klu_z_scale.o: ../Source/klu_scale.c - $(C) -E $(I) -DCOMPLEX $< | $(PRETTY) > cov_klu_z_scale.c - $(C) -c $(I) cov_klu_z_scale.c - -cov_klu_d_solve.o: ../Source/klu_solve.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_d_solve.c - $(C) -c $(I) cov_klu_d_solve.c - -cov_klu_z_solve.o: ../Source/klu_solve.c - $(C) -E $(I) -DCOMPLEX $< | $(PRETTY) > cov_klu_z_solve.c - $(C) -c $(I) cov_klu_z_solve.c - -cov_klu_d_tsolve.o: ../Source/klu_tsolve.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_d_tsolve.c - $(C) -c $(I) cov_klu_d_tsolve.c - -cov_klu_z_tsolve.o: ../Source/klu_tsolve.c - $(C) -E $(I) -DCOMPLEX $< | $(PRETTY) > cov_klu_z_tsolve.c - $(C) -c $(I) cov_klu_z_tsolve.c - -#------------------------------------------------------------------------------- - -cov_klu_analyze.o: ../Source/klu_analyze.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_analyze.c - $(C) -c $(I) cov_klu_analyze.c - -cov_klu_analyze_given.o: ../Source/klu_analyze_given.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_analyze_given.c - $(C) -c $(I) cov_klu_analyze_given.c - -cov_klu_defaults.o: ../Source/klu_defaults.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_defaults.c - $(C) -c $(I) cov_klu_defaults.c - -cov_klu_free_symbolic.o: ../Source/klu_free_symbolic.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_free_symbolic.c - $(C) -c $(I) cov_klu_free_symbolic.c - -cov_klu_memory.o: ../Source/klu_memory.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_memory.c - $(C) -c $(I) cov_klu_memory.c - -#------------------------------------------------------------------------------- - -cov_btf_order.o: ../../BTF/Source/btf_order.c - $(C) -E $(I) $< | $(PRETTY) > cov_btf_order.c - $(C) -c $(I) cov_btf_order.c - -cov_btf_maxtrans.o: ../../BTF/Source/btf_maxtrans.c - $(C) -E $(I) $< | $(PRETTY) > cov_btf_maxtrans.c - $(C) -c $(I) cov_btf_maxtrans.c - -cov_btf_strongcomp.o: ../../BTF/Source/btf_strongcomp.c - $(C) -E $(I) $< | $(PRETTY) > cov_btf_strongcomp.c - $(C) -c $(I) cov_btf_strongcomp.c - -#------------------------------------------------------------------------------- - -cov_klu_cholmod.o: ../User/klu_cholmod.c - $(C) -E $(I) $< | $(PRETTY) > cov_klu_cholmod.c - $(C) -c $(I) cov_klu_cholmod.c - - - - - - - -#------------------------------------------------------------------------------- - -cov_klu_l.o: ../Source/klu.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l.c - $(C) -c $(I) cov_klu_l.c - -cov_klu_zl.o: ../Source/klu.c - $(C) -E $(I) -DDLONG -DCOMPLEX $< | $(PRETTY) > cov_klu_zl.c - $(C) -c $(I) cov_klu_zl.c - -cov_klu_l_kernel.o: ../Source/klu_kernel.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_kernel.c - $(C) -c $(I) cov_klu_l_kernel.c - -cov_klu_zl_kernel.o: ../Source/klu_kernel.c - $(C) -E $(I) -DDLONG -DCOMPLEX $< | $(PRETTY) > cov_klu_zl_kernel.c - $(C) -c $(I) cov_klu_zl_kernel.c - -cov_klu_l_diagnostics.o: ../Source/klu_diagnostics.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_diagnostics.c - $(C) -c $(I) cov_klu_l_diagnostics.c - -cov_klu_zl_diagnostics.o: ../Source/klu_diagnostics.c - $(C) -E $(I) -DDLONG -DCOMPLEX $< | $(PRETTY) > cov_klu_zl_diagnostics.c - $(C) -c $(I) cov_klu_zl_diagnostics.c - -cov_klu_l_dump.o: ../Source/klu_dump.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_dump.c - $(C) -c $(I) cov_klu_l_dump.c - -cov_klu_zl_dump.o: ../Source/klu_dump.c - $(C) -E $(I) -DDLONG -DCOMPLEX $< | $(PRETTY) > cov_klu_zl_dump.c - $(C) -c $(I) cov_klu_zl_dump.c - -cov_klu_l_factor.o: ../Source/klu_factor.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_factor.c - $(C) -c $(I) cov_klu_l_factor.c - -cov_klu_zl_factor.o: ../Source/klu_factor.c - $(C) -E $(I) -DDLONG -DCOMPLEX $< | $(PRETTY) > cov_klu_zl_factor.c - $(C) -c $(I) cov_klu_zl_factor.c - -cov_klu_l_free_numeric.o: ../Source/klu_free_numeric.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_free_numeric.c - $(C) -c $(I) cov_klu_l_free_numeric.c - -cov_klu_zl_free_numeric.o: ../Source/klu_free_numeric.c - $(C) -E $(I) -DDLONG -DCOMPLEX $< | $(PRETTY) > cov_klu_zl_free_numeric.c - $(C) -c $(I) cov_klu_zl_free_numeric.c - -cov_klu_l_extract.o: ../Source/klu_extract.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_extract.c - $(C) -c $(I) cov_klu_l_extract.c - -cov_klu_zl_extract.o: ../Source/klu_extract.c - $(C) -E $(I) -DDLONG -DCOMPLEX $< | $(PRETTY) > cov_klu_zl_extract.c - $(C) -c $(I) cov_klu_zl_extract.c - -cov_klu_l_refactor.o: ../Source/klu_refactor.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_refactor.c - $(C) -c $(I) cov_klu_l_refactor.c - -cov_klu_zl_refactor.o: ../Source/klu_refactor.c - $(C) -E $(I) -DDLONG -DCOMPLEX $< | $(PRETTY) > cov_klu_zl_refactor.c - $(C) -c $(I) cov_klu_zl_refactor.c - -cov_klu_l_scale.o: ../Source/klu_scale.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_scale.c - $(C) -c $(I) cov_klu_l_scale.c - -cov_klu_zl_scale.o: ../Source/klu_scale.c - $(C) -E $(I) -DDLONG -DCOMPLEX $< | $(PRETTY) > cov_klu_zl_scale.c - $(C) -c $(I) cov_klu_zl_scale.c - -cov_klu_l_solve.o: ../Source/klu_solve.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_solve.c - $(C) -c $(I) cov_klu_l_solve.c - -cov_klu_zl_solve.o: ../Source/klu_solve.c - $(C) -E $(I) -DDLONG -DCOMPLEX $< | $(PRETTY) > cov_klu_zl_solve.c - $(C) -c $(I) cov_klu_zl_solve.c - -cov_klu_l_tsolve.o: ../Source/klu_tsolve.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_tsolve.c - $(C) -c $(I) cov_klu_l_tsolve.c - -cov_klu_zl_tsolve.o: ../Source/klu_tsolve.c - $(C) -E $(I) -DDLONG -DCOMPLEX $< | $(PRETTY) > cov_klu_zl_tsolve.c - $(C) -c $(I) cov_klu_zl_tsolve.c - -#------------------------------------------------------------------------------- - -cov_klu_l_analyze.o: ../Source/klu_analyze.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_analyze.c - $(C) -c $(I) cov_klu_l_analyze.c - -cov_klu_l_analyze_given.o: ../Source/klu_analyze_given.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_analyze_given.c - $(C) -c $(I) cov_klu_l_analyze_given.c - -cov_klu_l_defaults.o: ../Source/klu_defaults.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_defaults.c - $(C) -c $(I) cov_klu_l_defaults.c - -cov_klu_l_free_symbolic.o: ../Source/klu_free_symbolic.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_free_symbolic.c - $(C) -c $(I) cov_klu_l_free_symbolic.c - -cov_klu_l_memory.o: ../Source/klu_memory.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_memory.c - $(C) -c $(I) cov_klu_l_memory.c - -#------------------------------------------------------------------------------- - -cov_btf_l_order.o: ../../BTF/Source/btf_order.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_btf_l_order.c - $(C) -c $(I) cov_btf_l_order.c - -cov_btf_l_maxtrans.o: ../../BTF/Source/btf_maxtrans.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_btf_l_maxtrans.c - $(C) -c $(I) cov_btf_l_maxtrans.c - -cov_btf_l_strongcomp.o: ../../BTF/Source/btf_strongcomp.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_btf_l_strongcomp.c - $(C) -c $(I) cov_btf_l_strongcomp.c - -#------------------------------------------------------------------------------- - -cov_klu_l_cholmod.o: ../User/klu_l_cholmod.c - $(C) -E $(I) -DDLONG $< | $(PRETTY) > cov_klu_l_cholmod.c - $(C) -c $(I) cov_klu_l_cholmod.c - diff --git a/ThirdParty/SuiteSparse/KLU/Tcov/README.txt b/ThirdParty/SuiteSparse/KLU/Tcov/README.txt deleted file mode 100644 index e8c862b916..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Tcov/README.txt +++ /dev/null @@ -1,7 +0,0 @@ -Test suite for KLU - -To compile and run the test suite, first type "make" in the Linux/Unix shell. -The libraries must be compiled first (if they aren't use "make libs"). -"make clean" or "make distclean" will remove all unnecessary files. - -Timothy A. Davis, http://www.suitesparse.com diff --git a/ThirdParty/SuiteSparse/KLU/Tcov/coverage b/ThirdParty/SuiteSparse/KLU/Tcov/coverage deleted file mode 100755 index c081588286..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Tcov/coverage +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/csh -gcov cov*.c >& /dev/null -echo -n 'statements not covered: ' -grep "#####" *.c.gcov | wc -l diff --git a/ThirdParty/SuiteSparse/KLU/Tcov/klultests b/ThirdParty/SuiteSparse/KLU/Tcov/klultests deleted file mode 100755 index 98f2734aae..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Tcov/klultests +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/csh - -# 57 unique statements: -./klultest < ../Matrix/impcol_a.mtx - -# 20: -./klultest < ../Matrix/GD99_cc.mtx - -# 17: -./klultest < ../Matrix/two.mtx - -# 10: -./klultest < ../Matrix/w156.mtx - -# 3, xsize memgrow in klu_kernel -./klultest < ../Matrix/arrow.mtx - -# 3, xsize memgrow in klu_kernel, 1 in klu_z_condest, -./klultest < ../Matrix/arrowc.mtx - -# 2 in klu_z_kernel (if pivot == 0 and halt_if_singular, and in complex divide) -./klultest < ../Matrix/onec.mtx - -# 1 in klu_kernel (if pivot == 0 and halt if singular) -./klultest < ../Matrix/one.mtx - -# 1 in klu_z_condest: -./klultest < ../Matrix/1c.mtx - -# 1 in klu_z_condest: -./klultest < ../Matrix/ctina.mtx diff --git a/ThirdParty/SuiteSparse/KLU/Tcov/klutest.c b/ThirdParty/SuiteSparse/KLU/Tcov/klutest.c deleted file mode 100644 index c097814995..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Tcov/klutest.c +++ /dev/null @@ -1,1384 +0,0 @@ -/* ========================================================================== */ -/* === KLU test ============================================================= */ -/* ========================================================================== */ - -/* Exhaustive test for KLU and BTF (int, long, real, and complex versions) */ - -#include -#include "cholmod.h" -#include "klu_cholmod.h" -#include "klu_internal.h" - -#define ID Int_id - -#define NRHS 6 - -#define HALT { fprintf (stderr, "Test failure: %d\n", __LINE__) ; abort () ; } -#define OK(a) { if (!(a)) HALT ; } -#define FAIL(a) { if (a) HALT ; } - -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) - - -#ifdef DLONG - -#define klu_z_scale klu_zl_scale -#define klu_z_solve klu_zl_solve -#define klu_z_tsolve klu_zl_tsolve -#define klu_z_free_numeric klu_zl_free_numeric -#define klu_z_factor klu_zl_factor -#define klu_z_refactor klu_zl_refactor -#define klu_z_lsolve klu_zl_lsolve -#define klu_z_ltsolve klu_zl_ltsolve -#define klu_z_usolve klu_zl_usolve -#define klu_z_utsolve klu_zl_utsolve -#define klu_z_defaults klu_zl_defaults -#define klu_z_rgrowth klu_zl_rgrowth -#define klu_z_rcond klu_zl_rcond -#define klu_z_extract klu_zl_extract -#define klu_z_condest klu_zl_condest -#define klu_z_flops klu_zl_flops - -#define klu_scale klu_l_scale -#define klu_solve klu_l_solve -#define klu_tsolve klu_l_tsolve -#define klu_free_numeric klu_l_free_numeric -#define klu_factor klu_l_factor -#define klu_refactor klu_l_refactor -#define klu_lsolve klu_l_lsolve -#define klu_ltsolve klu_l_ltsolve -#define klu_usolve klu_l_usolve -#define klu_utsolve klu_l_utsolve -#define klu_defaults klu_l_defaults -#define klu_rgrowth klu_l_rgrowth -#define klu_rcond klu_l_rcond -#define klu_extract klu_l_extract -#define klu_condest klu_l_condest -#define klu_flops klu_l_flops - -#define klu_analyze klu_l_analyze -#define klu_analyze_given klu_l_analyze_given -#define klu_malloc klu_l_malloc -#define klu_free klu_l_free -#define klu_realloc klu_l_realloc -#define klu_free_symbolic klu_l_free_symbolic -#define klu_free_numeric klu_l_free_numeric -#define klu_defaults klu_l_defaults - -#define klu_cholmod klu_l_cholmod - -#endif - - -#ifdef DLONG - -#define CHOLMOD_print_sparse cholmod_l_print_sparse -#define CHOLMOD_print_dense cholmod_l_print_dense -#define CHOLMOD_copy_sparse cholmod_l_copy_sparse -#define CHOLMOD_copy_dense cholmod_l_copy_dense -#define CHOLMOD_transpose cholmod_l_transpose -#define CHOLMOD_sdmult cholmod_l_sdmult -#define CHOLMOD_norm_dense cholmod_l_norm_dense -#define CHOLMOD_norm_sparse cholmod_l_norm_sparse -#define CHOLMOD_free_sparse cholmod_l_free_sparse -#define CHOLMOD_free_dense cholmod_l_free_dense -#define CHOLMOD_start cholmod_l_start -#define CHOLMOD_read_sparse cholmod_l_read_sparse -#define CHOLMOD_allocate_dense cholmod_l_allocate_dense -#define CHOLMOD_finish cholmod_l_finish - -#else - -#define CHOLMOD_print_sparse cholmod_print_sparse -#define CHOLMOD_print_dense cholmod_print_dense -#define CHOLMOD_copy_sparse cholmod_copy_sparse -#define CHOLMOD_copy_dense cholmod_copy_dense -#define CHOLMOD_transpose cholmod_transpose -#define CHOLMOD_sdmult cholmod_sdmult -#define CHOLMOD_norm_dense cholmod_norm_dense -#define CHOLMOD_norm_sparse cholmod_norm_sparse -#define CHOLMOD_free_sparse cholmod_free_sparse -#define CHOLMOD_free_dense cholmod_free_dense -#define CHOLMOD_start cholmod_start -#define CHOLMOD_read_sparse cholmod_read_sparse -#define CHOLMOD_allocate_dense cholmod_allocate_dense -#define CHOLMOD_finish cholmod_finish - -#endif - -/* ========================================================================== */ -/* === random numbers ======================================================= */ -/* ========================================================================== */ - -#define MY_RAND_MAX 32767 - -static unsigned long next = 1 ; - -static Int my_rand (void) -{ - next = next * 1103515245 + 12345 ; - return ((unsigned)(next/65536) % (MY_RAND_MAX+1)) ; -} - -static void my_srand (unsigned seed) -{ - next = seed ; -} - -/* ========================================================================== */ -/* === memory management ==================================================== */ -/* ========================================================================== */ - -void *my_malloc (size_t size) ; -void *my_calloc (size_t n, size_t size) ; -void *my_realloc (void *p, size_t size) ; -void my_free (void *p) ; - -Int my_tries = -1 ; - -void *my_malloc (size_t size) -{ - if (my_tries == 0) return (NULL) ; /* pretend to fail */ - if (my_tries > 0) my_tries-- ; - return (malloc (size)) ; -} - -void *my_calloc (size_t n, size_t size) -{ - if (my_tries == 0) return (NULL) ; /* pretend to fail */ - if (my_tries > 0) my_tries-- ; - return (calloc (n, size)) ; -} - -void *my_realloc (void *p, size_t size) -{ - if (my_tries == 0) return (NULL) ; /* pretend to fail */ - if (my_tries > 0) my_tries-- ; - return (realloc (p, size)) ; -} - -void my_free (void *p) -{ - if (p) free (p) ; -} - -static void normal_memory_handler ( void ) -{ - SuiteSparse_config.malloc_func = malloc ; - SuiteSparse_config.calloc_func = calloc ; - SuiteSparse_config.realloc_func = realloc ; - SuiteSparse_config.free_func = free ; - - my_tries = -1 ; -} - -static void test_memory_handler ( void ) -{ - SuiteSparse_config.malloc_func = my_malloc ; - SuiteSparse_config.calloc_func = my_calloc ; - SuiteSparse_config.realloc_func = my_realloc ; - SuiteSparse_config.free_func = my_free ; - my_tries = -1 ; -} - - -/* ========================================================================== */ -/* === print_sparse ========================================================= */ -/* ========================================================================== */ - -/* print a sparse matrix */ - -static void print_sparse (Int n, Int isreal, Int *Ap, Int *Ai, double *Ax, - double *Az) -{ - double ax, az ; - Int i, j, p ; - for (j = 0 ; j < n ; j++) - { - printf ("column "ID":\n", j) ; - for (p = Ap [j] ; p < Ap [j+1] ; p++) - { - i = Ai [p] ; - if (isreal) - { - ax = Ax [p] ; - az = 0 ; - } - else if (Az) - { - /* split complex */ - ax = Ax [p] ; - az = Az [p] ; - } - else - { - /* merged complex */ - ax = Ax [2*p ] ; - az = Ax [2*p+1] ; - } - printf (" row "ID" : %g", i, ax) ; - if (!isreal) - { - printf (" + (%g)i", az) ; - } - printf ("\n") ; - } - } - fflush (stdout) ; -} - - -/* ========================================================================== */ -/* === print_int ============================================================ */ -/* ========================================================================== */ - -/* print an Int vector */ - -static void print_int (Int n, Int *P) -{ - Int j ; - for (j = 0 ; j < n ; j++) - { - printf (" "ID" : "ID"\n", j, P [j]) ; - } - fflush (stdout) ; -} - - -/* ========================================================================== */ -/* === print_double ========================================================= */ -/* ========================================================================== */ - -/* print a double vector */ - -static void print_double (Int n, double *X) -{ - Int j ; - for (j = 0 ; j < n ; j++) - { - printf (" "ID" : %g\n", j, X [j]) ; - } - fflush (stdout) ; -} - - -/* ========================================================================== */ -/* === ludump =============================================================== */ -/* ========================================================================== */ - -/* extract and print the LU factors */ - -static void ludump (KLU_symbolic *Symbolic, KLU_numeric *Numeric, Int isreal, - cholmod_common *ch, KLU_common *Common) -{ - Int *Lp, *Li, *Up, *Ui, *Fp, *Fi, *P, *Q, *R ; - double *Lx, *Ux, *Fx, *Lz, *Uz, *Fz, *Rs ; - Int n, lnz, unz, fnz, nb, result ; - - if (Symbolic == NULL || Numeric == NULL) - { - return ; - } - - n = Symbolic->n ; - lnz = Numeric->lnz ; - unz = Numeric->unz ; - fnz = Numeric->Offp [n] ; - nb = Symbolic->nblocks ; - - printf ("n "ID" lnz "ID" unz "ID" fnz "ID" nblocks "ID" isreal "ID"\n", - n, lnz, unz, fnz, nb, isreal) ; - fflush (stdout) ; - - Lp = malloc ((n+1) * sizeof (Int)) ; - Li = malloc (lnz * sizeof (Int)) ; - Lx = malloc (lnz * sizeof (double)) ; - Lz = malloc (lnz * sizeof (double)) ; - - Up = malloc ((n+1) * sizeof (Int)) ; - Ui = malloc (unz * sizeof (Int)) ; - Ux = malloc (unz * sizeof (double)) ; - Uz = malloc (unz * sizeof (double)) ; - - Fp = malloc ((n+1) * sizeof (Int)) ; - Fi = malloc (fnz * sizeof (Int)) ; - Fx = malloc (fnz * sizeof (double)) ; - Fz = malloc (fnz * sizeof (double)) ; - - P = malloc (n * sizeof (Int)) ; - Q = malloc (n * sizeof (Int)) ; - Rs = malloc (n * sizeof (double)) ; - R = malloc ((nb+1) * sizeof (double)) ; - - if (isreal) - { - result = klu_extract (Numeric, Symbolic, Lp, Li, Lx, - Up, Ui, Ux, Fp, Fi, Fx, P, Q, Rs, R, Common) ; - } - else - { - result = klu_z_extract (Numeric, Symbolic, Lp, Li, Lx, Lz, - Up, Ui, Ux, Uz, Fp, Fi, Fx, Fz, P, Q, Rs, R, Common) ; - } - - if (my_tries != 0) OK (result) ; - - if (ch->print >= 5) - { - printf ("------ L:\n") ; print_sparse (n, isreal, Lp, Li, Lx, Lz) ; - printf ("------ U:\n") ; print_sparse (n, isreal, Up, Ui, Ux, Uz) ; - printf ("------ F:\n") ; print_sparse (n, isreal, Fp, Fi, Fx, Fz) ; - printf ("------ P:\n") ; print_int (n, P) ; - printf ("------ Q:\n") ; print_int (n, Q) ; - printf ("------ Rs:\n") ; print_double (n, Rs) ; - printf ("------ R:\n") ; print_int (nb+1, R) ; - } - - free (Lp) ; - free (Li) ; - free (Lx) ; - free (Lz) ; - - free (Up) ; - free (Ui) ; - free (Ux) ; - free (Uz) ; - - free (Fp) ; - free (Fi) ; - free (Fx) ; - free (Fz) ; - - free (P) ; - free (Q) ; - free (Rs) ; - free (R) ; -} - - -/* ========================================================================== */ -/* === randperm ============================================================= */ -/* ========================================================================== */ - -/* return a random permutation vector */ - -static Int *randperm (Int n, Int seed) -{ - Int *p, k, j, t ; - p = malloc (n * sizeof (Int)) ; - for (k = 0 ; k < n ; k++) - { - p [k] = k ; - } - my_srand (seed) ; /* get new random number seed */ - for (k = 0 ; k < n ; k++) - { - j = k + (my_rand ( ) % (n-k)) ; /* j = my_rand in range k to n-1 */ - t = p [j] ; /* swap p[k] and p[j] */ - p [j] = p [k] ; - p [k] = t ; - } - return (p) ; -} - - -/* ========================================================================== */ -/* === do_1_solve =========================================================== */ -/* ========================================================================== */ - -static double do_1_solve (cholmod_sparse *A, cholmod_dense *B, - cholmod_dense *Xknown, Int *Puser, Int *Quser, - KLU_common *Common, cholmod_common *ch, Int *isnan) -{ - Int *Ai, *Ap ; - double *Ax, *Xknownx, *Xx, *Ax2, *Axx ; - KLU_symbolic *Symbolic = NULL ; - KLU_numeric *Numeric = NULL ; - cholmod_dense *X = NULL, *R = NULL ; - cholmod_sparse *AT = NULL, *A2 = NULL, *AT2 = NULL ; - double one [2], minusone [2], - rnorm, anorm, xnorm, relresid, relerr, err = 0. ; - Int i, j, nrhs2, isreal, n, nrhs, transpose, step, k, save, tries ; - - printf ("\ndo_1_solve: btf "ID" maxwork %g scale "ID" ordering "ID" user: " - ID" P,Q: %d halt: "ID"\n", - Common->btf, Common->maxwork, Common->scale, Common->ordering, - Common->user_data ? (*((Int *) Common->user_data)) : -1, - (Puser != NULL || Quser != NULL), Common->halt_if_singular) ; - fflush (stdout) ; - fflush (stderr) ; - - CHOLMOD_print_sparse (A, "A", ch) ; - CHOLMOD_print_dense (B, "B", ch) ; - - Ap = A->p ; - Ai = A->i ; - Ax = A->x ; - n = A->nrow ; - isreal = (A->xtype == CHOLMOD_REAL) ; - /* Bx = B->x ; */ - Xknownx = Xknown->x ; - nrhs = B->ncol ; - - one [0] = 1 ; - one [1] = 0 ; - - minusone [0] = -1 ; - minusone [1] = 0 ; - - /* ---------------------------------------------------------------------- */ - /* symbolic analysis */ - /* ---------------------------------------------------------------------- */ - - Symbolic = NULL ; - my_tries = 0 ; - for (tries = 0 ; Symbolic == NULL && my_tries == 0 ; tries++) - { - my_tries = tries ; - if (Puser != NULL || Quser != NULL) - { - Symbolic = klu_analyze_given (n, Ap, Ai, Puser, Quser, Common) ; - } - else - { - Symbolic = klu_analyze (n, Ap, Ai, Common) ; - } - } - printf ("sym try "ID" btf "ID" ordering "ID"\n", - tries, Common->btf, Common->ordering) ; - if (Symbolic == NULL) - { - printf ("Symbolic is null\n") ; - return (998) ; - } - my_tries = -1 ; - - /* create a modified version of A */ - - A2 = CHOLMOD_copy_sparse (A, ch) ; - Ax2 = A2->x ; - my_srand (42) ; - for (k = 0 ; k < Ap [n] * (isreal ? 1:2) ; k++) - { - Ax2 [k] = Ax [k] * - (1 + 1e-4 * ((double) my_rand ( )) / ((double) MY_RAND_MAX)) ; - } - - AT = isreal ? NULL : CHOLMOD_transpose (A, 1, ch) ; - AT2 = isreal ? NULL : CHOLMOD_transpose (A2, 1, ch) ; - - /* ---------------------------------------------------------------------- */ - /* factorize then solve */ - /* ---------------------------------------------------------------------- */ - - for (step = 1 ; step <= 3 ; step++) - { - printf ("step: "ID"\n", step) ; - fflush (stdout) ; - - /* ------------------------------------------------------------------ */ - /* factorization or refactorization */ - /* ------------------------------------------------------------------ */ - - /* step 1: factor - step 2: refactor with same A - step 3: refactor with modified A, and scaling forced on - and solve each time - */ - - if (step == 1) - { - /* numeric factorization */ - - Numeric = NULL ; - my_tries = 0 ; - for (tries = 0 ; Numeric == NULL && my_tries == 0 ; tries++) - { - my_tries = tries ; - if (isreal) - { - Numeric = klu_factor (Ap, Ai, Ax, Symbolic, Common) ; - } - else - { - Numeric = klu_z_factor (Ap, Ai, Ax, Symbolic, Common) ; - } - } - printf ("num try "ID" btf "ID"\n", tries, Common->btf) ; - my_tries = -1 ; - - if (Common->status == KLU_OK || - (Common->status == KLU_SINGULAR && !Common->halt_if_singular)) - { - OK (Numeric) ; - } - else - { - FAIL (Numeric) ; - } - - if (Common->status < KLU_OK) - { - printf ("factor failed: "ID"\n", Common->status) ; - } - - } - else if (step == 2) - { - - /* numeric refactorization with same values, same scaling */ - if (isreal) - { - klu_refactor (Ap, Ai, Ax, Symbolic, Numeric, Common) ; - } - else - { - klu_z_refactor (Ap, Ai, Ax, Symbolic, Numeric, Common) ; - } - - } - else - { - - /* numeric refactorization with different values */ - save = Common->scale ; - if (Common->scale == 0) - { - Common->scale = 1 ; - } - for (tries = 0 ; tries <= 1 ; tries++) - { - my_tries = tries ; - if (isreal) - { - klu_refactor (Ap, Ai, Ax2, Symbolic, Numeric, Common) ; - } - else - { - klu_z_refactor (Ap, Ai, Ax2, Symbolic, Numeric, Common) ; - } - } - my_tries = -1 ; - Common->scale = save ; - } - - if (Common->status == KLU_SINGULAR) - { - printf ("# singular column : "ID"\n", Common->singular_col) ; - } - - /* ------------------------------------------------------------------ */ - /* diagnostics */ - /* ------------------------------------------------------------------ */ - - Axx = (step == 3) ? Ax2 : Ax ; - - if (isreal) - { - klu_rgrowth (Ap, Ai, Axx, Symbolic, Numeric, Common) ; - klu_condest (Ap, Axx, Symbolic, Numeric, Common) ; - klu_rcond (Symbolic, Numeric, Common) ; - klu_flops (Symbolic, Numeric, Common) ; - } - else - { - klu_z_rgrowth (Ap, Ai, Axx, Symbolic, Numeric, Common) ; - klu_z_condest (Ap, Axx, Symbolic, Numeric, Common) ; - klu_z_rcond (Symbolic, Numeric, Common) ; - klu_z_flops (Symbolic, Numeric, Common) ; - } - - printf ("growth %g condest %g rcond %g flops %g\n", - Common->rgrowth, Common->condest, Common->rcond, Common->flops) ; - - ludump (Symbolic, Numeric, isreal, ch, Common) ; - - if (Numeric == NULL || Common->status < KLU_OK) - { - continue ; - } - - /* ------------------------------------------------------------------ */ - /* solve */ - /* ------------------------------------------------------------------ */ - - /* forward/backsolve to solve A*X=B or A'*X=B */ - for (transpose = (isreal ? 0 : -1) ; transpose <= 1 ; transpose++) - { - - for (nrhs2 = 1 ; nrhs2 <= nrhs ; nrhs2++) - { - /* mangle B so that it has only nrhs2 columns */ - B->ncol = nrhs2 ; - - X = CHOLMOD_copy_dense (B, ch) ; - CHOLMOD_print_dense (X, "X before solve", ch) ; - Xx = X->x ; - - if (isreal) - { - if (transpose) - { - /* solve A'x=b */ - klu_tsolve (Symbolic, Numeric, n, nrhs2, Xx, Common) ; - } - else - { - /* solve A*x=b */ - klu_solve (Symbolic, Numeric, n, nrhs2, Xx, Common) ; - } - } - else - { - if (transpose) - { - /* solve A'x=b (if 1) or A.'x=b (if -1) */ - klu_z_tsolve (Symbolic, Numeric, n, nrhs2, Xx, - (transpose == 1), Common) ; - } - else - { - /* solve A*x=b */ - klu_z_solve (Symbolic, Numeric, n, nrhs2, Xx, Common) ; - } - } - - CHOLMOD_print_dense (X, "X", ch) ; - - /* compute the residual, R = B-A*X, B-A'*X, or B-A.'*X */ - R = CHOLMOD_copy_dense (B, ch) ; - if (transpose == -1) - { - /* R = B-A.'*X (use A.' explicitly) */ - CHOLMOD_sdmult ((step == 3) ? AT2 : AT, - 0, minusone, one, X, R, ch) ; - } - else - { - /* R = B-A*X or B-A'*X */ - CHOLMOD_sdmult ((step == 3) ? A2 :A, - transpose, minusone, one, X, R, ch) ; - } - - CHOLMOD_print_dense (R, "R", ch) ; - - /* compute the norms of R, A, X, and B */ - rnorm = CHOLMOD_norm_dense (R, 1, ch) ; - anorm = CHOLMOD_norm_sparse ((step == 3) ? A2 : A, 1, ch) ; - xnorm = CHOLMOD_norm_dense (X, 1, ch) ; - /* bnorm = CHOLMOD_norm_dense (B, 1, ch) ; */ - - CHOLMOD_free_dense (&R, ch) ; - - /* relative residual = norm (r) / (norm (A) * norm (x)) */ - relresid = rnorm ; - if (anorm > 0) - { - relresid /= anorm ; - } - if (xnorm > 0) - { - relresid /= xnorm ; - } - - if (SCALAR_IS_NAN (relresid)) - { - *isnan = TRUE ; - } - else - { - err = MAX (err, relresid) ; - } - - /* relative error = norm (x - xknown) / norm (xknown) */ - /* overwrite X with X - Xknown */ - if (transpose || step == 3) - { - /* not computed */ - relerr = -1 ; - } - else - { - for (j = 0 ; j < nrhs2 ; j++) - { - for (i = 0 ; i < n ; i++) - { - if (isreal) - { - Xx [i+j*n] -= Xknownx [i+j*n] ; - } - else - { - Xx [2*(i+j*n) ] -= Xknownx [2*(i+j*n) ] ; - Xx [2*(i+j*n)+1] -= Xknownx [2*(i+j*n)+1] ; - } - } - } - relerr = CHOLMOD_norm_dense (X, 1, ch) ; - xnorm = CHOLMOD_norm_dense (Xknown, 1, ch) ; - if (xnorm > 0) - { - relerr /= xnorm ; - } - - if (SCALAR_IS_NAN (relerr)) - { - *isnan = TRUE ; - } - else - { - err = MAX (relerr, err) ; - } - - } - - CHOLMOD_free_dense (&X, ch) ; - - printf (ID" "ID" relresid %10.3g relerr %10.3g %g\n", - transpose, nrhs2, relresid, relerr, err) ; - - B->ncol = nrhs ; /* restore B */ - } - } - } - - /* ---------------------------------------------------------------------- */ - /* free factorization and temporary matrices, and return */ - /* ---------------------------------------------------------------------- */ - - klu_free_symbolic (&Symbolic, Common) ; - if (isreal) - { - klu_free_numeric (&Numeric, Common) ; - } - else - { - klu_z_free_numeric (&Numeric, Common) ; - } - CHOLMOD_free_sparse (&A2, ch) ; - CHOLMOD_free_sparse (&AT, ch) ; - CHOLMOD_free_sparse (&AT2, ch) ; - fflush (stdout) ; - fflush (stderr) ; - return (err) ; -} - - -/* ========================================================================== */ -/* === do_solves ============================================================ */ -/* ========================================================================== */ - -/* test KLU with many options */ - -static double do_solves (cholmod_sparse *A, cholmod_dense *B, cholmod_dense *X, - Int *Puser, Int *Quser, KLU_common *Common, cholmod_common *ch, Int *isnan) -{ - double err, maxerr = 0 ; - Int n = A->nrow, sflag ; - *isnan = FALSE ; - - /* ---------------------------------------------------------------------- */ - /* test KLU with the system A*X=B and default options */ - /* ---------------------------------------------------------------------- */ - - maxerr = do_1_solve (A, B, X, NULL, NULL, Common, ch, isnan) ; - - /* ---------------------------------------------------------------------- */ - /* test with non-default options */ - /* ---------------------------------------------------------------------- */ - - Common->user_order = klu_cholmod ; - for (Common->btf = 0 ; Common->btf <= 2 ; Common->btf++) - { - Common->maxwork = (Common->btf == 2) ? 0.001 : 0 ; - - for (Common->halt_if_singular = 0 ; Common->halt_if_singular <= 1 ; - Common->halt_if_singular++) - { - for (Common->scale = 0 ; Common->scale <= 2 ; Common->scale++) - - { - fprintf (stderr, ".") ; - fflush (stderr) ; - - /* orderings: 0: AMD, 1: COLAMD, 2: natural, 3: user function */ - for (Common->ordering = 0 ; Common->ordering <= 3 ; - Common->ordering++) - { - err = do_1_solve (A, B, X, NULL, NULL, Common, ch, isnan) ; - maxerr = MAX (maxerr, err) ; - } - - /* user-ordering, unsymmetric case */ - Common->ordering = 3 ; - Common->user_data = &sflag ; - sflag = 0 ; - err = do_1_solve (A, B, X, NULL, NULL, Common, ch, isnan) ; - maxerr = MAX (maxerr, err) ; - Common->user_data = NULL ; - - /* Puser and Quser, but only for small matrices */ - Common->ordering = 2 ; - if (n < 200) - { - err = do_1_solve (A, B, X, Puser, Quser, Common, ch, isnan); - maxerr = MAX (maxerr, err) ; - } - } - } - } - - /* restore defaults */ - Common->btf = TRUE ; - Common->maxwork = 0 ; - Common->ordering = 0 ; - Common->scale = -1 ; - Common->halt_if_singular = TRUE ; - Common->user_order = NULL ; - - my_tries = -1 ; - return (maxerr) ; -} - - -/* ========================================================================== */ -/* === main ================================================================= */ -/* ========================================================================== */ - -int main (void) -{ - KLU_common Common ; - cholmod_sparse *A, *A2 ; - cholmod_dense *X, *B ; - cholmod_common ch ; - Int *Ap, *Ai, *Puser, *Quser, *Gunk ; - double *Ax, *Xx, *A2x ; - double one [2], zero [2], xsave, maxerr ; - Int n, i, j, nz, save, isreal, k, isnan ; - KLU_symbolic *Symbolic, *Symbolic2 ; - KLU_numeric *Numeric ; - - one [0] = 1 ; - one [1] = 0 ; - zero [0] = 0 ; - zero [1] = 0 ; - - printf ("klu test: -------------------------------------------------\n") ; - OK (klu_defaults (&Common)) ; - CHOLMOD_start (&ch) ; - ch.print = 0 ; - normal_memory_handler ( ) ; - - /* ---------------------------------------------------------------------- */ - /* read in a sparse matrix from stdin */ - /* ---------------------------------------------------------------------- */ - - A = CHOLMOD_read_sparse (stdin, &ch) ; - - if (A->nrow != A->ncol || A->stype != 0) - { - fprintf (stderr, "error: only square unsymmetric matrices handled\n") ; - CHOLMOD_free_sparse (&A, &ch) ; - return (0) ; - } - if (!(A->xtype == CHOLMOD_REAL || A->xtype == CHOLMOD_COMPLEX)) - { - fprintf (stderr, "error: only real or complex matrices hanlded\n") ; - CHOLMOD_free_sparse (&A, &ch) ; - return (0) ; - } - - n = A->nrow ; - Ap = A->p ; - Ai = A->i ; - Ax = A->x ; - nz = Ap [n] ; - isreal = (A->xtype == CHOLMOD_REAL) ; - - /* ---------------------------------------------------------------------- */ - /* construct random permutations */ - /* ---------------------------------------------------------------------- */ - - Puser = randperm (n, n) ; - Quser = randperm (n, n) ; - - /* ---------------------------------------------------------------------- */ - /* select known solution to Ax=b */ - /* ---------------------------------------------------------------------- */ - - X = CHOLMOD_allocate_dense (n, NRHS, n, A->xtype, &ch) ; - Xx = X->x ; - for (j = 0 ; j < NRHS ; j++) - { - for (i = 0 ; i < n ; i++) - { - if (isreal) - { - Xx [i] = 1 + ((double) i) / ((double) n) + j * 100; - } - else - { - Xx [2*i ] = 1 + ((double) i) / ((double) n) + j * 100 ; - Xx [2*i+1] = - ((double) i+1) / ((double) n + j) ; - if (j == NRHS-1) - { - Xx [2*i+1] = 0 ; /* zero imaginary part */ - } - else if (j == NRHS-2) - { - Xx [2*i] = 0 ; /* zero real part */ - } - } - } - Xx += isreal ? n : 2*n ; - } - - /* B = A*X */ - B = CHOLMOD_allocate_dense (n, NRHS, n, A->xtype, &ch) ; - CHOLMOD_sdmult (A, 0, one, zero, X, B, &ch) ; - /* Bx = B->x ; */ - - /* ---------------------------------------------------------------------- */ - /* test KLU */ - /* ---------------------------------------------------------------------- */ - - test_memory_handler ( ) ; - maxerr = do_solves (A, B, X, Puser, Quser, &Common, &ch, &isnan) ; - - /* ---------------------------------------------------------------------- */ - /* basic error checking */ - /* ---------------------------------------------------------------------- */ - - FAIL (klu_defaults (NULL)) ; - - FAIL (klu_extract (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_extract (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_z_extract (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_z_extract (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_analyze (0, NULL, NULL, NULL)) ; - FAIL (klu_analyze (0, NULL, NULL, &Common)) ; - - FAIL (klu_analyze_given (0, NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_analyze_given (0, NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_cholmod (0, NULL, NULL, NULL, NULL)) ; - - FAIL (klu_factor (NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_factor (NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_z_factor (NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_z_factor (NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_refactor (NULL, NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_refactor (NULL, NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_z_refactor (NULL, NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_z_refactor (NULL, NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_rgrowth (NULL, NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_rgrowth (NULL, NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_z_rgrowth (NULL, NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_z_rgrowth (NULL, NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_condest (NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_condest (NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_z_condest (NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_z_condest (NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_flops (NULL, NULL, NULL)) ; - FAIL (klu_flops (NULL, NULL, &Common)) ; - - FAIL (klu_z_flops (NULL, NULL, NULL)) ; - FAIL (klu_z_flops (NULL, NULL, &Common)) ; - - FAIL (klu_rcond (NULL, NULL, NULL)) ; - FAIL (klu_rcond (NULL, NULL, &Common)) ; - - FAIL (klu_z_rcond (NULL, NULL, NULL)) ; - FAIL (klu_z_rcond (NULL, NULL, &Common)) ; - - FAIL (klu_free_symbolic (NULL, NULL)) ; - OK (klu_free_symbolic (NULL, &Common)) ; - - FAIL (klu_free_numeric (NULL, NULL)) ; - OK (klu_free_numeric (NULL, &Common)) ; - - FAIL (klu_z_free_numeric (NULL, NULL)) ; - OK (klu_z_free_numeric (NULL, &Common)) ; - - FAIL (klu_scale (0, 0, NULL, NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_scale (0, 0, NULL, NULL, NULL, NULL, NULL, &Common)) ; - OK (klu_scale (-1, 0, NULL, NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_z_scale (0, 0, NULL, NULL, NULL, NULL, NULL, NULL)) ; - FAIL (klu_z_scale (0, 0, NULL, NULL, NULL, NULL, NULL, &Common)) ; - OK (klu_z_scale (-1, 0, NULL, NULL, NULL, NULL, NULL, &Common)) ; - - FAIL (klu_solve (NULL, NULL, 0, 0, NULL, NULL)) ; - FAIL (klu_solve (NULL, NULL, 0, 0, NULL, &Common)) ; - - FAIL (klu_z_solve (NULL, NULL, 0, 0, NULL, NULL)) ; - FAIL (klu_z_solve (NULL, NULL, 0, 0, NULL, &Common)) ; - - FAIL (klu_tsolve (NULL, NULL, 0, 0, NULL, NULL)) ; - FAIL (klu_tsolve (NULL, NULL, 0, 0, NULL, &Common)) ; - - FAIL (klu_z_tsolve (NULL, NULL, 0, 0, NULL, 0, NULL)) ; - FAIL (klu_z_tsolve (NULL, NULL, 0, 0, NULL, 0, &Common)) ; - - FAIL (klu_malloc (0, 0, NULL)) ; - FAIL (klu_malloc (0, 0, &Common)) ; - FAIL (klu_malloc (Int_MAX, 1, &Common)) ; - - FAIL (klu_realloc (0, 0, 0, NULL, NULL)) ; - FAIL (klu_realloc (0, 0, 0, NULL, &Common)) ; - FAIL (klu_realloc (Int_MAX, 1, 0, NULL, &Common)) ; - Gunk = (Int *) klu_realloc (1, 0, sizeof (Int), NULL, &Common) ; - OK (Gunk) ; - OK (klu_realloc (Int_MAX, 1, sizeof (Int), Gunk, &Common)) ; - OK (Common.status == KLU_TOO_LARGE) ; - klu_free (Gunk, 1, sizeof (Int), &Common) ; - - /* ---------------------------------------------------------------------- */ - /* mangle the matrix, and other error checking */ - /* ---------------------------------------------------------------------- */ - - printf ("\nerror handling:\n") ; - Symbolic = klu_analyze (n, Ap, Ai, &Common) ; - OK (Symbolic) ; - - Xx = X->x ; - if (nz > 0) - { - - /* ------------------------------------------------------------------ */ - /* row index out of bounds */ - /* ------------------------------------------------------------------ */ - - save = Ai [0] ; - Ai [0] = -1 ; - FAIL (klu_analyze (n, Ap, Ai, &Common)) ; - if (isreal) - { - FAIL (klu_scale (1, n, Ap, Ai, Ax, Xx, Puser, &Common)) ; - } - else - { - FAIL (klu_z_scale (1, n, Ap, Ai, Ax, Xx, Puser, &Common)) ; - } - Ai [0] = save ; - - /* ------------------------------------------------------------------ */ - /* row index out of bounds */ - /* ------------------------------------------------------------------ */ - - save = Ai [0] ; - Ai [0] = Int_MAX ; - FAIL (klu_analyze (n, Ap, Ai, &Common)) ; - if (isreal) - { - FAIL (klu_scale (1, n, Ap, Ai, Ax, Xx, Puser, &Common)) ; - } - else - { - FAIL (klu_z_scale (1, n, Ap, Ai, Ax, Xx, Puser, &Common)) ; - } - Ai [0] = save ; - - /* ------------------------------------------------------------------ */ - /* column pointers mangled */ - /* ------------------------------------------------------------------ */ - - save = Ap [n] ; - Ap [n] = -1 ; - FAIL (klu_analyze (n, Ap, Ai, &Common)) ; - if (isreal) - { - FAIL (klu_scale (1, n, Ap, Ai, Ax, Xx, Puser, &Common)) ; - } - else - { - FAIL (klu_z_scale (1, n, Ap, Ai, Ax, Xx, Puser, &Common)) ; - } - Ap [n] = save ; - - /* ------------------------------------------------------------------ */ - /* column pointers mangled */ - /* ------------------------------------------------------------------ */ - - save = Ap [n] ; - Ap [n] = Ap [n-1] - 1 ; - FAIL (klu_analyze (n, Ap, Ai, &Common)) ; - if (isreal) - { - FAIL (klu_scale (1, n, Ap, Ai, Ax, Xx, Puser, &Common)) ; - } - else - { - FAIL (klu_z_scale (1, n, Ap, Ai, Ax, Xx, Puser, &Common)) ; - } - Ap [n] = save ; - - /* ------------------------------------------------------------------ */ - /* duplicates */ - /* ------------------------------------------------------------------ */ - - if (n > 1 && Ap [1] - Ap [0] > 1) - { - save = Ai [1] ; - Ai [1] = Ai [0] ; - FAIL (klu_analyze (n, Ap, Ai, &Common)) ; - if (isreal) - { - FAIL (klu_scale (1, n, Ap, Ai, Ax, Xx, Puser, &Common)) ; - } - else - { - FAIL (klu_z_scale (1, n, Ap, Ai, Ax, Xx, Puser, &Common)) ; - } - Ai [1] = save ; - } - - /* ------------------------------------------------------------------ */ - /* invalid ordering */ - /* ------------------------------------------------------------------ */ - - save = Common.ordering ; - Common.ordering = 42 ; - FAIL (klu_analyze (n, Ap, Ai, &Common)) ; - Common.ordering = save ; - - /* ------------------------------------------------------------------ */ - /* invalid ordering (klu_cholmod, with NULL user_ordering) */ - /* ------------------------------------------------------------------ */ - - save = Common.ordering ; - Common.user_order = NULL ; - Common.ordering = 3 ; - FAIL (klu_analyze (n, Ap, Ai, &Common)) ; - Common.ordering = save ; - } - - /* ---------------------------------------------------------------------- */ - /* tests with valid symbolic factorization */ - /* ---------------------------------------------------------------------- */ - - Common.halt_if_singular = FALSE ; - Common.scale = 0 ; - Numeric = NULL ; - - if (nz > 0) - { - - /* ------------------------------------------------------------------ */ - /* Int overflow */ - /* ------------------------------------------------------------------ */ - - if (n == 100) - { - Common.ordering = 2 ; - Symbolic2 = klu_analyze (n, Ap, Ai, &Common) ; - OK (Symbolic2) ; - Common.memgrow = Int_MAX ; - if (isreal) - { - Numeric = klu_factor (Ap, Ai, Ax, Symbolic2, &Common) ; - } - else - { - Numeric = klu_z_factor (Ap, Ai, Ax, Symbolic2, &Common) ; - } - Common.memgrow = 1.2 ; - Common.ordering = 0 ; - klu_free_symbolic (&Symbolic2, &Common) ; - klu_free_numeric (&Numeric, &Common) ; - } - - /* ------------------------------------------------------------------ */ - /* Int overflow again */ - /* ------------------------------------------------------------------ */ - - Common.initmem = Int_MAX ; - Common.initmem_amd = Int_MAX ; - if (isreal) - { - Numeric = klu_factor (Ap, Ai, Ax, Symbolic, &Common) ; - } - else - { - Numeric = klu_z_factor (Ap, Ai, Ax, Symbolic, &Common) ; - } - Common.initmem = 10 ; - Common.initmem_amd = 1.2 ; - klu_free_numeric (&Numeric, &Common) ; - - /* ------------------------------------------------------------------ */ - /* mangle the matrix */ - /* ------------------------------------------------------------------ */ - - save = Ai [0] ; - Ai [0] = -1 ; - - if (isreal) - { - Numeric = klu_factor (Ap, Ai, Ax, Symbolic, &Common) ; - } - else - { - Numeric = klu_z_factor (Ap, Ai, Ax, Symbolic, &Common) ; - } - FAIL (Numeric) ; - Ai [0] = save ; - - /* ------------------------------------------------------------------ */ - /* nan and inf handling */ - /* ------------------------------------------------------------------ */ - - xsave = Ax [0] ; - Ax [0] = one [0] / zero [0] ; - if (isreal) - { - Numeric = klu_factor (Ap, Ai, Ax, Symbolic, &Common) ; - klu_rcond (Symbolic, Numeric, &Common) ; - klu_condest (Ap, Ax, Symbolic, Numeric, &Common) ; - } - else - { - Numeric = klu_z_factor (Ap, Ai, Ax, Symbolic, &Common) ; - klu_z_rcond (Symbolic, Numeric, &Common) ; - klu_z_condest (Ap, Ax, Symbolic, Numeric, &Common) ; - } - printf ("Nan case: rcond %g condest %g\n", - Common.rcond, Common.condest) ; - OK (Numeric) ; - Ax [0] = xsave ; - - /* ------------------------------------------------------------------ */ - /* mangle the matrix again */ - /* ------------------------------------------------------------------ */ - - save = Ai [0] ; - Ai [0] = -1 ; - if (isreal) - { - FAIL (klu_refactor (Ap, Ai, Ax, Symbolic, Numeric, &Common)) ; - } - else - { - FAIL (klu_z_refactor (Ap, Ai, Ax, Symbolic, Numeric, &Common)) ; - } - Ai [0] = save ; - - /* ------------------------------------------------------------------ */ - /* all zero */ - /* ------------------------------------------------------------------ */ - - A2 = CHOLMOD_copy_sparse (A, &ch) ; - A2x = A2->x ; - for (k = 0 ; k < nz * (isreal ? 1:2) ; k++) - { - A2x [k] = 0 ; - } - for (Common.halt_if_singular = 0 ; Common.halt_if_singular <= 1 ; - Common.halt_if_singular++) - { - for (Common.scale = -1 ; Common.scale <= 2 ; Common.scale++) - { - if (isreal) - { - klu_refactor (Ap, Ai, A2x, Symbolic, Numeric, &Common) ; - klu_condest (Ap, A2x, Symbolic, Numeric, &Common) ; - } - else - { - klu_z_refactor (Ap, Ai, A2x, Symbolic, Numeric, &Common) ; - klu_z_condest (Ap, A2x, Symbolic, Numeric, &Common) ; - } - OK (Common.status = KLU_SINGULAR) ; - } - } - CHOLMOD_free_sparse (&A2, &ch) ; - - /* ------------------------------------------------------------------ */ - /* all one, or all 1i for complex case */ - /* ------------------------------------------------------------------ */ - - A2 = CHOLMOD_copy_sparse (A, &ch) ; - A2x = A2->x ; - for (k = 0 ; k < nz ; k++) - { - if (isreal) - { - A2x [k] = 1 ; - } - else - { - A2x [2*k ] = 0 ; - A2x [2*k+1] = 1 ; - } - } - Common.halt_if_singular = 0 ; - Common.scale = 0 ; - if (isreal) - { - klu_refactor (Ap, Ai, A2x, Symbolic, Numeric, &Common) ; - klu_condest (Ap, A2x, Symbolic, Numeric, &Common) ; - } - else - { - klu_z_refactor (Ap, Ai, A2x, Symbolic, Numeric, &Common) ; - klu_z_condest (Ap, A2x, Symbolic, Numeric, &Common) ; - } - OK (Common.status = KLU_SINGULAR) ; - CHOLMOD_free_sparse (&A2, &ch) ; - } - - klu_free_symbolic (&Symbolic, &Common) ; - if (isreal) - { - klu_free_numeric (&Numeric, &Common) ; - } - else - { - klu_z_free_numeric (&Numeric, &Common) ; - } - - /* ---------------------------------------------------------------------- */ - /* free problem and quit */ - /* ---------------------------------------------------------------------- */ - - CHOLMOD_free_dense (&X, &ch) ; - CHOLMOD_free_dense (&B, &ch) ; - CHOLMOD_free_sparse (&A, &ch) ; - free (Puser) ; - free (Quser) ; - CHOLMOD_finish (&ch) ; - fprintf (stderr, " maxerr %10.3e", maxerr) ; - printf (" maxerr %10.3e", maxerr) ; - if (maxerr < 1e-8) - { - fprintf (stderr, " test passed") ; - printf (" test passed") ; - } - else - { - fprintf (stderr, " test FAILED") ; - printf (" test FAILED") ; - } - if (isnan) - { - fprintf (stderr, " *") ; - printf (" *") ; - } - fprintf (stderr, "\n") ; - printf ("\n-----------------------------------------------------------\n") ; - return (0) ; -} diff --git a/ThirdParty/SuiteSparse/KLU/Tcov/klutests b/ThirdParty/SuiteSparse/KLU/Tcov/klutests deleted file mode 100755 index 9b110bd34c..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Tcov/klutests +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/csh - -# 57 unique statements: -./klutest < ../Matrix/impcol_a.mtx - -# 20: -./klutest < ../Matrix/GD99_cc.mtx - -# 17: -./klutest < ../Matrix/two.mtx - -# 10: -./klutest < ../Matrix/w156.mtx - -# 3, xsize memgrow in klu_kernel -./klutest < ../Matrix/arrow.mtx - -# 3, xsize memgrow in klu_kernel, 1 in klu_z_condest, -./klutest < ../Matrix/arrowc.mtx - -# 2 in klu_z_kernel (if pivot == 0 and halt_if_singular, and in complex divide) -./klutest < ../Matrix/onec.mtx - -# 1 in klu_kernel (if pivot == 0 and halt if singular) -./klutest < ../Matrix/one.mtx - -# 1 in klu_z_condest: -./klutest < ../Matrix/1c.mtx - -# 1 in klu_z_condest: -./klutest < ../Matrix/ctina.mtx diff --git a/ThirdParty/SuiteSparse/KLU/Tcov/vklultests b/ThirdParty/SuiteSparse/KLU/Tcov/vklultests deleted file mode 100755 index 8aa8dcf540..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Tcov/vklultests +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/csh - -# 57 unique statements: -valgrind ./klultest < ../Matrix/impcol_a.mtx - -# 20: -valgrind ./klultest < ../Matrix/GD99_cc.mtx - -# 17: -valgrind ./klultest < ../Matrix/two.mtx - -# 10: -valgrind ./klultest < ../Matrix/w156.mtx - -# 3, xsize memgrow in klu_kernel -valgrind ./klultest < ../Matrix/arrow.mtx - -# 3, xsize memgrow in klu_kernel, 1 in klu_z_condest, -valgrind ./klultest < ../Matrix/arrowc.mtx - -# 2 in klu_z_kernel (if pivot == 0 and halt_if_singular, and in complex divide) -valgrind ./klultest < ../Matrix/onec.mtx - -# 1 in klu_kernel (if pivot == 0 and halt if singular) -valgrind ./klultest < ../Matrix/one.mtx - -# 1 in klu_z_condest: -valgrind ./klultest < ../Matrix/1c.mtx - -# 1 in klu_z_condest: -valgrind ./klultest < ../Matrix/ctina.mtx diff --git a/ThirdParty/SuiteSparse/KLU/Tcov/vklutests b/ThirdParty/SuiteSparse/KLU/Tcov/vklutests deleted file mode 100755 index 7dfada9023..0000000000 --- a/ThirdParty/SuiteSparse/KLU/Tcov/vklutests +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/csh - -# 57 unique statements: -valgrind ./klutest < ../Matrix/impcol_a.mtx - -# 20: -valgrind ./klutest < ../Matrix/GD99_cc.mtx - -# 17: -valgrind ./klutest < ../Matrix/two.mtx - -# 10: -valgrind ./klutest < ../Matrix/w156.mtx - -# 3, xsize memgrow in klu_kernel -valgrind ./klutest < ../Matrix/arrow.mtx - -# 3, xsize memgrow in klu_kernel, 1 in klu_z_condest, -valgrind ./klutest < ../Matrix/arrowc.mtx - -# 2 in klu_z_kernel (if pivot == 0 and halt_if_singular, and in complex divide) -valgrind ./klutest < ../Matrix/onec.mtx - -# 1 in klu_kernel (if pivot == 0 and halt if singular) -valgrind ./klutest < ../Matrix/one.mtx - -# 1 in klu_z_condest: -valgrind ./klutest < ../Matrix/1c.mtx - -# 1 in klu_z_condest: -valgrind ./klutest < ../Matrix/ctina.mtx diff --git a/ThirdParty/SuiteSparse/KLU/User/Makefile b/ThirdParty/SuiteSparse/KLU/User/Makefile deleted file mode 100644 index b01a389c74..0000000000 --- a/ThirdParty/SuiteSparse/KLU/User/Makefile +++ /dev/null @@ -1,28 +0,0 @@ -default: all - -include ../../SuiteSparse_config/SuiteSparse_config.mk - -all: libklu_cholmod.a - -I = -I../../CHOLMOD/Include -I../../SuiteSparse_config \ - -I../Include -I../../AMD/Include \ - -I../../BTF/Include -I../../COLAMD/Include - -libklu_cholmod.a: library klu_cholmod.c klu_cholmod.h - $(CC) $(CF) $(I) -c klu_cholmod.c - $(ARCHIVE) libklu_cholmod.a klu_cholmod.o - - $(RANLIB) libklu_cholmod.a - -distclean: purge - -purge: clean - - $(RM) -r $(PURGE) - -clean: - - $(RM) -r $(CLEAN) - -library: - ( cd ../../AMD ; $(MAKE) library ) - ( cd ../../COLAMD ; $(MAKE) library ) - ( cd ../../CHOLMOD/Lib ; $(MAKE) ) - ( cd ../../SuiteSparse_config ; $(MAKE) ) diff --git a/ThirdParty/SuiteSparse/KLU/User/README.txt b/ThirdParty/SuiteSparse/KLU/User/README.txt deleted file mode 100644 index 04195b8e12..0000000000 --- a/ThirdParty/SuiteSparse/KLU/User/README.txt +++ /dev/null @@ -1,4 +0,0 @@ -This directory contains a sample user-ordering function, klu_cholmod. -Its use (and the use of CHOLMOD) is optional. - -Timothy A. Davis, http://www.suitesparse.com diff --git a/ThirdParty/SuiteSparse/KLU/User/klu_cholmod.c b/ThirdParty/SuiteSparse/KLU/User/klu_cholmod.c deleted file mode 100644 index c1c1872e44..0000000000 --- a/ThirdParty/SuiteSparse/KLU/User/klu_cholmod.c +++ /dev/null @@ -1,108 +0,0 @@ -/* ========================================================================== */ -/* === klu_cholmod ========================================================== */ -/* ========================================================================== */ - -/* klu_cholmod: user-defined ordering function to interface KLU to CHOLMOD. - * - * This routine is an example of a user-provided ordering function for KLU. - * Its return value is klu_cholmod's estimate of max (nnz(L),nnz(U)): - * 0 if error, - * -1 if OK, but estimate of max (nnz(L),nnz(U)) not computed - * > 0 if OK and estimate computed. - * - * This function can be assigned to KLU's Common->user_order function pointer. - */ - -#include "klu_cholmod.h" -#include "cholmod.h" -#define TRUE 1 -#define FALSE 0 - -int klu_cholmod -( - /* inputs */ - int n, /* A is n-by-n */ - int Ap [ ], /* column pointers */ - int Ai [ ], /* row indices */ - /* outputs */ - int Perm [ ], /* fill-reducing permutation */ - /* user-defined */ - klu_common *Common /* user-defined data is in Common->user_data */ -) -{ - double one [2] = {1,0}, zero [2] = {0,0}, lnz = 0 ; - cholmod_sparse Amatrix, *A, *AT, *S ; - cholmod_factor *L ; - cholmod_common cm ; - int *P ; - int k, symmetric ; - - if (Ap == NULL || Ai == NULL || Perm == NULL || n < 0) - { - /* invalid inputs */ - return (0) ; - } - - /* start CHOLMOD */ - cholmod_start (&cm) ; - cm.supernodal = CHOLMOD_SIMPLICIAL ; - cm.print = 0 ; - - /* construct a CHOLMOD version of the input matrix A */ - A = &Amatrix ; - A->nrow = n ; /* A is n-by-n */ - A->ncol = n ; - A->nzmax = Ap [n] ; /* with nzmax entries */ - A->packed = TRUE ; /* there is no A->nz array */ - A->stype = 0 ; /* A is unsymmetric */ - A->itype = CHOLMOD_INT ; - A->xtype = CHOLMOD_PATTERN ; - A->dtype = CHOLMOD_DOUBLE ; - A->nz = NULL ; - A->p = Ap ; /* column pointers */ - A->i = Ai ; /* row indices */ - A->x = NULL ; /* no numerical values */ - A->z = NULL ; - A->sorted = FALSE ; /* columns of A are not sorted */ - - /* get the user_data; default is symmetric if user_data is NULL */ - symmetric = (Common->user_data == NULL) ? TRUE : - (((int *) (Common->user_data)) [0] != 0) ; - - /* AT = pattern of A' */ - AT = cholmod_transpose (A, 0, &cm) ; - if (symmetric) - { - /* S = the symmetric pattern of A+A' */ - S = cholmod_add (A, AT, one, zero, FALSE, FALSE, &cm) ; - cholmod_free_sparse (&AT, &cm) ; - if (S != NULL) - { - S->stype = 1 ; - } - } - else - { - /* S = A'. CHOLMOD will order S*S', which is A'*A */ - S = AT ; - } - - /* order and analyze S or S*S' */ - L = cholmod_analyze (S, &cm) ; - - /* copy the permutation from L to the output */ - if (L != NULL) - { - P = L->Perm ; - for (k = 0 ; k < n ; k++) - { - Perm [k] = P [k] ; - } - lnz = cm.lnz ; - } - - cholmod_free_sparse (&S, &cm) ; - cholmod_free_factor (&L, &cm) ; - cholmod_finish (&cm) ; - return (lnz) ; -} diff --git a/ThirdParty/SuiteSparse/KLU/User/klu_cholmod.h b/ThirdParty/SuiteSparse/KLU/User/klu_cholmod.h deleted file mode 100644 index 8f532a23f1..0000000000 --- a/ThirdParty/SuiteSparse/KLU/User/klu_cholmod.h +++ /dev/null @@ -1,7 +0,0 @@ -#include "klu.h" - -int klu_cholmod (int n, int Ap [ ], int Ai [ ], int Perm [ ], klu_common *) ; - -SuiteSparse_long klu_l_cholmod (SuiteSparse_long n, SuiteSparse_long Ap [ ], - SuiteSparse_long Ai [ ], SuiteSparse_long Perm [ ], klu_l_common *) ; - diff --git a/ThirdParty/SuiteSparse/KLU/User/klu_l_cholmod.c b/ThirdParty/SuiteSparse/KLU/User/klu_l_cholmod.c deleted file mode 100644 index 0307546bd2..0000000000 --- a/ThirdParty/SuiteSparse/KLU/User/klu_l_cholmod.c +++ /dev/null @@ -1,108 +0,0 @@ -/* ========================================================================== */ -/* === klu_cholmod ========================================================== */ -/* ========================================================================== */ - -/* klu_l_cholmod: user-defined ordering function to interface KLU to CHOLMOD. - * - * This routine is an example of a user-provided ordering function for KLU. - * Its return value is klu_l_cholmod's estimate of max (nnz(L),nnz(U)): - * 0 if error, - * -1 if OK, but estimate of max (nnz(L),nnz(U)) not computed - * > 0 if OK and estimate computed. - * - * This function can be assigned to KLU's Common->user_order function pointer. - */ - -#include "klu_cholmod.h" -#include "cholmod.h" -#define TRUE 1 -#define FALSE 0 - -SuiteSparse_long klu_l_cholmod -( - /* inputs */ - SuiteSparse_long n, /* A is n-by-n */ - SuiteSparse_long Ap [ ], /* column pointers */ - SuiteSparse_long Ai [ ], /* row indices */ - /* outputs */ - SuiteSparse_long Perm [ ], /* fill-reducing permutation */ - /* user-defined */ - klu_l_common *Common /* user-defined data is in Common->user_data */ -) -{ - double one [2] = {1,0}, zero [2] = {0,0}, lnz = 0 ; - cholmod_sparse Amatrix, *A, *AT, *S ; - cholmod_factor *L ; - cholmod_common cm ; - SuiteSparse_long *P ; - SuiteSparse_long k, symmetric ; - - if (Ap == NULL || Ai == NULL || Perm == NULL || n < 0) - { - /* invalid inputs */ - return (0) ; - } - - /* start CHOLMOD */ - cholmod_l_start (&cm) ; - cm.supernodal = CHOLMOD_SIMPLICIAL ; - cm.print = 0 ; - - /* construct a CHOLMOD version of the input matrix A */ - A = &Amatrix ; - A->nrow = n ; /* A is n-by-n */ - A->ncol = n ; - A->nzmax = Ap [n] ; /* with nzmax entries */ - A->packed = TRUE ; /* there is no A->nz array */ - A->stype = 0 ; /* A is unsymmetric */ - A->itype = CHOLMOD_INT ; - A->xtype = CHOLMOD_PATTERN ; - A->dtype = CHOLMOD_DOUBLE ; - A->nz = NULL ; - A->p = Ap ; /* column pointers */ - A->i = Ai ; /* row indices */ - A->x = NULL ; /* no numerical values */ - A->z = NULL ; - A->sorted = FALSE ; /* columns of A are not sorted */ - - /* get the user_data; default is symmetric if user_data is NULL */ - symmetric = (Common->user_data == NULL) ? TRUE : - (((SuiteSparse_long *) (Common->user_data)) [0] != 0) ; - - /* AT = pattern of A' */ - AT = cholmod_l_transpose (A, 0, &cm) ; - if (symmetric) - { - /* S = the symmetric pattern of A+A' */ - S = cholmod_l_add (A, AT, one, zero, FALSE, FALSE, &cm) ; - cholmod_l_free_sparse (&AT, &cm) ; - if (S != NULL) - { - S->stype = 1 ; - } - } - else - { - /* S = A'. CHOLMOD will order S*S', which is A'*A */ - S = AT ; - } - - /* order and analyze S or S*S' */ - L = cholmod_l_analyze (S, &cm) ; - - /* copy the permutation from L to the output */ - if (L != NULL) - { - P = L->Perm ; - for (k = 0 ; k < n ; k++) - { - Perm [k] = P [k] ; - } - lnz = cm.lnz ; - } - - cholmod_l_free_sparse (&S, &cm) ; - cholmod_l_free_factor (&L, &cm) ; - cholmod_l_finish (&cm) ; - return (lnz) ; -} diff --git a/ThirdParty/SuiteSparse/KLU/build/.gitignore b/ThirdParty/SuiteSparse/KLU/build/.gitignore new file mode 100644 index 0000000000..52e15321b7 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/build/.gitignore @@ -0,0 +1,4 @@ +# Ignore all files except this file. +* +*/ +!.gitignore diff --git a/ThirdParty/SuiteSparse/KLU/cmake_modules/FindKLU.cmake b/ThirdParty/SuiteSparse/KLU/cmake_modules/FindKLU.cmake new file mode 100644 index 0000000000..cd3f4040e4 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/cmake_modules/FindKLU.cmake @@ -0,0 +1,129 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/KLU/cmake_modules/FindKLU.cmake +#------------------------------------------------------------------------------- + +# The following copyright and license applies to just this file only, not to +# the library itself: +# FindKLU.cmake, Copyright (c) 2022-2023, Timothy A. Davis. All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# Finds the KLU include file and compiled library and sets: + +# KLU_INCLUDE_DIR - where to find klu.h +# KLU_LIBRARY - dynamic KLU library +# KLU_STATIC - static KLU library +# KLU_LIBRARIES - libraries when using KLU +# KLU_FOUND - true if KLU found + +# set ``KLU_ROOT`` to a KLU installation root to +# tell this module where to look. + +# All the Find*.cmake files in SuiteSparse are installed by 'make install' into +# /usr/local/lib/cmake/SuiteSparse (where '/usr/local' is the +# ${CMAKE_INSTALL_PREFIX}). To access this file, place the following commands +# in your CMakeLists.txt file. See also SuiteSparse/Example/CMakeLists.txt: +# +# set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} +# ${CMAKE_INSTALL_PREFIX}/lib/cmake/SuiteSparse ) + +#------------------------------------------------------------------------------- + +# include files for KLU +find_path ( KLU_INCLUDE_DIR + NAMES klu.h + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/KLU + HINTS ${CMAKE_SOURCE_DIR}/../KLU + PATH_SUFFIXES include Include +) + +# dynamic KLU library (or static if no dynamic library was built) +find_library ( KLU_LIBRARY + NAMES klu klu_static + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/KLU + HINTS ${CMAKE_SOURCE_DIR}/../KLU + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( MSVC ) + set ( STATIC_NAME klu_static ) +else ( ) + set ( STATIC_NAME klu ) + set ( save ${CMAKE_FIND_LIBRARY_SUFFIXES} ) + set ( CMAKE_FIND_LIBRARY_SUFFIXES + ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES} ) +endif ( ) + +# static KLU library +find_library ( KLU_STATIC + NAMES ${STATIC_NAME} + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/KLU + HINTS ${CMAKE_SOURCE_DIR}/../KLU + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( NOT MSVC ) + # restore the CMAKE_FIND_LIBRARY_SUFFIXES variable + set ( CMAKE_FIND_LIBRARY_SUFFIXES ${save} ) +endif ( ) + +# get version of the library from the dynamic library name +get_filename_component ( KLU_LIBRARY ${KLU_LIBRARY} REALPATH ) +get_filename_component ( KLU_FILENAME ${KLU_LIBRARY} NAME ) +string ( + REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" + KLU_VERSION + ${KLU_FILENAME} +) + +# set ( KLU_VERSION "" ) +if ( EXISTS "${KLU_INCLUDE_DIR}" AND NOT KLU_VERSION ) + # if the version does not appear in the filename, read the include file + file ( STRINGS ${KLU_INCLUDE_DIR}/klu.h KLU_MAJOR_STR + REGEX "define KLU_MAIN_VERSION" ) + file ( STRINGS ${KLU_INCLUDE_DIR}/klu.h KLU_MINOR_STR + REGEX "define KLU_SUB_VERSION" ) + file ( STRINGS ${KLU_INCLUDE_DIR}/klu.h KLU_PATCH_STR + REGEX "define KLU_SUBSUB_VERSION" ) + message ( STATUS "major: ${KLU_MAJOR_STR}" ) + message ( STATUS "minor: ${KLU_MINOR_STR}" ) + message ( STATUS "patch: ${KLU_PATCH_STR}" ) + string ( REGEX MATCH "[0-9]+" KLU_MAJOR ${KLU_MAJOR_STR} ) + string ( REGEX MATCH "[0-9]+" KLU_MINOR ${KLU_MINOR_STR} ) + string ( REGEX MATCH "[0-9]+" KLU_PATCH ${KLU_PATCH_STR} ) + set (KLU_VERSION "${KLU_MAJOR}.${KLU_MINOR}.${KLU_PATCH}") +endif ( ) + +set ( KLU_LIBRARIES ${KLU_LIBRARY} ) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args ( KLU + REQUIRED_VARS KLU_LIBRARY KLU_INCLUDE_DIR + VERSION_VAR KLU_VERSION + ) + +mark_as_advanced ( + KLU_INCLUDE_DIR + KLU_LIBRARY + KLU_STATIC + KLU_LIBRARIES + ) + +if ( KLU_FOUND ) + message ( STATUS "KLU version: ${KLU_VERSION}" ) + message ( STATUS "KLU include: ${KLU_INCLUDE_DIR}" ) + message ( STATUS "KLU library: ${KLU_LIBRARY}" ) + message ( STATUS "KLU static: ${KLU_STATIC}" ) +else ( ) + message ( STATUS "KLU not found" ) + set ( KLU_INCLUDE_DIR "" ) + set ( KLU_LIBRARIES "" ) + set ( KLU_LIBRARY "" ) + set ( KLU_STATIC "" ) +endif ( ) + diff --git a/ThirdParty/SuiteSparse/KLU/cmake_modules/FindKLU_CHOLMOD.cmake b/ThirdParty/SuiteSparse/KLU/cmake_modules/FindKLU_CHOLMOD.cmake new file mode 100644 index 0000000000..d3b3663228 --- /dev/null +++ b/ThirdParty/SuiteSparse/KLU/cmake_modules/FindKLU_CHOLMOD.cmake @@ -0,0 +1,137 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/KLU/cmake_modules/FindKLU_CHOLMOD.cmake +#------------------------------------------------------------------------------- + +# The following copyright and license applies to just this file only, not to +# the library itself: +# FindKLU_CHOLMOD.cmake, Copyright (c) 2022-2023, Timothy A. Davis. All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# Finds the KLU_CHOLMOD include file and compiled library and sets: + +# KLU_CHOLMOD_INCLUDE_DIR - where to find klu_cholmod.h +# KLU_CHOLMOD_LIBRARY - compiled KLU_CHOLMOD library +# KLU_CHOLMOD_LIBRARIES - libraries when using KLU_CHOLMOD +# KLU_CHOLMOD_FOUND - true if KLU_CHOLMOD found + +# set ``KLU_CHOLMOD_ROOT`` to a KLU_CHOLMOD installation root to +# tell this module where to look. + +# All the Find*.cmake files in SuiteSparse are installed by 'make install' into +# /usr/local/lib/cmake/SuiteSparse (where '/usr/local' is the +# ${CMAKE_INSTALL_PREFIX}). To access this file, place the following commands +# in your CMakeLists.txt file. See also SuiteSparse/Example/CMakeLists.txt: +# +# set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} +# ${CMAKE_INSTALL_PREFIX}/lib/cmake/SuiteSparse ) + +#------------------------------------------------------------------------------- + +# include files for KLU_CHOLMOD +find_path ( KLU_CHOLMOD_INCLUDE_DIR + NAMES klu_cholmod.h + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/KLU/User + HINTS ${CMAKE_SOURCE_DIR}/../KLU/User + PATH_SUFFIXES include Include +) + +# include files for KLU +find_path ( KLU_INCLUDE_DIR + NAMES klu.h + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/KLU + HINTS ${CMAKE_SOURCE_DIR}/../KLU + PATH_SUFFIXES include Include +) + +# dynamic KLU_CHOLMOD library (or static if no dynamic library was built) +find_library ( KLU_CHOLMOD_LIBRARY + NAMES klu_cholmod klu_cholmod_static + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/KLU/User + HINTS ${CMAKE_SOURCE_DIR}/../KLU/User + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( MSVC ) + set ( STATIC_NAME klu_cholmod_static ) +else ( ) + set ( STATIC_NAME klu_cholmod ) + set ( save ${CMAKE_FIND_LIBRARY_SUFFIXES} ) + set ( CMAKE_FIND_LIBRARY_SUFFIXES + ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES} ) +endif ( ) + +# static KLU_CHOLMOD library +find_library ( KLU_CHOLMOD_STATIC + NAMES ${STATIC_NAME} + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/KLU/User + HINTS ${CMAKE_SOURCE_DIR}/../KLU/User + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( NOT MSVC ) + # restore the CMAKE_FIND_LIBRARY_SUFFIXES variable + set ( CMAKE_FIND_LIBRARY_SUFFIXES ${save} ) +endif ( ) + +# get version of the library from the dynamic library name +get_filename_component ( KLU_CHOLMOD_LIBRARY ${KLU_CHOLMOD_LIBRARY} REALPATH ) +get_filename_component ( KLU_CHOLMOD_FILENAME ${KLU_CHOLMOD_LIBRARY} NAME ) +string ( + REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" + KLU_CHOLMOD_VERSION + ${KLU_CHOLMOD_FILENAME} +) + +# set ( KLU_CHOLMOD_VERSION "" ) +if ( EXISTS "${KLU_INCLUDE_DIR}" AND NOT KLU_CHOLMOD_VERSION ) + # if the version does not appear in the filename, read the include file + file ( STRINGS ${KLU_INCLUDE_DIR}/klu.h KLU_CHOLMOD_MAJOR_STR + REGEX "define KLU_MAIN_VERSION" ) + file ( STRINGS ${KLU_INCLUDE_DIR}/klu.h KLU_CHOLMOD_MINOR_STR + REGEX "define KLU_SUB_VERSION" ) + file ( STRINGS ${KLU_INCLUDE_DIR}/klu.h KLU_CHOLMOD_PATCH_STR + REGEX "define KLU_SUBSUB_VERSION" ) + message ( STATUS "major: ${KLU_CHOLMOD_MAJOR_STR}" ) + message ( STATUS "minor: ${KLU_CHOLMOD_MINOR_STR}" ) + message ( STATUS "patch: ${KLU_CHOLMOD_PATCH_STR}" ) + string ( REGEX MATCH "[0-9]+" KLU_CHOLMOD_MAJOR ${KLU_CHOLMOD_MAJOR_STR} ) + string ( REGEX MATCH "[0-9]+" KLU_CHOLMOD_MINOR ${KLU_CHOLMOD_MINOR_STR} ) + string ( REGEX MATCH "[0-9]+" KLU_CHOLMOD_PATCH ${KLU_CHOLMOD_PATCH_STR} ) + set (KLU_CHOLMOD_VERSION "${KLU_CHOLMOD_MAJOR}.${KLU_CHOLMOD_MINOR}.${KLU_CHOLMOD_PATCH}") +endif ( ) + +set ( KLU_CHOLMOD_LIBRARIES ${KLU_CHOLMOD_LIBRARY} ) + +include (FindPackageHandleStandardArgs) + +find_package_handle_standard_args ( KLU_CHOLMOD + REQUIRED_VARS KLU_CHOLMOD_LIBRARY KLU_CHOLMOD_INCLUDE_DIR + VERSION_VAR KLU_CHOLMOD_VERSION +) + +mark_as_advanced ( + KLU_CHOLMOD_INCLUDE_DIR + KLU_CHOLMOD_LIBRARY + KLU_CHOLMOD_STATIC + KLU_CHOLMOD_LIBRARIES +) + +if ( KLU_CHOLMOD_FOUND ) + message ( STATUS "KLU_CHOLMOD version: ${KLU_CHOLMOD_VERSION}" ) + message ( STATUS "KLU_CHOLMOD include: ${KLU_CHOLMOD_INCLUDE_DIR}" ) + message ( STATUS "KLU_CHOLMOD library: ${KLU_CHOLMOD_LIBRARY}" ) + message ( STATUS "KLU_CHOLMOD static: ${KLU_CHOLMOD_STATIC}" ) +else ( ) + message ( STATUS "KLU_CHOLMOD not found" ) + set ( KLU_CHOLMOD_INCLUDE_DIR "" ) + set ( KLU_CHOLMOD_LIBRARIES "" ) + set ( KLU_CHOLMOD_LIBRARY "" ) + set ( KLU_CHOLMOD_STATIC "" ) +endif ( ) + diff --git a/ThirdParty/SuiteSparse/LICENSE.txt b/ThirdParty/SuiteSparse/LICENSE.txt index 445759392d..0e51e9e0c8 100644 --- a/ThirdParty/SuiteSparse/LICENSE.txt +++ b/ThirdParty/SuiteSparse/LICENSE.txt @@ -1,11 +1,57 @@ +This file lists all licenses for all packages in SuiteSparse, for your +convenience. Each package has its own separate license, which can be +found in the lists below. + +==> SPEX/License/license.txt <== + + SPEX: a Sparse Left-looking Integer-Preserving LU Factorization + + Copyright (c) 2019-2022, Christopher Lourenco, JinHao Chen, Erick Moreno- + Centeno, and Timothy A. Davis. + + Available at: + + https://github.com/clouren/SPEX + http://suitesparse.com + + Contact Chris Lourenco, chrisjlourenco@gmail.com, or Tim Davis + (timdavis@aldenmath.com or DrTimothyAldenDavis@gmail.com) for a commercial + license. + + -------------------------------------------------------------------------------- + + SPEX is free software; you can redistribute it and/or modify + it under the terms of either: + + * the GNU Lesser General Public License as published by the Free + Software Foundation; either version 3 of the License, or (at your + option) any later version. + + or + + * the GNU General Public License as published by the Free Software + Foundation; either version 2 of the License, or (at your option) any + later version. + + or both in parallel, as here. + + SPEX is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received copies of the GNU General Public License and the + GNU Lesser General Public License along with this software. If not, + see https://www.gnu.org/licenses/. + ==> AMD/Doc/License.txt <== - AMD, Copyright (c), 1996-2015, Timothy A. Davis, + AMD, Copyright (c), 1996-2022, Timothy A. Davis, Patrick R. Amestoy, and Iain S. Duff. All Rights Reserved. Availability: - http://www.suitesparse.com + http://suitesparse.com ------------------------------------------------------------------------------- AMD License: BSD 3-clause: @@ -36,10 +82,10 @@ DAMAGE. ==> BTF/Doc/License.txt <== - BTF, Copyright (C) 2004-2013, University of Florida + BTF, Copyright (C) 2004-2022, University of Florida by Timothy A. Davis and Ekanathan Palamadai. BTF is also available under other licenses; contact authors for details. - http://www.suitesparse.com + http://suitesparse.com -------------------------------------------------------------------------------- @@ -92,15 +138,15 @@ Availability: - http://www.suitesparse.com + http://suitesparse.com ==> CCOLAMD/Doc/License.txt <== CCOLAMD: constrained column approximate minimum degree ordering - Copyright (C) 2005-2016, Univ. of Florida. Authors: Timothy A. Davis, + Copyright (C) 2005-2022, Univ. of Florida. Authors: Timothy A. Davis, Sivasankaran Rajamanickam, and Stefan Larimore. Closely based on COLAMD by Davis, Stefan Larimore, in collaboration with Esmond Ng, and John Gilbert. - http://www.suitesparse.com + http://suitesparse.com -------------------------------------------------------------------------------- @@ -137,9 +183,9 @@ ==> Check/License.txt <== -------------------------------------------------------------------------------- - CHOLMOD/Check Module. Copyright (C) 2005-2006, Timothy A. Davis CHOLMOD is + CHOLMOD/Check Module. Copyright (C) 2005-2022, Timothy A. Davis CHOLMOD is also available under other licenses; contact authors for details. - http://www.suitesparse.com + http://suitesparse.com Note that this license is for the CHOLMOD/Check module only. All CHOLMOD modules are licensed separately. @@ -164,9 +210,9 @@ ==> Cholesky/License.txt <== -------------------------------------------------------------------------------- - CHOLMOD/Cholesky module, Copyright (C) 2005-2006, Timothy A. Davis. + CHOLMOD/Cholesky module, Copyright (C) 2005-2022, Timothy A. Davis. CHOLMOD is also available under other licenses; contact authors for - details. http://www.suitesparse.com + details. http://suitesparse.com Note that this license is for the CHOLMOD/Cholesky module only. All CHOLMOD modules are licensed separately. @@ -192,9 +238,9 @@ ==> Core/License.txt <== -------------------------------------------------------------------------------- - CHOLMOD/Core Module. Copyright (C) 2005-2006, Univ. of Florida. Author: + CHOLMOD/Core Module. Copyright (C) 2005-2022, Univ. of Florida. Author: Timothy A. Davis. CHOLMOD is also available under other licenses; contact - authors for details. http://www.suitesparse.com + authors for details. http://suitesparse.com Note that this license is for the CHOLMOD/Core module only. All CHOLMOD modules are licensed separately. @@ -221,9 +267,9 @@ ==> Demo/License.txt <== -------------------------------------------------------------------------------- - CHOLMOD/Demo Module. Copyright (C) 2005-2006, Timothy A. Davis. CHOLMOD + CHOLMOD/Demo Module. Copyright (C) 2005-2022, Timothy A. Davis. CHOLMOD is also available under other licenses; contact authors for details. - http://www.suitesparse.com + http://suitesparse.com Note that this license is for the CHOLMOD/Demo module only. All CHOLMOD modules are licensed separately. @@ -250,14 +296,13 @@ ==> Include/License.txt <== -------------------------------------------------------------------------------- - CHOLMOD/Include/* files. Copyright (C) 2005-2006, either Univ. of Florida + CHOLMOD/Include/* files. Copyright (C) 2005-2022, either Univ. of Florida or T. Davis, depending on the file. Each file is licensed separately, according to the Module for which it contains definitions and prototypes: Include/cholmod.h LGPL - Include/cholmod_blas.h LGPL Include/cholmod_camd.h part of Partition module Include/cholmod_check.h part of Check module Include/cholmod_cholesky.h part of Cholesky module @@ -279,10 +324,10 @@ ==> MATLAB/License.txt <== -------------------------------------------------------------------------------- - CHOLMOD/MATLAB Module. Copyright (C) 2005-2006, Timothy A. Davis. CHOLMOD + CHOLMOD/MATLAB Module. Copyright (C) 2005-2022, Timothy A. Davis. CHOLMOD is also available under other licenses; contact authors for details. MATLAB(tm) is a Registered Trademark of The MathWorks, Inc. - http://www.suitesparse.com + http://suitesparse.com Note that this license is for the CHOLMOD/MATLAB module only. All CHOLMOD modules are licensed separately. @@ -308,9 +353,9 @@ ==> MatrixOps/License.txt <== -------------------------------------------------------------------------------- - CHOLMOD/MatrixOps Module. Copyright (C) 2005-2006, Timothy A. Davis. + CHOLMOD/MatrixOps Module. Copyright (C) 2005-2022, Timothy A. Davis. CHOLMOD is also available under other licenses; contact authors for - details. http://www.suitesparse.com + details. http://suitesparse.com Note that this license is for the CHOLMOD/MatrixOps module only. All CHOLMOD modules are licensed separately. @@ -337,9 +382,9 @@ ==> Modify/License.txt <== -------------------------------------------------------------------------------- - CHOLMOD/Modify Module. Copyright (C) 2005-2006, Timothy A. Davis and + CHOLMOD/Modify Module. Copyright (C) 2005-2022, Timothy A. Davis and William W. Hager. CHOLMOD is also available under other licenses; contact - authors for details. http://www.suitesparse.com + authors for details. http://suitesparse.com Note that this license is for the CHOLMOD/Modify module only. All CHOLMOD modules are licensed separately. @@ -367,9 +412,9 @@ -------------------------------------------------------------------------------- CHOLMOD/Partition Module. - Copyright (C) 2005-2006, Univ. of Florida. Author: Timothy A. Davis + Copyright (C) 2005-2022, Univ. of Florida. Author: Timothy A. Davis CHOLMOD is also available under other licenses; contact authors for details. - http://www.suitesparse.com + http://suitesparse.com Note that this license is for the CHOLMOD/Partition module only. All CHOLMOD modules are licensed separately. @@ -397,9 +442,9 @@ -------------------------------------------------------------------------------- CHOLMOD/Supernodal Module. - Copyright (C) 2005-2006, Timothy A. Davis + Copyright (C) 2005-2022, Timothy A. Davis CHOLMOD is also available under other licenses; contact authors for details. - http://www.suitesparse.com + http://suitesparse.com Note that this license is for the CHOLMOD/Supernodal module only. All CHOLMOD modules are licensed separately. @@ -426,9 +471,9 @@ ==> Tcov/License.txt <== -------------------------------------------------------------------------------- - CHOLMOD/Tcov Module. Copyright (C) 2005-2006, Timothy A. Davis + CHOLMOD/Tcov Module. Copyright (C) 2005-2022, Timothy A. Davis CHOLMOD is also available under other licenses; contact authors for details. - http://www.suitesparse.com + http://suitesparse.com Note that this license is for the CHOLMOD/Tcov module only. All CHOLMOD modules are licensed separately. @@ -455,9 +500,9 @@ ==> Valgrind/License.txt <== -------------------------------------------------------------------------------- - CHOLMOD/Valgrind Module. Copyright (C) 2005-2006, Timothy A. Davis. + CHOLMOD/Valgrind Module. Copyright (C) 2005-2022, Timothy A. Davis. CHOLMOD is also available under other licenses; contact authors for details. - http://www.suitesparse.com + http://suitesparse.com Note that this license is for the CHOLMOD/Valgrind module only. All CHOLMOD modules are licensed separately. @@ -481,8 +526,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. ==> COLAMD/Doc/License.txt <== - COLAMD, Copyright 1998-2016, Timothy A. Davis. http://www.suitesparse.com - http://www.suitesparse.com + COLAMD, Copyright 1998-2022, Timothy A. Davis. http://suitesparse.com + http://suitesparse.com COLAMD License: BSD 3-clause @@ -512,8 +557,8 @@ ==> CSparse/Doc/License.txt <== CSparse: a Concise Sparse matrix package. - Copyright (c) 2006, Timothy A. Davis. - http://www.suitesparse.com + Copyright (c) 2006-2022, Timothy A. Davis. + http://suitesparse.com -------------------------------------------------------------------------------- @@ -533,8 +578,8 @@ ==> CXSparse/Doc/License.txt <== CXSparse: a Concise Sparse matrix package - Extended. - Copyright (c) 2006, Timothy A. Davis. - http://www.suitesparse.com + Copyright (c) 2006-2022, Timothy A. Davis. + http://suitesparse.com -------------------------------------------------------------------------------- @@ -554,8 +599,8 @@ ==> CXSparse_newfiles/Doc/License.txt <== CXSparse: a Concise Sparse matrix package - Extended. - Copyright (c) 2006, Timothy A. Davis. - http://www.suitesparse.com + Copyright (c) 2006-2022, Timothy A. Davis. + http://suitesparse.com -------------------------------------------------------------------------------- @@ -574,9 +619,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ==> GPUQREngine/Doc/License.txt <== - GPUQREngine Copyright (c) 2013, Timothy A. Davis, Sencer Nuri Yeralan, + GPUQREngine Copyright (c) 2013-2022, Timothy A. Davis, Sencer Nuri Yeralan, and Sanjay Ranka. - http://www.suitesparse.com + http://suitesparse.com GPUQREngine is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -593,10 +638,10 @@ ==> KLU/Doc/License.txt <== - KLU, Copyright (C) 2004-2013, University of Florida + KLU, Copyright (C) 2004-2022, University of Florida by Timothy A. Davis and Ekanathan Palamadai. KLU is also available under other licenses; contact authors for details. - http://www.suitesparse.com + http://suitesparse.com -------------------------------------------------------------------------------- @@ -615,9 +660,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA ==> LDL/Doc/License.txt <== - LDL Copyright (c) 2005-2013 by Timothy A. Davis. + LDL Copyright (c) 2005-2022 by Timothy A. Davis. LDL is also available under other licenses; contact the author for details. - http://www.suitesparse.com + http://suitesparse.com -------------------------------------------------------------------------------- @@ -694,8 +739,8 @@ SSMULT License: -------------------------------------------------------------------------------- - SSMULT, Copyright (c) 2007-2011, Timothy A. Davis, - http://www.suitesparse.com. + SSMULT, Copyright (c) 2007-2022, Timothy A. Davis, + http://suitesparse.com. SSMULT is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -713,9 +758,9 @@ ==> RBio/Doc/License.txt <== - RBio toolbox. Copyright (C) 2006-2009, Timothy A. Davis + RBio toolbox. Copyright (C) 2006-2022, Timothy A. Davis RBio is also available under other licenses; contact authors for details. - http://www.suitesparse.com + http://suitesparse.com -------------------------------------------------------------------------------- @@ -735,7 +780,7 @@ ==> SPQR/Doc/License.txt <== - SPQR, Copyright 2008-2016 by Timothy A. Davis. + SPQR, Copyright 2008-2022 by Timothy A. Davis. All Rights Reserved. SPQR is available under alternate licenses, contact T. Davis for details. @@ -771,12 +816,12 @@ Availability: - http://www.suitesparse.com + http://suitesparse.com ==> SuiteSparse_GPURuntime/Doc/License.txt <== - SuiteSparse_GPURuntime Copyright (c) 2013-2016, Timothy A. Davis, - Sencer Nuri Yeralan, and Sanjay Ranka. http://www.suitesparse.com + SuiteSparse_GPURuntime Copyright (c) 2013-2022, Timothy A. Davis, + Sencer Nuri Yeralan, and Sanjay Ranka. http://suitesparse.com -------------------------------------------------------------------------------- @@ -795,7 +840,7 @@ Street, Fifth Floor, Boston, MA 02110-1301, USA. ==> ssget/Doc/License.txt <== - Copyright (c), 2009-2016, Timothy A. Davis, All Rights Reserved. + Copyright (c), 2009-2022, Timothy A. Davis, All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -823,7 +868,7 @@ ==> UMFPACK/Doc/License.txt <== - UMFPACK, Copyright 1995-2009 by Timothy A. Davis. + UMFPACK, Copyright 1995-2022 by Timothy A. Davis. All Rights Reserved. UMFPACK is available under alternate licenses, contact T. Davis for details. @@ -859,11 +904,11 @@ Availability: - http://www.suitesparse.com + http://suitesparse.com ==> CSparse/MATLAB/ssget/Doc/License.txt <== - Copyright (c), 2009-2016, Timothy A. Davis, All Rights Reserved. + Copyright (c), 2009-2022, Timothy A. Davis, All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -891,7 +936,7 @@ ==> CXSparse/MATLAB/ssget/Doc/License.txt <== - Copyright (c), 2009-2016, Timothy A. Davis, All Rights Reserved. + Copyright (c), 2009-2022, Timothy A. Davis, All Rights Reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -917,24 +962,77 @@ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -==> GraphBLAS/Doc/License.txt <== - SuiteSparse:GraphBLAS, Copyright 2017, Timothy A. Davis +==> GraphBLAS/LICENSE <== + + SuiteSparse:GraphBLAS, Timothy A. Davis, (c) 2017-2021, All Rights Reserved. + The following Apache-2.0 applies to all of SuiteSparse:GraphBLAS except for the + @GrB MATLAB interface: + + SPDX-License-Identifier: Apache-2.0 + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use SuiteSparse:GraphBLAS except in compliance with the + License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + + No files that are compiled and packaged as part of the libgraphblas.so or + libgraphblas.a libraries are licensed under the GNU GPLv3. All of those files + are licensed under the Apache-2.0 license. + + ================================================================================ + + The @GrB MATLAB interface, including its test suite and demos (all files in the + GraphBLAS/GraphBLAS folder) are not under the above Apache-2.0 license, but + under the GNU GPLv3 (or later) license instead. Refer to the file + GraphBLAS/GraphBLAS/@GrB/LICENSE for details. + + All files throughout this package and the @GrB MATLAB interface are tagged + with an SPDX license identifier, file by file. Either: - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use SuiteSparse:GraphBLAS except in compliance with the - License. You may obtain a copy of the License at + SPDX-License-Identifier: Apache-2.0 - http://www.apache.org/licenses/LICENSE-2.0 + or, for the @GrB MATLAB interface, its test suite, and demos: - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + SPDX-License-Identifier: GPL-3.0-or-later ==> Mongoose License <== - Mongoose, Copyright 2018, Timothy A. Davis, Scott P. Kolodziej, + Mongoose, Copyright 2018-2022, Timothy A. Davis, Scott P. Kolodziej, William W. Hager, S. Nuri Yeralan Licensed under the GNU GENERAL PUBLIC LICENSE, Version 3, 29 June 2007 +==> Example License <== + +Example package, Copyright (c), 2022, Timothy A. Davis, All Rights Reserved. +SPDX-License-Identifier: BSD-3-clause + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the organizations to which the authors are + affiliated, nor the names of its contributors may be used to endorse + or promote products derived from this software without specific prior + written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH + DAMAGE. diff --git a/ThirdParty/SuiteSparse/Makefile b/ThirdParty/SuiteSparse/Makefile deleted file mode 100644 index 7d7d12d665..0000000000 --- a/ThirdParty/SuiteSparse/Makefile +++ /dev/null @@ -1,287 +0,0 @@ -#------------------------------------------------------------------------------- -# Makefile for all SuiteSparse packages -#------------------------------------------------------------------------------- - -SUITESPARSE = $(CURDIR) -export SUITESPARSE - -default: go - -include SuiteSparse_config/SuiteSparse_config.mk - -# Compile the default rules for each package -go: metis - ( cd SuiteSparse_config && $(MAKE) ) - ( cd GraphBLAS && $(MAKE) CMAKE_OPTIONS='$(CMAKE_OPTIONS)' ) - ( cd Mongoose && $(MAKE) CMAKE_OPTIONS='$(CMAKE_OPTIONS)' ) - ( cd AMD && $(MAKE) ) - ( cd BTF && $(MAKE) ) - ( cd CAMD && $(MAKE) ) - ( cd CCOLAMD && $(MAKE) ) - ( cd COLAMD && $(MAKE) ) - ( cd CHOLMOD && $(MAKE) ) - ( cd CSparse && $(MAKE) ) - ( cd CXSparse && $(MAKE) ) - ( cd LDL && $(MAKE) ) - ( cd KLU && $(MAKE) ) - ( cd UMFPACK && $(MAKE) ) - ( cd RBio && $(MAKE) ) -ifneq ($(GPU_CONFIG),) - ( cd SuiteSparse_GPURuntime && $(MAKE) ) - ( cd GPUQREngine && $(MAKE) ) -endif - ( cd SPQR && $(MAKE) ) -# ( cd PIRO_BAND && $(MAKE) ) -# ( cd SKYLINE_SVD && $(MAKE) ) - -# install all packages in /usr/local/lib and /usr/local/include -# (note that CSparse is not installed; CXSparse is installed instead) -install: metisinstall - ( cd SuiteSparse_config && $(MAKE) install ) - ( cd GraphBLAS && $(MAKE) CMAKE_OPTIONS='$(CMAKE_OPTIONS)' install ) - ( cd Mongoose && $(MAKE) CMAKE_OPTIONS='$(CMAKE_OPTIONS)' install ) - ( cd AMD && $(MAKE) install ) - ( cd BTF && $(MAKE) install ) - ( cd CAMD && $(MAKE) install ) - ( cd CCOLAMD && $(MAKE) install ) - ( cd COLAMD && $(MAKE) install ) - ( cd CHOLMOD && $(MAKE) install ) - ( cd CXSparse && $(MAKE) install ) - ( cd LDL && $(MAKE) install ) - ( cd KLU && $(MAKE) install ) - ( cd UMFPACK && $(MAKE) install ) - ( cd RBio && $(MAKE) install ) -ifneq (,$(GPU_CONFIG)) - ( cd SuiteSparse_GPURuntime && $(MAKE) install ) - ( cd GPUQREngine && $(MAKE) install ) -endif - ( cd SPQR && $(MAKE) install ) -# ( cd PIRO_BAND && $(MAKE) install ) -# ( cd SKYLINE_SVD && $(MAKE) install ) - $(CP) README.txt $(INSTALL_DOC)/SuiteSparse_README.txt - chmod 644 $(INSTALL_DOC)/SuiteSparse_README.txt - -metisinstall: metis -ifeq (,$(MY_METIS_LIB)) - # install METIS from SuiteSparse/metis-5.1.0 - @mkdir -p $(INSTALL_LIB) - @mkdir -p $(INSTALL_INCLUDE) - @mkdir -p $(INSTALL_DOC) - - $(CP) lib/libmetis.* $(INSTALL_LIB) - - $(CP) metis-5.1.0/manual/manual.pdf $(INSTALL_DOC)/METIS_manual.pdf - - $(CP) metis-5.1.0/README.txt $(INSTALL_DOC)/METIS_README.txt - # the following is needed only on the Mac, so *.dylib is hardcoded: - $(SO_INSTALL_NAME) $(INSTALL_LIB)/libmetis.dylib $(INSTALL_LIB)/libmetis.dylib - - $(CP) include/metis.h $(INSTALL_INCLUDE) - chmod 755 $(INSTALL_LIB)/libmetis.* - chmod 644 $(INSTALL_INCLUDE)/metis.h - chmod 644 $(INSTALL_DOC)/METIS_manual.pdf - chmod 644 $(INSTALL_DOC)/METIS_README.txt -endif - -# uninstall all packages -uninstall: - $(RM) $(INSTALL_DOC)/SuiteSparse_README.txt - ( cd SuiteSparse_config && $(MAKE) uninstall ) - - ( cd metis-5.1.0 && $(MAKE) uninstall ) - - ( cd GraphBLAS && $(MAKE) uninstall ) - - ( cd Mongoose && $(MAKE) uninstall ) - ( cd AMD && $(MAKE) uninstall ) - ( cd CAMD && $(MAKE) uninstall ) - ( cd COLAMD && $(MAKE) uninstall ) - ( cd BTF && $(MAKE) uninstall ) - ( cd KLU && $(MAKE) uninstall ) - ( cd LDL && $(MAKE) uninstall ) - ( cd CCOLAMD && $(MAKE) uninstall ) - ( cd UMFPACK && $(MAKE) uninstall ) - ( cd CHOLMOD && $(MAKE) uninstall ) - ( cd CSparse && $(MAKE) uninstall ) - ( cd CXSparse && $(MAKE) uninstall ) - ( cd RBio && $(MAKE) uninstall ) - ( cd SuiteSparse_GPURuntime && $(MAKE) uninstall ) - ( cd GPUQREngine && $(MAKE) uninstall ) - ( cd SPQR && $(MAKE) uninstall ) -# ( cd PIRO_BAND && $(MAKE) uninstall ) -# ( cd SKYLINE_SVD && $(MAKE) uninstall ) -ifeq (,$(MY_METIS_LIB)) - # uninstall METIS, which came from SuiteSparse/metis-5.1.0 - $(RM) $(INSTALL_LIB)/libmetis.* - $(RM) $(INSTALL_INCLUDE)/metis.h - $(RM) $(INSTALL_DOC)/METIS_manual.pdf - $(RM) $(INSTALL_DOC)/METIS_README.txt -endif - $(RM) -r $(INSTALL_DOC) - -# compile the dynamic libraries. For GraphBLAS and Mongoose, this also builds -# the static library -library: metis - ( cd SuiteSparse_config && $(MAKE) ) - ( cd GraphBLAS && $(MAKE) CMAKE_OPTIONS='$(CMAKE_OPTIONS)' library ) - ( cd Mongoose && $(MAKE) CMAKE_OPTIONS='$(CMAKE_OPTIONS)' library ) - ( cd AMD && $(MAKE) library ) - ( cd BTF && $(MAKE) library ) - ( cd CAMD && $(MAKE) library ) - ( cd CCOLAMD && $(MAKE) library ) - ( cd COLAMD && $(MAKE) library ) - ( cd CHOLMOD && $(MAKE) library ) - ( cd KLU && $(MAKE) library ) - ( cd LDL && $(MAKE) library ) - ( cd UMFPACK && $(MAKE) library ) - ( cd CSparse && $(MAKE) library ) - ( cd CXSparse && $(MAKE) library ) - ( cd RBio && $(MAKE) library ) -ifneq (,$(GPU_CONFIG)) - ( cd SuiteSparse_GPURuntime && $(MAKE) library ) - ( cd GPUQREngine && $(MAKE) library ) -endif - ( cd SPQR && $(MAKE) library ) -# ( cd PIRO_BAND && $(MAKE) library ) -# ( cd SKYLINE_SVD && $(MAKE) library ) - -# compile the static libraries (except for metis, GraphBLAS, and Mongoose). -# metis is only dynamic, and the 'make static' for GraphBLAS and Mongoose makes -# both the dynamic and static libraries. -static: metis - ( cd SuiteSparse_config && $(MAKE) static ) - ( cd GraphBLAS && $(MAKE) CMAKE_OPTIONS='$(CMAKE_OPTIONS)' static ) - ( cd Mongoose && $(MAKE) CMAKE_OPTIONS='$(CMAKE_OPTIONS)' static ) - ( cd AMD && $(MAKE) static ) - ( cd BTF && $(MAKE) static ) - ( cd CAMD && $(MAKE) static ) - ( cd CCOLAMD && $(MAKE) static ) - ( cd COLAMD && $(MAKE) static ) - ( cd CHOLMOD && $(MAKE) static ) - ( cd KLU && $(MAKE) static ) - ( cd LDL && $(MAKE) static ) - ( cd UMFPACK && $(MAKE) static ) - ( cd CSparse && $(MAKE) static ) - ( cd CXSparse && $(MAKE) static ) - ( cd RBio && $(MAKE) static ) -ifneq (,$(GPU_CONFIG)) - ( cd SuiteSparse_GPURuntime && $(MAKE) static ) - ( cd GPUQREngine && $(MAKE) static ) -endif - ( cd SPQR && $(MAKE) static ) -# ( cd PIRO_BAND && $(MAKE) static ) -# ( cd SKYLINE_SVD && $(MAKE) static ) - -# Remove all files not in the original distribution -purge: - - ( cd SuiteSparse_config && $(MAKE) purge ) - - ( cd metis-5.1.0 && $(MAKE) distclean ) - - ( cd AMD && $(MAKE) purge ) - - ( cd GraphBLAS && $(MAKE) purge ) - - ( cd Mongoose && $(MAKE) purge ) - - ( cd CAMD && $(MAKE) purge ) - - ( cd COLAMD && $(MAKE) purge ) - - ( cd BTF && $(MAKE) purge ) - - ( cd KLU && $(MAKE) purge ) - - ( cd LDL && $(MAKE) purge ) - - ( cd CCOLAMD && $(MAKE) purge ) - - ( cd UMFPACK && $(MAKE) purge ) - - ( cd CHOLMOD && $(MAKE) purge ) - - ( cd CSparse && $(MAKE) purge ) - - ( cd CXSparse && $(MAKE) purge ) - - ( cd RBio && $(MAKE) purge ) - - ( cd MATLAB_Tools/SuiteSparseCollection && $(RM) *.mex* ) - - ( cd MATLAB_Tools/SSMULT && $(RM) *.mex* ) - - ( cd SuiteSparse_GPURuntime && $(MAKE) purge ) - - ( cd GPUQREngine && $(MAKE) purge ) - - ( cd SPQR && $(MAKE) purge ) -# - ( cd PIRO_BAND && $(MAKE) purge ) -# - ( cd SKYLINE_SVD && $(MAKE) purge ) - - $(RM) MATLAB_Tools/*/*.mex* MATLAB_Tools/spok/private/*.mex* - - $(RM) -r include/* bin/* lib/* share/* - -# Remove all files not in the original distribution, but keep the libraries -clean: - - ( cd SuiteSparse_config && $(MAKE) clean ) - - ( cd metis-5.1.0 && $(MAKE) clean ) - - ( cd GraphBLAS && $(MAKE) clean ) - - ( cd Mongoose && $(MAKE) clean ) - - ( cd AMD && $(MAKE) clean ) - - ( cd CAMD && $(MAKE) clean ) - - ( cd COLAMD && $(MAKE) clean ) - - ( cd BTF && $(MAKE) clean ) - - ( cd KLU && $(MAKE) clean ) - - ( cd LDL && $(MAKE) clean ) - - ( cd CCOLAMD && $(MAKE) clean ) - - ( cd UMFPACK && $(MAKE) clean ) - - ( cd CHOLMOD && $(MAKE) clean ) - - ( cd CSparse && $(MAKE) clean ) - - ( cd CXSparse && $(MAKE) clean ) - - ( cd RBio && $(MAKE) clean ) - - ( cd SuiteSparse_GPURuntime && $(MAKE) clean ) - - ( cd GPUQREngine && $(MAKE) clean ) - - ( cd SPQR && $(MAKE) clean ) -# - ( cd PIRO_BAND && $(MAKE) clean ) -# - ( cd SKYLINE_SVD && $(MAKE) clean ) - -# Create the PDF documentation -docs: - ( cd GraphBLAS && $(MAKE) docs ) - ( cd Mongoose && $(MAKE) docs ) - ( cd AMD && $(MAKE) docs ) - ( cd CAMD && $(MAKE) docs ) - ( cd KLU && $(MAKE) docs ) - ( cd LDL && $(MAKE) docs ) - ( cd UMFPACK && $(MAKE) docs ) - ( cd CHOLMOD && $(MAKE) docs ) - ( cd SPQR && $(MAKE) docs ) -# ( cd PIRO_BAND && $(MAKE) docs ) -# ( cd SKYLINE_SVD && $(MAKE) docs ) - -distclean: purge - -# Create CXSparse from CSparse -# Note that the CXSparse directory should initially not exist. -cx: - ( cd CSparse ; $(MAKE) purge ) - ( cd SuiteSparse_config && $(MAKE) ) - ( cd CXSparse_newfiles ; tar cfv - * | gzip -9 > ../CXSparse_newfiles.tar.gz ) - ./CSparse_to_CXSparse CSparse CXSparse CXSparse_newfiles.tar.gz - ( cd CXSparse/Demo ; $(MAKE) ) - ( cd CXSparse/Demo ; $(MAKE) > cs_demo.out ) - ( cd CXSparse ; $(MAKE) purge ) - $(RM) -f CXSparse_newfiles.tar.gz - -# statement coverage (Linux only); this requires a lot of time. -# The umfpack tcov requires a lot of disk space in /tmp -cov: purge - ( cd CXSparse && $(MAKE) cov ) - ( cd CSparse && $(MAKE) cov ) - ( cd CHOLMOD && $(MAKE) cov ) - ( cd KLU && $(MAKE) cov ) - ( cd SPQR && $(MAKE) cov ) - ( cd UMFPACK && $(MAKE) cov ) -# ( cd PIRO_BAND && $(MAKE) cov ) -# ( cd SKYLINE_SVD && $(MAKE) cov ) - -# configure and compile METIS, placing the libmetis.* library in -# SuiteSparse/lib and the metis.h include file in SuiteSparse/include. -metis: include/metis.h - -# Install the shared version of METIS in SuiteSparse/lib. -# The SO_INSTALL_NAME commmand is only needed on the Mac, so *.dylib is -# hardcoded below. -include/metis.h: -ifeq (,$(MY_METIS_LIB)) - - ( cd metis-5.1.0 && $(MAKE) config shared=1 prefix=$(SUITESPARSE) cc=$(CC) ) - - ( cd metis-5.1.0 && $(MAKE) ) - - ( cd metis-5.1.0 && $(MAKE) install ) - - $(SO_INSTALL_NAME) $(SUITESPARSE)/lib/libmetis.dylib \ - $(SUITESPARSE)/lib/libmetis.dylib -else - @echo 'Using pre-installed METIS 5.1.0 library at ' '[$(MY_METIS_LIB)]' -endif - -# just compile GraphBLAS -gb: - echo $(CMAKE_OPTIONS) - ( cd GraphBLAS && $(MAKE) CMAKE_OPTIONS='$(CMAKE_OPTIONS)' ) - -# just install GraphBLAS -gbinstall: - echo $(CMAKE_OPTIONS) - ( cd GraphBLAS && $(MAKE) CMAKE_OPTIONS='$(CMAKE_OPTIONS)' install ) - diff --git a/ThirdParty/SuiteSparse/README.md b/ThirdParty/SuiteSparse/README.md new file mode 100644 index 0000000000..6771fa1d86 --- /dev/null +++ b/ThirdParty/SuiteSparse/README.md @@ -0,0 +1,682 @@ +----------------------------------------------------------------------------- +SuiteSparse: A Suite of Sparse matrix packages at http://suitesparse.com +----------------------------------------------------------------------------- + +Jan 20, 2023, SuiteSparse VERSION 7.0.1 + +SuiteSparse is a set of sparse-matrix-related packages written or co-authored +by Tim Davis, available at https://github.com/DrTimothyAldenDavis/SuiteSparse . + +Primary author of SuiteSparse (codes and algorithms, excl. METIS): Tim Davis + +Code co-authors, in alphabetical order (not including METIS): + Patrick Amestoy, David Bateman, Jinhao Chen, Yanqing Chen, Iain Duff, + Les Foster, William Hager, Scott Kolodziej, Chris Lourenco, Stefan + Larimore, Erick Moreno-Centeno, Ekanathan Palamadai, Sivasankaran + Rajamanickam, Sanjay Ranka, Wissam Sid-Lakhdar, Nuri Yeralan. + +METIS is authored by George Karypis. + +Additional algorithm designers: Esmond Ng and John Gilbert. + +Refer to each package for license, copyright, and author information. + +----------------------------------------------------------------------------- +SuiteSparse branches +----------------------------------------------------------------------------- + + * dev: the default branch, with recent updates of features to appear in + the next stable release. The intent is to keep this branch in + fully working order at all times, but the features will not be + finalized at any given time. + * stable: the most recent stable release. + * dev2: working branch. All submitted PRs should made to this branch. + This branch might not always be in working order. + +----------------------------------------------------------------------------- +How to cite the SuiteSparse meta-package and its component packages: +----------------------------------------------------------------------------- + +SuiteSparse is a meta-package of many packages, each with their own published +papers. To cite the whole collection, use the URLs: + + * https://github.com/DrTimothyAldenDavis/SuiteSparse + * http://suitesparse.com (which is a forwarding URL + to https://people.engr.tamu.edu/davis/suitesparse.html) + +Please also cite the specific papers for the packages you use. This is a long +list; if you want a shorter list, just cite the most recent "Algorithm XXX:" +papers in ACM TOMS, for each package. + + * For the MATLAB x=A\b, see below for AMD, COLAMD, CHOLMOD, UMFPACK, + and SuiteSparseQR (SPQR). + + * for GraphBLAS, and `C=A*B` in MATLAB (sparse-times-sparse): + + T. Davis, Algorithm 10xx: SuiteSparse:GraphBLAS: parallel graph + algorithms in the language of sparse linear algebra, ACM Trans on + Mathematical Software, to appear, 2023. See the pdf in + https://github.com/DrTimothyAldenDavis/GraphBLAS/tree/stable/Doc + + T. Davis, Algorithm 1000: SuiteSparse:GraphBLAS: graph algorithms in + the language of sparse linear algebra, ACM Trans on Mathematical + Software, vol 45, no 4, Dec. 2019, Article No 44. + https://doi.org/10.1145/3322125. + + * for CSparse/CXSParse: + + T. A. Davis, Direct Methods for Sparse Linear Systems, SIAM Series on + the Fundamentals of Algorithms, SIAM, Philadelphia, PA, 2006. + https://doi.org/10.1137/1.9780898718881 + + * for SuiteSparseQR (SPQR): (also cite AMD, COLAMD): + + T. A. Davis, Algorithm 915: SuiteSparseQR: Multifrontal multithreaded + rank-revealing sparse QR factorization, ACM Trans. on Mathematical + Software, 38(1), 2011, pp. 8:1--8:22. + https://doi.org/10.1145/2049662.2049670 + + * for SuiteSparseQR/GPU: + + Sencer Nuri Yeralan, T. A. Davis, Wissam M. Sid-Lakhdar, and Sanjay + Ranka. 2017. Algorithm 980: Sparse QR Factorization on the GPU. ACM + Trans. Math. Softw. 44, 2, Article 17 (June 2018), 29 pages. + https://doi.org/10.1145/3065870 + + * for CHOLMOD: (also cite AMD, COLAMD): + + Y. Chen, T. A. Davis, W. W. Hager, and S. Rajamanickam, Algorithm 887: + CHOLMOD, supernodal sparse Cholesky factorization and update/downdate, + ACM Trans. on Mathematical Software, 35(3), 2008, pp. 22:1--22:14. + https://dl.acm.org/doi/abs/10.1145/1391989.1391995 + + T. A. Davis and W. W. Hager, Dynamic supernodes in sparse Cholesky + update/downdate and triangular solves, ACM Trans. on Mathematical + Software, 35(4), 2009, pp. 27:1--27:23. + https://doi.org/10.1145/1462173.1462176 + + * for CHOLMOD/Modify Module: (also cite AMD, COLAMD): + + T. A. Davis and William W. Hager, Row Modifications of a Sparse + Cholesky Factorization SIAM Journal on Matrix Analysis and Applications + 2005 26:3, 621-639 + https://doi.org/10.1137/S089547980343641X + + T. A. Davis and William W. Hager, Multiple-Rank Modifications of a + Sparse Cholesky Factorization SIAM Journal on Matrix Analysis and + Applications 2001 22:4, 997-1013 + https://doi.org/10.1137/S0895479899357346 + + T. A. Davis and William W. Hager, Modifying a Sparse Cholesky + Factorization, SIAM Journal on Matrix Analysis and Applications 1999 + 20:3, 606-627 + https://doi.org/10.1137/S0895479897321076 + + * for CHOLMOD/GPU Modules: + + Steven C. Rennich, Darko Stosic, Timothy A. Davis, Accelerating sparse + Cholesky factorization on GPUs, Parallel Computing, Vol 59, 2016, pp + 140-150. + https://doi.org/10.1016/j.parco.2016.06.004 + + * for AMD and CAMD: + + P. Amestoy, T. A. Davis, and I. S. Duff, Algorithm 837: An approximate + minimum degree ordering algorithm, ACM Trans. on Mathematical Software, + 30(3), 2004, pp. 381--388. + https://dl.acm.org/doi/abs/10.1145/1024074.1024081 + + P. Amestoy, T. A. Davis, and I. S. Duff, An approximate minimum degree + ordering algorithm, SIAM J. Matrix Analysis and Applications, 17(4), + 1996, pp. 886--905. + https://doi.org/10.1137/S0895479894278952 + + * for COLAMD, SYMAMD, CCOLAMD, and CSYMAMD: + + T. A. Davis, J. R. Gilbert, S. Larimore, E. Ng, Algorithm 836: COLAMD, + an approximate column minimum degree ordering algorithm, ACM Trans. on + Mathematical Software, 30(3), 2004, pp. 377--380. + https://doi.org/10.1145/1024074.1024080 + + T. A. Davis, J. R. Gilbert, S. Larimore, E. Ng, A column approximate + minimum degree ordering algorithm, ACM Trans. on Mathematical Software, + 30(3), 2004, pp. 353--376. + https://doi.org/10.1145/1024074.1024079 + + * for UMFPACK: (also cite AMD and COLAMD): + + T. A. Davis, Algorithm 832: UMFPACK - an unsymmetric-pattern + multifrontal method with a column pre-ordering strategy, ACM Trans. on + Mathematical Software, 30(2), 2004, pp. 196--199. + https://dl.acm.org/doi/abs/10.1145/992200.992206 + + T. A. Davis, A column pre-ordering strategy for the unsymmetric-pattern + multifrontal method, ACM Trans. on Mathematical Software, 30(2), 2004, + pp. 165--195. + https://dl.acm.org/doi/abs/10.1145/992200.992205 + + T. A. Davis and I. S. Duff, A combined unifrontal/multifrontal method + for unsymmetric sparse matrices, ACM Trans. on Mathematical Software, + 25(1), 1999, pp. 1--19. + https://doi.org/10.1145/305658.287640 + + T. A. Davis and I. S. Duff, An unsymmetric-pattern multifrontal method + for sparse LU factorization, SIAM J. Matrix Analysis and Computations, + 18(1), 1997, pp. 140--158. + https://doi.org/10.1137/S0895479894246905 + + * for the FACTORIZE m-file: + + T. A. Davis, Algorithm 930: FACTORIZE, an object-oriented linear system + solver for MATLAB, ACM Trans. on Mathematical Software, 39(4), 2013, + pp. 28:1-28:18. + https://doi.org/10.1145/2491491.2491498 + + * for KLU and BTF (also cite AMD and COLAMD): + + T. A. Davis and Ekanathan Palamadai Natarajan. 2010. Algorithm 907: + KLU, A Direct Sparse Solver for Circuit Simulation Problems. ACM Trans. + Math. Softw. 37, 3, Article 36 (September 2010), 17 pages. + https://dl.acm.org/doi/abs/10.1145/1824801.1824814 + + * for LDL: + + T. A. Davis. Algorithm 849: A concise sparse Cholesky factorization + package. ACM Trans. Math. Softw. 31, 4 (December 2005), 587–591. + https://doi.org/10.1145/1114268.1114277 + + * for ssget and the SuiteSparse Matrix Collection: + + T. A. Davis and Yifan Hu. 2011. The University of Florida sparse + matrix collection. ACM Trans. Math. Softw. 38, 1, Article 1 (November + 2011), 25 pages. + https://doi.org/10.1145/2049662.2049663 + + Kolodziej et al., (2019). The SuiteSparse Matrix Collection Website + Interface. Journal of Open Source Software, 4(35), 1244, + https://doi.org/10.21105/joss.01244 + + * for `spqr_rank`: + + Leslie V. Foster and T. A. Davis. 2013. Algorithm 933: Reliable + calculation of numerical rank, null space bases, pseudoinverse + solutions, and basic solutions using suitesparseQR. ACM Trans. Math. + Softw. 40, 1, Article 7 (September 2013), 23 pages. + https://doi.org/10.1145/2513109.2513116 + + * for Mongoose: + + T. A. Davis, William W. Hager, Scott P. Kolodziej, and S. Nuri Yeralan. + 2020. Algorithm 1003: Mongoose, a Graph Coarsening and Partitioning + Library. ACM Trans. Math. Softw. 46, 1, Article 7 (March 2020), 18 + pages. + https://doi.org/10.1145/3337792 + + * for SPEX: + + Christopher Lourenco, Jinhao Chen, Erick Moreno-Centeno, and T. A. + Davis. 2022. Algorithm 1021: SPEX Left LU, Exactly Solving Sparse + Linear Systems via a Sparse Left-Looking Integer-Preserving LU + Factorization. ACM Trans. Math. Softw. June 2022. + https://doi.org/10.1145/3519024 + +----------------------------------------------------------------------------- +About the BLAS and LAPACK libraries +----------------------------------------------------------------------------- + +NOTE: Use of the Intel MKL BLAS is strongly recommended. In a 2019 test, +OpenBLAS caused result in severe performance degradation. The reason for this +is being investigated, and this may be resolved in the near future. + +To select your BLAS/LAPACK, see the instructions in SuiteSparseBLAS.cmake in +`SuiteSparse_config/cmake_modules`. If `SuiteSparse_config` finds a BLAS with +64-bit integers (such as the Intel MKL ilp64 BLAS), it configures +`SuiteSparse_config.h` with the `SUITESPARSE_BLAS_INT` defined as `int64_t`. +Otherwise, if a 32-bit BLAS is found, this type is defined as `int32_t`. If +later on, UMFPACK, CHOLMOD, or SPQR are compiled and linked with a BLAS that +has a different integer size, you must override the definition with -DBLAS64 +(to assert the use of 64-bit integers in the BLAS) or -DBLAS32, (to assert the +use of 32-bit integers in the BLAS). + +When distributed in a binary form (such as a Debian, Ubuntu, Spack, or Brew +package), SuiteSparse should probably be compiled to expect a 32-bit BLAS, +since this is the most common case. The default is to use a 32-bit BLAS, but +this can be changed in SuiteSparseBLAS.cmake or by compiling with +`-DALLOW_64BIT_BLAS=1`. + +By default, SuiteSparse hunts for a suitable BLAS library. To enforce a +particular BLAS library use either: + + CMAKE_OPTIONS="-DBLA_VENDOR=OpenBLAS" make + cd Package ; cmake -DBLA_VENDOR=OpenBLAS .. make + +To use the default (hunt for a BLAS), do not set `BLA_VENDOR`, or set it to +ANY. In this case, if `ALLOW_64BIT_BLAS` is set, preference is given to a +64-bit BLAS, but a 32-bit BLAS library will be used if no 64-bit library is +found. + +When selecting a particular BLAS library, the `ALLOW_64BIT_BLAS` setting is +strictly followed. If set to true, only a 64-bit BLAS library will be used. +If false (the default), only a 32-bit BLAS library will be used. If no such +BLAS is found, the build will fail. + +------------------ +SuiteSparse/README +------------------ + +Packages in SuiteSparse, and files in this directory: + + GraphBLAS graph algorithms in the language of linear algebra. + https://graphblas.org + author: Tim Davis + + SPEX solves sparse linear systems in exact arithmetic. + Requires the GNU GMP and MPRF libraries. + This will be soon replaced by a more general package, SPEX v3 + that includes this method (exact sparse LU) and others (sparse + exact Cholesky, and sparse exact update/downdate). The API + of v3 will be changing significantly. + + AMD approximate minimum degree ordering. This is the built-in AMD + function in MATLAB. + authors: Tim Davis, Patrick Amestoy, Iain Duff + + bin where programs are placed when compiled + + BTF permutation to block triangular form + authors: Tim Davis, Ekanathan Palamadai + + CAMD constrained approximate minimum degree ordering + authors: Tim Davis, Patrick Amestoy, Iain Duff, Yanqing Chen + + CCOLAMD constrained column approximate minimum degree ordering + authors: Tim Davis, Sivasankaran Rajamanickam, Stefan Larimore. + Algorithm design collaborators: Esmond Ng, John Gilbert + (for COLAMD) + + ChangeLog a summary of changes to SuiteSparse. See */Doc/ChangeLog + for details for each package. + + CHOLMOD sparse Cholesky factorization. Requires AMD, COLAMD, CCOLAMD, + the BLAS, and LAPACK. Optionally uses METIS. This is chol and + x=A\b in MATLAB. + author for all modules: Tim Davis + CHOLMOD/Modify module authors: Tim Davis and William W. Hager + + COLAMD column approximate minimum degree ordering. This is the + built-in COLAMD function in MATLAB. + authors (of the code): Tim Davis and Stefan Larimore + Algorithm design collaborators: Esmond Ng, John Gilbert + + Contents.m a list of contents for 'help SuiteSparse' in MATLAB. + + CSparse a concise sparse matrix package, developed for my + book, "Direct Methods for Sparse Linear Systems", + published by SIAM. Intended primarily for teaching. + Note that the code is (c) Tim Davis, as stated in the book. + For production, use CXSparse instead. In particular, both + CSparse and CXSparse have the same include filename: cs.h. + This package is used for the built-in DMPERM in MATLAB. + author: Tim Davis + + CXSparse CSparse Extended. Includes support for complex matrices + and both int or long integers. Use this instead of CSparse + for production use; it creates a libcsparse.so (or *dylib on + the Mac) with the same name as CSparse. It is a superset + of CSparse. Any code that links against CSparse should + also be able to link against CXSparse instead. + author: Tim Davis, David Bateman + + include 'make install' places user-visible include files for each + package here, after 'make local' + + KLU sparse LU factorization, primarily for circuit simulation. + Requires AMD, COLAMD, and BTF. Optionally uses CHOLMOD, + CAMD, CCOLAMD, and METIS. + authors: Tim Davis, Ekanathan Palamadai + + LDL a very concise LDL' factorization package + author: Tim Davis + + lib 'make install' places shared libraries for each package + here, after 'make local' + + Makefile to compile all of SuiteSparse + + make compiles SuiteSparse libraries. + Subsequent "make install" will install + in just CMAKE_INSTALL_PATH (defaults to + /usr/local/lib on Linux or Mac). + + make both compiles SuiteSparse, and then "make install" + will instal in both ./lib and + CMAKE_INSTALL_PATH). + + make local compiles SuiteSparse. + Subsequent "make install will install only + in ./lib, ./include only. + Does not install in CMAKE_INSTALL_PATH. + + make global compiles SuiteSparse libraries. + Subsequent "make install" will install in + just /usr/local/lib (or whatever your + CMAKE_INSTALL_PREFIX is). + Does not install in ./lib and ./include. + + make install installs in the current directory + (./lib, ./include), and/or in + /usr/local/lib and /usr/local/include, + depending on whether "make", "make local", + "make global", or "make both", + etc has been done. + + make uninstall undoes 'make install' + + make distclean removes all files not in distribution, including + ./bin, ./share, ./lib, and ./include. + + make purge same as 'make distclean' + + make clean removes all files not in distribution, but + keeps compiled libraries and demoes, ./lib, + ./share, and ./include. + + Each individual package also has each of the above 'make' + targets. + + Things you don't need to do: + make docs creates user guides from LaTeX files + make cov runs statement coverage tests (Linux only) + + MATLAB_Tools various m-files for use in MATLAB + author: Tim Davis (all parts) + for spqr_rank: author Les Foster and Tim Davis + + Contents.m list of contents + dimacs10 loads matrices for DIMACS10 collection + Factorize object-oriented x=A\b for MATLAB + find_components finds connected components in an image + GEE simple Gaussian elimination + getversion.m determine MATLAB version + gipper.m create MATLAB archive + hprintf.m print hyperlinks in command window + LINFACTOR predecessor to Factorize package + MESHND nested dissection ordering of regular meshes + pagerankdemo.m illustrates how PageRank works + SFMULT C=S*F where S is sparse and F is full + shellgui display a seashell + sparseinv sparse inverse subset + spok check if a sparse matrix is valid + spqr_rank SPQR_RANK package. MATLAB toolbox for rank + deficient sparse matrices: null spaces, + reliable factorizations, etc. With Leslie + Foster, San Jose State Univ. + SSMULT C=A*B where A and B are both sparse + SuiteSparseCollection for the SuiteSparse Matrix Collection + waitmex waitbar for use inside a mexFunction + + The SSMULT and SFMULT functions are the basis for the + built-in C=A*B functions in MATLAB. + + Mongoose graph partitioning. + authors: Nuri Yeralan, Scott Kolodziej, William Hager, Tim Davis + + CHOLMOD/SuiteSparse_metis: a modified version of METIS, embedded into + the CHOLMOD library. See the README.txt files + for details. author: George Karypis. This is a slightly + modified copy included with SuiteSparse via the open-source + license provided by George Karypis. SuiteSparse cannot use + an unmodified copy METIS. + + RBio read/write sparse matrices in Rutherford/Boeing format + author: Tim Davis + + README.txt this file + + SPQR sparse QR factorization. This the built-in qr and x=A\b in + MATLAB. Also called SuiteSparseQR. + author of the CPU code: Tim Davis + author of GPU modules: Tim Davis, Nuri Yeralan, + Wissam Sid-Lakhdar, Sanjay Ranka + + GPUQREngine: GPU support package for SPQR + (not built into MATLAB, however) + authors: Tim Davis, Nuri Yeralan, Sanjay Ranka, + Wissam Sid-Lakhdar + + SuiteSparse_config configuration file for all the above packages. + CSparse and MATLAB_Tools do not use SuiteSparse_config. + author: Tim Davis + + SuiteSparse_GPURuntime GPU support package for SPQR and CHOLMOD + (not builtin to MATLAB, however). + + SuiteSparse_install.m install SuiteSparse for MATLAB + SuiteSparse_paths.m set paths for SuiteSparse MATLAB mexFunctions + + SuiteSparse_test.m exhaustive test for SuiteSparse in MATLAB + + ssget MATLAB interface to the SuiteSparse Matrix Collection + author: Tim Davis + + UMFPACK sparse LU factorization. Requires AMD and the BLAS. + This is the built-in lu and x=A\b in MATLAB. + author: Tim Davis + algorithm design collaboration: Iain Duff + +Some codes optionally use METIS 5.1.0. This package is located in SuiteSparse +in the `CHOLMOD/SuiteSparse_metis` directory. Its use is optional. To compile +CHOLMOD without it, use the CMAKE_OPTIONS="-DNPARTITION=1" setting. The use of +METIS can improve ordering quality for some matrices, particularly large 3D +discretizations. METIS has been slightly modified for use in SuiteSparse; see +the `CHOLMOD/SuiteSparse_metis/README.txt` file for details. + +Refer to each package for license, copyright, and author information. All +codes are authored or co-authored by Timothy A. Davis (email: davis@tamu.edu), +except for METIS (by George Karypis), GraphBLAS/cpu_features (by Google), +GraphBLAS/lz4 and zstd (by Yann Collet, now at Facebook), and +GraphBLAS/CUDA/jitify.hpp (by NVIDIA). Parts of GraphBLAS/CUDA are +Copyright (c) by NVIDIA. Please refer to each of these licenses. + +Licenses for each package are located in the following files, all in +PACKAGENAME/Doc/License.txt, and these files are also concatenated into +the top-level LICENSE.txt file. + +----------------------------------------------------------------------------- +QUICK START FOR MATLAB USERS (Linux or Mac): +----------------------------------------------------------------------------- + +Uncompress the SuiteSparse.zip or SuiteSparse.tar.gz archive file (they contain +the same thing). Suppose you place SuiteSparse in the /home/me/SuiteSparse +folder. + +Add the SuiteSparse/lib folder to your run-time library path. On Linux, add +this to your ~/.bashrc script, assuming /home/me/SuiteSparse is the location of +your copy of SuiteSparse: + + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/me/SuiteSparse/lib + export LD_LIBRARY_PATH + +For the Mac, use this instead, in your ~/.zshrc script, assuming you place +SuiteSparse in /Users/me/SuiteSparse: + + DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/me/SuiteSparse/lib + export DYLD_LIBRARY_PATH + +Compile all of SuiteSparse with "make local". + +Next, compile the GraphBLAS MATLAB library. In the system shell while in the +SuiteSparse folder, type "make gbmatlab" if you want to install it system-wide +with "make install", or "make gblocal" if you want to use the library in +your own SuiteSparse/lib. + +Then in the MATLAB Command Window, cd to the SuiteSparse directory and type +`SuiteSparse_install`. All packages will be compiled, and several demos will be +run. To run a (long!) exhaustive test, do `SuiteSparse_test`. + +Save your MATLAB path for future sessions with the MATLAB pathtool or savepath +commands. If those methods fail because you don't have system-wide permission, +add the new paths to your startup.m file, normally in +Documents/MATLAB/startup.m. You can also use the `SuiteSparse_paths` m-file to +set all your paths at the start of each MATLAB session. + +----------------------------------------------------------------------------- +QUICK START FOR THE C/C++ LIBRARIES: +----------------------------------------------------------------------------- + +For Linux and Mac: type the following in this directory (requires system +priviledge to do the `sudo make install`): + + make + sudo make install + +All libraries will be created and copied into SuiteSparse/lib and into +/usr/local/lib. All include files need by the applications that use +SuiteSparse are copied into SuiteSparse/include and into /usr/local/include. + +For Windows, import each `*/CMakeLists.txt` file into MS Visual Studio. + +Be sure to first install all required libraries: BLAS and LAPACK for UMFPACK, +CHOLMOD, and SPQR, and GMP and MPFR for SPEX. Be sure to use the latest +libraries; SPEX requires MPFR 4.0.2 and GMP 6.1.2 (these version numbers +do NOT correspond to the X.Y.Z suffix of libgmp.so.X.Y.Z and libmpfr.so.X.Y.Z; +see the SPEX user guide for details). + +To compile the libraries and install them only in SuiteSparse/lib (not +/usr/local/lib), do this instead in the top-level of SuiteSparse: + + make local + +If you add /home/me/SuiteSparse/lib to your library search path +(`LD_LIBRARY_PATH` in Linux), you can do the following (for example): + + S = /home/me/SuiteSparse + cc myprogram.c -I$(S)/include -lumfpack -lamd -lcholmod -lsuitesparseconfig -lm + +To change the C and C++ compilers, and to compile in parallel use: + + CC=gcc CX=g++ JOBS=32 make + +for example, which changes the compiler to gcc and g++, and runs make with +'make -j32', in parallel with 32 jobs. + +This will work on Linux/Unix and the Mac. It should automatically detect if +you have the Intel compilers or not, and whether or not you have CUDA. + +NOTE: Use of the Intel MKL BLAS is strongly recommended. The OpenBLAS can +(rarely) result in severe performance degradation, in CHOLMOD in particular. +The reason for this is still under investigation and might already be resolved +in the current version of OpenBLAS. See +`SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake` to select your BLAS. + +You may also need to add SuiteSparse/lib to your path. If your copy of +SuiteSparse is in /home/me/SuiteSparse, for example, then add this to your +~/.bashrc file: + + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/me/SuiteSparse/lib + export LD_LIBRARY_PATH + +For the Mac, use this instead: + + DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/home/me/SuiteSparse/lib + export DYLD_LIBRARY_PATH + +----------------------------------------------------------------------------- +Python interface +----------------------------------------------------------------------------- + +See scikit-sparse and scikit-umfpack for the Python interface via SciPy: + +https://github.com/scikit-sparse/scikit-sparse + +https://github.com/scikit-umfpack/scikit-umfpack + +----------------------------------------------------------------------------- +Compilation options +----------------------------------------------------------------------------- + +You can set specific options for CMake with the command (for example): + + CMAKE_OPTIONS="-DNPARTITION=1 -DNSTATIC=1 -DCMAKE_BUILD_TYPE=Debug" make + +That command will compile all of SuiteSparse except for CHOLMOD/Partition +Module. Debug mode will be used. The static libraries will not be built +(NSTATIC is true). + + CMAKE_BUILD_TYPE: Default: "Release", use "Debug" for debugging. + + ENABLE_CUDA: if set to true, CUDA is enabled for the project. + Default: true for CHOLMOD and SPQR; false otherwise + + LOCAL_INSTALL: if true, "cmake --install" will install + into SuiteSparse/lib and SuiteSparse/include. + if false, "cmake --install" will install into the + default prefix (or the one configured with + CMAKE_INSTALL_PREFIX). + Default: false + + NSTATIC: if true, static libraries are not built. + Default: false, except for GraphBLAS, which + takes a long time to compile so the default for + GraphBLAS is true. For Mongoose, the NSTATIC setting + is treated as if it always false, since the mongoose + program is built with the static library. + + SUITESPARSE_CUDA_ARCHITECTURES: a string, such as "all" or + "35;50;75;80" that lists the CUDA architectures to use + when compiling CUDA kernels with nvcc. The "all" + option requires cmake 3.23 or later. + Default: "52;75;80". + + BLA_VENDOR a string. Leave unset, or use "ANY" to select any BLAS + library (the default). Or set to the name of a + BLA_VENDOR defined by FindBLAS.cmake. See: + https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors + + ALLOW_64BIT_BLAS if true: look for a 64-bit BLAS. If false: 32-bit only. + Default: false. + + NOPENMP if true: OpenMP is not used. Default: false. + UMFPACK, CHOLMOD, SPQR, and GraphBLAS will be slow. + Note that BLAS and LAPACK may still use OpenMP + internally; if you wish to disable OpenMP in an entire + application, select a single-threaded BLAS/LAPACK. + WARNING: GraphBLAS may not be thread-safe if built + without OpenMP (see the User Guide for details). + + DEMO if true: build the demo programs for each package. + Default: false. + +Additional options are available within specific packages: + + NCHOLMOD if true, UMFPACK and KLU do not use CHOLMOD for + additional (optional) ordering options + +CHOLMOD is composed of a set of Modules that can be independently selected; +all options default to false: + + NGL if true: do not build any GPL-licensed module + (MatrixOps, Modify, Supernodal, and GPU modules) + NCHECK if true: do not build the Check module. + NMATRIXOPS if true: do not build the MatrixOps module. + NCHOLESKY if true: do not build the Cholesky module. + This also disables the Supernodal and Modify modules. + NMODIFY if true: do not build the Modify module. + NCAMD if true: do not link against CAMD and CCOLAMD. + This also disables the Partition module. + NPARTITION if true: do not build the Partition module. + NSUPERNODAL if true: do not build the Supernodal module. + +----------------------------------------------------------------------------- +Acknowledgements +----------------------------------------------------------------------------- + +I would like to thank François Bissey, Sebastien Villemot, Erik Welch, Jim +Kitchen, Markus Mützel, and Fabian Wein for their valuable feedback on the +SuiteSparse build system and how it works with various Linux / Python distros +and other package managers. If you are a maintainer of a SuiteSparse packaging +for a Linux distro, conda-forge, R, spack, brew, vcpkg, etc, please feel free +to contact me if there's anything I can do to make your life easier. + +See also the various Acknowledgements within each package. + diff --git a/ThirdParty/SuiteSparse/README.txt b/ThirdParty/SuiteSparse/README.txt deleted file mode 100644 index 6678053b3d..0000000000 --- a/ThirdParty/SuiteSparse/README.txt +++ /dev/null @@ -1,412 +0,0 @@ -SuiteSparse: A Suite of Sparse matrix packages at http://www.suitesparse.com - -Dec 20, 2018. SuiteSparse VERSION 5.4.0 - -Now includes GraphBLAS and a new interface to the SuiteSparse Matrix -Collection (ssget), via MATLAB and a Java GUI, to http://sparse.tamu.edu. - -Primary author of SuiteSparse (codes and algorithms, excl. METIS): Tim Davis - -Code co-authors, in alphabetical order (not including METIS): - - Patrick Amestoy, David Bateman, Yanqing Chen, Iain Duff, Les Foster, - William Hager, Scott Kolodziej, Stefan Larimore, Ekanathan Palamadai, - Sivasankaran Rajamanickam, Sanjay Ranka, Wissam Sid-Lakhdar, Nuri Yeralan. - -Additional algorithm designers: Esmond Ng and John Gilbert. - -Refer to each package for license, copyright, and author information. All -codes are authored or co-authored by Timothy A. Davis. - ------------------- -SuiteSparse/README ------------------- - -================================================================================ -Packages in SuiteSparse, and files in this directory: -================================================================================ - - GraphBLAS graph algorithms in the language of linear algebra. - https://graphblas.org - A stand-alone package that uses cmake to compile; see - GraphBLAS/README.txt. The rest of SuiteSparse still uses - 'make'. A cmake setup for all of SuiteSparse is in progress. - author: Tim Davis - - AMD approximate minimum degree ordering. This is the built-in AMD - function in MATLAB. - authors: Tim Davis, Patrick Amestoy, Iain Duff - - bin where the metis-5.1.0 programs are placed when METIS is compiled - - BTF permutation to block triangular form - authors: Tim Davis, Ekanathan Palamadai - - CAMD constrained approximate minimum degree ordering - authors: Tim Davis, Patrick Amestoy, Iain Duff, Yanqing Chen - - CCOLAMD constrained column approximate minimum degree ordering - authors: Tim Davis, Sivasankaran Rajamanickam, Stefan Larimore. - Algorithm design collaborators: Esmond Ng, John Gilbert - (for COLAMD) - - ChangeLog a summary of changes to SuiteSparse. See */Doc/ChangeLog - for details for each package. - - CHOLMOD sparse Cholesky factorization. Requires AMD, COLAMD, CCOLAMD, - the BLAS, and LAPACK. Optionally uses METIS. This is chol and - x=A\b in MATLAB. - author for all modules: Tim Davis - CHOLMOD/Modify module authors: Tim Davis and William W. Hager - - COLAMD column approximate minimum degree ordering. This is the - built-in COLAMD function in MATLAB. - authors (of the code): Tim Davis and Stefan Larimore - Algorithm design collaborators: Esmond Ng, John Gilbert - - Contents.m a list of contents for 'help SuiteSparse' in MATLAB. - - CSparse a concise sparse matrix package, developed for my - book, "Direct Methods for Sparse Linear Systems", - published by SIAM. Intended primarily for teaching. - It does have a 'make install' but I recommend using - CXSparse instead. In particular, both CSparse and CXSparse - have the same include filename: cs.h. - - This package is used for the built-in DMPERM in MATLAB. - author: Tim Davis - - CSparse_to_CXSparse - a Perl script to create CXSparse from CSparse and - CXSparse_newfiles - author: David Bateman, Motorola - - CXSparse CSparse Extended. Includes support for complex matrices - and both int or long integers. Use this instead of CSparse - for production use; it creates a libcsparse.so (or *dylib on - the Mac) with the same name as CSparse. It is a superset - of CSparse. Any code that links against CSparse should - also be able to link against CXSparse instead. - author: Tim Davis, David Bateman - - CXSparse_newfiles - Files unique to CXSparse - author: Tim Davis, David Bateman - - share 'make' places documentation for each package here - - GPUQREngine GPU support package for SPQR (not built into MATLAB, however) - authors: Tim Davis, Nuri Yeralan, Sanjay Ranka, - Wissam Sid-Lakhdar - - include 'make' places user-visible include fomes for each package here - - KLU sparse LU factorization, primarily for circuit simulation. - Requires AMD, COLAMD, and BTF. Optionally uses CHOLMOD, - CAMD, CCOLAMD, and METIS. - authors: Tim Davis, Ekanathan Palamadai - - LDL a very concise LDL' factorization package - author: Tim Davis - - lib 'make' places shared libraries for each package here - - Makefile to compile all of SuiteSparse (except GraphBLAS) - make compiles SuiteSparse libraries and runs demos - make install compiles SuiteSparse and installs in /usr/local - make uninstall undoes 'make install' - make library compiles SuiteSparse libraries (not demos) - make distclean removes all files not in distribution, including - ./bin, ./share, ./lib, and ./include. - make purge same as 'make distclean' - make clean removes all files not in distribution, but - keeps compiled libraries and demoes, ./lib, - ./share, and ./include. - make config displays parameter settings; does not compile - - Each individual package also has each of the above 'make' - targets. Doing 'make config' in each package */Lib directory - displays the exact shared and static library names. - - Things you don't need to do: - make cx creates CXSparse from CSparse - make docs creates user guides from LaTeX files - make cov runs statement coverage tests (Linux only) - make metis compiles METIS (also done by 'make') - - MATLAB_Tools various m-files for use in MATLAB - author: Tim Davis (all parts) - for spqr_rank: author Les Foster and Tim Davis - - Contents.m list of contents - dimacs10 loads matrices for DIMACS10 collection - Factorize object-oriented x=A\b for MATLAB - find_components finds connected components in an image - GEE simple Gaussian elimination - getversion.m determine MATLAB version - gipper.m create MATLAB archive - hprintf.m print hyperlinks in command window - LINFACTOR predecessor to Factorize package - MESHND nested dissection ordering of regular meshes - pagerankdemo.m illustrates how PageRank works - SFMULT C=S*F where S is sparse and F is full - shellgui display a seashell - sparseinv sparse inverse subset - spok check if a sparse matrix is valid - spqr_rank SPQR_RANK package. MATLAB toolbox for rank - deficient sparse matrices: null spaces, - reliable factorizations, etc. With Leslie - Foster, San Jose State Univ. - SSMULT C=A*B where A and B are both sparse - SuiteSparseCollection maitains the SuiteSparse Matrix Collection - waitmex waitbar for use inside a mexFunction - - The SSMULT and SFMULT functions are the basis for the - built-in C=A*B functions in MATLAB. - - Mongoose graph partitioning. - authors: Nuri Yeralan, Scott Kolodziej, William Hager, Tim Davis - - metis-5.1.0 a modified version of METIS. See the README.txt files for - details. - author: George Karypis; not an integral component of - SuiteSparse, however. This is just a copy included with - SuiteSparse via the open-source license provided by - George Karypis - - RBio read/write sparse matrices in Rutherford/Boeing format - author: Tim Davis - - README.txt this file - - SPQR sparse QR factorization. This the built-in qr and x=A\b in - MATLAB. - author of the CPU code: Tim Davis - author of GPU modules: Tim Davis, Nuri Yeralan, - Wissam Sid-Lakhdar, Sanjay Ranka - - SuiteSparse_config configuration file for all the above packages. The - SuiteSparse_config/SuiteSparse_config.mk is included in the - Makefile's of all packages. CSparse and MATLAB_Tools do not - use SuiteSparse_config. - author: Tim Davis - - SuiteSparse_GPURuntime GPU support package for SPQR - (not builtin to MATLAB, however). - - SuiteSparse_install.m install SuiteSparse for MATLAB - - SuiteSparse_test.m exhaustive test for SuiteSparse in MATLAB - - ssget MATLAB interface to the SuiteSparse Matrix Collection - (formerly called the UF Sparse Matrix Collection). - Includes a UFget function for backward compatibility. - author: Tim Davis - - UMFPACK sparse LU factorization. Requires AMD and the BLAS. - This is the built-in lu and x=A\b in MATLAB. - author: Tim Davis - algorithm design collaboration: Iain Duff - -Some codes optionally use METIS 5.1.0. This package is located in SuiteSparse -in the metis-5.1.0 directory. Its use is optional, so you can remove it before -compiling SuiteSparse, if you desire. The use of METIS will improve the -ordering quality. METIS has been slightly modified for use in SuiteSparse; see -the metis-5.1.0/README.txt file for details. SuiteSparse can use the -unmodified METIS 5.1.0, however. To use your own copy of METIS, or a -pre-installed copy of METIS use 'make MY_METIS_LIB=-lmymetis' or -'make MY_METIS_LIB=/my/stuff/metis-5.1.0/whereeveritis/libmetis.so - MY_METIS_INC=/my/stuff/metis-5.1.0/include'. -If you want to use METIS in MATLAB, however, you MUST use the version provided -here, in SuiteSparse/metis-5.1.0. The MATLAB interface to METIS required some -small changes in METIS itself to get it to work. The original METIS 5.1.0 -will segfault MATLAB. - -Refer to each package for license, copyright, and author information. All -codes are authored or co-authored by Timothy A. Davis. -email: davis@tamu.edu - -Licenses for each package are located in the following files, all in -PACKAGENAME/Doc/License.txt: - - AMD/Doc/License.txt - BTF/Doc/License.txt - CAMD/Doc/License.txt - CCOLAMD/Doc/License.txt - CHOLMOD/Doc/License.txt - COLAMD/Doc/License.txt - CSparse/Doc/License.txt - CXSparse/Doc/License.txt - GPUQREngine/Doc/License.txt - KLU/Doc/License.txt - LDL/Doc/License.txt - MATLAB_Tools/Doc/License.txt - Mongoose/Doc/License.txt - RBio/Doc/License.txt - SPQR/Doc/License.txt - SuiteSparse_GPURuntime/Doc/License.txt - ssget/Doc/License.txt - UMFPACK/Doc/License.txt - GraphBLAS/Doc/License.txt - -These files are also present, but they are simply copies of the above license -files for CXSparse and ssget: - - CXSparse_newfiles/Doc/License.txt - CSparse/MATLAB/ssget/Doc/License.txt - CXSparse/MATLAB/ssget/Doc/License.txt - -METIS 5.0.1 is distributed with SuiteSparse, and is Copyright (c) -by George Karypis. Please refer to that package for its License. - -================================================================================ -QUICK START FOR MATLAB USERS (Linux, Mac, or Windows): uncompress the -SuiteSparse.zip or SuiteSparse.tar.gz archive file (they contain the same -thing), then in the MATLAB Command Window, cd to the SuiteSparse directory and -type SuiteSparse_install. All packages will be compiled, and several demos -will be run. To run a (long!) exhaustive test, do SuiteSparse_test. -================================================================================ - - -================================================================================ -QUICK START FOR THE C/C++ LIBRARIES: - -For just GraphBLAS, do this: - - cd GraphBLAS/build ; cmake .. ; make ; cd ../Demo ; ./demo - cd ../build ; sudo make install - -For all other packages, type 'make' in this directory. All libraries will be -created and copied into SuiteSparse/lib. All include files need by the -applications that use SuiteSparse are copied into SuiteSparse/include. All -user documenation is copied into SuiteSparse/share/doc. - -When compiling the libraries, do NOT use the INSTALL=... options for -installing. Just do: - - make - -or to compile just the libraries without running the demos, do: - - make library - -Any program that uses SuiteSparse can thus use a simpler rule as compared to -earlier versions of SuiteSparse. If you add /home/myself/SuiteSparse/lib to -your library search patch, you can do the following (for example): - - S = /home/myself/SuiteSparse - cc myprogram.c -I$(S)/include -lumfpack -lamd -lcholmod -lsuitesparseconfig -lm - -To change the C and C++ compilers, and to compile in parallel use: - - AUTOCC=no CC=gcc CX=g++ JOBS=32 make - -for example, which changes the compiler to gcc and g++, and runs make with -'make -j32', in parallel with 32 jobs. - -Now you can install the libraries, if you wish, in a location other than -SuiteSparse/lib, SuiteSparse/include, and SuiteSparse/share/doc, using -'make install INSTALL=...' - -Do 'make install' if you want to install the libraries and include files in -SuiteSparse/lib and SuiteSparse/include, and the documentation in -SuiteSparse/doc/suitesparse-VERSION. -This will work on Linux/Unix and the Mac. It should automatically detect if -you have the Intel compilers or not, and whether or not you have CUDA. If this -fails, see the SuiteSparse_config/SuiteSparse_config.mk file. There are many -options that you can either list on the 'make' command line, or you can just -edit that file. For example, to compile with your own BLAS: - - make BLAS=-lmyblaslibraryhere - -To list all configuration options (but not compile anything), do: - - make config - -Any parameter you see in the output of 'make config' with an equal sign -can be modified at the 'make' command line. - -If you do "make install" by itself, then the packages are all installed in -SuiteSparse/lib (libraries), SuiteSparse/include (include *.h files), and -SuiteSparse/doc/suitesparse-VERSION (documentation). If you want to install -elsewhere, do: - - make install INSTALL=/my/path - -which puts the files in /my/path/lib, /my/path/include, and /my/path/doc. -If you want to selectively put the libraries, include files, and doc files -in different locations, do: - - make install INSTALL_LIB=/my/libs INSTALL_INCLUDE=/myotherstuff/include INSTALL_DOC=/mydocs - -for example. Any term not defined will be set to its default, so if you don't -want to install the documentation, but wish to install the libraries and -includes in /usr/local/lib and /usr/local/include, do: - - make install INSTALL_DOC=/tmp/doc - -which copies the documentation to /tmp/doc where you can then remove it later. - -Both the static (*.a) and shared (*.so) libraries are compiled. The *.a -libraries are left in the package Lib folder (AMD/Lib/libamd.a for example). -The main exception to this rule is the SuiteSparse_config library, which is in -SuiteSparse/libsuiteSparseconfig.a. SuiteSparse_config is required by all -packages. The (extremely) optional xerbla library is also an exception, but it -is highly unlikely that you need that library. - -The 'make uninstall' takes the same command-line arguments. - ----------------------------------- -Step-by-step details: ----------------------------------- - -(1) Use the right BLAS and LAPACK libraries - - Determine where your BLAS and LAPACK libraries are. If the default - 'make' does not find them, use - 'make BLAS=-lmyblaslibraryhere LAPACK=-lmylapackgoeshere' - -(2) Install Intel's Threading Building Blocks (TBB) - - This is optionally used by SuiteSparseQR. Refer to the User Guide in - SuiteSparse/SPQR/Doc/spqr_user_guide.pdf for details. - -(3) Determine what other command line options you need for 'make'. All options - can be set at the 'make' command line without the need to edit this file. - Browse that file to see what options you can control. If you choose - different options and wish to recompile, be sure to do 'make distclean' in - this directory first, to remove all files not in the original distribution. - -(4) Type "make" in this directory. All packages will be be compiled. METIS - 5.1.0 will be compiled if you have it (note that METIS require CMake to - build it). Several demos will be run. - - To compile just the libraries, without running any demos, use - "make library". - - The libraries will appear in */Lib/*.so.* (*.dylib for the Mac). Include - files, as needed by user programs that use CHOLMOD, AMD, CAMD, COLAMD, - CCOLAMD, BTF, KLU, UMFPACK, LDL, etc. are in */Include/*.h. The include - files required by user programs are then copied into SuiteSparse/include, - and the compiled libraries are copied into SuiteSparse/lib. Documentation - is copied into SuiteSparse/doc. - - The GraphBLAS libraries are created by cmake and placed in GraphBLAS/build. - - NOTE: on Linux, you may see some errors when you compile METIS - ('make: *** No rule to make target 'w'.). You can safely ignore those - errors. - -(6) To install, type "make install". This will place copies of all - libraries in SuiteSparse/lib, and all include files in SuiteSparse/include, - and all documentation in SuiteSparse/doc/suitesparse-VERSION. You can - change the install location by "make install INSTALL=/my/path" which puts - the libraries in /my/path/lib, the include files in /my/path/include, and - documentation in /my/path/doc. These directories are created if they do - not already exist. - -(7) To uninstall, type "make uninstall", which reverses "make install" - by removing the SuiteSparse libraries, include files, and documentation - from the place they were installed. If you pass INSTALL_***= options - to 'make install', you must pass the same to 'make uninstall'. - diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/CMakeLists.txt b/ThirdParty/SuiteSparse/SuiteSparse_config/CMakeLists.txt new file mode 100644 index 0000000000..5864031298 --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/CMakeLists.txt @@ -0,0 +1,170 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/SuiteSparse_config/CMakeLists.txt: cmake for SuiteSparse_config +#------------------------------------------------------------------------------- + +# SuiteSparse_config, Copyright (c) 2012-2023, Timothy A. Davis. +# All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- +# get the version +#------------------------------------------------------------------------------- + +# cmake 3.22 is required to find the BLAS +cmake_minimum_required ( VERSION 3.22 ) + +# version of both SuiteSparse and SuiteSparse_config +set ( SUITESPARSE_DATE "Jan 20, 2023" ) +set ( SUITESPARSE_VERSION_MAJOR 7 ) +set ( SUITESPARSE_VERSION_MINOR 0 ) +set ( SUITESPARSE_VERSION_SUB 1 ) + +message ( STATUS "Building SuiteSparse_config version: v" + ${SUITESPARSE_VERSION_MAJOR}. + ${SUITESPARSE_VERSION_MINOR}. + ${SUITESPARSE_VERSION_SUB} " (" ${SUITESPARSE_DATE} ")" ) + +# AMICI +set(CMAKE_POSITION_INDEPENDENT_CODE ON) + +#------------------------------------------------------------------------------- +# SuiteSparse policies +#------------------------------------------------------------------------------- + +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${CMAKE_SOURCE_DIR}/cmake_modules ) + +include ( SuiteSparsePolicy ) + +if ( NOT NFORTRAN ) + include ( FortranCInterface ) +else ( ) + # No Fortran compiler available or enabled, configuration is not automatic. + set ( FortranCInterface_GLOBAL_MACRO ${SUITESPARSE_C_TO_FORTRAN} ) + set ( FortranCInterface_GLOBAL__MACRO ${SUITESPARSE_C_TO_FORTRAN} ) +endif ( ) + +#------------------------------------------------------------------------------- +# define the project +#------------------------------------------------------------------------------- + +project ( suitesparseconfig + VERSION "${SUITESPARSE_VERSION_MAJOR}.${SUITESPARSE_VERSION_MINOR}.${SUITESPARSE_VERSION_SUB}" + LANGUAGES C ) + +#------------------------------------------------------------------------------- +# find library dependencies +#------------------------------------------------------------------------------- + +option ( NOPENMP "ON: do not use OpenMP. OFF (default): use OpenMP" off ) +if ( NOPENMP ) + # OpenMP has been disabled + message ( STATUS "OpenMP disabled" ) + set ( OPENMP_FOUND false ) +else ( ) + find_package ( OpenMP ) +endif ( ) + +include ( SuiteSparseBLAS ) + +#------------------------------------------------------------------------------- +# configure files +#------------------------------------------------------------------------------- + +configure_file ( "Config/SuiteSparse_config.h.in" + "${PROJECT_SOURCE_DIR}/SuiteSparse_config.h" + NEWLINE_STYLE LF ) + +configure_file ( "Config/README.md.in" + "${PROJECT_SOURCE_DIR}/../README.md" + NEWLINE_STYLE LF ) + +#------------------------------------------------------------------------------- +# dynamic suitesparseconfig library properties +#------------------------------------------------------------------------------- + +file ( GLOB SUITESPARSECONFIG_SOURCES "*.c" ) + +add_library ( suitesparseconfig SHARED ${SUITESPARSECONFIG_SOURCES} ) +set_target_properties ( suitesparseconfig PROPERTIES + VERSION ${SUITESPARSE_VERSION_MAJOR}.${SUITESPARSE_VERSION_MINOR}.${SUITESPARSE_VERSION_SUB} + C_STANDARD_REQUIRED 11 + SOVERSION ${SUITESPARSE_VERSION_MAJOR} + PUBLIC_HEADER "SuiteSparse_config.h" + WINDOWS_EXPORT_ALL_SYMBOLS ON ) + +#------------------------------------------------------------------------------- +# static suitesparseconfig library properties +#------------------------------------------------------------------------------- + +if ( NOT NSTATIC ) + add_library ( suitesparseconfig_static STATIC ${SUITESPARSECONFIG_SOURCES} ) + + set_target_properties ( suitesparseconfig_static PROPERTIES + VERSION ${SUITESPARSE_VERSION_MAJOR}.${SUITESPARSE_VERSION_MINOR}.${SUITESPARSE_VERSION_SUB} + C_STANDARD_REQUIRED 11 + OUTPUT_NAME suitesparseconfig + SOVERSION ${SUITESPARSE_VERSION_MAJOR} ) + + if ( MSVC ) + set_target_properties ( suitesparseconfig_static PROPERTIES + OUTPUT_NAME suitesparseconfig_static ) + endif ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# add the library dependencies +#------------------------------------------------------------------------------- + +# libm: +if ( NOT WIN32 ) + target_link_libraries ( suitesparseconfig PUBLIC m ) + if ( NOT NSTATIC ) + target_link_libraries ( suitesparseconfig_static PUBLIC m ) + endif ( ) +endif ( ) + +# OpenMP: +if ( OPENMP_FOUND ) + message ( STATUS "OpenMP C libraries: ${OpenMP_C_LIBRARIES} ") + message ( STATUS "OpenMP C include: ${OpenMP_C_INCLUDE_DIRS} ") + message ( STATUS "OpenMP C flags: ${OpenMP_C_FLAGS} ") + target_link_libraries ( suitesparseconfig PUBLIC ${OpenMP_C_LIBRARIES} ) + if ( NOT NSTATIC ) + target_link_libraries ( suitesparseconfig_static PUBLIC ${OpenMP_C_LIBRARIES} ) + endif ( ) + set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS} " ) + include_directories ( ${OpenMP_C_INCLUDE_DIRS} ) +endif ( ) + +# BLAS: +if ( BLAS_FOUND ) + # SuiteSparse_config does not itself require the BLAS. It just needs to + # know which BLAS is going to be used by the rest of SuiteSparse so it + # can configure SuiteSparse_config.h properly. + message ( STATUS "BLAS libraries: ${BLAS_LIBRARIES} ") + message ( STATUS "BLAS linker flags: ${BLAS_LINKER_FLAGS} ") + message ( STATUS "BLAS include: ${BLAS_INCLUDE_DIRS} ") +endif ( ) + +#------------------------------------------------------------------------------- +# suitesparseconfig installation location +#------------------------------------------------------------------------------- + +file ( GLOB SUITESPARSE_CMAKE_MODULES "cmake_modules/*" ) + +install ( TARGETS suitesparseconfig + LIBRARY DESTINATION ${SUITESPARSE_LIBDIR} + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} + RUNTIME DESTINATION ${SUITESPARSE_BINDIR} + PUBLIC_HEADER DESTINATION ${SUITESPARSE_INCLUDEDIR} ) +install ( FILES + ${SUITESPARSE_CMAKE_MODULES} + DESTINATION ${SUITESPARSE_LIBDIR}/cmake/SuiteSparse + COMPONENT Development ) +if ( NOT NSTATIC ) + install ( TARGETS suitesparseconfig_static + ARCHIVE DESTINATION ${SUITESPARSE_LIBDIR} ) +endif ( ) + +include ( SuiteSparseReport ) diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/Config/README.md.in b/ThirdParty/SuiteSparse/SuiteSparse_config/Config/README.md.in new file mode 100644 index 0000000000..e45ae9c08d --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/Config/README.md.in @@ -0,0 +1,682 @@ +----------------------------------------------------------------------------- +SuiteSparse: A Suite of Sparse matrix packages at http://suitesparse.com +----------------------------------------------------------------------------- + +@SUITESPARSE_DATE@, SuiteSparse VERSION @SUITESPARSE_VERSION_MAJOR@.@SUITESPARSE_VERSION_MINOR@.@SUITESPARSE_VERSION_SUB@ + +SuiteSparse is a set of sparse-matrix-related packages written or co-authored +by Tim Davis, available at https://github.com/DrTimothyAldenDavis/SuiteSparse . + +Primary author of SuiteSparse (codes and algorithms, excl. METIS): Tim Davis + +Code co-authors, in alphabetical order (not including METIS): + Patrick Amestoy, David Bateman, Jinhao Chen, Yanqing Chen, Iain Duff, + Les Foster, William Hager, Scott Kolodziej, Chris Lourenco, Stefan + Larimore, Erick Moreno-Centeno, Ekanathan Palamadai, Sivasankaran + Rajamanickam, Sanjay Ranka, Wissam Sid-Lakhdar, Nuri Yeralan. + +METIS is authored by George Karypis. + +Additional algorithm designers: Esmond Ng and John Gilbert. + +Refer to each package for license, copyright, and author information. + +----------------------------------------------------------------------------- +SuiteSparse branches +----------------------------------------------------------------------------- + + * dev: the default branch, with recent updates of features to appear in + the next stable release. The intent is to keep this branch in + fully working order at all times, but the features will not be + finalized at any given time. + * stable: the most recent stable release. + * dev2: working branch. All submitted PRs should made to this branch. + This branch might not always be in working order. + +----------------------------------------------------------------------------- +How to cite the SuiteSparse meta-package and its component packages: +----------------------------------------------------------------------------- + +SuiteSparse is a meta-package of many packages, each with their own published +papers. To cite the whole collection, use the URLs: + + * https://github.com/DrTimothyAldenDavis/SuiteSparse + * http://suitesparse.com (which is a forwarding URL + to https://people.engr.tamu.edu/davis/suitesparse.html) + +Please also cite the specific papers for the packages you use. This is a long +list; if you want a shorter list, just cite the most recent "Algorithm XXX:" +papers in ACM TOMS, for each package. + + * For the MATLAB x=A\b, see below for AMD, COLAMD, CHOLMOD, UMFPACK, + and SuiteSparseQR (SPQR). + + * for GraphBLAS, and `C=A*B` in MATLAB (sparse-times-sparse): + + T. Davis, Algorithm 10xx: SuiteSparse:GraphBLAS: parallel graph + algorithms in the language of sparse linear algebra, ACM Trans on + Mathematical Software, to appear, 2023. See the pdf in + https://github.com/DrTimothyAldenDavis/GraphBLAS/tree/stable/Doc + + T. Davis, Algorithm 1000: SuiteSparse:GraphBLAS: graph algorithms in + the language of sparse linear algebra, ACM Trans on Mathematical + Software, vol 45, no 4, Dec. 2019, Article No 44. + https://doi.org/10.1145/3322125. + + * for CSparse/CXSParse: + + T. A. Davis, Direct Methods for Sparse Linear Systems, SIAM Series on + the Fundamentals of Algorithms, SIAM, Philadelphia, PA, 2006. + https://doi.org/10.1137/1.9780898718881 + + * for SuiteSparseQR (SPQR): (also cite AMD, COLAMD): + + T. A. Davis, Algorithm 915: SuiteSparseQR: Multifrontal multithreaded + rank-revealing sparse QR factorization, ACM Trans. on Mathematical + Software, 38(1), 2011, pp. 8:1--8:22. + https://doi.org/10.1145/2049662.2049670 + + * for SuiteSparseQR/GPU: + + Sencer Nuri Yeralan, T. A. Davis, Wissam M. Sid-Lakhdar, and Sanjay + Ranka. 2017. Algorithm 980: Sparse QR Factorization on the GPU. ACM + Trans. Math. Softw. 44, 2, Article 17 (June 2018), 29 pages. + https://doi.org/10.1145/3065870 + + * for CHOLMOD: (also cite AMD, COLAMD): + + Y. Chen, T. A. Davis, W. W. Hager, and S. Rajamanickam, Algorithm 887: + CHOLMOD, supernodal sparse Cholesky factorization and update/downdate, + ACM Trans. on Mathematical Software, 35(3), 2008, pp. 22:1--22:14. + https://dl.acm.org/doi/abs/10.1145/1391989.1391995 + + T. A. Davis and W. W. Hager, Dynamic supernodes in sparse Cholesky + update/downdate and triangular solves, ACM Trans. on Mathematical + Software, 35(4), 2009, pp. 27:1--27:23. + https://doi.org/10.1145/1462173.1462176 + + * for CHOLMOD/Modify Module: (also cite AMD, COLAMD): + + T. A. Davis and William W. Hager, Row Modifications of a Sparse + Cholesky Factorization SIAM Journal on Matrix Analysis and Applications + 2005 26:3, 621-639 + https://doi.org/10.1137/S089547980343641X + + T. A. Davis and William W. Hager, Multiple-Rank Modifications of a + Sparse Cholesky Factorization SIAM Journal on Matrix Analysis and + Applications 2001 22:4, 997-1013 + https://doi.org/10.1137/S0895479899357346 + + T. A. Davis and William W. Hager, Modifying a Sparse Cholesky + Factorization, SIAM Journal on Matrix Analysis and Applications 1999 + 20:3, 606-627 + https://doi.org/10.1137/S0895479897321076 + + * for CHOLMOD/GPU Modules: + + Steven C. Rennich, Darko Stosic, Timothy A. Davis, Accelerating sparse + Cholesky factorization on GPUs, Parallel Computing, Vol 59, 2016, pp + 140-150. + https://doi.org/10.1016/j.parco.2016.06.004 + + * for AMD and CAMD: + + P. Amestoy, T. A. Davis, and I. S. Duff, Algorithm 837: An approximate + minimum degree ordering algorithm, ACM Trans. on Mathematical Software, + 30(3), 2004, pp. 381--388. + https://dl.acm.org/doi/abs/10.1145/1024074.1024081 + + P. Amestoy, T. A. Davis, and I. S. Duff, An approximate minimum degree + ordering algorithm, SIAM J. Matrix Analysis and Applications, 17(4), + 1996, pp. 886--905. + https://doi.org/10.1137/S0895479894278952 + + * for COLAMD, SYMAMD, CCOLAMD, and CSYMAMD: + + T. A. Davis, J. R. Gilbert, S. Larimore, E. Ng, Algorithm 836: COLAMD, + an approximate column minimum degree ordering algorithm, ACM Trans. on + Mathematical Software, 30(3), 2004, pp. 377--380. + https://doi.org/10.1145/1024074.1024080 + + T. A. Davis, J. R. Gilbert, S. Larimore, E. Ng, A column approximate + minimum degree ordering algorithm, ACM Trans. on Mathematical Software, + 30(3), 2004, pp. 353--376. + https://doi.org/10.1145/1024074.1024079 + + * for UMFPACK: (also cite AMD and COLAMD): + + T. A. Davis, Algorithm 832: UMFPACK - an unsymmetric-pattern + multifrontal method with a column pre-ordering strategy, ACM Trans. on + Mathematical Software, 30(2), 2004, pp. 196--199. + https://dl.acm.org/doi/abs/10.1145/992200.992206 + + T. A. Davis, A column pre-ordering strategy for the unsymmetric-pattern + multifrontal method, ACM Trans. on Mathematical Software, 30(2), 2004, + pp. 165--195. + https://dl.acm.org/doi/abs/10.1145/992200.992205 + + T. A. Davis and I. S. Duff, A combined unifrontal/multifrontal method + for unsymmetric sparse matrices, ACM Trans. on Mathematical Software, + 25(1), 1999, pp. 1--19. + https://doi.org/10.1145/305658.287640 + + T. A. Davis and I. S. Duff, An unsymmetric-pattern multifrontal method + for sparse LU factorization, SIAM J. Matrix Analysis and Computations, + 18(1), 1997, pp. 140--158. + https://doi.org/10.1137/S0895479894246905 + + * for the FACTORIZE m-file: + + T. A. Davis, Algorithm 930: FACTORIZE, an object-oriented linear system + solver for MATLAB, ACM Trans. on Mathematical Software, 39(4), 2013, + pp. 28:1-28:18. + https://doi.org/10.1145/2491491.2491498 + + * for KLU and BTF (also cite AMD and COLAMD): + + T. A. Davis and Ekanathan Palamadai Natarajan. 2010. Algorithm 907: + KLU, A Direct Sparse Solver for Circuit Simulation Problems. ACM Trans. + Math. Softw. 37, 3, Article 36 (September 2010), 17 pages. + https://dl.acm.org/doi/abs/10.1145/1824801.1824814 + + * for LDL: + + T. A. Davis. Algorithm 849: A concise sparse Cholesky factorization + package. ACM Trans. Math. Softw. 31, 4 (December 2005), 587–591. + https://doi.org/10.1145/1114268.1114277 + + * for ssget and the SuiteSparse Matrix Collection: + + T. A. Davis and Yifan Hu. 2011. The University of Florida sparse + matrix collection. ACM Trans. Math. Softw. 38, 1, Article 1 (November + 2011), 25 pages. + https://doi.org/10.1145/2049662.2049663 + + Kolodziej et al., (2019). The SuiteSparse Matrix Collection Website + Interface. Journal of Open Source Software, 4(35), 1244, + https://doi.org/10.21105/joss.01244 + + * for `spqr_rank`: + + Leslie V. Foster and T. A. Davis. 2013. Algorithm 933: Reliable + calculation of numerical rank, null space bases, pseudoinverse + solutions, and basic solutions using suitesparseQR. ACM Trans. Math. + Softw. 40, 1, Article 7 (September 2013), 23 pages. + https://doi.org/10.1145/2513109.2513116 + + * for Mongoose: + + T. A. Davis, William W. Hager, Scott P. Kolodziej, and S. Nuri Yeralan. + 2020. Algorithm 1003: Mongoose, a Graph Coarsening and Partitioning + Library. ACM Trans. Math. Softw. 46, 1, Article 7 (March 2020), 18 + pages. + https://doi.org/10.1145/3337792 + + * for SPEX: + + Christopher Lourenco, Jinhao Chen, Erick Moreno-Centeno, and T. A. + Davis. 2022. Algorithm 1021: SPEX Left LU, Exactly Solving Sparse + Linear Systems via a Sparse Left-Looking Integer-Preserving LU + Factorization. ACM Trans. Math. Softw. June 2022. + https://doi.org/10.1145/3519024 + +----------------------------------------------------------------------------- +About the BLAS and LAPACK libraries +----------------------------------------------------------------------------- + +NOTE: Use of the Intel MKL BLAS is strongly recommended. In a 2019 test, +OpenBLAS caused result in severe performance degradation. The reason for this +is being investigated, and this may be resolved in the near future. + +To select your BLAS/LAPACK, see the instructions in SuiteSparseBLAS.cmake in +`SuiteSparse_config/cmake_modules`. If `SuiteSparse_config` finds a BLAS with +64-bit integers (such as the Intel MKL ilp64 BLAS), it configures +`SuiteSparse_config.h` with the `SUITESPARSE_BLAS_INT` defined as `int64_t`. +Otherwise, if a 32-bit BLAS is found, this type is defined as `int32_t`. If +later on, UMFPACK, CHOLMOD, or SPQR are compiled and linked with a BLAS that +has a different integer size, you must override the definition with -DBLAS64 +(to assert the use of 64-bit integers in the BLAS) or -DBLAS32, (to assert the +use of 32-bit integers in the BLAS). + +When distributed in a binary form (such as a Debian, Ubuntu, Spack, or Brew +package), SuiteSparse should probably be compiled to expect a 32-bit BLAS, +since this is the most common case. The default is to use a 32-bit BLAS, but +this can be changed in SuiteSparseBLAS.cmake or by compiling with +`-DALLOW_64BIT_BLAS=1`. + +By default, SuiteSparse hunts for a suitable BLAS library. To enforce a +particular BLAS library use either: + + CMAKE_OPTIONS="-DBLA_VENDOR=OpenBLAS" make + cd Package ; cmake -DBLA_VENDOR=OpenBLAS .. make + +To use the default (hunt for a BLAS), do not set `BLA_VENDOR`, or set it to +ANY. In this case, if `ALLOW_64BIT_BLAS` is set, preference is given to a +64-bit BLAS, but a 32-bit BLAS library will be used if no 64-bit library is +found. + +When selecting a particular BLAS library, the `ALLOW_64BIT_BLAS` setting is +strictly followed. If set to true, only a 64-bit BLAS library will be used. +If false (the default), only a 32-bit BLAS library will be used. If no such +BLAS is found, the build will fail. + +------------------ +SuiteSparse/README +------------------ + +Packages in SuiteSparse, and files in this directory: + + GraphBLAS graph algorithms in the language of linear algebra. + https://graphblas.org + author: Tim Davis + + SPEX solves sparse linear systems in exact arithmetic. + Requires the GNU GMP and MPRF libraries. + This will be soon replaced by a more general package, SPEX v3 + that includes this method (exact sparse LU) and others (sparse + exact Cholesky, and sparse exact update/downdate). The API + of v3 will be changing significantly. + + AMD approximate minimum degree ordering. This is the built-in AMD + function in MATLAB. + authors: Tim Davis, Patrick Amestoy, Iain Duff + + bin where programs are placed when compiled + + BTF permutation to block triangular form + authors: Tim Davis, Ekanathan Palamadai + + CAMD constrained approximate minimum degree ordering + authors: Tim Davis, Patrick Amestoy, Iain Duff, Yanqing Chen + + CCOLAMD constrained column approximate minimum degree ordering + authors: Tim Davis, Sivasankaran Rajamanickam, Stefan Larimore. + Algorithm design collaborators: Esmond Ng, John Gilbert + (for COLAMD) + + ChangeLog a summary of changes to SuiteSparse. See */Doc/ChangeLog + for details for each package. + + CHOLMOD sparse Cholesky factorization. Requires AMD, COLAMD, CCOLAMD, + the BLAS, and LAPACK. Optionally uses METIS. This is chol and + x=A\b in MATLAB. + author for all modules: Tim Davis + CHOLMOD/Modify module authors: Tim Davis and William W. Hager + + COLAMD column approximate minimum degree ordering. This is the + built-in COLAMD function in MATLAB. + authors (of the code): Tim Davis and Stefan Larimore + Algorithm design collaborators: Esmond Ng, John Gilbert + + Contents.m a list of contents for 'help SuiteSparse' in MATLAB. + + CSparse a concise sparse matrix package, developed for my + book, "Direct Methods for Sparse Linear Systems", + published by SIAM. Intended primarily for teaching. + Note that the code is (c) Tim Davis, as stated in the book. + For production, use CXSparse instead. In particular, both + CSparse and CXSparse have the same include filename: cs.h. + This package is used for the built-in DMPERM in MATLAB. + author: Tim Davis + + CXSparse CSparse Extended. Includes support for complex matrices + and both int or long integers. Use this instead of CSparse + for production use; it creates a libcsparse.so (or *dylib on + the Mac) with the same name as CSparse. It is a superset + of CSparse. Any code that links against CSparse should + also be able to link against CXSparse instead. + author: Tim Davis, David Bateman + + include 'make install' places user-visible include files for each + package here, after 'make local' + + KLU sparse LU factorization, primarily for circuit simulation. + Requires AMD, COLAMD, and BTF. Optionally uses CHOLMOD, + CAMD, CCOLAMD, and METIS. + authors: Tim Davis, Ekanathan Palamadai + + LDL a very concise LDL' factorization package + author: Tim Davis + + lib 'make install' places shared libraries for each package + here, after 'make local' + + Makefile to compile all of SuiteSparse + + make compiles SuiteSparse libraries. + Subsequent "make install" will install + in just CMAKE_INSTALL_PATH (defaults to + /usr/local/lib on Linux or Mac). + + make both compiles SuiteSparse, and then "make install" + will instal in both ./lib and + CMAKE_INSTALL_PATH). + + make local compiles SuiteSparse. + Subsequent "make install will install only + in ./lib, ./include only. + Does not install in CMAKE_INSTALL_PATH. + + make global compiles SuiteSparse libraries. + Subsequent "make install" will install in + just /usr/local/lib (or whatever your + CMAKE_INSTALL_PREFIX is). + Does not install in ./lib and ./include. + + make install installs in the current directory + (./lib, ./include), and/or in + /usr/local/lib and /usr/local/include, + depending on whether "make", "make local", + "make global", or "make both", + etc has been done. + + make uninstall undoes 'make install' + + make distclean removes all files not in distribution, including + ./bin, ./share, ./lib, and ./include. + + make purge same as 'make distclean' + + make clean removes all files not in distribution, but + keeps compiled libraries and demoes, ./lib, + ./share, and ./include. + + Each individual package also has each of the above 'make' + targets. + + Things you don't need to do: + make docs creates user guides from LaTeX files + make cov runs statement coverage tests (Linux only) + + MATLAB_Tools various m-files for use in MATLAB + author: Tim Davis (all parts) + for spqr_rank: author Les Foster and Tim Davis + + Contents.m list of contents + dimacs10 loads matrices for DIMACS10 collection + Factorize object-oriented x=A\b for MATLAB + find_components finds connected components in an image + GEE simple Gaussian elimination + getversion.m determine MATLAB version + gipper.m create MATLAB archive + hprintf.m print hyperlinks in command window + LINFACTOR predecessor to Factorize package + MESHND nested dissection ordering of regular meshes + pagerankdemo.m illustrates how PageRank works + SFMULT C=S*F where S is sparse and F is full + shellgui display a seashell + sparseinv sparse inverse subset + spok check if a sparse matrix is valid + spqr_rank SPQR_RANK package. MATLAB toolbox for rank + deficient sparse matrices: null spaces, + reliable factorizations, etc. With Leslie + Foster, San Jose State Univ. + SSMULT C=A*B where A and B are both sparse + SuiteSparseCollection for the SuiteSparse Matrix Collection + waitmex waitbar for use inside a mexFunction + + The SSMULT and SFMULT functions are the basis for the + built-in C=A*B functions in MATLAB. + + Mongoose graph partitioning. + authors: Nuri Yeralan, Scott Kolodziej, William Hager, Tim Davis + + CHOLMOD/SuiteSparse_metis: a modified version of METIS, embedded into + the CHOLMOD library. See the README.txt files + for details. author: George Karypis. This is a slightly + modified copy included with SuiteSparse via the open-source + license provided by George Karypis. SuiteSparse cannot use + an unmodified copy METIS. + + RBio read/write sparse matrices in Rutherford/Boeing format + author: Tim Davis + + README.txt this file + + SPQR sparse QR factorization. This the built-in qr and x=A\b in + MATLAB. Also called SuiteSparseQR. + author of the CPU code: Tim Davis + author of GPU modules: Tim Davis, Nuri Yeralan, + Wissam Sid-Lakhdar, Sanjay Ranka + + GPUQREngine: GPU support package for SPQR + (not built into MATLAB, however) + authors: Tim Davis, Nuri Yeralan, Sanjay Ranka, + Wissam Sid-Lakhdar + + SuiteSparse_config configuration file for all the above packages. + CSparse and MATLAB_Tools do not use SuiteSparse_config. + author: Tim Davis + + SuiteSparse_GPURuntime GPU support package for SPQR and CHOLMOD + (not builtin to MATLAB, however). + + SuiteSparse_install.m install SuiteSparse for MATLAB + SuiteSparse_paths.m set paths for SuiteSparse MATLAB mexFunctions + + SuiteSparse_test.m exhaustive test for SuiteSparse in MATLAB + + ssget MATLAB interface to the SuiteSparse Matrix Collection + author: Tim Davis + + UMFPACK sparse LU factorization. Requires AMD and the BLAS. + This is the built-in lu and x=A\b in MATLAB. + author: Tim Davis + algorithm design collaboration: Iain Duff + +Some codes optionally use METIS 5.1.0. This package is located in SuiteSparse +in the `CHOLMOD/SuiteSparse_metis` directory. Its use is optional. To compile +CHOLMOD without it, use the CMAKE_OPTIONS="-DNPARTITION=1" setting. The use of +METIS can improve ordering quality for some matrices, particularly large 3D +discretizations. METIS has been slightly modified for use in SuiteSparse; see +the `CHOLMOD/SuiteSparse_metis/README.txt` file for details. + +Refer to each package for license, copyright, and author information. All +codes are authored or co-authored by Timothy A. Davis (email: davis@tamu.edu), +except for METIS (by George Karypis), GraphBLAS/cpu_features (by Google), +GraphBLAS/lz4 and zstd (by Yann Collet, now at Facebook), and +GraphBLAS/CUDA/jitify.hpp (by NVIDIA). Parts of GraphBLAS/CUDA are +Copyright (c) by NVIDIA. Please refer to each of these licenses. + +Licenses for each package are located in the following files, all in +PACKAGENAME/Doc/License.txt, and these files are also concatenated into +the top-level LICENSE.txt file. + +----------------------------------------------------------------------------- +QUICK START FOR MATLAB USERS (Linux or Mac): +----------------------------------------------------------------------------- + +Uncompress the SuiteSparse.zip or SuiteSparse.tar.gz archive file (they contain +the same thing). Suppose you place SuiteSparse in the /home/me/SuiteSparse +folder. + +Add the SuiteSparse/lib folder to your run-time library path. On Linux, add +this to your ~/.bashrc script, assuming /home/me/SuiteSparse is the location of +your copy of SuiteSparse: + + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/me/SuiteSparse/lib + export LD_LIBRARY_PATH + +For the Mac, use this instead, in your ~/.zshrc script, assuming you place +SuiteSparse in /Users/me/SuiteSparse: + + DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/Users/me/SuiteSparse/lib + export DYLD_LIBRARY_PATH + +Compile all of SuiteSparse with "make local". + +Next, compile the GraphBLAS MATLAB library. In the system shell while in the +SuiteSparse folder, type "make gbmatlab" if you want to install it system-wide +with "make install", or "make gblocal" if you want to use the library in +your own SuiteSparse/lib. + +Then in the MATLAB Command Window, cd to the SuiteSparse directory and type +`SuiteSparse_install`. All packages will be compiled, and several demos will be +run. To run a (long!) exhaustive test, do `SuiteSparse_test`. + +Save your MATLAB path for future sessions with the MATLAB pathtool or savepath +commands. If those methods fail because you don't have system-wide permission, +add the new paths to your startup.m file, normally in +Documents/MATLAB/startup.m. You can also use the `SuiteSparse_paths` m-file to +set all your paths at the start of each MATLAB session. + +----------------------------------------------------------------------------- +QUICK START FOR THE C/C++ LIBRARIES: +----------------------------------------------------------------------------- + +For Linux and Mac: type the following in this directory (requires system +priviledge to do the `sudo make install`): + + make + sudo make install + +All libraries will be created and copied into SuiteSparse/lib and into +/usr/local/lib. All include files need by the applications that use +SuiteSparse are copied into SuiteSparse/include and into /usr/local/include. + +For Windows, import each `*/CMakeLists.txt` file into MS Visual Studio. + +Be sure to first install all required libraries: BLAS and LAPACK for UMFPACK, +CHOLMOD, and SPQR, and GMP and MPFR for SPEX. Be sure to use the latest +libraries; SPEX requires MPFR 4.0.2 and GMP 6.1.2 (these version numbers +do NOT correspond to the X.Y.Z suffix of libgmp.so.X.Y.Z and libmpfr.so.X.Y.Z; +see the SPEX user guide for details). + +To compile the libraries and install them only in SuiteSparse/lib (not +/usr/local/lib), do this instead in the top-level of SuiteSparse: + + make local + +If you add /home/me/SuiteSparse/lib to your library search path +(`LD_LIBRARY_PATH` in Linux), you can do the following (for example): + + S = /home/me/SuiteSparse + cc myprogram.c -I$(S)/include -lumfpack -lamd -lcholmod -lsuitesparseconfig -lm + +To change the C and C++ compilers, and to compile in parallel use: + + CC=gcc CX=g++ JOBS=32 make + +for example, which changes the compiler to gcc and g++, and runs make with +'make -j32', in parallel with 32 jobs. + +This will work on Linux/Unix and the Mac. It should automatically detect if +you have the Intel compilers or not, and whether or not you have CUDA. + +NOTE: Use of the Intel MKL BLAS is strongly recommended. The OpenBLAS can +(rarely) result in severe performance degradation, in CHOLMOD in particular. +The reason for this is still under investigation and might already be resolved +in the current version of OpenBLAS. See +`SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake` to select your BLAS. + +You may also need to add SuiteSparse/lib to your path. If your copy of +SuiteSparse is in /home/me/SuiteSparse, for example, then add this to your +~/.bashrc file: + + LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/me/SuiteSparse/lib + export LD_LIBRARY_PATH + +For the Mac, use this instead: + + DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:/home/me/SuiteSparse/lib + export DYLD_LIBRARY_PATH + +----------------------------------------------------------------------------- +Python interface +----------------------------------------------------------------------------- + +See scikit-sparse and scikit-umfpack for the Python interface via SciPy: + +https://github.com/scikit-sparse/scikit-sparse + +https://github.com/scikit-umfpack/scikit-umfpack + +----------------------------------------------------------------------------- +Compilation options +----------------------------------------------------------------------------- + +You can set specific options for CMake with the command (for example): + + CMAKE_OPTIONS="-DNPARTITION=1 -DNSTATIC=1 -DCMAKE_BUILD_TYPE=Debug" make + +That command will compile all of SuiteSparse except for CHOLMOD/Partition +Module. Debug mode will be used. The static libraries will not be built +(NSTATIC is true). + + CMAKE_BUILD_TYPE: Default: "Release", use "Debug" for debugging. + + ENABLE_CUDA: if set to true, CUDA is enabled for the project. + Default: true for CHOLMOD and SPQR; false otherwise + + LOCAL_INSTALL: if true, "cmake --install" will install + into SuiteSparse/lib and SuiteSparse/include. + if false, "cmake --install" will install into the + default prefix (or the one configured with + CMAKE_INSTALL_PREFIX). + Default: false + + NSTATIC: if true, static libraries are not built. + Default: false, except for GraphBLAS, which + takes a long time to compile so the default for + GraphBLAS is true. For Mongoose, the NSTATIC setting + is treated as if it always false, since the mongoose + program is built with the static library. + + SUITESPARSE_CUDA_ARCHITECTURES: a string, such as "all" or + "35;50;75;80" that lists the CUDA architectures to use + when compiling CUDA kernels with nvcc. The "all" + option requires cmake 3.23 or later. + Default: "52;75;80". + + BLA_VENDOR a string. Leave unset, or use "ANY" to select any BLAS + library (the default). Or set to the name of a + BLA_VENDOR defined by FindBLAS.cmake. See: + https://cmake.org/cmake/help/latest/module/FindBLAS.html#blas-lapack-vendors + + ALLOW_64BIT_BLAS if true: look for a 64-bit BLAS. If false: 32-bit only. + Default: false. + + NOPENMP if true: OpenMP is not used. Default: false. + UMFPACK, CHOLMOD, SPQR, and GraphBLAS will be slow. + Note that BLAS and LAPACK may still use OpenMP + internally; if you wish to disable OpenMP in an entire + application, select a single-threaded BLAS/LAPACK. + WARNING: GraphBLAS may not be thread-safe if built + without OpenMP (see the User Guide for details). + + DEMO if true: build the demo programs for each package. + Default: false. + +Additional options are available within specific packages: + + NCHOLMOD if true, UMFPACK and KLU do not use CHOLMOD for + additional (optional) ordering options + +CHOLMOD is composed of a set of Modules that can be independently selected; +all options default to false: + + NGL if true: do not build any GPL-licensed module + (MatrixOps, Modify, Supernodal, and GPU modules) + NCHECK if true: do not build the Check module. + NMATRIXOPS if true: do not build the MatrixOps module. + NCHOLESKY if true: do not build the Cholesky module. + This also disables the Supernodal and Modify modules. + NMODIFY if true: do not build the Modify module. + NCAMD if true: do not link against CAMD and CCOLAMD. + This also disables the Partition module. + NPARTITION if true: do not build the Partition module. + NSUPERNODAL if true: do not build the Supernodal module. + +----------------------------------------------------------------------------- +Acknowledgements +----------------------------------------------------------------------------- + +I would like to thank François Bissey, Sebastien Villemot, Erik Welch, Jim +Kitchen, Markus Mützel, and Fabian Wein for their valuable feedback on the +SuiteSparse build system and how it works with various Linux / Python distros +and other package managers. If you are a maintainer of a SuiteSparse packaging +for a Linux distro, conda-forge, R, spack, brew, vcpkg, etc, please feel free +to contact me if there's anything I can do to make your life easier. + +See also the various Acknowledgements within each package. + diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/Config/SuiteSparse_config.h.in b/ThirdParty/SuiteSparse/SuiteSparse_config/Config/SuiteSparse_config.h.in new file mode 100644 index 0000000000..09d05c9222 --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/Config/SuiteSparse_config.h.in @@ -0,0 +1,1408 @@ +//------------------------------------------------------------------------------ +// SuiteSparse_config/SuiteSparse_config.h: common utilites for SuiteSparse +//------------------------------------------------------------------------------ + +// SuiteSparse_config, Copyright (c) 2012-2023, Timothy A. Davis. +// All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + +// Configuration file for SuiteSparse: a Suite of Sparse matrix packages: AMD, +// COLAMD, CCOLAMD, CAMD, CHOLMOD, UMFPACK, CXSparse, SuiteSparseQR, ParU, ... + +// The SuiteSparse_config.h file is configured by CMake to be specific to the +// C/C++ compiler and BLAS library being used for SuiteSparse. The original +// file is SuiteSparse_config/SuiteSparse_config.h.in. Do not edit the +// SuiteSparse_config.h file directly. + +#ifndef SUITESPARSE_CONFIG_H +#define SUITESPARSE_CONFIG_H + +#ifdef __cplusplus +extern "C" +{ +#endif + +//------------------------------------------------------------------------------ +// SuiteSparse-wide ANSI C11 #include files +//------------------------------------------------------------------------------ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +//------------------------------------------------------------------------------ +// SuiteSparse_long is now int64_t in SuiteSparse v6.0.0 and later +//------------------------------------------------------------------------------ + +// The use of SuiteSparse_long is deprecated. User applications should use +// int64_t instead. + +#undef SuiteSparse_long +#undef SuiteSparse_long_max +#undef SuiteSparse_long_idd +#undef SuiteSparse_long_id + +#define SuiteSparse_long int64_t +#define SuiteSparse_long_max INT64_MAX +#define SuiteSparse_long_idd PRId64 +#define SuiteSparse_long_id "%" SuiteSparse_long_idd + +//------------------------------------------------------------------------------ +// OpenMP +//------------------------------------------------------------------------------ + +#if defined ( _OPENMP ) + + #include + #define SUITESPARSE_OPENMP_MAX_THREADS omp_get_max_threads ( ) + #define SUITESPARSE_OPENMP_GET_NUM_THREADS omp_get_num_threads ( ) + #define SUITESPARSE_OPENMP_GET_WTIME omp_get_wtime ( ) + #define SUITESPARSE_OPENMP_GET_THREAD_ID omp_get_thread_num ( ) + +#else + + // OpenMP not available + #define SUITESPARSE_OPENMP_MAX_THREADS (1) + #define SUITESPARSE_OPENMP_GET_NUM_THREADS (1) + #define SUITESPARSE_OPENMP_GET_WTIME (0) + #define SUITESPARSE_OPENMP_GET_THREAD_ID (0) + +#endif + +//------------------------------------------------------------------------------ +// MATLAB/Octave +//------------------------------------------------------------------------------ + +#if defined ( MATLAB_MEX_FILE ) +#include "mex.h" +#include "matrix.h" +#endif + +//------------------------------------------------------------------------------ +// string and token handling macros +//------------------------------------------------------------------------------ + +// SUITESPARSE_STR: convert the content of x into a string "x" +#define SUITESPARSE_XSTR(x) SUITESPARSE_STR(x) +#define SUITESPARSE_STR(x) #x + +// SUITESPARSE_CAT(x,y): concatenate two tokens +#define SUITESPARSE_CAT2(x,y) x ## y +#define SUITESPARSE_CAT(x,y) SUITESPARSE_CAT2(x,y) + +//------------------------------------------------------------------------------ +// determine which compiler is in use +//------------------------------------------------------------------------------ + +#define SUITESPARSE_COMPILER_NVCC 0 +#define SUITESPARSE_COMPILER_ICX 0 +#define SUITESPARSE_COMPILER_ICC 0 +#define SUITESPARSE_COMPILER_CLANG 0 +#define SUITESPARSE_COMPILER_GCC 0 +#define SUITESPARSE_COMPILER_MSC 0 +#define SUITESPARSE_COMPILER_XLC 0 + +#if defined ( __NVCC__ ) + + // NVIDIA nvcc compiler + #undef SUITESPARSE_COMPILER_NVCC + #define SUITESPARSE_COMPILER_NVCC 1 + + #define SUITESPARSE_COMPILER_MAJOR __CUDACC_VER_MAJOR__ + #define SUITESPARSE_COMPILER_MINOR __CUDACC_VER_MINOR__ + #define SUITESPARSE_COMPILER_SUB __CUDACC_VER_BUILD__ + #define SUITESPARSE_COMPILER_NAME "nvcc" + +#elif defined ( __INTEL_CLANG_COMPILER ) + + // Intel icx compiler, 2022.0.0 based on clang/llvm 14.0.0 + #undef SUITESPARSE_COMPILER_ICX + #define SUITESPARSE_COMPILER_ICX 1 + + #define SUITESPARSE_COMPILER_MAJOR __INTEL_CLANG_COMPILER + #define SUITESPARSE_COMPILER_MINOR 0 + #define SUITESPARSE_COMPILER_SUB 0 + #define SUITESPARSE_COMPILER_NAME __VERSION__ + +#elif defined ( __INTEL_COMPILER ) + + // Intel icc compiler: 2021.5.0 uses "gcc 7.5 mode" + #undef SUITESPARSE_COMPILER_ICC + #define SUITESPARSE_COMPILER_ICC 1 + + #define SUITESPARSE_COMPILER_MAJOR __INTEL_COMPILER + #define SUITESPARSE_COMPILER_MINOR __INTEL_COMPILER_UPDATE + #define SUITESPARSE_COMPILER_SUB 0 + #define SUITESPARSE_COMPILER_NAME __VERSION__ + +#elif defined ( __clang__ ) + + // clang + #undef SUITESPARSE_COMPILER_CLANG + #define SUITESPARSE_COMPILER_CLANG 1 + + #define SUITESPARSE_COMPILER_MAJOR __clang_major__ + #define SUITESPARSE_COMPILER_MINOR __clang_minor__ + #define SUITESPARSE_COMPILER_SUB __clang_patchlevel__ + #define SUITESPARSE_COMPILER_NAME "clang " __clang_version__ + +#elif defined ( __xlC__ ) + + // xlc + #undef SUITESPARSE_COMPILER_XLC + #define SUITESPARSE_COMPILER_XLC 1 + + #define SUITESPARSE_COMPILER_MAJOR ( __xlC__ / 256 ) + #define SUITESPARSE_COMPILER_MINOR \ + ( __xlC__ - 256 * SUITESPARSE_COMPILER_MAJOR) + #define SUITESPARSE_COMPILER_SUB 0 + #define SUITESPARSE_COMPILER_NAME "IBM xlc " SUITESPARSE_XSTR (__xlC__) + +#elif defined ( __GNUC__ ) + + // gcc + #undef SUITESPARSE_COMPILER_GCC + #define SUITESPARSE_COMPILER_GCC 1 + + #define SUITESPARSE_COMPILER_MAJOR __GNUC__ + #define SUITESPARSE_COMPILER_MINOR __GNUC_MINOR__ + #define SUITESPARSE_COMPILER_SUB __GNUC_PATCHLEVEL__ + #define SUITESPARSE_COMPILER_NAME "GNU gcc " \ + SUITESPARSE_XSTR (__GNUC__) "." \ + SUITESPARSE_XSTR (__GNUC_MINOR__) "." \ + SUITESPARSE_XSTR (__GNUC_PATCHLEVEL__) + +#elif defined ( _MSC_VER ) + + // Microsoft Visual Studio (cl compiler) + #undef SUITESPARSE_COMPILER_MSC + #define SUITESPARSE_COMPILER_MSC 1 + + #define SUITESPARSE_COMPILER_MAJOR ( _MSC_VER / 100 ) + #define SUITESPARSE_COMPILER_MINOR \ + ( _MSC_VER - 100 * SUITESPARSE_COMPILER_MAJOR) + #define SUITESPARSE_COMPILER_SUB 0 + #define SUITESPARSE_COMPILER_NAME \ + "Microsoft Visual Studio " SUITESPARSE_XSTR (_MSC_VER) + +#else + + // other compiler + #define SUITESPARSE_COMPILER_MAJOR 0 + #define SUITESPARSE_COMPILER_MINOR 0 + #define SUITESPARSE_COMPILER_SUB 0 + #define SUITESPARSE_COMPILER_NAME "other C compiler" + +#endif + +//------------------------------------------------------------------------------ +// malloc.h: required include file for Microsoft Visual Studio +//------------------------------------------------------------------------------ + +#if SUITESPARSE_COMPILER_MSC + #include +#endif + +// this was formerly "extern", or "__declspec ..." for Windows. +#define SUITESPARSE_PUBLIC + +//------------------------------------------------------------------------------ +// determine the ANSI C version +//------------------------------------------------------------------------------ + +#ifdef __STDC_VERSION__ +// ANSI C17: 201710L +// ANSI C11: 201112L +// ANSI C99: 199901L +// ANSI C95: 199409L +#define SUITESPARSE_STDC_VERSION __STDC_VERSION__ +#else +// assume ANSI C90 / C89 +#define SUITESPARSE_STDC_VERSION 199001L +#endif + +//------------------------------------------------------------------------------ +// handle the restrict keyword +//------------------------------------------------------------------------------ + +#if defined ( __cplusplus ) + + // C++ does not have the "restrict" keyword + #define SUITESPARSE_RESTRICT + +#elif SUITESPARSE_COMPILER_MSC + + // MS Visual Studio + #define SUITESPARSE_RESTRICT __restrict + +#elif SUITESPARSE_COMPILER_NVCC + + // NVIDIA nvcc + #define SUITESPARSE_RESTRICT __restrict__ + +#elif SUITESPARSE_STDC_VERSION >= 199901L + + // ANSI C99 or later + #define SUITESPARSE_RESTRICT restrict + +#else + + // ANSI C95 and earlier: no restrict keyword + #define SUITESPARSE_RESTRICT + +#endif + +//============================================================================== +// SuiteSparse_config parameters and functions +//============================================================================== + +// SuiteSparse-wide parameters are placed in a single static struct, defined +// locally in SuiteSparse_config.c. It is not meant to be updated frequently +// by multiple threads. Rather, if an application needs to modify +// SuiteSparse_config, it should do it once at the beginning of the +// application, before multiple threads are launched. + +// The intent of these function pointers is that they not be used in your +// application directly, except to assign them to the desired user-provided +// functions. Rather, you should use the SuiteSparse_malloc/calloc, etc +// wrappers defined below to access them. + +// The SuiteSparse_config_*_get methods return the contents of the struct: +void *(*SuiteSparse_config_malloc_func_get (void)) (size_t); +void *(*SuiteSparse_config_calloc_func_get (void)) (size_t, size_t); +void *(*SuiteSparse_config_realloc_func_get (void)) (void *, size_t); +void (*SuiteSparse_config_free_func_get (void)) (void *); +int (*SuiteSparse_config_printf_func_get (void)) (const char *, ...); +double (*SuiteSparse_config_hypot_func_get (void)) (double, double); +int (*SuiteSparse_config_divcomplex_func_get (void)) (double, double, double, double, double *, double *); + +// The SuiteSparse_config_*_set methods modify the contents of the struct: +void SuiteSparse_config_malloc_func_set (void *(*malloc_func) (size_t)); +void SuiteSparse_config_calloc_func_set (void *(*calloc_func) (size_t, size_t)); +void SuiteSparse_config_realloc_func_set (void *(*realloc_func) (void *, size_t)); +void SuiteSparse_config_free_func_set (void (*free_func) (void *)); +void SuiteSparse_config_printf_func_set (int (*printf_func) (const char *, ...)); +void SuiteSparse_config_hypot_func_set (double (*hypot_func) (double, double)); +void SuiteSparse_config_divcomplex_func_set (int (*divcomplex_func) (double, double, double, double, double *, double *)); + +// The SuiteSparse_config_*_func methods are wrappers that call the function +// pointers in the struct. Note that there is no wrapper for the printf_func. +// See the SUITESPARSE_PRINTF macro instead. +void *SuiteSparse_config_malloc (size_t s) ; +void *SuiteSparse_config_calloc (size_t n, size_t s) ; +void *SuiteSparse_config_realloc (void *, size_t s) ; +void SuiteSparse_config_free (void *) ; +double SuiteSparse_config_hypot (double x, double y) ; +int SuiteSparse_config_divcomplex +( + double xr, double xi, double yr, double yi, double *zr, double *zi +) ; + +void SuiteSparse_start ( void ) ; // called to start SuiteSparse + +void SuiteSparse_finish ( void ) ; // called to finish SuiteSparse + +void *SuiteSparse_malloc // pointer to allocated block of memory +( + size_t nitems, // number of items to malloc (>=1 is enforced) + size_t size_of_item // sizeof each item +) ; + +void *SuiteSparse_calloc // pointer to allocated block of memory +( + size_t nitems, // number of items to calloc (>=1 is enforced) + size_t size_of_item // sizeof each item +) ; + +void *SuiteSparse_realloc // pointer to reallocated block of memory, or + ///to original block if the realloc failed. +( + size_t nitems_new, // new number of items in the object + size_t nitems_old, // old number of items in the object + size_t size_of_item, // sizeof each item + void *p, // old object to reallocate + int *ok // 1 if successful, 0 otherwise +) ; + +void *SuiteSparse_free // always returns NULL +( + void *p // block to free +) ; + +void SuiteSparse_tic // start the timer +( + double tic [2] // output, contents undefined on input +) ; + +double SuiteSparse_toc // return time in seconds since last tic +( + double tic [2] // input: from last call to SuiteSparse_tic +) ; + +double SuiteSparse_time // returns current wall clock time in seconds +( + void +) ; + +// returns sqrt (x^2 + y^2), computed reliably +double SuiteSparse_hypot (double x, double y) ; + +// complex division of c = a/b +int SuiteSparse_divcomplex +( + double ar, double ai, // real and imaginary parts of a + double br, double bi, // real and imaginary parts of b + double *cr, double *ci // real and imaginary parts of c +) ; + +// determine which timer to use, if any +#ifndef NTIMER + #if defined ( _OPENMP ) + #define SUITESPARSE_TIMER_ENABLED + #elif defined ( _POSIX_C_SOURCE ) + #if _POSIX_C_SOURCE >= 199309L + #define SUITESPARSE_TIMER_ENABLED + #endif + #endif +#endif + +// SuiteSparse printf macro +#define SUITESPARSE_PRINTF(params) \ +{ \ + int (*printf_func) (const char *, ...) ; \ + printf_func = SuiteSparse_config_printf_func_get ( ) ; \ + if (printf_func != NULL) \ + { \ + (void) (printf_func) params ; \ + } \ +} + +//============================================================================== +// SuiteSparse version +//============================================================================== + +// SuiteSparse is not a package itself, but a collection of packages, some of +// which must be used together (UMFPACK requires AMD, CHOLMOD requires AMD, +// COLAMD, CAMD, and CCOLAMD, etc). A version number is provided here for the +// collection itself, which is also the version number of SuiteSparse_config. + +int SuiteSparse_version // returns SUITESPARSE_VERSION +( + // output, not defined on input. Not used if NULL. Returns + // the three version codes in version [0..2]: + // version [0] is SUITESPARSE_MAIN_VERSION + // version [1] is SUITESPARSE_SUB_VERSION + // version [2] is SUITESPARSE_SUBSUB_VERSION + int version [3] +) ; + +#define SUITESPARSE_HAS_VERSION_FUNCTION + +#define SUITESPARSE_DATE "@SUITESPARSE_DATE@" +#define SUITESPARSE_MAIN_VERSION @SUITESPARSE_VERSION_MAJOR@ +#define SUITESPARSE_SUB_VERSION @SUITESPARSE_VERSION_MINOR@ +#define SUITESPARSE_SUBSUB_VERSION @SUITESPARSE_VERSION_SUB@ + +#define SUITESPARSE_VER_CODE(main,sub) ((main) * 1000 + (sub)) +#define SUITESPARSE_VERSION \ + SUITESPARSE_VER_CODE(SUITESPARSE_MAIN_VERSION,SUITESPARSE_SUB_VERSION) + +//============================================================================== +// SuiteSparse interface to the BLAS and LAPACK libraries +//============================================================================== + +// Several SuiteSparse packages rely on the BLAS/LAPACK libraries (UMFPACK +// CHOLMOD, and SPQR, and likely GraphBLAS in the future). All of these +// packages are written in C/C++, but rely on the Fortran interface to +// BLAS/LAPACK. SuiteSparse does not use the cblas / lapacke interfaces to +// these libraries, mainly because FindBLAS.cmake does not locate them (or at +// least does not locate their respective cblas.h and lapacke.h files). In +// addition, the original definition of these files do not include a different +// name space for 64-bit integer versions. Finally, Intel renames cblas.h as +// mkl_cblas.h. As a result of these many portability issues, different +// implementations of those libraries extend them in different ways. Thus, +// SuiteSparse simply calls the Fortran functions directly. + +// However, the method for how C/C++ calling Fortran depends on the compilers +// involved. This connection is handled by the FortranCInterface.cmake module +// of CMake. + +// On typical systems (Linux with the GCC compiler for example, or on the Mac +// with clang) the Fortan name "dgemm" is called by C as "dgemm_", Other +// systems do not append the underscore. + +//------------------------------------------------------------------------------ +// SUITESPARSE_FORTRAN: macros created by CMake describing how C calls Fortran +//------------------------------------------------------------------------------ + +// SUITESPARSE_FORTAN: for Fortran routines with no "_" in their names +// SUITESPARSE__FORTAN: for Fortran routines with "_" in their names + +// The decision on which of these macros to use is based on the presence of +// underscores in the original Fortran names, not the (commonly) appended +// underscore needed for C to all the corresponding Fortran routine. + +// These two macros are created by the CMake module, FortranCInterface.cmake, +// which is then used by CMake to configure this file. + +// The CMAKE decision can be superceded by setting -DBLAS_NO_UNDERSCORE, so +// that "dgemm" remains "dgemm" (for MS Visual Studio for example). Setting +// -DBLAS_UNDERSCORE changes "dgemm" to "dgemm_", the common case for Mac and +// Linux. + +#if defined ( BLAS_NO_UNDERSCORE ) + + // no name mangling, use lower case + #define SUITESPARSE_FORTRAN(name,NAME) name + #define SUITESPARSE__FORTRAN(name,NAME) name + +#elif defined ( BLAS_UNDERSCORE ) + + // append an undescore, use lower case + #define SUITESPARSE_FORTRAN(name,NAME) name ## _ + #define SUITESPARSE__FORTRAN(name,NAME) name ## _ + +#else + + // let CMake decide how C calls Fortran + #define SUITESPARSE_FORTRAN@FortranCInterface_GLOBAL_MACRO@ + #define SUITESPARSE__FORTRAN@FortranCInterface_GLOBAL__MACRO@ + +#endif + +//------------------------------------------------------------------------------ +// SUITESPARSE_BLAS_INT: the BLAS/LAPACK integer (int32_t or int64_t) +//------------------------------------------------------------------------------ + +// CMake 3.22 and later allow the selection of the BLAS/LAPACK integer size. +// This information is then used to configure this file with the definition of +// this integer: int32_t or int64_t. + +// When compiling SuiteSparse for a MATLAB mexFunction, the MATLAB libmwblas is +// used, which is a 64-bit integer version of the BLAS. CMake is not used to +// configure SuiteSparse in this case. The flag -DBLAS64 can be used to ensure +// a 64-bit BLAS is used. Likewise, -DBLAS32 ensures a 32-bit BLAS is used. + +#if defined ( BLAS64 ) + + // override the BLAS found by CMake, and force a 64-bit interface + #define SUITESPARSE_BLAS_INT int64_t + +#elif defined ( BLAS32 ) + + // override the BLAS found by CMake, and force a 32-bit interface + #define SUITESPARSE_BLAS_INT int32_t + +#else + + // let CMake determine the size of the integer in the Fortran BLAS + #define SUITESPARSE_BLAS_INT @SuiteSparse_BLAS_integer@ + +#endif + +// SUITESPARSE_TO_BLAS_INT: convert an integer k to a BLAS integer K and set ok +// to false if the conversion changes its value. This is implemented as a +// macro so that can work with any type of the integer k. +#define SUITESPARSE_TO_BLAS_INT(K,k,ok) \ + SUITESPARSE_BLAS_INT K = (k) ; \ + ok = ok && ((sizeof (K) >= sizeof (k)) || ((int64_t)(K) == (int64_t)(k))) ; + +//------------------------------------------------------------------------------ +// SUITESPARSE_BLAS_SUFFIX: modify the name of a Fortran BLAS/LAPACK routine +//------------------------------------------------------------------------------ + +// OpenBLAS can be compiled by appending a suffix to each routine, so that the +// Fortan routine dgemm becomes dgemm_64, which denotes a version of dgemm with +// 64-bit integer parameters. The Sun Performance library does the same thing, +// but without the internal underscore, as dgemm64. + +// If the suffix does not contain "_", use (Sun Perf., for example): + +// cd build ; cmake -DBLAS64_SUFFIX="64" .. + +// If the suffix contains "_" (OpenBLAS in spack for example), use the +// following: + +// cd build ; cmake -DBLAS64_SUFFIX="_64" .. + +// This setting could be used by the spack packaging of SuiteSparse when linked +// with the spack-installed OpenBLAS with 64-bit integers. See +// https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/suite-sparse/package.py + +#if defined ( BLAS64__SUFFIX ) + + // The suffix includes an undersore (such as "_64"), so the Fortran name + // must be processed with the SUITESPARSE__FORTRAN macro. + #define SUITESPARSE_G(name,NAME) SUITESPARSE__FORTRAN(name,NAME) + #define SUITESPARSE_F(name,NAME) \ + SUITESPARSE_G (SUITESPARSE_CAT (name, BLAS64__SUFFIX), \ + SUITESPARSE_CAT (NAME, BLAS64__SUFFIX)) + #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_F(name,NAME) + +#elif defined ( BLAS64_SUFFIX ) + + // The suffix does not include an undersore, and neither do the original + // names of the BLAS and LAPACK routines. Thus, the Fortran name must be + // processed with the SUITESPARSE_FORTRAN macro. + #define SUITESPARSE_G(name,NAME) SUITESPARSE_FORTRAN(name,NAME) + #define SUITESPARSE_F(name,NAME) \ + SUITESPARSE_G (SUITESPARSE_CAT (name, BLAS64_SUFFIX), \ + SUITESPARSE_CAT (NAME, BLAS64_SUFFIX)) + #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_F(name,NAME) + +#else + + // No suffix is need, so the final Fortran name includes no suffix. + #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_FORTRAN(name,NAME) + +#endif + +//------------------------------------------------------------------------------ +// C names of Fortan BLAS and LAPACK functions used by SuiteSparse +//------------------------------------------------------------------------------ + +#define SUITESPARSE_BLAS_DTRSV SUITESPARSE_BLAS ( dtrsv , DTRSV ) +#define SUITESPARSE_BLAS_DGEMV SUITESPARSE_BLAS ( dgemv , DGEMV ) +#define SUITESPARSE_BLAS_DTRSM SUITESPARSE_BLAS ( dtrsm , DTRSM ) +#define SUITESPARSE_BLAS_DGEMM SUITESPARSE_BLAS ( dgemm , DGEMM ) +#define SUITESPARSE_BLAS_DSYRK SUITESPARSE_BLAS ( dsyrk , DSYRK ) +#define SUITESPARSE_BLAS_DGER SUITESPARSE_BLAS ( dger , DGER ) +#define SUITESPARSE_BLAS_DSCAL SUITESPARSE_BLAS ( dscal , DSCAL ) +#define SUITESPARSE_LAPACK_DPOTRF SUITESPARSE_BLAS ( dpotrf , DPOTRF ) + +#define SUITESPARSE_BLAS_ZTRSV SUITESPARSE_BLAS ( ztrsv , ZTRSV ) +#define SUITESPARSE_BLAS_ZGEMV SUITESPARSE_BLAS ( zgemv , ZGEMV ) +#define SUITESPARSE_BLAS_ZTRSM SUITESPARSE_BLAS ( ztrsm , ZTRSM ) +#define SUITESPARSE_BLAS_ZGEMM SUITESPARSE_BLAS ( zgemm , ZGEMM ) +#define SUITESPARSE_BLAS_ZHERK SUITESPARSE_BLAS ( zherk , ZHERK ) +#define SUITESPARSE_BLAS_ZGERU SUITESPARSE_BLAS ( zgeru , ZGERU ) +#define SUITESPARSE_BLAS_ZSCAL SUITESPARSE_BLAS ( zscal , ZSCAL ) +#define SUITESPARSE_LAPACK_ZPOTRF SUITESPARSE_BLAS ( zpotrf , ZPOTRF ) + +#define SUITESPARSE_BLAS_DNRM2 SUITESPARSE_BLAS ( dnrm2 , DNRM2 ) +#define SUITESPARSE_LAPACK_DLARF SUITESPARSE_BLAS ( dlarf , DLARF ) +#define SUITESPARSE_LAPACK_DLARFG SUITESPARSE_BLAS ( dlarfg , DLARFG ) +#define SUITESPARSE_LAPACK_DLARFT SUITESPARSE_BLAS ( dlarft , DLARFT ) +#define SUITESPARSE_LAPACK_DLARFB SUITESPARSE_BLAS ( dlarfb , DLARFB ) + +#define SUITESPARSE_BLAS_DZNRM2 SUITESPARSE_BLAS ( dznrm2 , DZNRM2 ) +#define SUITESPARSE_LAPACK_ZLARF SUITESPARSE_BLAS ( zlarf , ZLARF ) +#define SUITESPARSE_LAPACK_ZLARFG SUITESPARSE_BLAS ( zlarfg , ZLARFG ) +#define SUITESPARSE_LAPACK_ZLARFT SUITESPARSE_BLAS ( zlarft , ZLARFT ) +#define SUITESPARSE_LAPACK_ZLARFB SUITESPARSE_BLAS ( zlarfb , ZLARFB ) + +//------------------------------------------------------------------------------ +// prototypes of BLAS and SUITESPARSE_LAPACK functions +//------------------------------------------------------------------------------ + +// For complex functions, the (void *) parameters are actually pointers to +// arrays of complex values. They are prototyped here as (void *) to allow +// them to be called from both C and C++. + +// See https://netlib.org/blas/ and https://netlib.org/lapack/ for the +// definitions of the inputs/outputs of these functions. + +// These prototypes need to be found by UMFPACK, CHOLMOD, and SPQR, and to do +// so, they need to appear in this public header to ensure the correct BLAS +// library and integer size is used. However, these definitions should not +// (normally) be exposed to the user application. + +// If a user application wishes to use these definitions, simply add + +// #define SUITESPARSE_BLAS_DEFINITIONS +// #include "SuiteSparse_config.h" + +// prior to #include'ing any SuiteSparse headers (amd.h, and so on). + +#if defined ( SUITESPARSE_BLAS_DEFINITIONS ) + +void SUITESPARSE_BLAS_DGEMV // Y = alpha*A*x + beta*Y +( + // input: + const char *trans, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const double *alpha, + const double *A, + const SUITESPARSE_BLAS_INT *lda, + const double *X, + const SUITESPARSE_BLAS_INT *incx, + const double *beta, + // input/output: + double *Y, + // input: + const SUITESPARSE_BLAS_INT *incy +) ; + +#define SUITESPARSE_BLAS_dgemv(trans,m,n,alpha,A,lda,X,incx,beta,Y,incy,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DGEMV (trans, &M_blas_int, &N_blas_int, alpha, A, \ + &LDA_blas_int, X, &INCX_blas_int, beta, Y, &INCY_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZGEMV // Y = alpha*A*X + beta*Y +( + // input: + const char *trans, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const void *alpha, + const void *A, + const SUITESPARSE_BLAS_INT *lda, + const void *X, + const SUITESPARSE_BLAS_INT *incx, + const void *beta, + // input/output: + void *Y, + // input: + const SUITESPARSE_BLAS_INT *incy +) ; + +#define SUITESPARSE_BLAS_zgemv(trans,m,n,alpha,A,lda,X,incx,beta,Y,incy,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZGEMV (trans, &M_blas_int, &N_blas_int, alpha, A, \ + &LDA_blas_int, X, &INCX_blas_int, beta, Y, &INCY_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_DTRSV // solve Lx=b, Ux=b, L'x=b, or U'x=b +( + // input: + const char *uplo, + const char *trans, + const char *diag, + const SUITESPARSE_BLAS_INT *n, + const double *A, + const SUITESPARSE_BLAS_INT *lda, + // input/output: + double *X, + // input: + const SUITESPARSE_BLAS_INT *incx +) ; + +#define SUITESPARSE_BLAS_dtrsv(uplo,trans,diag,n,A,lda,X,incx,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DTRSV (uplo, trans, diag, &N_blas_int, A, \ + &LDA_blas_int, X, &INCX_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZTRSV // solve (L, L', L^H, U, U', or U^H)x=b +( + // input: + const char *uplo, + const char *trans, + const char *diag, + const SUITESPARSE_BLAS_INT *n, + const void *A, + const SUITESPARSE_BLAS_INT *lda, + // input/output: + void *X, + // input: + const SUITESPARSE_BLAS_INT *incx +) ; + +#define SUITESPARSE_BLAS_ztrsv(uplo,trans,diag,n,A,lda,X,incx,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZTRSV (uplo, trans, diag, &N_blas_int, A, \ + &LDA_blas_int, X, &INCX_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_DTRSM // solve LX=B, UX=B, L'X=B, or U'X=B +( + // input: + const char *side, + const char *uplo, + const char *transa, + const char *diag, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const double *alpha, + const double *A, + const SUITESPARSE_BLAS_INT *lda, + // input/output: + double *B, + // input: + const SUITESPARSE_BLAS_INT *ldb +) ; + +#define SUITESPARSE_BLAS_dtrsm(side,uplo,transa,diag,m,n,alpha,A,lda,B,ldb,ok)\ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDB_blas_int, ldb, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DTRSM (side, uplo, transa, diag, &M_blas_int, \ + &N_blas_int, alpha, A, &LDA_blas_int, B, &LDB_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZTRSM // solve (L, L', L^H, U, U', or U^H)X=B +( + // input: + const char *side, + const char *uplo, + const char *transa, + const char *diag, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const void *alpha, + const void *A, + const SUITESPARSE_BLAS_INT *lda, + // input/output: + void *B, + // input: + const SUITESPARSE_BLAS_INT *ldb +) ; + +#define SUITESPARSE_BLAS_ztrsm(side,uplo,transa,diag,m,n,alpha,A,lda,B,ldb,ok)\ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDB_blas_int, ldb, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZTRSM (side, uplo, transa, diag, &M_blas_int, \ + &N_blas_int, alpha, A, &LDA_blas_int, B, &LDB_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_DGEMM // C = alpha*A*B + beta*C +( + // input: + const char *transa, + const char *transb, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const double *alpha, + const double *A, + const SUITESPARSE_BLAS_INT *lda, + const double *B, + const SUITESPARSE_BLAS_INT *ldb, + const double *beta, + // input/output: + double *C, + // input: + const SUITESPARSE_BLAS_INT *ldc +) ; + +#define SUITESPARSE_BLAS_dgemm(transa,transb,m,n,k,alpha,A,lda,B,ldb,beta, \ + C,ldc,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDB_blas_int, ldb, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DGEMM (transa, transb, &M_blas_int, &N_blas_int, \ + &K_blas_int, alpha, A, &LDA_blas_int, B, &LDB_blas_int, beta, C, \ + &LDC_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZGEMM // C = alpha*A*B + beta*C +( + // input: + const char *transa, + const char *transb, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const void *alpha, + const void *A, + const SUITESPARSE_BLAS_INT *lda, + const void *B, + const SUITESPARSE_BLAS_INT *ldb, + const void *beta, + // input/output: + void *C, + // input: + const SUITESPARSE_BLAS_INT *ldc +) ; + +#define SUITESPARSE_BLAS_zgemm(transa,transb,m,n,k,alpha,A,lda,B,ldb,beta, \ + C,ldc,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDB_blas_int, ldb, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZGEMM (transa, transb, &M_blas_int, &N_blas_int, \ + &K_blas_int, alpha, A, &LDA_blas_int, B, &LDB_blas_int, beta, C, \ + &LDC_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_DSYRK // C = alpha*A*A' + beta*C, or A'A +( + // input: + const char *uplo, + const char *trans, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const double *alpha, + const double *A, + const SUITESPARSE_BLAS_INT *lda, + const double *beta, + // input/output: + double *C, + // input: + const SUITESPARSE_BLAS_INT *ldc +) ; + +#define SUITESPARSE_BLAS_dsyrk(uplo,trans,n,k,alpha,A,lda,beta,C,ldc,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DSYRK (uplo, trans, &N_blas_int, &K_blas_int, alpha, \ + A, &LDA_blas_int, beta, C, &LDC_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZHERK // C = alpha*A*A^H + beta*C, or A^H*A +( + // input: + const char *uplo, + const char *trans, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const void *alpha, + const void *A, + const SUITESPARSE_BLAS_INT *lda, + const void *beta, + // input/output: + void *C, + // input: + const SUITESPARSE_BLAS_INT *ldc +) ; + +#define SUITESPARSE_BLAS_zherk(uplo,trans,n,k,alpha,A,lda,beta,C,ldc,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZHERK (uplo, trans, &N_blas_int, &K_blas_int, alpha, \ + A, &LDA_blas_int, beta, C, &LDC_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_DPOTRF // Cholesky factorization +( + // input: + const char *uplo, + const SUITESPARSE_BLAS_INT *n, + // input/output: + double *A, + // input: + const SUITESPARSE_BLAS_INT *lda, + // output: + SUITESPARSE_BLAS_INT *info +) ; + +#define SUITESPARSE_LAPACK_dpotrf(uplo,n,A,lda,info,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + info = 1 ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_INT LAPACK_Info = -999 ; \ + SUITESPARSE_LAPACK_DPOTRF (uplo, &N_blas_int, A, &LDA_blas_int, \ + &LAPACK_Info) ; \ + info = (Int) LAPACK_Info ; \ + } \ +} + +void SUITESPARSE_LAPACK_ZPOTRF // Cholesky factorization +( + // input: + const char *uplo, + const SUITESPARSE_BLAS_INT *n, + // input/output: + void *A, + // input: + const SUITESPARSE_BLAS_INT *lda, + // output: + SUITESPARSE_BLAS_INT *info +) ; + +#define SUITESPARSE_LAPACK_zpotrf(uplo,n,A,lda,info,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + info = 1 ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_INT LAPACK_Info = -999 ; \ + SUITESPARSE_LAPACK_ZPOTRF (uplo, &N_blas_int, A, &LDA_blas_int, \ + &LAPACK_Info) ; \ + info = LAPACK_Info ; \ + } \ +} + +void SUITESPARSE_BLAS_DSCAL // Y = alpha*Y +( + // input: + const SUITESPARSE_BLAS_INT *n, + const double *alpha, + // input/output: + double *Y, + // input: + const SUITESPARSE_BLAS_INT *incy +) ; + +#define SUITESPARSE_BLAS_dscal(n,alpha,Y,incy,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DSCAL (&N_blas_int, alpha, Y, &INCY_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZSCAL // Y = alpha*Y +( + // input: + const SUITESPARSE_BLAS_INT *n, + const void *alpha, + // input/output: + void *Y, + // input: + const SUITESPARSE_BLAS_INT *incy +) ; + +#define SUITESPARSE_BLAS_zscal(n,alpha,Y,incy,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZSCAL (&N_blas_int, alpha, Y, &INCY_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_DGER // A = alpha*x*y' + A +( + // input: + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const double *alpha, + const double *X, + const SUITESPARSE_BLAS_INT *incx, + const double *Y, + const SUITESPARSE_BLAS_INT *incy, + // input/output: + double *A, + // input: + const SUITESPARSE_BLAS_INT *lda +) ; + +#define SUITESPARSE_BLAS_dger(m,n,alpha,X,incx,Y,incy,A,lda,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DGER (&M_blas_int, &N_blas_int, alpha, X, \ + &INCX_blas_int, Y, &INCY_blas_int, A, &LDA_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZGERU // A = alpha*x*y' + A +( + // input: + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const void *alpha, + const void *X, + const SUITESPARSE_BLAS_INT *incx, + const void *Y, + const SUITESPARSE_BLAS_INT *incy, + // input/output: + void *A, + // input: + const SUITESPARSE_BLAS_INT *lda +) ; + +#define SUITESPARSE_BLAS_zgeru(m,n,alpha,X,incx,Y,incy,A,lda,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZGERU (&M_blas_int, &N_blas_int, alpha, X, \ + &INCX_blas_int, Y, &INCY_blas_int, A, &LDA_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_DLARFT // T = block Householder factor +( + // input: + const char *direct, + const char *storev, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const double *V, + const SUITESPARSE_BLAS_INT *ldv, + const double *Tau, + // output: + double *T, + // input: + const SUITESPARSE_BLAS_INT *ldt +) ; + +#define SUITESPARSE_LAPACK_dlarft(direct,storev,n,k,V,ldv,Tau,T,ldt,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDV_blas_int, ldv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDT_blas_int, ldt, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_DLARFT (direct, storev, &N_blas_int, &K_blas_int, \ + V, &LDV_blas_int, Tau, T, &LDT_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_ZLARFT // T = block Householder factor +( + // input: + const char *direct, + const char *storev, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const void *V, + const SUITESPARSE_BLAS_INT *ldv, + const void *Tau, + // output: + void *T, + // input: + const SUITESPARSE_BLAS_INT *ldt +) ; + +#define SUITESPARSE_LAPACK_zlarft(direct,storev,n,k,V,ldv,Tau,T,ldt,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDV_blas_int, ldv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDT_blas_int, ldt, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_ZLARFT (direct, storev, &N_blas_int, &K_blas_int, \ + V, &LDV_blas_int, Tau, T, &LDT_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_DLARFB // apply block Householder reflector +( + // input: + const char *side, + const char *trans, + const char *direct, + const char *storev, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const double *V, + const SUITESPARSE_BLAS_INT *ldv, + const double *T, + const SUITESPARSE_BLAS_INT *ldt, + // input/output: + double *C, + // input: + const SUITESPARSE_BLAS_INT *ldc, + // workspace: + double *Work, + // input: + const SUITESPARSE_BLAS_INT *ldwork +) ; + +#define SUITESPARSE_LAPACK_dlarfb(side,trans,direct,storev,m,n,k,V,ldv,T,ldt, \ + C,ldc,Work,ldwork,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDV_blas_int, ldv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDT_blas_int, ldt, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDWORK_blas_int, ldwork, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_DLARFB (side, trans, direct, storev, &M_blas_int, \ + &N_blas_int, &K_blas_int, V, &LDV_blas_int, T, &LDT_blas_int, C, \ + &LDC_blas_int, Work, &LDWORK_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_ZLARFB // apply block Householder reflector +( + // input: + const char *side, + const char *trans, + const char *direct, + const char *storev, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const void *V, + const SUITESPARSE_BLAS_INT *ldv, + const void *T, + const SUITESPARSE_BLAS_INT *ldt, + // input/output: + void *C, + // input: + const SUITESPARSE_BLAS_INT *ldc, + // workspace: + void *Work, + // input: + const SUITESPARSE_BLAS_INT *ldwork +) ; + +#define SUITESPARSE_LAPACK_zlarfb(side,trans,direct,storev,m,n,k,V,ldv,T,ldt, \ + C,ldc,Work,ldwork,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDV_blas_int, ldv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDT_blas_int, ldt, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDWORK_blas_int, ldwork, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_ZLARFB (side, trans, direct, storev, &M_blas_int, \ + &N_blas_int, &K_blas_int, V, &LDV_blas_int, T, &LDT_blas_int, C, \ + &LDC_blas_int, Work, &LDWORK_blas_int) ; \ + } \ +} + +double SUITESPARSE_BLAS_DNRM2 // vector 2-norm +( + // input: + const SUITESPARSE_BLAS_INT *n, + const double *X, + const SUITESPARSE_BLAS_INT *incx +) ; + +#define SUITESPARSE_BLAS_dnrm2(result,n,X,incx,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + result = 0 ; \ + if (ok) \ + { \ + result = SUITESPARSE_BLAS_DNRM2 (&N_blas_int, X, &INCX_blas_int) ; \ + } \ +} + +double SUITESPARSE_BLAS_DZNRM2 // vector 2-norm +( + // input: + const SUITESPARSE_BLAS_INT *n, + const void *X, + const SUITESPARSE_BLAS_INT *incx +) ; + +#define SUITESPARSE_BLAS_dznrm2(result,n,X,incx,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + result = 0 ; \ + if (ok) \ + { \ + result = SUITESPARSE_BLAS_DZNRM2 (&N_blas_int, X, &INCX_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_DLARFG // generate Householder reflector +( + // input: + const SUITESPARSE_BLAS_INT *n, + // input/output: + double *alpha, + double *X, + // input: + const SUITESPARSE_BLAS_INT *incx, + // output: + double *tau +) ; + +#define SUITESPARSE_LAPACK_dlarfg(n,alpha,X,incx,tau,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_DLARFG (&N_blas_int, alpha, X, &INCX_blas_int, \ + tau) ; \ + } \ +} + +void SUITESPARSE_LAPACK_ZLARFG // generate Householder reflector +( + // input: + const SUITESPARSE_BLAS_INT *n, + // input/output: + void *alpha, + void *X, + // input: + const SUITESPARSE_BLAS_INT *incx, + // output: + void *tau +) ; + +#define SUITESPARSE_LAPACK_zlarfg(n,alpha,X,incx,tau,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_ZLARFG (&N_blas_int, alpha, X, &INCX_blas_int, \ + tau) ; \ + } \ +} + +void SUITESPARSE_LAPACK_DLARF // apply Householder reflector +( + // input: + const char *side, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const double *V, + const SUITESPARSE_BLAS_INT *incv, + const double *tau, + // input/output: + double *C, + // input: + const SUITESPARSE_BLAS_INT *ldc, + // workspace: + double *Work +) ; + +#define SUITESPARSE_LAPACK_dlarf(side,m,n,V,incv,tau,C,ldc,Work,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCV_blas_int, incv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_DLARF (side, &M_blas_int, &N_blas_int, V, \ + &INCV_blas_int, tau, C, &LDC_blas_int, Work) ; \ + } \ +} + +void SUITESPARSE_LAPACK_ZLARF // apply Householder reflector +( + // input: + const char *side, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const void *V, + const SUITESPARSE_BLAS_INT *incv, + const void *tau, + // input/output: + void *C, + // input: + const SUITESPARSE_BLAS_INT *ldc, + // workspace: + void *Work +) ; + +#define SUITESPARSE_LAPACK_zlarf(side,m,n,V,incv,tau,C,ldc,Work,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCV_blas_int, incv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_ZLARF (side, &M_blas_int, &N_blas_int, V, \ + &INCV_blas_int, tau, C, &LDC_blas_int, Work) ; \ + } \ +} + +#endif + +//------------------------------------------------------------------------------ +// SuiteSparse_BLAS_library: return name of BLAS library found +//------------------------------------------------------------------------------ + +// Returns the name of the BLAS library found by SuiteSparse_config + +const char *SuiteSparse_BLAS_library ( void ) ; + +//------------------------------------------------------------------------------ +// SuiteSparse_BLAS_integer_size: return sizeof (SUITESPARSE_BLAS_INT) +//------------------------------------------------------------------------------ + +size_t SuiteSparse_BLAS_integer_size ( void ) ; + +#ifdef __cplusplus +} +#endif +#endif + diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/Makefile b/ThirdParty/SuiteSparse/SuiteSparse_config/Makefile index 695a327a45..9893afe789 100644 --- a/ThirdParty/SuiteSparse/SuiteSparse_config/Makefile +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/Makefile @@ -1,72 +1,81 @@ #------------------------------------------------------------------------------- -# SuiteSparse_config Makefile +# SuiteSparse/SuiteSparse_config/Makefile #------------------------------------------------------------------------------- -SUITESPARSE ?= $(realpath $(CURDIR)/..) -export SUITESPARSE +# SuiteSparse_config, Copyright (c) 2012-2023, Timothy A. Davis. +# All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause -# version of SuiteSparse_config is also version of SuiteSparse meta-package -LIBRARY = libsuitesparseconfig -VERSION = 5.4.0 -SO_VERSION = 5 +#------------------------------------------------------------------------------- -default: library +# A simple Makefile for SuiteSparse_config, which relies on cmake to do the +# actual build. All the work is done in cmake so this Makefile is just for +# convenience. + +# To compile with an alternate compiler: +# +# make CC=gcc CXX=g++ +# +# To compile/install for system-wide usage and for local usage in +# SuiteSparse/lib and SuiteSparse/include: +# +# make +# sudo make install +# +# To compile/install for local usage (SuiteSparse/lib and SuiteSparse/include): +# +# make local +# make install +# +# To clean up the files: +# +# make clean + +JOBS ?= 8 -include SuiteSparse_config.mk +default: library -ccode: all +# default is to install only in /usr/local +library: + ( cd build && cmake $(CMAKE_OPTIONS) .. && cmake --build . -j${JOBS} ) -all: library +# install only in SuiteSparse/lib and SuiteSparse/include +local: + ( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=1 .. && cmake --build . -j${JOBS} ) -# compile and install in SuiteSparse/lib -library: $(AR_TARGET) - $(MAKE) install INSTALL=$(SUITESPARSE) +# install only in /usr/local (default) +global: + ( cd build && cmake $(CMAKE_OPTIONS) -DLOCAL_INSTALL=0 .. && cmake --build . -j${JOBS} ) -OBJ = SuiteSparse_config.o +debug: + ( cd build ; cmake $(CMAKE_OPTIONS) -DCMAKE_BUILD_TYPE=Debug .. ; cmake --build . ) -SuiteSparse_config.o: SuiteSparse_config.c SuiteSparse_config.h - $(CC) $(CF) -c SuiteSparse_config.c +all: library -static: $(AR_TARGET) +demos: library -$(AR_TARGET): $(OBJ) - $(ARCHIVE) $(AR_TARGET) SuiteSparse_config.o - $(RANLIB) $(AR_TARGET) +# just compile after running cmake; do not run cmake again +remake: + ( cd build ; cmake --build . ) -distclean: purge +# just run cmake to set things up +setup: + ( cd build ; cmake $(CMAKE_OPTIONS) .. ) -purge: clean - ( cd xerbla ; $(MAKE) purge ) - - $(RM) -r $(PURGE) +install: + ( cd build ; cmake --install . ) -clean: - ( cd xerbla ; $(MAKE) clean ) - - $(RM) -r $(CLEAN) +# remove any installed libraries and #include files +uninstall: + - xargs rm < build/install_manifest.txt -# install SuiteSparse_config -install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET) +# remove all files not in the distribution +clean: distclean -$(INSTALL_LIB)/$(SO_TARGET): $(OBJ) - @mkdir -p $(INSTALL_LIB) - @mkdir -p $(INSTALL_INCLUDE) - @mkdir -p $(INSTALL_DOC) - $(CC) $(SO_OPTS) $^ -o $@ $(LDLIBS) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) ) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) ) - $(CP) SuiteSparse_config.h $(INSTALL_INCLUDE) - $(CP) README.txt $(INSTALL_DOC)/SUITESPARSECONFIG_README.txt - chmod 755 $(INSTALL_LIB)/$(SO_TARGET) - chmod 755 $(INSTALL_LIB)/$(SO_PLAIN) - chmod 644 $(INSTALL_INCLUDE)/SuiteSparse_config.h - chmod 644 $(INSTALL_DOC)/SUITESPARSECONFIG_README.txt +purge: distclean -# uninstall SuiteSparse_config -uninstall: - $(RM) $(INSTALL_LIB)/$(SO_TARGET) - $(RM) $(INSTALL_LIB)/$(SO_PLAIN) - $(RM) $(INSTALL_LIB)/$(SO_MAIN) - $(RM) $(INSTALL_INCLUDE)/SuiteSparse_config.h - $(RM) $(INSTALL_DOC)/SUITESPARSECONFIG_README.txt - ( cd xerbla ; $(MAKE) uninstall ) +distclean: + - $(RM) -rf build/* Config/*.tmp +docs: diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/README.txt b/ThirdParty/SuiteSparse/SuiteSparse_config/README.txt index 8555cc459e..4ff01953f8 100644 --- a/ThirdParty/SuiteSparse/SuiteSparse_config/README.txt +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/README.txt @@ -1,15 +1,10 @@ -SuiteSparse_config, 2018, Timothy A. Davis, http://www.suitesparse.com -(formerly the UFconfig package) +SuiteSparse_config, Copyright (c) 2012-2023, Timothy A. Davis. +All Rights Reserved. +SPDX-License-Identifier: BSD-3-clause -This directory contains a default SuiteSparse_config.mk file. It tries to -detect your system (Linux, SunOS, or Mac), which compiler to use (icc or cc), -which BLAS and LAPACK library to use (OpenBLAS or MKL), and whether or not to -compile with CUDA. - -For alternatives, see the comments in the SuiteSparse_config.mk file. - -License: No licensing restrictions apply to this file or to the -SuiteSparse_config directory. +The version of SuiteSparse_config always matches the version of the SuiteSparse +meta-package. See the top-level SuiteSparse/ChangeLog for changes to this +package. -------------------------------------------------------------------------------- @@ -17,6 +12,59 @@ SuiteSparse_config contains configuration settings for all many of the software packages that I develop or co-author. Note that older versions of some of these packages do not require SuiteSparse_config. +Files in SuiteSparse_config: + + CMakeLists.txt for compiling SuiteSparse_config + Makefile simple Makefile to control cmake (optional) + README.txt this file + SuiteSparse_config.c SuiteSparse-wide utilities + SuiteSparse_config.h SuiteSparse-wide include file + (created from Config/SuiteSparse_config.h) + + build/ where SuiteSparse_config is compiled + + Config/SuiteSparse_config.h.in source for SuiteSparse_config.h + Config/README.md.in README.md for all of SuiteSparse + + cmake_modules/FindSuiteSparse_config.cmake how to find SuiteSparse_config + cmake_modules/SuiteSparseBLAS.cmake find BLAS for SuiteSparse + cmake_modules/SuiteSparseBLAS32.cmake when a 32-bit BLAS is found + cmake_modules/SuiteSparseBLAS64.cmake when a 64-bit BLAS is found + cmake_modules/SuiteSparseLAPACK.cmake find LAPACK for SuiteSparse + cmake_modules/SuiteSparsePolicy.cmake SuiteSparse-wide policies + cmake_modules/SuiteSparseReport.cmake SuiteSparse-wide reporting + +For packages that use cmake and require SuiteSparse_config, see: + + ../SuiteSparse_config/cmake_modules/FindSuiteSparse_config.cmake + +To compile/install SuiteSparse_config on Linux/MacOS, in this directory do: + + make + sudo make install + +To compile all of SuiteSparse for installation only in ../lib +and ../include instead: + + make local + +Within each package, to install only in ../lib and ../include, +for example for UMFPACK: + + cd UMFPACK + make local + make install + +To clean up: + + make clean + +See the SuiteSparse/SuiteSparse_config/Makefile for more options. + +-------------------------------------------------------------------------------- +SuiteSparse packages: +-------------------------------------------------------------------------------- + Package Description ------- ----------- AMD approximate minimum degree ordering @@ -32,6 +80,7 @@ these packages do not require SuiteSparse_config. LPDASA LP Dual Active Set Algorithm RBio read/write files in Rutherford/Boeing format SPQR sparse QR factorization (full name: SuiteSparseQR) + SPEX sparse left-looking integer-preserving LU factorization SuiteSparse_config is not required by these packages: @@ -39,14 +88,7 @@ SuiteSparse_config is not required by these packages: MATLAB_Tools toolboxes for use in MATLAB GraphBLAS graph algorithms in the language of linear algebra -In addition, the xerbla/ directory contains Fortan and C versions of the -BLAS/LAPACK xerbla routine, which is called when an invalid input is passed to -the BLAS or LAPACK. The xerbla provided here does not print any message, so -the entire Fortran I/O library does not need to be linked into a C application. -Most versions of the BLAS contain xerbla, but those from K. Goto do not. Use -this if you need too. - -If you edit this directory (SuiteSparse_config.mk in particular) then you -must do "make purge ; make" in the parent directory to recompile all of -SuiteSparse. Otherwise, the changes will not necessarily be applied. +If you edit this directory then you should do "make purge ; make" in the parent +directory to recompile all of SuiteSparse. Otherwise, the changes will not +necessarily be applied. diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.c b/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.c index 595e46781f..079093716a 100644 --- a/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.c +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.c @@ -1,44 +1,34 @@ -/* ========================================================================== */ -/* === SuiteSparse_config =================================================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// SuiteSparse_config/SuiteSparse_config.c: common utilites for SuiteSparse +//------------------------------------------------------------------------------ -/* SuiteSparse configuration : memory manager and printf functions. */ +// SuiteSparse_config, Copyright (c) 2012-2023, Timothy A. Davis. +// All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause -/* Copyright (c) 2013-2018, Timothy A. Davis. No licensing restrictions - * apply to this file or to the SuiteSparse_config directory. - * Author: Timothy A. Davis. - */ - -#include -#include - -#ifndef NPRINT -#include -#endif - -#ifdef MATLAB_MEX_FILE -#include "mex.h" -#include "matrix.h" -#endif +//------------------------------------------------------------------------------ -#ifndef NULL -#define NULL ((void *) 0) -#endif +/* SuiteSparse configuration : memory manager and printf functions. + */ +#define SUITESPARSE_LIBRARY #include "SuiteSparse_config.h" /* -------------------------------------------------------------------------- */ -/* SuiteSparse_config : a global extern struct */ +/* SuiteSparse_config : a static struct */ /* -------------------------------------------------------------------------- */ -/* The SuiteSparse_config struct is available to all SuiteSparse functions and - to all applications that use those functions. It must be modified with - care, particularly in a multithreaded context. Normally, the application - will initialize this object once, via SuiteSparse_start, possibily followed - by application-specific modifications if the applications wants to use - alternative memory manager functions. +/* The SuiteSparse_config struct is indirectly available to all SuiteSparse + functions and to all applications that use those functions. In v6.x and + earlier, it was globally visible, but it is now hidden and accessible only + by functions in this file (SuiteSparse v7.0.0 and later). + + It must be modified with care, particularly in a multithreaded context. + Normally, the application will initialize this object once, via + SuiteSparse_start, possibily followed by application-specific modifications + if the applications wants to use alternative memory manager functions. - The user can redefine these global pointers at run-time to change the + The user can redefine these pointers at run-time to change the memory manager and printf function used by SuiteSparse. If -DNMALLOC is defined at compile-time, then no memory-manager is @@ -49,7 +39,18 @@ SuiteSparse will not use printf. */ -struct SuiteSparse_config_struct SuiteSparse_config = +struct SuiteSparse_config_struct +{ + void *(*malloc_func) (size_t) ; // pointer to malloc + void *(*calloc_func) (size_t, size_t) ; // pointer to calloc + void *(*realloc_func) (void *, size_t) ; // pointer to realloc + void (*free_func) (void *) ; // pointer to free + int (*printf_func) (const char *, ...) ; // pointer to printf + double (*hypot_func) (double, double) ; // pointer to hypot + int (*divcomplex_func) (double, double, double, double, double *, double *); +} ; + +static struct SuiteSparse_config_struct SuiteSparse_config = { /* memory management functions */ @@ -80,11 +81,133 @@ struct SuiteSparse_config_struct SuiteSparse_config = NULL, #endif - SuiteSparse_hypot, + hypot, // was SuiteSparse_hypot in v5 and earlier SuiteSparse_divcomplex } ; +//------------------------------------------------------------------------------ +// SuiteSparse_config_*_get methods +//------------------------------------------------------------------------------ + +// Methods that return the contents of the SuiteSparse_config struct. + +void *(*SuiteSparse_config_malloc_func_get (void)) (size_t) +{ + return (SuiteSparse_config.malloc_func) ; +} + +void *(*SuiteSparse_config_calloc_func_get (void)) (size_t, size_t) +{ + return (SuiteSparse_config.calloc_func) ; +} + +void *(*SuiteSparse_config_realloc_func_get (void)) (void *, size_t) +{ + return (SuiteSparse_config.realloc_func) ; +} + +void (*SuiteSparse_config_free_func_get (void)) (void *) +{ + return (SuiteSparse_config.free_func) ; +} + +int (*SuiteSparse_config_printf_func_get (void)) (const char *, ...) +{ + return (SuiteSparse_config.printf_func) ; +} + +double (*SuiteSparse_config_hypot_func_get (void)) (double, double) +{ + return (SuiteSparse_config.hypot_func) ; +} + +int (*SuiteSparse_config_divcomplex_func_get (void)) (double, double, double, double, double *, double *) +{ + return (SuiteSparse_config.divcomplex_func) ; +} + +//------------------------------------------------------------------------------ +// SuiteSparse_config_*_set methods +//------------------------------------------------------------------------------ + +// Methods that set the contents of the SuiteSparse_config struct. + +void SuiteSparse_config_malloc_func_set (void *(*malloc_func) (size_t)) +{ + SuiteSparse_config.malloc_func = malloc_func ; +} + +void SuiteSparse_config_calloc_func_set (void *(*calloc_func) (size_t, size_t)) +{ + SuiteSparse_config.calloc_func = calloc_func ; +} + +void SuiteSparse_config_realloc_func_set (void *(*realloc_func) (void *, size_t)) +{ + SuiteSparse_config.realloc_func = realloc_func ; +} + +void SuiteSparse_config_free_func_set (void (*free_func) (void *)) +{ + SuiteSparse_config.free_func = free_func ; +} + +void SuiteSparse_config_printf_func_set (int (*printf_func) (const char *, ...)) +{ + SuiteSparse_config.printf_func = printf_func ; +} + +void SuiteSparse_config_hypot_func_set (double (*hypot_func) (double, double)) +{ + SuiteSparse_config.hypot_func = hypot_func ; +} + +void SuiteSparse_config_divcomplex_func_set (int (*divcomplex_func) (double, double, double, double, double *, double *)) +{ + SuiteSparse_config.divcomplex_func = divcomplex_func ; +} + +//------------------------------------------------------------------------------ +// SuiteSparse_config_*_call methods +//------------------------------------------------------------------------------ + +// Methods that directly call the functions in the SuiteSparse_config struct. +// Note that there is no wrapper for the printf_func. + +void *SuiteSparse_config_malloc (size_t s) +{ + return (SuiteSparse_config.malloc_func (s)) ; +} + +void *SuiteSparse_config_calloc (size_t n, size_t s) +{ + return (SuiteSparse_config.calloc_func (n, s)) ; +} + +void *SuiteSparse_config_realloc (void *p, size_t s) +{ + return (SuiteSparse_config.realloc_func (p, s)) ; +} + +void SuiteSparse_config_free (void *p) +{ + SuiteSparse_config.free_func (p) ; +} + +double SuiteSparse_config_hypot (double x, double y) +{ + return (SuiteSparse_config.hypot_func (x, y)) ; +} + +int SuiteSparse_config_divcomplex +( + double xr, double xi, double yr, double yi, double *zr, double *zi +) +{ + return (SuiteSparse_config.divcomplex_func (xr, xi, yr, yi, zr, zi)) ; +} + /* -------------------------------------------------------------------------- */ /* SuiteSparse_start */ /* -------------------------------------------------------------------------- */ @@ -143,7 +266,7 @@ void SuiteSparse_start ( void ) #endif /* math functions */ - SuiteSparse_config.hypot_func = SuiteSparse_hypot ; + SuiteSparse_config.hypot_func = hypot ; // was SuiteSparse_hypot in v5 SuiteSparse_config.divcomplex_func = SuiteSparse_divcomplex ; } @@ -194,7 +317,6 @@ void *SuiteSparse_malloc /* pointer to allocated block of memory */ return (p) ; } - /* -------------------------------------------------------------------------- */ /* SuiteSparse_calloc: calloc wrapper */ /* -------------------------------------------------------------------------- */ @@ -312,7 +434,6 @@ void *SuiteSparse_free /* always returns NULL */ return (NULL) ; } - /* -------------------------------------------------------------------------- */ /* SuiteSparse_tic: return current wall clock time */ /* -------------------------------------------------------------------------- */ @@ -344,36 +465,57 @@ void *SuiteSparse_free /* always returns NULL */ * include file. */ -#ifdef SUITESPARSE_TIMER_ENABLED +#if !defined ( SUITESPARSE_TIMER_ENABLED ) -#include + /* ---------------------------------------------------------------------- */ + /* no timer */ + /* ---------------------------------------------------------------------- */ -void SuiteSparse_tic -( - double tic [2] /* output, contents undefined on input */ -) -{ - /* POSIX C 1993 timer, requires -librt */ - struct timespec t ; - clock_gettime (CLOCK_MONOTONIC, &t) ; - tic [0] = (double) (t.tv_sec) ; - tic [1] = (double) (t.tv_nsec) ; -} + void SuiteSparse_tic + ( + double tic [2] /* output, contents undefined on input */ + ) + { + /* no timer installed */ + tic [0] = 0 ; + tic [1] = 0 ; + } -#else +#elif defined ( _OPENMP ) -void SuiteSparse_tic -( - double tic [2] /* output, contents undefined on input */ -) -{ - /* no timer installed */ - tic [0] = 0 ; - tic [1] = 0 ; -} + /* ---------------------------------------------------------------------- */ + /* OpenMP timer */ + /* ---------------------------------------------------------------------- */ -#endif + void SuiteSparse_tic + ( + double tic [2] /* output, contents undefined on input */ + ) + { + tic [0] = omp_get_wtime ( ) ; + tic [1] = 0 ; + } + +#else + + /* ---------------------------------------------------------------------- */ + /* POSIX timer */ + /* ---------------------------------------------------------------------- */ + + #include + void SuiteSparse_tic + ( + double tic [2] /* output, contents undefined on input */ + ) + { + /* POSIX C 1993 timer, requires -lrt */ + struct timespec t ; + clock_gettime (CLOCK_MONOTONIC, &t) ; + tic [0] = (double) (t.tv_sec) ; + tic [1] = (double) (t.tv_nsec) ; + } +#endif /* -------------------------------------------------------------------------- */ /* SuiteSparse_toc: return time since last tic */ @@ -396,7 +538,6 @@ double SuiteSparse_toc /* returns time in seconds since last tic */ return ((toc [0] - tic [0]) + 1e-9 * (toc [1] - tic [1])) ; } - /* -------------------------------------------------------------------------- */ /* SuiteSparse_time: return current wallclock time in seconds */ /* -------------------------------------------------------------------------- */ @@ -413,7 +554,6 @@ double SuiteSparse_time /* returns current wall clock time in seconds */ return (toc [0] + 1e-9 * toc [1]) ; } - /* -------------------------------------------------------------------------- */ /* SuiteSparse_version: return the current version of SuiteSparse */ /* -------------------------------------------------------------------------- */ @@ -432,26 +572,22 @@ int SuiteSparse_version return (SUITESPARSE_VERSION) ; } -/* -------------------------------------------------------------------------- */ -/* SuiteSparse_hypot */ -/* -------------------------------------------------------------------------- */ +//------------------------------------------------------------------------------ +// SuiteSparse_hypot +//------------------------------------------------------------------------------ -/* There is an equivalent routine called hypot in , which conforms - * to ANSI C99. However, SuiteSparse does not assume that ANSI C99 is - * available. You can use the ANSI C99 hypot routine with: - * - * #include - *i SuiteSparse_config.hypot_func = hypot ; - * - * Default value of the SuiteSparse_config.hypot_func pointer is - * SuiteSparse_hypot, defined below. - * - * s = hypot (x,y) computes s = sqrt (x*x + y*y) but does so more accurately. - * The NaN cases for the double relops x >= y and x+y == x are safely ignored. - * - * Source: Algorithm 312, "Absolute value and square root of a complex number," - * P. Friedland, Comm. ACM, vol 10, no 10, October 1967, page 665. - */ +// SuiteSparse_config v5 and earlier used SuiteSparse_hypot, defined below. +// SuiteSparse_config v6 now uses the hypot method in , by default. +// The hypot function appears in ANSI C99 and later, and SuiteSparse now +// assumes ANSI C11. + +// s = hypot (x,y) computes s = sqrt (x*x + y*y) but does so more accurately. +// The NaN cases for the double relops x >= y and x+y == x are safely ignored. + +// Source: Algorithm 312, "Absolute value and square root of a complex number," +// P. Friedland, Comm. ACM, vol 10, no 10, October 1967, page 665. + +// This method below is kept for historical purposes. double SuiteSparse_hypot (double x, double y) { @@ -485,47 +621,162 @@ double SuiteSparse_hypot (double x, double y) return (s) ; } -/* -------------------------------------------------------------------------- */ -/* SuiteSparse_divcomplex */ -/* -------------------------------------------------------------------------- */ - -/* c = a/b where c, a, and b are complex. The real and imaginary parts are - * passed as separate arguments to this routine. The NaN case is ignored - * for the double relop br >= bi. Returns 1 if the denominator is zero, - * 0 otherwise. - * - * This uses ACM Algo 116, by R. L. Smith, 1962, which tries to avoid - * underflow and overflow. - * - * c can be the same variable as a or b. - * - * Default value of the SuiteSparse_config.divcomplex_func pointer is - * SuiteSparse_divcomplex. - */ +//------------------------------------------------------------------------------ +// SuiteSparse_divcomplex +//------------------------------------------------------------------------------ + +// z = x/y where z, x, and y are complex. The real and imaginary parts are +// passed as separate arguments to this routine. The NaN case is ignored +// for the double relop yr >= yi. Returns 1 if the denominator is zero, +// 0 otherwise. +// +// This uses ACM Algo 116, by R. L. Smith, 1962, which tries to avoid +// underflow and overflow. +// +// z can be the same variable as x or y. +// +// Default value of the SuiteSparse_config.divcomplex_func pointer is +// SuiteSparse_divcomplex. +// +// This function is identical to GB_divcomplex in GraphBLAS/Source/GB_math.h. +// The only difference is the name of the function. int SuiteSparse_divcomplex ( - double ar, double ai, /* real and imaginary parts of a */ - double br, double bi, /* real and imaginary parts of b */ - double *cr, double *ci /* real and imaginary parts of c */ + double xr, double xi, // real and imaginary parts of x + double yr, double yi, // real and imaginary parts of y + double *zr, double *zi // real and imaginary parts of z ) { double tr, ti, r, den ; - if (fabs (br) >= fabs (bi)) + + int yr_class = fpclassify (yr) ; + int yi_class = fpclassify (yi) ; + + if (yi_class == FP_ZERO) + { + den = yr ; + if (xi == 0) + { + tr = xr / den ; + ti = 0 ; + } + else if (xr == 0) + { + tr = 0 ; + ti = xi / den ; + } + else + { + tr = xr / den ; + ti = xi / den ; + } + } + else if (yr_class == FP_ZERO) { - r = bi / br ; - den = br + r * bi ; - tr = (ar + ai * r) / den ; - ti = (ai - ar * r) / den ; + den = yi ; + if (xr == 0) + { + tr = xi / den ; + ti = 0 ; + } + else if (xi == 0) + { + tr = 0 ; + ti = -xr / den ; + } + else + { + tr = xi / den ; + ti = -xr / den ; + } + } + else if (yi_class == FP_INFINITE && yr_class == FP_INFINITE) + { + + if (signbit (yr) == signbit (yi)) + { + // r = 1 + den = yr + yi ; + tr = (xr + xi) / den ; + ti = (xi - xr) / den ; + } + else + { + // r = -1 + den = yr - yi ; + tr = (xr - xi) / den ; + ti = (xi + xr) / den ; + } + } else { - r = br / bi ; - den = r * br + bi ; - tr = (ar * r + ai) / den ; - ti = (ai * r - ar) / den ; + + if (fabs (yr) >= fabs (yi)) + { + r = yi / yr ; + den = yr + r * yi ; + tr = (xr + xi * r) / den ; + ti = (xi - xr * r) / den ; + } + else + { + r = yr / yi ; + den = r * yr + yi ; + tr = (xr * r + xi) / den ; + ti = (xi * r - xr) / den ; + } + } - *cr = tr ; - *ci = ti ; - return (den == 0.) ; + (*zr) = tr ; + (*zi) = ti ; + return (den == 0) ; +} + +//------------------------------------------------------------------------------ +// SuiteSparse_BLAS_library: return name of BLAS library found +//------------------------------------------------------------------------------ + +// Returns the name of the BLAS library found by SuiteSparse_config + +const char *SuiteSparse_BLAS_library ( void ) +{ + #if defined ( BLAS_Intel10_64ilp ) + return ("Intel MKL 64ilp BLAS (64-bit integers)") ; + #elif defined ( BLAS_Intel10_64lp ) + return ("Intel MKL 64lp BLAS (32-bit integers)") ; + #elif defined ( BLAS_Apple ) + return ("Apple Accelerate Framework BLAS (32-bit integers)") ; + #elif defined ( BLAS_Arm_ilp64_mp ) + return ("ARM MP BLAS (64-bit integers)") ; + #elif defined ( BLAS_Arm_mp ) + return ("ARM MP BLAS (32-bit integers)") ; + #elif defined ( BLAS_IBMESSL_SMP ) + return ((sizeof (SUITESPARSE_BLAS_INT) == 8) ? + "IBMESSL_SMP BLAS (64-bit integers)" : + "IBMESSL_SMP BLAS (32-bit integers)") ; + #elif defined ( BLAS_OpenBLAS ) + return ((sizeof (SUITESPARSE_BLAS_INT) == 8) ? + "OpenBLAS (64-bit integers)" : + "OpenBLAS (32-bit integers)") ; + #elif defined ( BLAS_Generic ) + return ((sizeof (SUITESPARSE_BLAS_INT) == 8) ? + "Reference BLAS (64-bit integers)" : + "Reference BLAS (32-bit integers)") ; + #else + return ((sizeof (SUITESPARSE_BLAS_INT) == 8) ? + "Other BLAS (64-bit integers)" : + "Other BLAS (32-bit integers)") ; + #endif } + +//------------------------------------------------------------------------------ +// SuiteSparse_BLAS_integer: return size of BLAS integer +//------------------------------------------------------------------------------ + +size_t SuiteSparse_BLAS_integer_size ( void ) +{ + return (sizeof (SUITESPARSE_BLAS_INT)) ; +} + diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.h b/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.h index 1698a79621..57bc081bea 100644 --- a/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.h +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.h @@ -1,218 +1,1408 @@ -/* ========================================================================== */ -/* === SuiteSparse_config =================================================== */ -/* ========================================================================== */ - -/* Configuration file for SuiteSparse: a Suite of Sparse matrix packages - * (AMD, COLAMD, CCOLAMD, CAMD, CHOLMOD, UMFPACK, CXSparse, and others). - * - * SuiteSparse_config.h provides the definition of the long integer. On most - * systems, a C program can be compiled in LP64 mode, in which long's and - * pointers are both 64-bits, and int's are 32-bits. Windows 64, however, uses - * the LLP64 model, in which int's and long's are 32-bits, and long long's and - * pointers are 64-bits. - * - * SuiteSparse packages that include long integer versions are - * intended for the LP64 mode. However, as a workaround for Windows 64 - * (and perhaps other systems), the long integer can be redefined. - * - * If _WIN64 is defined, then the __int64 type is used instead of long. - * - * The long integer can also be defined at compile time. For example, this - * could be added to SuiteSparse_config.mk: - * - * CFLAGS = -O -D'SuiteSparse_long=long long' \ - * -D'SuiteSparse_long_max=9223372036854775801' -D'SuiteSparse_long_idd="lld"' - * - * This file defines SuiteSparse_long as either long (on all but _WIN64) or - * __int64 on Windows 64. The intent is that a SuiteSparse_long is always a - * 64-bit integer in a 64-bit code. ptrdiff_t might be a better choice than - * long; it is always the same size as a pointer. - * - * This file also defines the SUITESPARSE_VERSION and related definitions. - * - * Copyright (c) 2012, Timothy A. Davis. No licensing restrictions apply - * to this file or to the SuiteSparse_config directory. - * Author: Timothy A. Davis. - */ +//------------------------------------------------------------------------------ +// SuiteSparse_config/SuiteSparse_config.h: common utilites for SuiteSparse +//------------------------------------------------------------------------------ + +// SuiteSparse_config, Copyright (c) 2012-2023, Timothy A. Davis. +// All Rights Reserved. +// SPDX-License-Identifier: BSD-3-clause + +//------------------------------------------------------------------------------ + +// Configuration file for SuiteSparse: a Suite of Sparse matrix packages: AMD, +// COLAMD, CCOLAMD, CAMD, CHOLMOD, UMFPACK, CXSparse, SuiteSparseQR, ParU, ... + +// The SuiteSparse_config.h file is configured by CMake to be specific to the +// C/C++ compiler and BLAS library being used for SuiteSparse. The original +// file is SuiteSparse_config/SuiteSparse_config.h.in. Do not edit the +// SuiteSparse_config.h file directly. #ifndef SUITESPARSE_CONFIG_H #define SUITESPARSE_CONFIG_H #ifdef __cplusplus -extern "C" { +extern "C" +{ #endif -#include +//------------------------------------------------------------------------------ +// SuiteSparse-wide ANSI C11 #include files +//------------------------------------------------------------------------------ + +#include +#include +#include #include +#include +#include #include +#include +#include +#include +#include +#include -/* ========================================================================== */ -/* === SuiteSparse_long ===================================================== */ -/* ========================================================================== */ - -#ifndef SuiteSparse_long - -#ifdef _WIN64 +//------------------------------------------------------------------------------ +// SuiteSparse_long is now int64_t in SuiteSparse v6.0.0 and later +//------------------------------------------------------------------------------ -#define SuiteSparse_long __int64 -#define SuiteSparse_long_max _I64_MAX -#define SuiteSparse_long_idd "I64d" +// The use of SuiteSparse_long is deprecated. User applications should use +// int64_t instead. -#else +#undef SuiteSparse_long +#undef SuiteSparse_long_max +#undef SuiteSparse_long_idd +#undef SuiteSparse_long_id #define SuiteSparse_long int64_t #define SuiteSparse_long_max INT64_MAX #define SuiteSparse_long_idd PRId64 +#define SuiteSparse_long_id "%" SuiteSparse_long_idd + +//------------------------------------------------------------------------------ +// OpenMP +//------------------------------------------------------------------------------ + +#if defined ( _OPENMP ) + + #include + #define SUITESPARSE_OPENMP_MAX_THREADS omp_get_max_threads ( ) + #define SUITESPARSE_OPENMP_GET_NUM_THREADS omp_get_num_threads ( ) + #define SUITESPARSE_OPENMP_GET_WTIME omp_get_wtime ( ) + #define SUITESPARSE_OPENMP_GET_THREAD_ID omp_get_thread_num ( ) + +#else + + // OpenMP not available + #define SUITESPARSE_OPENMP_MAX_THREADS (1) + #define SUITESPARSE_OPENMP_GET_NUM_THREADS (1) + #define SUITESPARSE_OPENMP_GET_WTIME (0) + #define SUITESPARSE_OPENMP_GET_THREAD_ID (0) #endif -#define SuiteSparse_long_id "%" SuiteSparse_long_idd -#define SuiteSparse_unsigned_long uint64_t + +//------------------------------------------------------------------------------ +// MATLAB/Octave +//------------------------------------------------------------------------------ + +#if defined ( MATLAB_MEX_FILE ) +#include "mex.h" +#include "matrix.h" #endif -/* ========================================================================== */ -/* === SuiteSparse_config parameters and functions ========================== */ -/* ========================================================================== */ +//------------------------------------------------------------------------------ +// string and token handling macros +//------------------------------------------------------------------------------ -/* SuiteSparse-wide parameters are placed in this struct. It is meant to be - an extern, globally-accessible struct. It is not meant to be updated - frequently by multiple threads. Rather, if an application needs to modify - SuiteSparse_config, it should do it once at the beginning of the application, - before multiple threads are launched. +// SUITESPARSE_STR: convert the content of x into a string "x" +#define SUITESPARSE_XSTR(x) SUITESPARSE_STR(x) +#define SUITESPARSE_STR(x) #x - The intent of these function pointers is that they not be used in your - application directly, except to assign them to the desired user-provided - functions. Rather, you should use the - */ +// SUITESPARSE_CAT(x,y): concatenate two tokens +#define SUITESPARSE_CAT2(x,y) x ## y +#define SUITESPARSE_CAT(x,y) SUITESPARSE_CAT2(x,y) -struct SuiteSparse_config_struct -{ - void *(*malloc_func) (size_t) ; /* pointer to malloc */ - void *(*calloc_func) (size_t, size_t) ; /* pointer to calloc */ - void *(*realloc_func) (void *, size_t) ; /* pointer to realloc */ - void (*free_func) (void *) ; /* pointer to free */ - int (*printf_func) (const char *, ...) ; /* pointer to printf */ - double (*hypot_func) (double, double) ; /* pointer to hypot */ - int (*divcomplex_func) (double, double, double, double, double *, double *); -} ; +//------------------------------------------------------------------------------ +// determine which compiler is in use +//------------------------------------------------------------------------------ + +#define SUITESPARSE_COMPILER_NVCC 0 +#define SUITESPARSE_COMPILER_ICX 0 +#define SUITESPARSE_COMPILER_ICC 0 +#define SUITESPARSE_COMPILER_CLANG 0 +#define SUITESPARSE_COMPILER_GCC 0 +#define SUITESPARSE_COMPILER_MSC 0 +#define SUITESPARSE_COMPILER_XLC 0 + +#if defined ( __NVCC__ ) + + // NVIDIA nvcc compiler + #undef SUITESPARSE_COMPILER_NVCC + #define SUITESPARSE_COMPILER_NVCC 1 + + #define SUITESPARSE_COMPILER_MAJOR __CUDACC_VER_MAJOR__ + #define SUITESPARSE_COMPILER_MINOR __CUDACC_VER_MINOR__ + #define SUITESPARSE_COMPILER_SUB __CUDACC_VER_BUILD__ + #define SUITESPARSE_COMPILER_NAME "nvcc" + +#elif defined ( __INTEL_CLANG_COMPILER ) + + // Intel icx compiler, 2022.0.0 based on clang/llvm 14.0.0 + #undef SUITESPARSE_COMPILER_ICX + #define SUITESPARSE_COMPILER_ICX 1 + + #define SUITESPARSE_COMPILER_MAJOR __INTEL_CLANG_COMPILER + #define SUITESPARSE_COMPILER_MINOR 0 + #define SUITESPARSE_COMPILER_SUB 0 + #define SUITESPARSE_COMPILER_NAME __VERSION__ + +#elif defined ( __INTEL_COMPILER ) + + // Intel icc compiler: 2021.5.0 uses "gcc 7.5 mode" + #undef SUITESPARSE_COMPILER_ICC + #define SUITESPARSE_COMPILER_ICC 1 + + #define SUITESPARSE_COMPILER_MAJOR __INTEL_COMPILER + #define SUITESPARSE_COMPILER_MINOR __INTEL_COMPILER_UPDATE + #define SUITESPARSE_COMPILER_SUB 0 + #define SUITESPARSE_COMPILER_NAME __VERSION__ + +#elif defined ( __clang__ ) + + // clang + #undef SUITESPARSE_COMPILER_CLANG + #define SUITESPARSE_COMPILER_CLANG 1 + + #define SUITESPARSE_COMPILER_MAJOR __clang_major__ + #define SUITESPARSE_COMPILER_MINOR __clang_minor__ + #define SUITESPARSE_COMPILER_SUB __clang_patchlevel__ + #define SUITESPARSE_COMPILER_NAME "clang " __clang_version__ + +#elif defined ( __xlC__ ) + + // xlc + #undef SUITESPARSE_COMPILER_XLC + #define SUITESPARSE_COMPILER_XLC 1 + + #define SUITESPARSE_COMPILER_MAJOR ( __xlC__ / 256 ) + #define SUITESPARSE_COMPILER_MINOR \ + ( __xlC__ - 256 * SUITESPARSE_COMPILER_MAJOR) + #define SUITESPARSE_COMPILER_SUB 0 + #define SUITESPARSE_COMPILER_NAME "IBM xlc " SUITESPARSE_XSTR (__xlC__) + +#elif defined ( __GNUC__ ) + + // gcc + #undef SUITESPARSE_COMPILER_GCC + #define SUITESPARSE_COMPILER_GCC 1 + + #define SUITESPARSE_COMPILER_MAJOR __GNUC__ + #define SUITESPARSE_COMPILER_MINOR __GNUC_MINOR__ + #define SUITESPARSE_COMPILER_SUB __GNUC_PATCHLEVEL__ + #define SUITESPARSE_COMPILER_NAME "GNU gcc " \ + SUITESPARSE_XSTR (__GNUC__) "." \ + SUITESPARSE_XSTR (__GNUC_MINOR__) "." \ + SUITESPARSE_XSTR (__GNUC_PATCHLEVEL__) + +#elif defined ( _MSC_VER ) + + // Microsoft Visual Studio (cl compiler) + #undef SUITESPARSE_COMPILER_MSC + #define SUITESPARSE_COMPILER_MSC 1 + + #define SUITESPARSE_COMPILER_MAJOR ( _MSC_VER / 100 ) + #define SUITESPARSE_COMPILER_MINOR \ + ( _MSC_VER - 100 * SUITESPARSE_COMPILER_MAJOR) + #define SUITESPARSE_COMPILER_SUB 0 + #define SUITESPARSE_COMPILER_NAME \ + "Microsoft Visual Studio " SUITESPARSE_XSTR (_MSC_VER) + +#else + + // other compiler + #define SUITESPARSE_COMPILER_MAJOR 0 + #define SUITESPARSE_COMPILER_MINOR 0 + #define SUITESPARSE_COMPILER_SUB 0 + #define SUITESPARSE_COMPILER_NAME "other C compiler" + +#endif + +//------------------------------------------------------------------------------ +// malloc.h: required include file for Microsoft Visual Studio +//------------------------------------------------------------------------------ + +#if SUITESPARSE_COMPILER_MSC + #include +#endif + +// this was formerly "extern", or "__declspec ..." for Windows. +#define SUITESPARSE_PUBLIC + +//------------------------------------------------------------------------------ +// determine the ANSI C version +//------------------------------------------------------------------------------ + +#ifdef __STDC_VERSION__ +// ANSI C17: 201710L +// ANSI C11: 201112L +// ANSI C99: 199901L +// ANSI C95: 199409L +#define SUITESPARSE_STDC_VERSION __STDC_VERSION__ +#else +// assume ANSI C90 / C89 +#define SUITESPARSE_STDC_VERSION 199001L +#endif + +//------------------------------------------------------------------------------ +// handle the restrict keyword +//------------------------------------------------------------------------------ + +#if defined ( __cplusplus ) + + // C++ does not have the "restrict" keyword + #define SUITESPARSE_RESTRICT + +#elif SUITESPARSE_COMPILER_MSC + + // MS Visual Studio + #define SUITESPARSE_RESTRICT __restrict + +#elif SUITESPARSE_COMPILER_NVCC + + // NVIDIA nvcc + #define SUITESPARSE_RESTRICT __restrict__ + +#elif SUITESPARSE_STDC_VERSION >= 199901L + + // ANSI C99 or later + #define SUITESPARSE_RESTRICT restrict + +#else + + // ANSI C95 and earlier: no restrict keyword + #define SUITESPARSE_RESTRICT + +#endif + +//============================================================================== +// SuiteSparse_config parameters and functions +//============================================================================== -extern struct SuiteSparse_config_struct SuiteSparse_config ; +// SuiteSparse-wide parameters are placed in a single static struct, defined +// locally in SuiteSparse_config.c. It is not meant to be updated frequently +// by multiple threads. Rather, if an application needs to modify +// SuiteSparse_config, it should do it once at the beginning of the +// application, before multiple threads are launched. -void SuiteSparse_start ( void ) ; /* called to start SuiteSparse */ +// The intent of these function pointers is that they not be used in your +// application directly, except to assign them to the desired user-provided +// functions. Rather, you should use the SuiteSparse_malloc/calloc, etc +// wrappers defined below to access them. -void SuiteSparse_finish ( void ) ; /* called to finish SuiteSparse */ +// The SuiteSparse_config_*_get methods return the contents of the struct: +void *(*SuiteSparse_config_malloc_func_get (void)) (size_t); +void *(*SuiteSparse_config_calloc_func_get (void)) (size_t, size_t); +void *(*SuiteSparse_config_realloc_func_get (void)) (void *, size_t); +void (*SuiteSparse_config_free_func_get (void)) (void *); +int (*SuiteSparse_config_printf_func_get (void)) (const char *, ...); +double (*SuiteSparse_config_hypot_func_get (void)) (double, double); +int (*SuiteSparse_config_divcomplex_func_get (void)) (double, double, double, double, double *, double *); -void *SuiteSparse_malloc /* pointer to allocated block of memory */ +// The SuiteSparse_config_*_set methods modify the contents of the struct: +void SuiteSparse_config_malloc_func_set (void *(*malloc_func) (size_t)); +void SuiteSparse_config_calloc_func_set (void *(*calloc_func) (size_t, size_t)); +void SuiteSparse_config_realloc_func_set (void *(*realloc_func) (void *, size_t)); +void SuiteSparse_config_free_func_set (void (*free_func) (void *)); +void SuiteSparse_config_printf_func_set (int (*printf_func) (const char *, ...)); +void SuiteSparse_config_hypot_func_set (double (*hypot_func) (double, double)); +void SuiteSparse_config_divcomplex_func_set (int (*divcomplex_func) (double, double, double, double, double *, double *)); + +// The SuiteSparse_config_*_func methods are wrappers that call the function +// pointers in the struct. Note that there is no wrapper for the printf_func. +// See the SUITESPARSE_PRINTF macro instead. +void *SuiteSparse_config_malloc (size_t s) ; +void *SuiteSparse_config_calloc (size_t n, size_t s) ; +void *SuiteSparse_config_realloc (void *, size_t s) ; +void SuiteSparse_config_free (void *) ; +double SuiteSparse_config_hypot (double x, double y) ; +int SuiteSparse_config_divcomplex ( - size_t nitems, /* number of items to malloc (>=1 is enforced) */ - size_t size_of_item /* sizeof each item */ + double xr, double xi, double yr, double yi, double *zr, double *zi ) ; -void *SuiteSparse_calloc /* pointer to allocated block of memory */ +void SuiteSparse_start ( void ) ; // called to start SuiteSparse + +void SuiteSparse_finish ( void ) ; // called to finish SuiteSparse + +void *SuiteSparse_malloc // pointer to allocated block of memory ( - size_t nitems, /* number of items to calloc (>=1 is enforced) */ - size_t size_of_item /* sizeof each item */ + size_t nitems, // number of items to malloc (>=1 is enforced) + size_t size_of_item // sizeof each item ) ; -void *SuiteSparse_realloc /* pointer to reallocated block of memory, or - to original block if the realloc failed. */ +void *SuiteSparse_calloc // pointer to allocated block of memory ( - size_t nitems_new, /* new number of items in the object */ - size_t nitems_old, /* old number of items in the object */ - size_t size_of_item, /* sizeof each item */ - void *p, /* old object to reallocate */ - int *ok /* 1 if successful, 0 otherwise */ + size_t nitems, // number of items to calloc (>=1 is enforced) + size_t size_of_item // sizeof each item ) ; -void *SuiteSparse_free /* always returns NULL */ +void *SuiteSparse_realloc // pointer to reallocated block of memory, or + ///to original block if the realloc failed. ( - void *p /* block to free */ + size_t nitems_new, // new number of items in the object + size_t nitems_old, // old number of items in the object + size_t size_of_item, // sizeof each item + void *p, // old object to reallocate + int *ok // 1 if successful, 0 otherwise ) ; -void SuiteSparse_tic /* start the timer */ +void *SuiteSparse_free // always returns NULL ( - double tic [2] /* output, contents undefined on input */ + void *p // block to free ) ; -double SuiteSparse_toc /* return time in seconds since last tic */ +void SuiteSparse_tic // start the timer ( - double tic [2] /* input: from last call to SuiteSparse_tic */ + double tic [2] // output, contents undefined on input ) ; -double SuiteSparse_time /* returns current wall clock time in seconds */ +double SuiteSparse_toc // return time in seconds since last tic +( + double tic [2] // input: from last call to SuiteSparse_tic +) ; + +double SuiteSparse_time // returns current wall clock time in seconds ( void ) ; -/* returns sqrt (x^2 + y^2), computed reliably */ +// returns sqrt (x^2 + y^2), computed reliably double SuiteSparse_hypot (double x, double y) ; -/* complex division of c = a/b */ +// complex division of c = a/b int SuiteSparse_divcomplex ( - double ar, double ai, /* real and imaginary parts of a */ - double br, double bi, /* real and imaginary parts of b */ - double *cr, double *ci /* real and imaginary parts of c */ + double ar, double ai, // real and imaginary parts of a + double br, double bi, // real and imaginary parts of b + double *cr, double *ci // real and imaginary parts of c ) ; -/* determine which timer to use, if any */ +// determine which timer to use, if any #ifndef NTIMER -#ifdef _POSIX_C_SOURCE -#if _POSIX_C_SOURCE >= 199309L -#define SUITESPARSE_TIMER_ENABLED -#endif -#endif + #if defined ( _OPENMP ) + #define SUITESPARSE_TIMER_ENABLED + #elif defined ( _POSIX_C_SOURCE ) + #if _POSIX_C_SOURCE >= 199309L + #define SUITESPARSE_TIMER_ENABLED + #endif + #endif #endif -/* SuiteSparse printf macro */ -#define SUITESPARSE_PRINTF(params) \ -{ \ - if (SuiteSparse_config.printf_func != NULL) \ - { \ - (void) (SuiteSparse_config.printf_func) params ; \ - } \ -} - -/* ========================================================================== */ -/* === SuiteSparse version ================================================== */ -/* ========================================================================== */ - -/* SuiteSparse is not a package itself, but a collection of packages, some of - * which must be used together (UMFPACK requires AMD, CHOLMOD requires AMD, - * COLAMD, CAMD, and CCOLAMD, etc). A version number is provided here for the - * collection itself, which is also the version number of SuiteSparse_config. - */ - -int SuiteSparse_version /* returns SUITESPARSE_VERSION */ -( - /* output, not defined on input. Not used if NULL. Returns - the three version codes in version [0..2]: - version [0] is SUITESPARSE_MAIN_VERSION - version [1] is SUITESPARSE_SUB_VERSION - version [2] is SUITESPARSE_SUBSUB_VERSION - */ +// SuiteSparse printf macro +#define SUITESPARSE_PRINTF(params) \ +{ \ + int (*printf_func) (const char *, ...) ; \ + printf_func = SuiteSparse_config_printf_func_get ( ) ; \ + if (printf_func != NULL) \ + { \ + (void) (printf_func) params ; \ + } \ +} + +//============================================================================== +// SuiteSparse version +//============================================================================== + +// SuiteSparse is not a package itself, but a collection of packages, some of +// which must be used together (UMFPACK requires AMD, CHOLMOD requires AMD, +// COLAMD, CAMD, and CCOLAMD, etc). A version number is provided here for the +// collection itself, which is also the version number of SuiteSparse_config. + +int SuiteSparse_version // returns SUITESPARSE_VERSION +( + // output, not defined on input. Not used if NULL. Returns + // the three version codes in version [0..2]: + // version [0] is SUITESPARSE_MAIN_VERSION + // version [1] is SUITESPARSE_SUB_VERSION + // version [2] is SUITESPARSE_SUBSUB_VERSION int version [3] ) ; -/* Versions prior to 4.2.0 do not have the above function. The following - code fragment will work with any version of SuiteSparse: - - #ifdef SUITESPARSE_HAS_VERSION_FUNCTION - v = SuiteSparse_version (NULL) ; - #else - v = SUITESPARSE_VERSION ; - #endif -*/ #define SUITESPARSE_HAS_VERSION_FUNCTION -#define SUITESPARSE_DATE "Dec 28, 2018" +#define SUITESPARSE_DATE "Jan 20, 2023" +#define SUITESPARSE_MAIN_VERSION 7 +#define SUITESPARSE_SUB_VERSION 0 +#define SUITESPARSE_SUBSUB_VERSION 1 + #define SUITESPARSE_VER_CODE(main,sub) ((main) * 1000 + (sub)) -#define SUITESPARSE_MAIN_VERSION 5 -#define SUITESPARSE_SUB_VERSION 4 -#define SUITESPARSE_SUBSUB_VERSION 0 #define SUITESPARSE_VERSION \ SUITESPARSE_VER_CODE(SUITESPARSE_MAIN_VERSION,SUITESPARSE_SUB_VERSION) +//============================================================================== +// SuiteSparse interface to the BLAS and LAPACK libraries +//============================================================================== + +// Several SuiteSparse packages rely on the BLAS/LAPACK libraries (UMFPACK +// CHOLMOD, and SPQR, and likely GraphBLAS in the future). All of these +// packages are written in C/C++, but rely on the Fortran interface to +// BLAS/LAPACK. SuiteSparse does not use the cblas / lapacke interfaces to +// these libraries, mainly because FindBLAS.cmake does not locate them (or at +// least does not locate their respective cblas.h and lapacke.h files). In +// addition, the original definition of these files do not include a different +// name space for 64-bit integer versions. Finally, Intel renames cblas.h as +// mkl_cblas.h. As a result of these many portability issues, different +// implementations of those libraries extend them in different ways. Thus, +// SuiteSparse simply calls the Fortran functions directly. + +// However, the method for how C/C++ calling Fortran depends on the compilers +// involved. This connection is handled by the FortranCInterface.cmake module +// of CMake. + +// On typical systems (Linux with the GCC compiler for example, or on the Mac +// with clang) the Fortan name "dgemm" is called by C as "dgemm_", Other +// systems do not append the underscore. + +//------------------------------------------------------------------------------ +// SUITESPARSE_FORTRAN: macros created by CMake describing how C calls Fortran +//------------------------------------------------------------------------------ + +// SUITESPARSE_FORTAN: for Fortran routines with no "_" in their names +// SUITESPARSE__FORTAN: for Fortran routines with "_" in their names + +// The decision on which of these macros to use is based on the presence of +// underscores in the original Fortran names, not the (commonly) appended +// underscore needed for C to all the corresponding Fortran routine. + +// These two macros are created by the CMake module, FortranCInterface.cmake, +// which is then used by CMake to configure this file. + +// The CMAKE decision can be superceded by setting -DBLAS_NO_UNDERSCORE, so +// that "dgemm" remains "dgemm" (for MS Visual Studio for example). Setting +// -DBLAS_UNDERSCORE changes "dgemm" to "dgemm_", the common case for Mac and +// Linux. + +#if defined ( BLAS_NO_UNDERSCORE ) + + // no name mangling, use lower case + #define SUITESPARSE_FORTRAN(name,NAME) name + #define SUITESPARSE__FORTRAN(name,NAME) name + +#elif defined ( BLAS_UNDERSCORE ) + + // append an undescore, use lower case + #define SUITESPARSE_FORTRAN(name,NAME) name ## _ + #define SUITESPARSE__FORTRAN(name,NAME) name ## _ + +#else + + // let CMake decide how C calls Fortran + #define SUITESPARSE_FORTRAN(name,NAME) name##_ + #define SUITESPARSE__FORTRAN(name,NAME) name##_ + +#endif + +//------------------------------------------------------------------------------ +// SUITESPARSE_BLAS_INT: the BLAS/LAPACK integer (int32_t or int64_t) +//------------------------------------------------------------------------------ + +// CMake 3.22 and later allow the selection of the BLAS/LAPACK integer size. +// This information is then used to configure this file with the definition of +// this integer: int32_t or int64_t. + +// When compiling SuiteSparse for a MATLAB mexFunction, the MATLAB libmwblas is +// used, which is a 64-bit integer version of the BLAS. CMake is not used to +// configure SuiteSparse in this case. The flag -DBLAS64 can be used to ensure +// a 64-bit BLAS is used. Likewise, -DBLAS32 ensures a 32-bit BLAS is used. + +#if defined ( BLAS64 ) + + // override the BLAS found by CMake, and force a 64-bit interface + #define SUITESPARSE_BLAS_INT int64_t + +#elif defined ( BLAS32 ) + + // override the BLAS found by CMake, and force a 32-bit interface + #define SUITESPARSE_BLAS_INT int32_t + +#else + + // let CMake determine the size of the integer in the Fortran BLAS + #define SUITESPARSE_BLAS_INT int32_t + +#endif + +// SUITESPARSE_TO_BLAS_INT: convert an integer k to a BLAS integer K and set ok +// to false if the conversion changes its value. This is implemented as a +// macro so that can work with any type of the integer k. +#define SUITESPARSE_TO_BLAS_INT(K,k,ok) \ + SUITESPARSE_BLAS_INT K = (k) ; \ + ok = ok && ((sizeof (K) >= sizeof (k)) || ((int64_t)(K) == (int64_t)(k))) ; + +//------------------------------------------------------------------------------ +// SUITESPARSE_BLAS_SUFFIX: modify the name of a Fortran BLAS/LAPACK routine +//------------------------------------------------------------------------------ + +// OpenBLAS can be compiled by appending a suffix to each routine, so that the +// Fortan routine dgemm becomes dgemm_64, which denotes a version of dgemm with +// 64-bit integer parameters. The Sun Performance library does the same thing, +// but without the internal underscore, as dgemm64. + +// If the suffix does not contain "_", use (Sun Perf., for example): + +// cd build ; cmake -DBLAS64_SUFFIX="64" .. + +// If the suffix contains "_" (OpenBLAS in spack for example), use the +// following: + +// cd build ; cmake -DBLAS64_SUFFIX="_64" .. + +// This setting could be used by the spack packaging of SuiteSparse when linked +// with the spack-installed OpenBLAS with 64-bit integers. See +// https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/suite-sparse/package.py + +#if defined ( BLAS64__SUFFIX ) + + // The suffix includes an undersore (such as "_64"), so the Fortran name + // must be processed with the SUITESPARSE__FORTRAN macro. + #define SUITESPARSE_G(name,NAME) SUITESPARSE__FORTRAN(name,NAME) + #define SUITESPARSE_F(name,NAME) \ + SUITESPARSE_G (SUITESPARSE_CAT (name, BLAS64__SUFFIX), \ + SUITESPARSE_CAT (NAME, BLAS64__SUFFIX)) + #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_F(name,NAME) + +#elif defined ( BLAS64_SUFFIX ) + + // The suffix does not include an undersore, and neither do the original + // names of the BLAS and LAPACK routines. Thus, the Fortran name must be + // processed with the SUITESPARSE_FORTRAN macro. + #define SUITESPARSE_G(name,NAME) SUITESPARSE_FORTRAN(name,NAME) + #define SUITESPARSE_F(name,NAME) \ + SUITESPARSE_G (SUITESPARSE_CAT (name, BLAS64_SUFFIX), \ + SUITESPARSE_CAT (NAME, BLAS64_SUFFIX)) + #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_F(name,NAME) + +#else + + // No suffix is need, so the final Fortran name includes no suffix. + #define SUITESPARSE_BLAS(name,NAME) SUITESPARSE_FORTRAN(name,NAME) + +#endif + +//------------------------------------------------------------------------------ +// C names of Fortan BLAS and LAPACK functions used by SuiteSparse +//------------------------------------------------------------------------------ + +#define SUITESPARSE_BLAS_DTRSV SUITESPARSE_BLAS ( dtrsv , DTRSV ) +#define SUITESPARSE_BLAS_DGEMV SUITESPARSE_BLAS ( dgemv , DGEMV ) +#define SUITESPARSE_BLAS_DTRSM SUITESPARSE_BLAS ( dtrsm , DTRSM ) +#define SUITESPARSE_BLAS_DGEMM SUITESPARSE_BLAS ( dgemm , DGEMM ) +#define SUITESPARSE_BLAS_DSYRK SUITESPARSE_BLAS ( dsyrk , DSYRK ) +#define SUITESPARSE_BLAS_DGER SUITESPARSE_BLAS ( dger , DGER ) +#define SUITESPARSE_BLAS_DSCAL SUITESPARSE_BLAS ( dscal , DSCAL ) +#define SUITESPARSE_LAPACK_DPOTRF SUITESPARSE_BLAS ( dpotrf , DPOTRF ) + +#define SUITESPARSE_BLAS_ZTRSV SUITESPARSE_BLAS ( ztrsv , ZTRSV ) +#define SUITESPARSE_BLAS_ZGEMV SUITESPARSE_BLAS ( zgemv , ZGEMV ) +#define SUITESPARSE_BLAS_ZTRSM SUITESPARSE_BLAS ( ztrsm , ZTRSM ) +#define SUITESPARSE_BLAS_ZGEMM SUITESPARSE_BLAS ( zgemm , ZGEMM ) +#define SUITESPARSE_BLAS_ZHERK SUITESPARSE_BLAS ( zherk , ZHERK ) +#define SUITESPARSE_BLAS_ZGERU SUITESPARSE_BLAS ( zgeru , ZGERU ) +#define SUITESPARSE_BLAS_ZSCAL SUITESPARSE_BLAS ( zscal , ZSCAL ) +#define SUITESPARSE_LAPACK_ZPOTRF SUITESPARSE_BLAS ( zpotrf , ZPOTRF ) + +#define SUITESPARSE_BLAS_DNRM2 SUITESPARSE_BLAS ( dnrm2 , DNRM2 ) +#define SUITESPARSE_LAPACK_DLARF SUITESPARSE_BLAS ( dlarf , DLARF ) +#define SUITESPARSE_LAPACK_DLARFG SUITESPARSE_BLAS ( dlarfg , DLARFG ) +#define SUITESPARSE_LAPACK_DLARFT SUITESPARSE_BLAS ( dlarft , DLARFT ) +#define SUITESPARSE_LAPACK_DLARFB SUITESPARSE_BLAS ( dlarfb , DLARFB ) + +#define SUITESPARSE_BLAS_DZNRM2 SUITESPARSE_BLAS ( dznrm2 , DZNRM2 ) +#define SUITESPARSE_LAPACK_ZLARF SUITESPARSE_BLAS ( zlarf , ZLARF ) +#define SUITESPARSE_LAPACK_ZLARFG SUITESPARSE_BLAS ( zlarfg , ZLARFG ) +#define SUITESPARSE_LAPACK_ZLARFT SUITESPARSE_BLAS ( zlarft , ZLARFT ) +#define SUITESPARSE_LAPACK_ZLARFB SUITESPARSE_BLAS ( zlarfb , ZLARFB ) + +//------------------------------------------------------------------------------ +// prototypes of BLAS and SUITESPARSE_LAPACK functions +//------------------------------------------------------------------------------ + +// For complex functions, the (void *) parameters are actually pointers to +// arrays of complex values. They are prototyped here as (void *) to allow +// them to be called from both C and C++. + +// See https://netlib.org/blas/ and https://netlib.org/lapack/ for the +// definitions of the inputs/outputs of these functions. + +// These prototypes need to be found by UMFPACK, CHOLMOD, and SPQR, and to do +// so, they need to appear in this public header to ensure the correct BLAS +// library and integer size is used. However, these definitions should not +// (normally) be exposed to the user application. + +// If a user application wishes to use these definitions, simply add + +// #define SUITESPARSE_BLAS_DEFINITIONS +// #include "SuiteSparse_config.h" + +// prior to #include'ing any SuiteSparse headers (amd.h, and so on). + +#if defined ( SUITESPARSE_BLAS_DEFINITIONS ) + +void SUITESPARSE_BLAS_DGEMV // Y = alpha*A*x + beta*Y +( + // input: + const char *trans, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const double *alpha, + const double *A, + const SUITESPARSE_BLAS_INT *lda, + const double *X, + const SUITESPARSE_BLAS_INT *incx, + const double *beta, + // input/output: + double *Y, + // input: + const SUITESPARSE_BLAS_INT *incy +) ; + +#define SUITESPARSE_BLAS_dgemv(trans,m,n,alpha,A,lda,X,incx,beta,Y,incy,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DGEMV (trans, &M_blas_int, &N_blas_int, alpha, A, \ + &LDA_blas_int, X, &INCX_blas_int, beta, Y, &INCY_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZGEMV // Y = alpha*A*X + beta*Y +( + // input: + const char *trans, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const void *alpha, + const void *A, + const SUITESPARSE_BLAS_INT *lda, + const void *X, + const SUITESPARSE_BLAS_INT *incx, + const void *beta, + // input/output: + void *Y, + // input: + const SUITESPARSE_BLAS_INT *incy +) ; + +#define SUITESPARSE_BLAS_zgemv(trans,m,n,alpha,A,lda,X,incx,beta,Y,incy,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZGEMV (trans, &M_blas_int, &N_blas_int, alpha, A, \ + &LDA_blas_int, X, &INCX_blas_int, beta, Y, &INCY_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_DTRSV // solve Lx=b, Ux=b, L'x=b, or U'x=b +( + // input: + const char *uplo, + const char *trans, + const char *diag, + const SUITESPARSE_BLAS_INT *n, + const double *A, + const SUITESPARSE_BLAS_INT *lda, + // input/output: + double *X, + // input: + const SUITESPARSE_BLAS_INT *incx +) ; + +#define SUITESPARSE_BLAS_dtrsv(uplo,trans,diag,n,A,lda,X,incx,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DTRSV (uplo, trans, diag, &N_blas_int, A, \ + &LDA_blas_int, X, &INCX_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZTRSV // solve (L, L', L^H, U, U', or U^H)x=b +( + // input: + const char *uplo, + const char *trans, + const char *diag, + const SUITESPARSE_BLAS_INT *n, + const void *A, + const SUITESPARSE_BLAS_INT *lda, + // input/output: + void *X, + // input: + const SUITESPARSE_BLAS_INT *incx +) ; + +#define SUITESPARSE_BLAS_ztrsv(uplo,trans,diag,n,A,lda,X,incx,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZTRSV (uplo, trans, diag, &N_blas_int, A, \ + &LDA_blas_int, X, &INCX_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_DTRSM // solve LX=B, UX=B, L'X=B, or U'X=B +( + // input: + const char *side, + const char *uplo, + const char *transa, + const char *diag, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const double *alpha, + const double *A, + const SUITESPARSE_BLAS_INT *lda, + // input/output: + double *B, + // input: + const SUITESPARSE_BLAS_INT *ldb +) ; + +#define SUITESPARSE_BLAS_dtrsm(side,uplo,transa,diag,m,n,alpha,A,lda,B,ldb,ok)\ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDB_blas_int, ldb, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DTRSM (side, uplo, transa, diag, &M_blas_int, \ + &N_blas_int, alpha, A, &LDA_blas_int, B, &LDB_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZTRSM // solve (L, L', L^H, U, U', or U^H)X=B +( + // input: + const char *side, + const char *uplo, + const char *transa, + const char *diag, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const void *alpha, + const void *A, + const SUITESPARSE_BLAS_INT *lda, + // input/output: + void *B, + // input: + const SUITESPARSE_BLAS_INT *ldb +) ; + +#define SUITESPARSE_BLAS_ztrsm(side,uplo,transa,diag,m,n,alpha,A,lda,B,ldb,ok)\ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDB_blas_int, ldb, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZTRSM (side, uplo, transa, diag, &M_blas_int, \ + &N_blas_int, alpha, A, &LDA_blas_int, B, &LDB_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_DGEMM // C = alpha*A*B + beta*C +( + // input: + const char *transa, + const char *transb, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const double *alpha, + const double *A, + const SUITESPARSE_BLAS_INT *lda, + const double *B, + const SUITESPARSE_BLAS_INT *ldb, + const double *beta, + // input/output: + double *C, + // input: + const SUITESPARSE_BLAS_INT *ldc +) ; + +#define SUITESPARSE_BLAS_dgemm(transa,transb,m,n,k,alpha,A,lda,B,ldb,beta, \ + C,ldc,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDB_blas_int, ldb, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DGEMM (transa, transb, &M_blas_int, &N_blas_int, \ + &K_blas_int, alpha, A, &LDA_blas_int, B, &LDB_blas_int, beta, C, \ + &LDC_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZGEMM // C = alpha*A*B + beta*C +( + // input: + const char *transa, + const char *transb, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const void *alpha, + const void *A, + const SUITESPARSE_BLAS_INT *lda, + const void *B, + const SUITESPARSE_BLAS_INT *ldb, + const void *beta, + // input/output: + void *C, + // input: + const SUITESPARSE_BLAS_INT *ldc +) ; + +#define SUITESPARSE_BLAS_zgemm(transa,transb,m,n,k,alpha,A,lda,B,ldb,beta, \ + C,ldc,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDB_blas_int, ldb, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZGEMM (transa, transb, &M_blas_int, &N_blas_int, \ + &K_blas_int, alpha, A, &LDA_blas_int, B, &LDB_blas_int, beta, C, \ + &LDC_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_DSYRK // C = alpha*A*A' + beta*C, or A'A +( + // input: + const char *uplo, + const char *trans, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const double *alpha, + const double *A, + const SUITESPARSE_BLAS_INT *lda, + const double *beta, + // input/output: + double *C, + // input: + const SUITESPARSE_BLAS_INT *ldc +) ; + +#define SUITESPARSE_BLAS_dsyrk(uplo,trans,n,k,alpha,A,lda,beta,C,ldc,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DSYRK (uplo, trans, &N_blas_int, &K_blas_int, alpha, \ + A, &LDA_blas_int, beta, C, &LDC_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZHERK // C = alpha*A*A^H + beta*C, or A^H*A +( + // input: + const char *uplo, + const char *trans, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const void *alpha, + const void *A, + const SUITESPARSE_BLAS_INT *lda, + const void *beta, + // input/output: + void *C, + // input: + const SUITESPARSE_BLAS_INT *ldc +) ; + +#define SUITESPARSE_BLAS_zherk(uplo,trans,n,k,alpha,A,lda,beta,C,ldc,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZHERK (uplo, trans, &N_blas_int, &K_blas_int, alpha, \ + A, &LDA_blas_int, beta, C, &LDC_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_DPOTRF // Cholesky factorization +( + // input: + const char *uplo, + const SUITESPARSE_BLAS_INT *n, + // input/output: + double *A, + // input: + const SUITESPARSE_BLAS_INT *lda, + // output: + SUITESPARSE_BLAS_INT *info +) ; + +#define SUITESPARSE_LAPACK_dpotrf(uplo,n,A,lda,info,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + info = 1 ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_INT LAPACK_Info = -999 ; \ + SUITESPARSE_LAPACK_DPOTRF (uplo, &N_blas_int, A, &LDA_blas_int, \ + &LAPACK_Info) ; \ + info = (Int) LAPACK_Info ; \ + } \ +} + +void SUITESPARSE_LAPACK_ZPOTRF // Cholesky factorization +( + // input: + const char *uplo, + const SUITESPARSE_BLAS_INT *n, + // input/output: + void *A, + // input: + const SUITESPARSE_BLAS_INT *lda, + // output: + SUITESPARSE_BLAS_INT *info +) ; + +#define SUITESPARSE_LAPACK_zpotrf(uplo,n,A,lda,info,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + info = 1 ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_INT LAPACK_Info = -999 ; \ + SUITESPARSE_LAPACK_ZPOTRF (uplo, &N_blas_int, A, &LDA_blas_int, \ + &LAPACK_Info) ; \ + info = LAPACK_Info ; \ + } \ +} + +void SUITESPARSE_BLAS_DSCAL // Y = alpha*Y +( + // input: + const SUITESPARSE_BLAS_INT *n, + const double *alpha, + // input/output: + double *Y, + // input: + const SUITESPARSE_BLAS_INT *incy +) ; + +#define SUITESPARSE_BLAS_dscal(n,alpha,Y,incy,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DSCAL (&N_blas_int, alpha, Y, &INCY_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZSCAL // Y = alpha*Y +( + // input: + const SUITESPARSE_BLAS_INT *n, + const void *alpha, + // input/output: + void *Y, + // input: + const SUITESPARSE_BLAS_INT *incy +) ; + +#define SUITESPARSE_BLAS_zscal(n,alpha,Y,incy,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZSCAL (&N_blas_int, alpha, Y, &INCY_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_DGER // A = alpha*x*y' + A +( + // input: + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const double *alpha, + const double *X, + const SUITESPARSE_BLAS_INT *incx, + const double *Y, + const SUITESPARSE_BLAS_INT *incy, + // input/output: + double *A, + // input: + const SUITESPARSE_BLAS_INT *lda +) ; + +#define SUITESPARSE_BLAS_dger(m,n,alpha,X,incx,Y,incy,A,lda,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_DGER (&M_blas_int, &N_blas_int, alpha, X, \ + &INCX_blas_int, Y, &INCY_blas_int, A, &LDA_blas_int) ; \ + } \ +} + +void SUITESPARSE_BLAS_ZGERU // A = alpha*x*y' + A +( + // input: + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const void *alpha, + const void *X, + const SUITESPARSE_BLAS_INT *incx, + const void *Y, + const SUITESPARSE_BLAS_INT *incy, + // input/output: + void *A, + // input: + const SUITESPARSE_BLAS_INT *lda +) ; + +#define SUITESPARSE_BLAS_zgeru(m,n,alpha,X,incx,Y,incy,A,lda,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCY_blas_int, incy, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDA_blas_int, lda, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_BLAS_ZGERU (&M_blas_int, &N_blas_int, alpha, X, \ + &INCX_blas_int, Y, &INCY_blas_int, A, &LDA_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_DLARFT // T = block Householder factor +( + // input: + const char *direct, + const char *storev, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const double *V, + const SUITESPARSE_BLAS_INT *ldv, + const double *Tau, + // output: + double *T, + // input: + const SUITESPARSE_BLAS_INT *ldt +) ; + +#define SUITESPARSE_LAPACK_dlarft(direct,storev,n,k,V,ldv,Tau,T,ldt,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDV_blas_int, ldv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDT_blas_int, ldt, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_DLARFT (direct, storev, &N_blas_int, &K_blas_int, \ + V, &LDV_blas_int, Tau, T, &LDT_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_ZLARFT // T = block Householder factor +( + // input: + const char *direct, + const char *storev, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const void *V, + const SUITESPARSE_BLAS_INT *ldv, + const void *Tau, + // output: + void *T, + // input: + const SUITESPARSE_BLAS_INT *ldt +) ; + +#define SUITESPARSE_LAPACK_zlarft(direct,storev,n,k,V,ldv,Tau,T,ldt,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDV_blas_int, ldv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDT_blas_int, ldt, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_ZLARFT (direct, storev, &N_blas_int, &K_blas_int, \ + V, &LDV_blas_int, Tau, T, &LDT_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_DLARFB // apply block Householder reflector +( + // input: + const char *side, + const char *trans, + const char *direct, + const char *storev, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const double *V, + const SUITESPARSE_BLAS_INT *ldv, + const double *T, + const SUITESPARSE_BLAS_INT *ldt, + // input/output: + double *C, + // input: + const SUITESPARSE_BLAS_INT *ldc, + // workspace: + double *Work, + // input: + const SUITESPARSE_BLAS_INT *ldwork +) ; + +#define SUITESPARSE_LAPACK_dlarfb(side,trans,direct,storev,m,n,k,V,ldv,T,ldt, \ + C,ldc,Work,ldwork,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDV_blas_int, ldv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDT_blas_int, ldt, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDWORK_blas_int, ldwork, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_DLARFB (side, trans, direct, storev, &M_blas_int, \ + &N_blas_int, &K_blas_int, V, &LDV_blas_int, T, &LDT_blas_int, C, \ + &LDC_blas_int, Work, &LDWORK_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_ZLARFB // apply block Householder reflector +( + // input: + const char *side, + const char *trans, + const char *direct, + const char *storev, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const SUITESPARSE_BLAS_INT *k, + const void *V, + const SUITESPARSE_BLAS_INT *ldv, + const void *T, + const SUITESPARSE_BLAS_INT *ldt, + // input/output: + void *C, + // input: + const SUITESPARSE_BLAS_INT *ldc, + // workspace: + void *Work, + // input: + const SUITESPARSE_BLAS_INT *ldwork +) ; + +#define SUITESPARSE_LAPACK_zlarfb(side,trans,direct,storev,m,n,k,V,ldv,T,ldt, \ + C,ldc,Work,ldwork,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (K_blas_int, k, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDV_blas_int, ldv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDT_blas_int, ldt, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDWORK_blas_int, ldwork, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_ZLARFB (side, trans, direct, storev, &M_blas_int, \ + &N_blas_int, &K_blas_int, V, &LDV_blas_int, T, &LDT_blas_int, C, \ + &LDC_blas_int, Work, &LDWORK_blas_int) ; \ + } \ +} + +double SUITESPARSE_BLAS_DNRM2 // vector 2-norm +( + // input: + const SUITESPARSE_BLAS_INT *n, + const double *X, + const SUITESPARSE_BLAS_INT *incx +) ; + +#define SUITESPARSE_BLAS_dnrm2(result,n,X,incx,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + result = 0 ; \ + if (ok) \ + { \ + result = SUITESPARSE_BLAS_DNRM2 (&N_blas_int, X, &INCX_blas_int) ; \ + } \ +} + +double SUITESPARSE_BLAS_DZNRM2 // vector 2-norm +( + // input: + const SUITESPARSE_BLAS_INT *n, + const void *X, + const SUITESPARSE_BLAS_INT *incx +) ; + +#define SUITESPARSE_BLAS_dznrm2(result,n,X,incx,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + result = 0 ; \ + if (ok) \ + { \ + result = SUITESPARSE_BLAS_DZNRM2 (&N_blas_int, X, &INCX_blas_int) ; \ + } \ +} + +void SUITESPARSE_LAPACK_DLARFG // generate Householder reflector +( + // input: + const SUITESPARSE_BLAS_INT *n, + // input/output: + double *alpha, + double *X, + // input: + const SUITESPARSE_BLAS_INT *incx, + // output: + double *tau +) ; + +#define SUITESPARSE_LAPACK_dlarfg(n,alpha,X,incx,tau,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_DLARFG (&N_blas_int, alpha, X, &INCX_blas_int, \ + tau) ; \ + } \ +} + +void SUITESPARSE_LAPACK_ZLARFG // generate Householder reflector +( + // input: + const SUITESPARSE_BLAS_INT *n, + // input/output: + void *alpha, + void *X, + // input: + const SUITESPARSE_BLAS_INT *incx, + // output: + void *tau +) ; + +#define SUITESPARSE_LAPACK_zlarfg(n,alpha,X,incx,tau,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCX_blas_int, incx, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_ZLARFG (&N_blas_int, alpha, X, &INCX_blas_int, \ + tau) ; \ + } \ +} + +void SUITESPARSE_LAPACK_DLARF // apply Householder reflector +( + // input: + const char *side, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const double *V, + const SUITESPARSE_BLAS_INT *incv, + const double *tau, + // input/output: + double *C, + // input: + const SUITESPARSE_BLAS_INT *ldc, + // workspace: + double *Work +) ; + +#define SUITESPARSE_LAPACK_dlarf(side,m,n,V,incv,tau,C,ldc,Work,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCV_blas_int, incv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_DLARF (side, &M_blas_int, &N_blas_int, V, \ + &INCV_blas_int, tau, C, &LDC_blas_int, Work) ; \ + } \ +} + +void SUITESPARSE_LAPACK_ZLARF // apply Householder reflector +( + // input: + const char *side, + const SUITESPARSE_BLAS_INT *m, + const SUITESPARSE_BLAS_INT *n, + const void *V, + const SUITESPARSE_BLAS_INT *incv, + const void *tau, + // input/output: + void *C, + // input: + const SUITESPARSE_BLAS_INT *ldc, + // workspace: + void *Work +) ; + +#define SUITESPARSE_LAPACK_zlarf(side,m,n,V,incv,tau,C,ldc,Work,ok) \ +{ \ + SUITESPARSE_TO_BLAS_INT (M_blas_int, m, ok) ; \ + SUITESPARSE_TO_BLAS_INT (N_blas_int, n, ok) ; \ + SUITESPARSE_TO_BLAS_INT (INCV_blas_int, incv, ok) ; \ + SUITESPARSE_TO_BLAS_INT (LDC_blas_int, ldc, ok) ; \ + if (ok) \ + { \ + SUITESPARSE_LAPACK_ZLARF (side, &M_blas_int, &N_blas_int, V, \ + &INCV_blas_int, tau, C, &LDC_blas_int, Work) ; \ + } \ +} + +#endif + +//------------------------------------------------------------------------------ +// SuiteSparse_BLAS_library: return name of BLAS library found +//------------------------------------------------------------------------------ + +// Returns the name of the BLAS library found by SuiteSparse_config + +const char *SuiteSparse_BLAS_library ( void ) ; + +//------------------------------------------------------------------------------ +// SuiteSparse_BLAS_integer_size: return sizeof (SUITESPARSE_BLAS_INT) +//------------------------------------------------------------------------------ + +size_t SuiteSparse_BLAS_integer_size ( void ) ; + #ifdef __cplusplus } #endif #endif + diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.mk b/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.mk deleted file mode 100644 index 19a39032ad..0000000000 --- a/ThirdParty/SuiteSparse/SuiteSparse_config/SuiteSparse_config.mk +++ /dev/null @@ -1,621 +0,0 @@ -#=============================================================================== -# SuiteSparse_config.mk: common configuration file for the SuiteSparse -#=============================================================================== - -# This file contains all configuration settings for all packages in SuiteSparse, -# except for CSparse (which is stand-alone), the packages in MATLAB_Tools, -# and GraphBLAS. The configuration settings for GraphBLAS are determined by -# GraphBLAS/CMakeLists.txt - -SUITESPARSE_VERSION = 5.4.0 - -#=============================================================================== -# Options you can change without editing this file: -#=============================================================================== - - # To list the options you can modify at the 'make' command line, type - # 'make config', which also lists their default values. You can then - # change them with 'make OPTION=value'. For example, to use an INSTALL - # path of /my/path, and to use your own BLAS and LAPACK libraries, do: - # - # make install INSTALL=/my/path BLAS=-lmyblas LAPACK=-lmylapackgoeshere - # - # which will install the package into /my/path/lib and /my/path/include, - # and use -lmyblas -lmylapackgoes here when building the demo program. - -#=============================================================================== -# Defaults for any system -#=============================================================================== - - #--------------------------------------------------------------------------- - # SuiteSparse root directory - #--------------------------------------------------------------------------- - - # Most Makefiles are in SuiteSparse/Pkg/Lib or SuiteSparse/Pkg/Demo, so - # the top-level of SuiteSparse is in ../.. unless otherwise specified. - # This is true for all but the SuiteSparse_config package. - SUITESPARSE ?= $(realpath $(CURDIR)/../..) - - #--------------------------------------------------------------------------- - # installation location - #--------------------------------------------------------------------------- - - # For "make install" and "make uninstall", the default location is - # SuiteSparse/lib, SuiteSparse/include, and - # SuiteSparse/share/doc/suitesparse-x.y.z - # If you do this: - # make install INSTALL=/usr/local - # then the libraries are installed in /usr/local/lib, include files in - # /usr/local/include, and documentation in - # /usr/local/share/doc/suitesparse-x.y.z. - # You can instead specify the install location of each of these 3 components - # separately, via (for example): - # make install INSTALL_LIB=/yada/mylibs INSTALL_INCLUDE=/yoda/myinc \ - # INSTALL_DOC=/solo/mydox - # which puts the libraries in /yada/mylibs, include files in /yoda/myinc, - # and documentation in /solo/mydox. - INSTALL ?= $(SUITESPARSE) - INSTALL_LIB ?= $(INSTALL)/lib - INSTALL_INCLUDE ?= $(INSTALL)/include - INSTALL_DOC ?= $(INSTALL)/share/doc/suitesparse-$(SUITESPARSE_VERSION) - - CMAKE_OPTIONS ?= -DCMAKE_INSTALL_PREFIX=$(INSTALL) - - #--------------------------------------------------------------------------- - # parallel make - #--------------------------------------------------------------------------- - - # sequential make's by default - JOBS ?= 1 - - #--------------------------------------------------------------------------- - # optimization level - #--------------------------------------------------------------------------- - - OPTIMIZATION ?= -O3 - - #--------------------------------------------------------------------------- - # statement coverage for */Tcov - #--------------------------------------------------------------------------- - - ifeq ($(TCOV),yes) - # Each package has a */Tcov directory for extensive testing, including - # statement coverage. The Tcov tests require Linux and gcc, and use - # the vanilla BLAS. For those tests, the packages use 'make TCOV=yes', - # which overrides the following settings: - MKLROOT = - AUTOCC = no - CC = gcc - CXX = g++ - BLAS = -lrefblas -lgfortran -lstdc++ - LAPACK = -llapack - CFLAGS += --coverage - OPTIMIZATION = -g - LDFLAGS += --coverage - endif - - #--------------------------------------------------------------------------- - # OpenMP is used in CHOLMOD - #--------------------------------------------------------------------------- - - # with gcc, enable OpenMP directives via -fopenmp - # This is not supported on Darwin, so this string is cleared, below. - CFOPENMP ?= -fopenmp - - #--------------------------------------------------------------------------- - # compiler - #--------------------------------------------------------------------------- - - # By default, look for the Intel compilers. If present, they are used - # instead of $(CC), $(CXX), and $(F77). To disable this feature and - # use the $(CC), $(CXX), and $(F77) compilers, use 'make AUTOCC=no' - - AUTOCC ?= yes - - ifneq ($(AUTOCC),no) - ifneq ($(shell which icc 2>/dev/null),) - # use the Intel icc compiler for C codes, and -qopenmp for OpenMP - CC = icc - CFLAGS += -D_GNU_SOURCE - CXX = icpc - CFOPENMP = -qopenmp -I$(MKLROOT)/include - LDFLAGS += -qopenmp - LDLIBS += -lm -lirc - endif - ifneq ($(shell which ifort 2>/dev/null),) - # use the Intel ifort compiler for Fortran codes - F77 = ifort - endif - endif - - CMAKE_OPTIONS += -DCMAKE_CXX_COMPILER=$(CXX) -DCMAKE_C_COMPILER=$(CC) - - #--------------------------------------------------------------------------- - # CFLAGS for the C/C++ compiler - #--------------------------------------------------------------------------- - - # The CF macro is used by SuiteSparse Makefiles as a combination of - # CFLAGS, CPPFLAGS, TARGET_ARCH, and system-dependent settings. - CF ?= $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) $(OPTIMIZATION) -fexceptions -fPIC - - #--------------------------------------------------------------------------- - # code formatting (for Tcov on Linux only) - #--------------------------------------------------------------------------- - - PRETTY ?= grep -v "^\#" | indent -bl -nce -bli0 -i4 -sob -l120 - - #--------------------------------------------------------------------------- - # required libraries - #--------------------------------------------------------------------------- - - # SuiteSparse requires the BLAS, LAPACK, and -lm (Math) libraries. - # It places its shared *.so libraries in SuiteSparse/lib. - # Linux also requires the -lrt library (see below) - LDLIBS ?= -lm - LDFLAGS += -L$(INSTALL_LIB) - - # See http://www.openblas.net for a recent and freely available optimzed - # BLAS. LAPACK is at http://www.netlib.org/lapack/ . You can use the - # standard Fortran LAPACK along with OpenBLAS to obtain very good - # performance. This script can also detect if the Intel MKL BLAS is - # installed. - - LAPACK ?= -llapack - - ifndef BLAS - ifdef MKLROOT - # use the Intel MKL for BLAS and LAPACK - # using static linking: - # BLAS = -Wl,--start-group \ - # $(MKLROOT)/lib/intel64/libmkl_intel_lp64.a \ - # $(MKLROOT)/lib/intel64/libmkl_core.a \ - # $(MKLROOT)/lib/intel64/libmkl_intel_thread.a \ - # -Wl,--end-group -lpthread -lm - # using dynamic linking: - BLAS = -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -liomp5 -lpthread -lm - LAPACK = - else - # use the OpenBLAS at http://www.openblas.net - BLAS = -lopenblas - endif - endif - - # For ACML, use this instead: - # make BLAS='-lacml -lgfortran' - - #--------------------------------------------------------------------------- - # shell commands - #--------------------------------------------------------------------------- - - # ranlib, and ar, for generating libraries. If you don't need ranlib, - # just change it to RANLAB = echo - RANLIB ?= ranlib - ARCHIVE ?= $(AR) $(ARFLAGS) - CP ?= cp -f - MV ?= mv -f - - #--------------------------------------------------------------------------- - # Fortran compiler (not required for 'make' or 'make library') - #--------------------------------------------------------------------------- - - # A Fortran compiler is optional. Only required for the optional Fortran - # interfaces to AMD and UMFPACK. Not needed by 'make' or 'make install' - F77 ?= gfortran - F77FLAGS ?= $(FFLAGS) $(OPTIMIZATION) - - #--------------------------------------------------------------------------- - # NVIDIA CUDA configuration for CHOLMOD and SPQR - #--------------------------------------------------------------------------- - - # CUDA is detected automatically, and used if found. To disable CUDA, - # use CUDA=no - - ifneq ($(CUDA),no) - CUDA_PATH = $(shell which nvcc 2>/dev/null | sed "s/\/bin\/nvcc//") - endif - - ifeq ($(wildcard $(CUDA_PATH)),) - # CUDA is not present - CUDA_PATH = - GPU_BLAS_PATH = - GPU_CONFIG = - CUDART_LIB = - CUBLAS_LIB = - CUDA_INC_PATH = - CUDA_INC = - NVCC = echo - NVCCFLAGS = - else - # with CUDA for CHOLMOD and SPQR - GPU_BLAS_PATH = $(CUDA_PATH) - # GPU_CONFIG must include -DGPU_BLAS to compile SuiteSparse for the - # GPU. You can add additional GPU-related flags to it as well. - # with 4 cores (default): - GPU_CONFIG = -DGPU_BLAS - # For example, to compile CHOLMOD for 10 CPU cores when using the GPU: - # GPU_CONFIG = -DGPU_BLAS -DCHOLMOD_OMP_NUM_THREADS=10 - CUDART_LIB = $(CUDA_PATH)/lib64/libcudart.so - CUBLAS_LIB = $(CUDA_PATH)/lib64/libcublas.so - CUDA_INC_PATH = $(CUDA_PATH)/include/ - CUDA_INC = -I$(CUDA_INC_PATH) - MAGMA_INC = -I/opt/magma-2.4.0/include/ - MAGMA_LIB = -L/opt/magma-2.4.0/lib/ -lmagma - NVCC = $(CUDA_PATH)/bin/nvcc - NVCCFLAGS = -Xcompiler -fPIC -O3 \ - -gencode=arch=compute_30,code=sm_30 \ - -gencode=arch=compute_35,code=sm_35 \ - -gencode=arch=compute_50,code=sm_50 \ - -gencode=arch=compute_53,code=sm_53 \ - -gencode=arch=compute_53,code=sm_53 \ - -gencode=arch=compute_60,code=compute_60 - endif - - #--------------------------------------------------------------------------- - # UMFPACK configuration: - #--------------------------------------------------------------------------- - - # Configuration for UMFPACK. See UMFPACK/Source/umf_config.h for details. - # - # -DNBLAS do not use the BLAS. UMFPACK will be very slow. - # -D'LONGBLAS=long' or -DLONGBLAS='long long' defines the integers used by - # LAPACK and the BLAS (defaults to 'int') - # -DNSUNPERF do not use the Sun Perf. Library on Solaris - # -DNRECIPROCAL do not multiply by the reciprocal - # -DNO_DIVIDE_BY_ZERO do not divide by zero - # -DNCHOLMOD do not use CHOLMOD as a ordering method. If -DNCHOLMOD is - # included in UMFPACK_CONFIG, then UMFPACK does not rely on - # CHOLMOD, CAMD, CCOLAMD, COLAMD, and METIS. - - UMFPACK_CONFIG ?= - - # For example, uncomment this line to compile UMFPACK without CHOLMOD: - # UMFPACK_CONFIG = -DNCHOLMOD - # or use 'make UMFPACK_CONFIG=-DNCHOLMOD' - - #--------------------------------------------------------------------------- - # CHOLMOD configuration - #--------------------------------------------------------------------------- - - # CHOLMOD Library Modules, which appear in -lcholmod - # Core requires: none - # Check requires: Core - # Cholesky requires: Core, AMD, COLAMD. optional: Partition, Supernodal - # MatrixOps requires: Core - # Modify requires: Core - # Partition requires: Core, CCOLAMD, METIS. optional: Cholesky - # Supernodal requires: Core, BLAS, LAPACK - # - # CHOLMOD test/demo Modules (these do not appear in -lcholmod): - # Tcov requires: Core, Check, Cholesky, MatrixOps, Modify, Supernodal - # optional: Partition - # Valgrind same as Tcov - # Demo requires: Core, Check, Cholesky, MatrixOps, Supernodal - # optional: Partition - # - # Configuration flags: - # -DNCHECK do not include the Check module. - # -DNCHOLESKY do not include the Cholesky module. - # -DNPARTITION do not include the Partition module. - # also do not include METIS. - # -DNCAMD do not use CAMD & CCOLAMD in Parition Module. - # -DNMATRIXOPS do not include the MatrixOps module. - # -DNMODIFY do not include the Modify module. - # -DNSUPERNODAL do not include the Supernodal module. - # - # -DNPRINT do not print anything. - # -D'LONGBLAS=long' or -DLONGBLAS='long long' defines the integers used by - # LAPACK and the BLAS (defaults to 'int') - # -DNSUNPERF for Solaris only. If defined, do not use the Sun - # Performance Library - # -DGPU_BLAS enable the use of the CUDA BLAS - - CHOLMOD_CONFIG ?= $(GPU_CONFIG) - - #--------------------------------------------------------------------------- - # SuiteSparseQR configuration: - #--------------------------------------------------------------------------- - - # The SuiteSparseQR library can be compiled with the following options: - # - # -DNPARTITION do not include the CHOLMOD partition module - # -DNEXPERT do not include the functions in SuiteSparseQR_expert.cpp - # -DHAVE_TBB enable the use of Intel's Threading Building Blocks - # -DGPU_BLAS enable the use of the CUDA BLAS - - SPQR_CONFIG ?= $(GPU_CONFIG) - - # to compile with Intel's TBB, use TBB=-ltbb -DSPQR_CONFIG=-DHAVE_TBB - TBB ?= - # TBB = -ltbb -DSPQR_CONFIG=-DHAVE_TBB - - # TODO: this *mk file should auto-detect the presence of Intel's TBB, - # and set the compiler flags accordingly. - -#=============================================================================== -# System-dependent configurations -#=============================================================================== - - #--------------------------------------------------------------------------- - # determine what system we are on - #--------------------------------------------------------------------------- - - # To disable these auto configurations, use 'make UNAME=custom' - - ifndef UNAME - ifeq ($(OS),Windows_NT) - # Cygwin Make on Windows has an $(OS) variable, but not uname. - # Note that this option is untested. - UNAME = Windows - else - # Linux and Darwin (Mac OSX) have been tested. - UNAME := $(shell uname) - endif - endif - - #--------------------------------------------------------------------------- - # Linux - #--------------------------------------------------------------------------- - - ifeq ($(UNAME),Linux) - # add the realtime library, librt, and SuiteSparse/lib - LDLIBS += -lrt -Wl,-rpath=$(INSTALL_LIB) - endif - - #--------------------------------------------------------------------------- - # Mac - #--------------------------------------------------------------------------- - - ifeq ($(UNAME), Darwin) - # To compile on the Mac, you must install Xcode. Then do this at the - # command line in the Terminal, before doing 'make': - # xcode-select --install - CF += -fno-common - BLAS = -framework Accelerate - LAPACK = -framework Accelerate - # OpenMP is not yet supported by default in clang - CFOPENMP = - endif - - #--------------------------------------------------------------------------- - # Solaris - #--------------------------------------------------------------------------- - - ifeq ($(UNAME), SunOS) - # Using the Sun compiler and the Sun Performance Library - # This hasn't been tested recently. - # I leave it here in case you need it. It likely needs updating. - CF += -fast -KPIC -xc99=%none -xlibmieee -xlibmil -m64 -Xc - F77FLAGS = -O -fast -KPIC -dalign -xlibmil -m64 - BLAS = -xlic_lib=sunperf - LAPACK = - # Using the GCC compiler and the reference BLAS - ## CC = gcc - ## CXX = g++ - ## MAKE = gmake - ## BLAS = -lrefblas -lgfortran - ## LAPACK = -llapack - endif - - #--------------------------------------------------------------------------- - # IBM AIX - #--------------------------------------------------------------------------- - - ifeq ($(UNAME), AIX) - # hasn't been tested for a very long time... - # I leave it here in case you need it. It likely needs updating. - CF += -O4 -qipa -qmaxmem=16384 -q64 -qproto -DBLAS_NO_UNDERSCORE - F77FLAGS = -O4 -qipa -qmaxmem=16384 -q64 - BLAS = -lessl - LAPACK = - endif - -#=============================================================================== -# finalize the CF compiler flags -#=============================================================================== - - CF += $(CFOPENMP) - -#=============================================================================== -# internal configuration -#=============================================================================== - - # The user should not have to change these definitions, and they are - # not displayed by 'make config' - - #--------------------------------------------------------------------------- - # for removing files not in the distribution - #--------------------------------------------------------------------------- - - # remove object files, but keep compiled libraries via 'make clean' - CLEAN = *.o *.obj *.ln *.bb *.bbg *.da *.tcov *.gcov gmon.out *.bak *.d \ - *.gcda *.gcno *.aux *.bbl *.blg *.log *.toc *.dvi *.lof *.lot - - # also remove compiled libraries, via 'make distclean' - PURGE = *.so* *.a *.dll *.dylib *.dSYM - - # location of TCOV test output - TCOV_TMP ?= /tmp - -#=============================================================================== -# Building the shared and static libraries -#=============================================================================== - -# How to build/install shared and static libraries for Mac and Linux/Unix. -# This assumes that LIBRARY and VERSION have already been defined by the -# Makefile that includes this file. - -SO_OPTS = $(LDFLAGS) - -ifeq ($(UNAME),Windows) - # Cygwin Make on Windows (untested) - AR_TARGET = $(LIBRARY).lib - SO_PLAIN = $(LIBRARY).dll - SO_MAIN = $(LIBRARY).$(SO_VERSION).dll - SO_TARGET = $(LIBRARY).$(VERSION).dll - SO_INSTALL_NAME = echo -else - # Mac or Linux/Unix - AR_TARGET = $(LIBRARY).a - ifeq ($(UNAME),Darwin) - # Mac - SO_PLAIN = $(LIBRARY).dylib - SO_MAIN = $(LIBRARY).$(SO_VERSION).dylib - SO_TARGET = $(LIBRARY).$(VERSION).dylib - SO_OPTS += -dynamiclib -compatibility_version $(SO_VERSION) \ - -current_version $(VERSION) \ - -shared -undefined dynamic_lookup - # When a Mac *.dylib file is moved, this command is required - # to change its internal name to match its location in the filesystem: - SO_INSTALL_NAME = install_name_tool -id - else - # Linux and other variants of Unix - SO_PLAIN = $(LIBRARY).so - SO_MAIN = $(LIBRARY).so.$(SO_VERSION) - SO_TARGET = $(LIBRARY).so.$(VERSION) - SO_OPTS += -shared -Wl,-soname -Wl,$(SO_MAIN) -Wl,--no-undefined - # Linux/Unix *.so files can be moved without modification: - SO_INSTALL_NAME = echo - endif -endif - -#=============================================================================== -# Configure CHOLMOD/Partition module with METIS, CAMD, and CCOLAMD -#=============================================================================== - -# By default, SuiteSparse uses METIS 5.1.0 in the SuiteSparse/metis-5.1.0 -# directory. SuiteSparse's interface to METIS is only through the -# SuiteSparse/CHOLMOD/Partition module, which also requires SuiteSparse/CAMD -# and SuiteSparse/CCOLAMD. -# -# If you wish to use your own pre-installed copy of METIS, use the MY_METIS_LIB -# and MY_METIS_INC options passed to 'make'. For example: -# make MY_METIS_LIB=-lmetis -# make MY_METIS_LIB=/home/myself/mylibraries/libmetis.so -# make MY_METIS_LIB='-L/home/myself/mylibraries -lmetis' -# If you need to tell the compiler where to find the metis.h include file, -# then add MY_METIS_INC=/home/myself/metis-5.1.0/include as well, which points -# to the directory containing metis.h. If metis.h is already installed in -# a location known to the compiler (/usr/local/include/metis.h for example) -# then you do not need to add MY_METIS_INC. - -I_WITH_PARTITION = -LIB_WITH_PARTITION = -CONFIG_PARTITION = -DNPARTITION -DNCAMD -# check if CAMD/CCOLAMD and METIS are requested and available -ifeq (,$(findstring -DNCAMD, $(CHOLMOD_CONFIG))) - # CAMD and CCOLAMD are requested. See if they are available in - # SuiteSparse/CAMD and SuiteSparse/CCOLAMD - ifneq (, $(wildcard $(SUITESPARSE)/CAMD)) - ifneq (, $(wildcard $(SUITESPARSE)/CCOLAMD)) - # CAMD and CCOLAMD are requested and available - LIB_WITH_PARTITION = -lccolamd -lcamd - I_WITH_PARTITION = -I$(SUITESPARSE)/CCOLAMD/Include -I$(SUITESPARSE)/CAMD/Include - CONFIG_PARTITION = -DNPARTITION - # check if METIS is requested and available - ifeq (,$(findstring -DNPARTITION, $(CHOLMOD_CONFIG))) - # METIS is requested. See if it is available. - ifneq (,$(MY_METIS_LIB)) - # METIS 5.1.0 is provided elsewhere, and we are not using - # SuiteSparse/metis-5.1.0. To do so, we link with - # $(MY_METIS_LIB) and add the -I$(MY_METIS_INC) option for - # the compiler. The latter can be empty if you have METIS - # installed in a place where the compiler can find the - # metis.h include file by itself without any -I option - # (/usr/local/include/metis.h for example). - LIB_WITH_PARTITION += $(MY_METIS_LIB) - ifneq (,$(MY_METIS_INC)) - I_WITH_PARTITION += -I$(MY_METIS_INC) - endif - CONFIG_PARTITION = - else - # see if METIS is in SuiteSparse/metis-5.1.0 - ifneq (, $(wildcard $(SUITESPARSE)/metis-5.1.0)) - # SuiteSparse/metis5.1.0 is available - ifeq ($(UNAME), Darwin) - LIB_WITH_PARTITION += $(SUITESPARSE)/lib/libmetis.dylib - else - LIB_WITH_PARTITION += -lmetis - endif - I_WITH_PARTITION += -I$(SUITESPARSE)/metis-5.1.0/include - CONFIG_PARTITION = - endif - endif - endif - endif - endif -endif - -#=============================================================================== -# display configuration -#=============================================================================== - -ifeq ($(LIBRARY),) - # placeholders, for 'make config' in the top-level SuiteSparse - LIBRARY=PackageNameWillGoHere - VERSION=x.y.z - SO_VERSION=x -endif - -# 'make config' lists the primary installation options -config: - @echo ' ' - @echo '----------------------------------------------------------------' - @echo 'SuiteSparse package compilation options:' - @echo '----------------------------------------------------------------' - @echo ' ' - @echo 'SuiteSparse Version: ' '$(SUITESPARSE_VERSION)' - @echo 'SuiteSparse top folder: ' '$(SUITESPARSE)' - @echo 'Package: LIBRARY= ' '$(LIBRARY)' - @echo 'Version: VERSION= ' '$(VERSION)' - @echo 'SO version: SO_VERSION= ' '$(SO_VERSION)' - @echo 'System: UNAME= ' '$(UNAME)' - @echo 'Install directory: INSTALL= ' '$(INSTALL)' - @echo 'Install libraries in: INSTALL_LIB= ' '$(INSTALL_LIB)' - @echo 'Install include files in: INSTALL_INCLUDE=' '$(INSTALL_INCLUDE)' - @echo 'Install documentation in: INSTALL_DOC= ' '$(INSTALL_DOC)' - @echo 'Optimization level: OPTIMIZATION= ' '$(OPTIMIZATION)' - @echo 'parallel make jobs: JOBS= ' '$(JOBS)' - @echo 'BLAS library: BLAS= ' '$(BLAS)' - @echo 'LAPACK library: LAPACK= ' '$(LAPACK)' - @echo 'Intel TBB library: TBB= ' '$(TBB)' - @echo 'Other libraries: LDLIBS= ' '$(LDLIBS)' - @echo 'static library: AR_TARGET= ' '$(AR_TARGET)' - @echo 'shared library (full): SO_TARGET= ' '$(SO_TARGET)' - @echo 'shared library (main): SO_MAIN= ' '$(SO_MAIN)' - @echo 'shared library (short): SO_PLAIN= ' '$(SO_PLAIN)' - @echo 'shared library options: SO_OPTS= ' '$(SO_OPTS)' - @echo 'shared library name tool: SO_INSTALL_NAME=' '$(SO_INSTALL_NAME)' - @echo 'ranlib, for static libs: RANLIB= ' '$(RANLIB)' - @echo 'static library command: ARCHIVE= ' '$(ARCHIVE)' - @echo 'copy file: CP= ' '$(CP)' - @echo 'move file: MV= ' '$(MV)' - @echo 'remove file: RM= ' '$(RM)' - @echo 'pretty (for Tcov tests): PRETTY= ' '$(PRETTY)' - @echo 'C compiler: CC= ' '$(CC)' - @echo 'C++ compiler: CXX= ' '$(CXX)' - @echo 'CUDA compiler: NVCC= ' '$(NVCC)' - @echo 'CUDA root directory: CUDA_PATH= ' '$(CUDA_PATH)' - @echo 'OpenMP flags: CFOPENMP= ' '$(CFOPENMP)' - @echo 'C/C++ compiler flags: CF= ' '$(CF)' - @echo 'LD flags: LDFLAGS= ' '$(LDFLAGS)' - @echo 'Fortran compiler: F77= ' '$(F77)' - @echo 'Fortran flags: F77FLAGS= ' '$(F77FLAGS)' - @echo 'Intel MKL root: MKLROOT= ' '$(MKLROOT)' - @echo 'Auto detect Intel icc: AUTOCC= ' '$(AUTOCC)' - @echo 'UMFPACK config: UMFPACK_CONFIG= ' '$(UMFPACK_CONFIG)' - @echo 'CHOLMOD config: CHOLMOD_CONFIG= ' '$(CHOLMOD_CONFIG)' - @echo 'SuiteSparseQR config: SPQR_CONFIG= ' '$(SPQR_CONFIG)' - @echo 'CUDA library: CUDART_LIB= ' '$(CUDART_LIB)' - @echo 'CUBLAS library: CUBLAS_LIB= ' '$(CUBLAS_LIB)' - @echo 'METIS and CHOLMOD/Partition configuration:' - @echo 'Your METIS library: MY_METIS_LIB= ' '$(MY_METIS_LIB)' - @echo 'Your metis.h is in: MY_METIS_INC= ' '$(MY_METIS_INC)' - @echo 'METIS is used via the CHOLMOD/Partition module, configured as follows.' - @echo 'If the next line has -DNPARTITION then METIS will not be used:' - @echo 'CHOLMOD Partition config: ' '$(CONFIG_PARTITION)' - @echo 'CHOLMOD Partition libs: ' '$(LIB_WITH_PARTITION)' - @echo 'CHOLMOD Partition include:' '$(I_WITH_PARTITION)' -ifeq ($(TCOV),yes) - @echo 'TCOV=yes, for extensive testing only (gcc, g++, vanilla BLAS)' -endif - diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/build/.gitignore b/ThirdParty/SuiteSparse/SuiteSparse_config/build/.gitignore new file mode 100644 index 0000000000..52e15321b7 --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/build/.gitignore @@ -0,0 +1,4 @@ +# Ignore all files except this file. +* +*/ +!.gitignore diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/FindSuiteSparse_config.cmake b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/FindSuiteSparse_config.cmake new file mode 100644 index 0000000000..2b75390cc9 --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/FindSuiteSparse_config.cmake @@ -0,0 +1,141 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/SuiteSparse_config/cmake_modules/FindSuiteSparse_config.cmake +#------------------------------------------------------------------------------- + +# The following copyright and license applies to just this file only, not to +# the library itself: +# FindSuiteSparse_config.cmake, Copyright (c) 2022-2023, Timothy A. Davis. All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# Finds the SuiteSparse_config include file and compiled library and sets: + +# SUITESPARSE_CONFIG_INCLUDE_DIR - where to find SuiteSparse_config.h +# SUITESPARSE_CONFIG_LIBRARY - dynamic SuiteSparse_config library +# SUITESPARSE_CONFIG_STATIC - static SuiteSparse_config library +# SUITESPARSE_CONFIG_LIBRARIES - libraries when using SuiteSparse_config +# SUITESPARSE_CONFIG_FOUND - true if SuiteSparse_config found + +# set ``SUITESPARSE_CONFIG_ROOT`` or ``SuiteSparse_config_ROOT`` to a +# SuiteSparse_config installation root to tell this module where to look. + +# All the Find*.cmake files in SuiteSparse are installed by 'make install' into +# /usr/local/lib/cmake/SuiteSparse (where '/usr/local' is the +# ${CMAKE_INSTALL_PREFIX}). To access this file, place the following commands +# in your CMakeLists.txt file. See also SuiteSparse/Example/CMakeLists.txt: +# +# set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} +# ${CMAKE_INSTALL_PREFIX}/lib/cmake/SuiteSparse ) + +#------------------------------------------------------------------------------- + +# include files for SuiteSparse_config +find_path ( SUITESPARSE_CONFIG_INCLUDE_DIR + NAMES SuiteSparse_config.h + HINTS ${SUITESPARSE_CONFIG_ROOT} + HINTS ENV SUITESPARSE_CONFIG_ROOT + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/SuiteSparse_config + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config + PATH_SUFFIXES include Include +) + +# dynamic SuiteSparse_config (or static if no dynamic library was built) +find_library ( SUITESPARSE_CONFIG_LIBRARY + NAMES suitesparseconfig suitesparseconfig_static + HINTS ${SUITESPARSE_CONFIG_ROOT} + HINTS ENV SUITESPARSE_CONFIG_ROOT + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/SuiteSparse_config + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( MSVC ) + set ( STATIC_NAME suitesparseconfig_static ) +else ( ) + set ( STATIC_NAME suitesparseconfig ) + set ( save ${CMAKE_FIND_LIBRARY_SUFFIXES} ) + message ( STATUS "original library suffixes: ${CMAKE_FIND_LIBRARY_SUFFIXES}" ) + set ( CMAKE_FIND_LIBRARY_SUFFIXES + ${CMAKE_STATIC_LIBRARY_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES} ) + message ( STATUS "revised for static search: ${CMAKE_FIND_LIBRARY_SUFFIXES}" ) +endif ( ) + +# static libraries for SuiteSparse_config +find_library ( SUITESPARSE_CONFIG_STATIC + NAMES ${STATIC_NAME} + HINTS ${SUITESPARSE_CONFIG_ROOT} + HINTS ENV SUITESPARSE_CONFIG_ROOT + HINTS ${CMAKE_SOURCE_DIR}/.. + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse/SuiteSparse_config + HINTS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config + PATH_SUFFIXES lib build build/Release build/Debug +) + +if ( NOT MSVC ) + # restore the CMAKE_FIND_LIBRARY_SUFFIXES variable + set ( CMAKE_FIND_LIBRARY_SUFFIXES ${save} ) +endif ( ) + +# get version of the library from the dynamic library filename, if present +get_filename_component ( SUITESPARSE_CONFIG_LIBRARY ${SUITESPARSE_CONFIG_LIBRARY} REALPATH ) +get_filename_component ( SUITESPARSE_CONFIG_FILENAME ${SUITESPARSE_CONFIG_LIBRARY} NAME ) +string ( + REGEX MATCH "[0-9]+.[0-9]+.[0-9]+" + SUITESPARSE_CONFIG_VERSION + ${SUITESPARSE_CONFIG_FILENAME} +) + +# set ( SUITESPARSE_CONFIG_VERSION "" ) +if ( EXISTS "${SUITESPARSE_CONFIG_INCLUDE_DIR}" AND NOT SUITESPARSE_CONFIG_VERSION ) + # if the version does not appear in the filename, read the include file + file ( STRINGS ${SUITESPARSE_CONFIG_INCLUDE_DIR}/SuiteSparse_config.h SUITESPARSE_CONFIG_MAJOR_STR + REGEX "define SUITESPARSE_MAIN_VERSION" ) + file ( STRINGS ${SUITESPARSE_CONFIG_INCLUDE_DIR}/SuiteSparse_config.h SUITESPARSE_CONFIG_MINOR_STR + REGEX "define SUITESPARSE_SUB_VERSION" ) + file ( STRINGS ${SUITESPARSE_CONFIG_INCLUDE_DIR}/SuiteSparse_config.h SUITESPARSE_CONFIG_PATCH_STR + REGEX "define SUITESPARSE_SUBSUB_VERSION" ) + message ( STATUS "major: ${SUITESPARSE_CONFIG_MAJOR_STR}" ) + message ( STATUS "minor: ${SUITESPARSE_CONFIG_MINOR_STR}" ) + message ( STATUS "patch: ${SUITESPARSE_CONFIG_PATCH_STR}" ) + string ( REGEX MATCH "[0-9]+" SUITESPARSE_CONFIG_MAJOR ${SUITESPARSE_CONFIG_MAJOR_STR} ) + string ( REGEX MATCH "[0-9]+" SUITESPARSE_CONFIG_MINOR ${SUITESPARSE_CONFIG_MINOR_STR} ) + string ( REGEX MATCH "[0-9]+" SUITESPARSE_CONFIG_PATCH ${SUITESPARSE_CONFIG_PATCH_STR} ) + set (SUITESPARSE_CONFIG_VERSION "${SUITESPARSE_CONFIG_MAJOR}.${SUITESPARSE_CONFIG_MINOR}.${SUITESPARSE_CONFIG_PATCH}") +endif ( ) + +# libaries when using SuiteSparse_config +set (SUITESPARSE_CONFIG_LIBRARIES ${SUITESPARSE_CONFIG_LIBRARY}) + +include ( FindPackageHandleStandardArgs ) + +find_package_handle_standard_args ( SuiteSparse_config + REQUIRED_VARS SUITESPARSE_CONFIG_LIBRARY SUITESPARSE_CONFIG_INCLUDE_DIR + VERSION_VAR SUITESPARSE_CONFIG_VERSION + REASON_FAILURE_MESSAGE result +) + +message (STATUS "result: ${result}") + +mark_as_advanced ( + SUITESPARSE_CONFIG_INCLUDE_DIR + SUITESPARSE_CONFIG_LIBRARY + SUITESPARSE_CONFIG_STATIC + SUITESPARSE_CONFIG_LIBRARIES +) + +if ( SUITESPARSE_CONFIG_FOUND ) + message ( STATUS "SuiteSparse_config version: ${SUITESPARSE_CONFIG_VERSION}" ) + message ( STATUS "SuiteSparse_config include: ${SUITESPARSE_CONFIG_INCLUDE_DIR}" ) + message ( STATUS "SuiteSparse_config library: ${SUITESPARSE_CONFIG_LIBRARY}" ) + message ( STATUS "SuiteSparse_config static: ${SUITESPARSE_CONFIG_STATIC}" ) +else ( ) + message ( STATUS "SuiteSparse_config not found" ) + set ( SUITESPARSE_CONFIG_INCLUDE_DIR "" ) + set ( SUITESPARSE_CONFIG_LIBRARIES "" ) + set ( SUITESPARSE_CONFIG_LIBRARY "" ) + set ( SUITESPARSE_CONFIG_STATIC "" ) +endif ( ) + diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS.cmake b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS.cmake new file mode 100644 index 0000000000..9e4b779acb --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS.cmake @@ -0,0 +1,218 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS.cmake +#------------------------------------------------------------------------------- + +# SuiteSparse_config, Copyright (c) 2012-2023, Timothy A. Davis. +# All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# SuiteSparse interface to the Fortran BLAS library. +# cmake 3.22 is required because BLA_SIZEOF_INTEGER is used. + +# The Intel MKL BLAS is highly recommended. It is free to download (but be +# sure to check their license to make sure you accept it). See: +# https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.htm + +cmake_minimum_required ( VERSION 3.22 ) + +# To select a specific BLAS: set to the BLA_VENDOR options from FindBLAS.cmake +if ( DEFINED ENV{BLA_VENDOR} ) + set ( BLA_VENDOR $ENV{BLA_VENDOR} ) +endif ( ) +set ( BLA_VENDOR "ANY" CACHE STRING + "if ANY (default): searches for any BLAS. Otherwise: search for a specific BLAS" ) + +# To allow the use of a BLAS with 64-bit integers, set this to true +option ( ALLOW_64BIT_BLAS + "OFF (default): use only 32-bit BLAS. ON: look for 32 or 64-bit BLAS" off ) + +# dynamic/static linking with BLAS +option ( BLA_STATIC + "OFF (default): dynamic linking of BLAS. ON: static linking of BLAS" off ) + +#------------------------------------------------------------------------------- +# look for a specific BLAS library +#------------------------------------------------------------------------------- + +# To request specific BLAS, use either (for example): +# +# CMAKE_OPTIONS="-DBLA_VENDOR=Apple" make +# cd build ; cmake -DBLA_VENDOR=Apple .. ; make +# +# Use the ALLOW_64BIT_BLAS to select 64-bit or 32-bit BLAS. This setting is +# strictly enforced. If set to true, then only a 64-bit BLAS is allowed. +# If this is not found, no 32-bit BLAS is considered, and the build will fail. +# +# If the BLA_VENDOR string implies a 64-bit BLAS, then ALLOW_64BIT_BLAS is set +# to true, ignoring the setting from the user (Intel10_64ilp* and Arm_64ilp*). +# +# The default for ALLOW_64BIT_BLAS is false. + +if ( NOT (BLA_VENDOR STREQUAL "ANY" ) ) + # only look for the BLAS from a single vendor + if ( ( BLA_VENDOR MATCHES "64ilp" ) OR + ( BLA_VENDOR MATCHES "ilp64" ) ) + # Intel10_64ilp* or Arm_ilp64* + set ( ALLOW_64BIT_BLAS true ) + endif ( ) + if ( ALLOW_64BIT_BLAS ) + # only look for 64-bit BLAS + set ( BLA_SIZEOF_INTEGER 8 ) + message ( STATUS "Looking for 64-BLAS: " ${BLA_VENDOR} ) + else ( ) + # only look for 32-bit BLAS + message ( STATUS "Looking for 32-BLAS: " ${BLA_VENDOR} ) + set ( BLA_SIZEOF_INTEGER 4 ) + endif ( ) + find_package ( BLAS REQUIRED ) + if ( BLA_SIZEOF_INTEGER EQUAL 8 ) + include ( SuiteSparseBLAS64 ) + if ( BLA_VENDOR STREQUAL "Intel10_64ilp" ) + add_compile_definitions ( MKL_ILP64 ) + endif ( ) + else ( BLA_SIZEOF_INTEGER EQUAL 4 ) + include ( SuiteSparseBLAS32 ) + endif ( ) + message ( STATUS "Specific BLAS: ${BLA_VENDOR} found: ${BLAS_FOUND}" ) + return ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# Look for any 64-bit BLAS, if allowed +#------------------------------------------------------------------------------- + +# If ALLOW_64BIT_BLAS is true, then a 64-bit BLAS is preferred. +# If not found, a 32-bit BLAS is sought (below) + +if ( ALLOW_64BIT_BLAS ) + + # Look for Intel MKL BLAS with 64-bit integers + message ( STATUS "Looking for Intel 64-bit BLAS" ) + set ( BLA_VENDOR Intel10_64ilp ) + set ( BLA_SIZEOF_INTEGER 8 ) + find_package ( BLAS ) + if ( BLAS_FOUND ) + include ( SuiteSparseBLAS64 ) + add_compile_definitions ( MKL_ILP64 ) + return ( ) + endif ( ) + + # Look for ARM BLAS with 64-bit integers + message ( STATUS "Looking for ARM 64-bit BLAS" ) + set ( BLA_VENDOR Arm_ilp64_mp ) + set ( BLA_SIZEOF_INTEGER 8 ) + find_package ( BLAS ) + if ( BLAS_FOUND ) + include ( SuiteSparseBLAS64 ) + return ( ) + endif ( ) + + # Look for IBM BLAS with 64-bit integers + message ( STATUS "Looking for IBM ESSL 64-bit BLAS" ) + set ( BLA_VENDOR IBMESSL_SMP ) + set ( BLA_SIZEOF_INTEGER 8 ) + find_package ( BLAS ) + if ( BLAS_FOUND ) + include ( SuiteSparseBLAS64 ) + return ( ) + endif ( ) + + # Look for OpenBLAS with 64-bit integers + message ( STATUS "Looking for 64-bit OpenBLAS" ) + set ( BLA_VENDOR OpenBLAS ) + set ( BLA_SIZEOF_INTEGER 8 ) + find_package ( BLAS ) + if ( BLAS_FOUND ) + include ( SuiteSparseBLAS64 ) + return ( ) + endif ( ) + + # Look for any 64-bit BLAS + unset ( BLA_VENDOR ) + message ( STATUS "Looking for any 64-bit BLAS" ) + set ( BLA_SIZEOF_INTEGER 8 ) + find_package ( BLAS ) + if ( BLAS_FOUND ) + include ( SuiteSparseBLAS64 ) + return ( ) + endif ( ) + +endif ( ) + +#------------------------------------------------------------------------------- +# Look for a 32-bit BLAS, if no 64-bit BLAS has been found +#------------------------------------------------------------------------------- + +# Look for Intel MKL BLAS with 32-bit integers (and 64-bit pointer) +message ( STATUS "Looking for Intel 32-bit BLAS" ) +set ( BLA_VENDOR Intel10_64lp ) +set ( BLA_SIZEOF_INTEGER 4 ) +find_package ( BLAS ) +if ( BLAS_FOUND ) + include ( SuiteSparseBLAS32 ) + return ( ) +endif ( ) + +# Look for Apple Accelerate Framework (32-bit only) +message ( STATUS "Looking for 32-bit Apple BLAS" ) +set ( BLA_VENDOR Apple ) +set ( BLA_SIZEOF_INTEGER 4 ) +find_package ( BLAS ) +if ( BLAS_FOUND ) + include ( SuiteSparseBLAS32 ) + return ( ) +endif ( ) + +# Look for ARM BLAS with 32-bit integers +message ( STATUS "Looking for ARM 32-bit BLAS" ) +set ( BLA_VENDOR Arm_mp ) +set ( BLA_SIZEOF_INTEGER 4 ) +find_package ( BLAS ) +if ( BLAS_FOUND ) + include ( SuiteSparseBLAS32 ) + return ( ) +endif ( ) + +# Look for IBM BLAS with 32-bit integers +message ( STATUS "Looking for IBM ESSL 32-bit BLAS" ) +set ( BLA_VENDOR IBMESSL_SMP ) +set ( BLA_SIZEOF_INTEGER 4 ) +find_package ( BLAS ) +if ( BLAS_FOUND ) + include ( SuiteSparseBLAS32 ) + return ( ) +endif ( ) + +# Look for OpenBLAS with 32-bit integers +message ( STATUS "Looking for 32-bit OpenBLAS" ) +set ( BLA_VENDOR OpenBLAS ) +set ( BLA_SIZEOF_INTEGER 4 ) +find_package ( BLAS ) +if ( BLAS_FOUND ) + include ( SuiteSparseBLAS32 ) + return ( ) +endif ( ) + +# Look for FLAME BLAS(32-bit only) +message ( STATUS "Looking for 32-bit FLAME (BLIS) BLAS" ) +set ( BLA_VENDOR FLAME ) +set ( BLA_SIZEOF_INTEGER 4 ) +find_package ( BLAS ) +if ( BLAS_FOUND ) + include ( SuiteSparseBLAS32 ) + return ( ) +endif ( ) + +#------------------------------------------------------------------------------- +# do not change the following +#------------------------------------------------------------------------------- + +# Look for any 32-bit BLAS (this is required) +unset ( BLA_VENDOR ) +message ( STATUS "Looking for any 32-bit BLAS" ) +set ( BLA_SIZEOF_INTEGER 4 ) +find_package ( BLAS REQUIRED ) +include ( SuiteSparseBLAS32 ) + diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS32.cmake b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS32.cmake new file mode 100644 index 0000000000..550642e303 --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS32.cmake @@ -0,0 +1,16 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS32.cmake +#------------------------------------------------------------------------------- + +# SuiteSparse_config, Copyright (c) 2012-2023, Timothy A. Davis. +# All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# actions taken when a 32-bit BLAS has been found + +message ( STATUS "Found ${BLA_VENDOR} 32-bit BLAS" ) +add_compile_definitions ( BLAS_${BLA_VENDOR} ) +set ( SuiteSparse_BLAS_integer "int32_t" ) + diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS64.cmake b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS64.cmake new file mode 100644 index 0000000000..744aaef910 --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS64.cmake @@ -0,0 +1,51 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseBLAS64.cmake +#------------------------------------------------------------------------------- + +# SuiteSparse_config, Copyright (c) 2012-2023, Timothy A. Davis. +# All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# actions taken when a 64-bit BLAS has been found + +message ( STATUS "Found ${BLA_VENDOR} 64-bit BLAS" ) +add_compile_definitions ( BLAS_${BLA_VENDOR} ) +add_compile_definitions ( BLAS64 ) +set ( SuiteSparse_BLAS_integer "int64_t" ) + +#------------------------------------------------------------------------------- +# Examine the suffix appended to the Fortran 64-bit BLAS+LAPACK functions +#------------------------------------------------------------------------------- + +# OpenBLAS can be compiled by appending a suffix to each routine, so that the +# Fortan routine dgemm becomes dgemm_64, which denotes a version of dgemm with +# 64-bit integer parameters. The Sun Performance library does the same thing. + +# If the suffix does not contain "_", use (Sun Perf., for example): + +# cd build ; cmake -DBLAS64_SUFFIX="64" .. + +# If the suffix contains "_" (OpenBLAS in spack for example), use the +# following: + +# cd build ; cmake -DBLAS64_SUFFIX="_64" .. + +# This setting could be used by the spack packaging of SuiteSparse when linked +# with the spack-installed OpenBLAS with 64-bit integers. See +# https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/suite-sparse/package.py + +if ( DEFINED BLAS64_SUFFIX ) + # append BLAS64_SUFFIX to each BLAS and LAPACK name + string ( FIND ${BLAS64_SUFFIX} "_" HAS_UNDERSCORE ) + message ( STATUS "BLAS64_suffix: ${BLAS64_SUFFIX}" ) + if ( HAS_UNDERSCORE EQUAL -1 ) + message ( STATUS "BLAS64 suffix has no underscore" ) + add_compile_definitions ( BLAS64_SUFFIX=${BLAS64_SUFFIX} ) + else ( ) + message ( STATUS "BLAS64 suffix has an underscore" ) + add_compile_definitions ( BLAS64__SUFFIX=${BLAS64_SUFFIX} ) + endif ( ) +endif ( ) + diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseLAPACK.cmake b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseLAPACK.cmake new file mode 100644 index 0000000000..27ff73cadd --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseLAPACK.cmake @@ -0,0 +1,74 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseLAPACK.cmake +#------------------------------------------------------------------------------- + +# SuiteSparse_config, Copyright (c) 2012-2023, Timothy A. Davis. +# All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# SuiteSparse interface to the Fortran LAPACK library. +# cmake 3.22 is required because BLA_SIZEOF_INTEGER is used. + +# The Intel MKL BLAS is highly recommended. It is free to download (but be +# sure to check their license to make sure you accept it). See: +# https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.htm + +# The use of this package must be preceded with: +# include ( SuiteSparseBLAS ) + +cmake_minimum_required ( VERSION 3.22 ) + +if ( BLA_VENDOR STREQUAL "FLAME" ) + # FLAME has the BLAS but not LAPACK + + set ( BLA_VENDOR "Generic" ) + message ( STATUS "Looking for generic LAPACK to use with BLIS/FLAME BLAS" ) + + # look for the generic dynamic LAPACK library (usually liblagraph.so) + find_library ( LAPACK_LIBRARY + NAMES lapack + PATH_SUFFIXES lib build ) + + # look for the static LAPACK library (usually liblagraph.a) + if ( MSVC ) + set ( STATIC_SUFFIX .lib ) + else ( ) + set ( STATIC_SUFFIX .a ) + endif ( ) + set ( save ${CMAKE_FIND_LIBRARY_SUFFIXES} ) + set ( CMAKE_FIND_LIBRARY_SUFFIXES ${STATIC_SUFFIX} ${CMAKE_FIND_LIBRARY_SUFFIXES} ) + find_library ( LAPACK_STATIC + NAMES lapack + PATH_SUFFIXES lib build) + set ( CMAKE_FIND_LIBRARY_SUFFIXES ${save} ) + + set ( LAPACK_LIBRARIES ${LAPACK_LIBRARY} ) + + include (FindPackageHandleStandardArgs) + + find_package_handle_standard_args ( LAPACK + REQUIRED_VARS LAPACK_LIBRARY + ) + + mark_as_advanced ( + LAPACK_LIBRARY + LAPACK_STATIC + LAPACK_LIBRARIES + ) + + set ( BLA_VENDOR "FLAME" ) + + if ( LAPACK_FOUND ) + message ( STATUS "LAPACK library: ${LAPACK_LIBRARY}" ) + message ( STATUS "LAPACK static: ${LAPACK_STATIC}" ) + else ( ) + message ( STATUS "LAPACK not found" ) + endif ( ) + +else ( ) + # all other cases: BLA_VENDOR works fine for LAPACK + find_package ( LAPACK REQUIRED ) +endif ( ) + diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake new file mode 100644 index 0000000000..57727207dd --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake @@ -0,0 +1,266 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparsePolicy.cmake +#------------------------------------------------------------------------------- + +# Copyright (c) 2022-2023, Timothy A. Davis. All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# SuiteSparse CMake policies. The following parameters can be defined prior +# to including this file: +# +# CMAKE_BUILD_TYPE: if not set, it is set below to "Release". +# To use the "Debug" policy, precede this with +# set ( CMAKE_BUILD_TYPE Debug ) +# +# ENABLE_CUDA: if set to true, CUDA is enabled for the project. +# Default: true for CHOLMOD and SPQR, false for GraphBLAS +# (for which CUDA is in progress and not ready for +# production use). +# +# LOCAL_INSTALL: if true, "cmake --install" will install +# into SuiteSparse/lib and SuiteSparse/include. +# if false, "cmake --install" will install into the +# default prefix (or the one configured with +# CMAKE_INSTALL_PREFIX). +# Default: false +# +# NSTATIC: if true, static libraries are not built. +# Default: false, except for GraphBLAS, which +# takes a long time to compile so the default for +# GraphBLAS is true. For Mongoose, the NSTATIC setting +# is treated as if it always false, since the mongoose +# program is built with the static library. +# +# SUITESPARSE_CUDA_ARCHITECTURES: a string, such as "all" or +# "35;50;75;80" that lists the CUDA architectures to use +# when compiling CUDA kernels with nvcc. The "all" +# option requires cmake 3.23 or later. +# Default: "52;75;80". +# +# BLA_VENDOR and BLA_SIZEOF_INTEGER: By default, SuiteSparse searches for +# the BLAS library in a specific order. If you wish to +# use a specific BLAS library, set both of these with +# (for example): +# -DBLA_VENDOR=Intel10_64lp -DBLA_SIZEOF_INTEGER=4 +# Both settings must appear, or neither. +# Default: neither are defined. +# +# BLA_STATIC: if true, use static linkage for BLAS and LAPACK. +# Default: false +# +# ALLOW_64BIT_BLAS if true, SuiteSparse will search for both 32-bit and +# 64-bit BLAS. If false, only 32-bit BLAS will be +# searched for. Ignored if BLA_VENDOR and +# BLA_SIZEOF_INTEGER are defined. +# +# SUITESPARSE_C_TO_FORTRAN: a string that defines how C calls Fortran. +# Defaults to "(name,NAME) name" for Windows (lower case, +# no underscore appended to the name), which is the +# system that is most likely not to have a Fortran +# compiler. Defaults to "(name,NAME) name##_" otherwise. +# This setting is only used if no Fortran compiler is +# found. +# +# NFORTRAN: if true, no Fortan files are compiled, and the Fortran +# language is not enabled in any cmake scripts. The +# built-in cmake script FortranCInterface is skipped. +# This will require SUITESPARSE_C_TO_FORTRAN to be defined +# explicitly, if the defaults are not appropriate for your +# system. +# Default: false + +cmake_minimum_required ( VERSION 3.19 ) + +message ( STATUS "Source: ${CMAKE_SOURCE_DIR} ") +message ( STATUS "Build: ${CMAKE_BINARY_DIR} ") + +cmake_policy ( SET CMP0042 NEW ) # enable MACOSX_RPATH by default +cmake_policy ( SET CMP0048 NEW ) # VERSION variable policy +cmake_policy ( SET CMP0054 NEW ) # if ( expression ) handling policy +cmake_policy ( SET CMP0104 NEW ) # initialize CUDA architectures + +if ( WIN32 ) + set ( CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS true ) + add_compile_definitions ( _CRT_SECURE_NO_WARNINGS ) +endif ( ) + +set ( CMAKE_MACOSX_RPATH TRUE ) +enable_language ( C ) +include ( GNUInstallDirs ) + +# add the cmake_modules folder for this package to the module path +set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${CMAKE_SOURCE_DIR}/cmake_modules ) + +# NSTATIC option +if ( NSTATIC_DEFAULT_ON ) + option ( NSTATIC "ON (default): do not build static libraries. OFF: build static libraries" on ) +else ( ) + option ( NSTATIC "ON: do not build static libraries. OFF (default): build static libraries" off ) +endif ( ) + +# installation options +option ( LOCAL_INSTALL "Install in SuiteSparse/lib" off ) + +if ( SUITESPARSE_SECOND_LEVEL ) + # some packages in SuiteSparse are in SuiteSparse/Package/Package + set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${CMAKE_SOURCE_DIR}/../../lib/cmake ) +else ( ) + # most packages in SuiteSparse are located in SuiteSparse/Package + set ( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} + ${CMAKE_SOURCE_DIR}/../lib/cmake ) +endif ( ) + +# add the ./build folder to the runpath so other SuiteSparse packages can +# find this one without "make install" +set ( CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${CMAKE_BINARY_DIR} ) + +# determine if this Package is inside the SuiteSparse folder +set ( INSIDE_SUITESPARSE false ) +if ( LOCAL_INSTALL ) + # if you do not want to install local copies of SuiteSparse + # packages in SuiteSparse/lib and SuiteSparse/, set + # LOCAL_INSTALL to false in your CMake options. + if ( SUITESPARSE_SECOND_LEVEL ) + # the package is normally located at the 2nd level inside SuiteSparse + # (SuiteSparse/GraphBLAS/GraphBLAS/ for example) + if ( EXISTS ${CMAKE_SOURCE_DIR}/../../SuiteSparse_config ) + set ( INSIDE_SUITESPARSE true ) + endif ( ) + else ( ) + # typical case, the package is at the 1st level inside SuiteSparse + # (SuiteSparse/AMD for example) + if ( EXISTS ${CMAKE_SOURCE_DIR}/../SuiteSparse_config ) + set ( INSIDE_SUITESPARSE true ) + endif ( ) + endif ( ) + + if ( NOT INSIDE_SUITESPARSE ) + message ( FATAL_ERROR "Unsupported layout for local installation. Correct the directory layout or unset LOCAL_INSTALL." ) + endif ( ) + +endif ( ) + +if ( INSIDE_SUITESPARSE ) + # ../lib and ../include exist: the package is inside SuiteSparse. + # find ( REAL_PATH ...) requires cmake 3.19. + if ( SUITESPARSE_SECOND_LEVEL ) + file ( REAL_PATH ${CMAKE_SOURCE_DIR}/../.. SUITESPARSE_LOCAL_PREFIX ) + else ( ) + file ( REAL_PATH ${CMAKE_SOURCE_DIR}/.. SUITESPARSE_LOCAL_PREFIX ) + endif ( ) +endif ( ) + +if ( LOCAL_INSTALL ) + set ( SUITESPARSE_LIBDIR ${SUITESPARSE_LOCAL_PREFIX}/lib ) + set ( SUITESPARSE_INCLUDEDIR ${SUITESPARSE_LOCAL_PREFIX}/include ) + set ( SUITESPARSE_BINDIR ${SUITESPARSE_LOCAL_PREFIX}/bin ) +else ( ) + set ( SUITESPARSE_LIBDIR ${CMAKE_INSTALL_LIBDIR} ) + set ( SUITESPARSE_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR} ) + set ( SUITESPARSE_BINDIR ${CMAKE_INSTALL_BINDIR} ) +endif ( ) + +if ( INSIDE_SUITESPARSE ) + # append ../lib to the install and build runpaths + set ( CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} ${SUITESPARSE_LIBDIR} ) + set ( CMAKE_BUILD_RPATH ${CMAKE_BUILD_RPATH} ${SUITESPARSE_LIBDIR} ) +endif ( ) + +message ( STATUS "Install lib: ${SUITESPARSE_LIBDIR}" ) +message ( STATUS "Install include: ${SUITESPARSE_INCLUDEDIR}" ) +message ( STATUS "Install bin: ${SUITESPARSE_BINDIR}" ) +message ( STATUS "Install rpath: ${CMAKE_INSTALL_RPATH}" ) +message ( STATUS "Build rpath: ${CMAKE_BUILD_RPATH}" ) + +if ( NOT CMAKE_BUILD_TYPE ) + set ( CMAKE_BUILD_TYPE Release ) +endif ( ) + +message ( STATUS "Build type: ${CMAKE_BUILD_TYPE} ") + +set ( CMAKE_INCLUDE_CURRENT_DIR ON ) + +#------------------------------------------------------------------------------- +# check if Fortran is available and enabled +#------------------------------------------------------------------------------- + +include ( CheckLanguage ) +option ( NFORTRAN "ON: do not try to use Fortran. OFF (default): try Fortran" off ) +if ( NFORTRAN ) + message ( STATUS "Fortran: not enabled" ) +else ( ) + check_language ( Fortran ) + if ( CMAKE_Fortran_COMPILER ) + enable_language ( Fortran ) + message ( STATUS "Fortran: ${CMAKE_Fortran_COMPILER}" ) + else ( ) + # Fortran not available: + set ( NFORTRAN true ) + message ( STATUS "Fortran: not available" ) + endif ( ) +endif ( ) + +# default C-to-Fortran name mangling if Fortran compiler not found +if ( MSVC ) + # MS Visual Studio Fortran compiler does not mangle the Fortran name + set ( SUITESPARSE_C_TO_FORTRAN "(name,NAME) name" + CACHE STRING "C to Fortan name mangling" ) +else ( ) + # Other systems (Linux, Mac) typically append an underscore + set ( SUITESPARSE_C_TO_FORTRAN "(name,NAME) name##_" + CACHE STRING "C to Fortan name mangling" ) +endif ( ) + +#------------------------------------------------------------------------------- +# find CUDA +#------------------------------------------------------------------------------- + +if ( ENABLE_CUDA ) + + # try finding CUDA + check_language ( CUDA ) + message ( STATUS "Looking for CUDA" ) + if ( CMAKE_CUDA_COMPILER ) + # with CUDA: + message ( STATUS "Find CUDA tool kit:" ) + # FindCUDAToolKit needs to have C or CXX enabled first (see above) + include ( FindCUDAToolkit ) + message ( STATUS "CUDA toolkit found: " ${CUDAToolkit_FOUND} ) + message ( STATUS "CUDA toolkit version: " ${CUDAToolkit_VERSION} ) + message ( STATUS "CUDA toolkit include: " ${CUDAToolkit_INCLUDE_DIRS} ) + message ( STATUS "CUDA toolkit lib dir: " ${CUDAToolkit_LIBRARY_DIR} ) + if ( CUDAToolkit_VERSION VERSION_LESS "11.2" ) + # CUDA is present but too old + message ( STATUS "CUDA: not enabled (CUDA 11.2 or later required)" ) + set ( SUITESPARSE_CUDA off ) + else ( ) + # CUDA 11.2 or later present + enable_language ( CUDA ) + set ( SUITESPARSE_CUDA on ) + endif ( ) + else ( ) + # without CUDA: + message ( STATUS "CUDA: not found" ) + set ( SUITESPARSE_CUDA off ) + endif ( ) + +else ( ) + + # CUDA is disabled + set ( SUITESPARSE_CUDA off ) + +endif ( ) + +if ( SUITESPARSE_CUDA ) + message ( STATUS "CUDA: enabled" ) + add_compile_definitions ( SUITESPARSE_CUDA ) + set ( SUITESPARSE_CUDA_ARCHITECTURES "52;75;80" CACHE STRING "CUDA architectures" ) + set ( CMAKE_CUDA_ARCHITECTURES ${SUITESPARSE_CUDA_ARCHITECTURES} ) +else ( ) + message ( STATUS "CUDA: not enabled" ) +endif ( ) + diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseReport.cmake b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseReport.cmake new file mode 100644 index 0000000000..9271c4a920 --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparseReport.cmake @@ -0,0 +1,55 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/SuiteSparse_config/SuiteSparseReport.cmake +#------------------------------------------------------------------------------- + +# Copyright (c) 2012-2023, Timothy A. Davis. All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- +# report status and compile flags +#------------------------------------------------------------------------------- + +message ( STATUS "------------------------------------------------------------------------" ) +message ( STATUS "SuiteSparse CMAKE report for: ${CMAKE_PROJECT_NAME}" ) +message ( STATUS "------------------------------------------------------------------------" ) +message ( STATUS "inside common SuiteSparse root: ${INSIDE_SUITESPARSE}" ) +message ( STATUS "install in SuiteSparse/lib and SuiteSparse/include: ${LOCAL_INSTALL}" ) +message ( STATUS "build type: ${CMAKE_BUILD_TYPE}" ) +if ( NSTATIC ) + message ( STATUS "NSTATIC: true (do not build static library)" ) +else ( ) + message ( STATUS "NSTATIC: false (build static library)" ) +endif ( ) +if ( OPENMP_FOUND ) + message ( STATUS "use OpenMP: yes ") +else ( ) + message ( STATUS "use OpenMP: no ") +endif ( ) +message ( STATUS "C compiler: ${CMAKE_C_COMPILER} ") +message ( STATUS "C flags: ${CMAKE_C_FLAGS}" ) +message ( STATUS "C++ compiler: ${CMAKE_CXX_COMPILER}" ) +message ( STATUS "C++ flags: ${CMAKE_CXX_FLAGS}" ) +if ( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" ) + message ( STATUS "C Flags debug: ${CMAKE_C_FLAGS_DEBUG} ") + message ( STATUS "C++ Flags debug: ${CMAKE_CXX_FLAGS_DEBUG} ") +else ( ) + message ( STATUS "C Flags release: ${CMAKE_C_FLAGS_RELEASE} ") + message ( STATUS "C++ Flags release: ${CMAKE_CXX_FLAGS_RELEASE} ") +endif ( ) +if ( NFORTRAN ) + message ( STATUS "Fortran compiler: none" ) +else ( ) + message ( STATUS "Fortran compiler: ${CMAKE_Fortran_COMPILER} " ) +endif ( ) +get_property ( CDEFN DIRECTORY PROPERTY COMPILE_DEFINITIONS ) +message ( STATUS "compile definitions: ${CDEFN}") +if ( DEFINED SuiteSparse_BLAS_integer ) + message ( STATUS "BLAS integer: ${SuiteSparse_BLAS_integer}" ) +endif ( ) +if ( DEFINED CMAKE_CUDA_ARCHITECTURES ) + message ( STATUS "CUDA architectures: ${CMAKE_CUDA_ARCHITECTURES}" ) +endif ( ) +if ( NPARTITION ) + message ( STATUS "NPARTITION: do not use METIS" ) +endif ( ) +message ( STATUS "------------------------------------------------------------------------" ) diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparse_ssize_t.cmake b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparse_ssize_t.cmake new file mode 100644 index 0000000000..2b74bae83b --- /dev/null +++ b/ThirdParty/SuiteSparse/SuiteSparse_config/cmake_modules/SuiteSparse_ssize_t.cmake @@ -0,0 +1,32 @@ +#------------------------------------------------------------------------------- +# SuiteSparse/cmake_modules/SuiteSparse_ssize_t.cmake +#------------------------------------------------------------------------------- + +# Copyright (c) 2023, Timothy A. Davis. All Rights Reserved. +# SPDX-License-Identifier: BSD-3-clause + +#------------------------------------------------------------------------------- + +# determine if the compiler defines ssize_t + +include ( CheckCSourceCompiles ) + +set ( ssize_t_source +" #include + int main (void) + { + ssize_t x = 0 ; + return (0) ; + } +" ) + +check_c_source_compiles ( "${ssize_t_source}" TEST_FOR_SSIZE_T ) + +if ( TEST_FOR_SSIZE_T ) + set ( HAVE_SSIZE_T true ) + message ( STATUS "#include and ssize_t: OK" ) +else ( ) + set ( HAVE_SSIZE_T false ) + message ( STATUS "#include and ssize_t: not found" ) +endif ( ) + diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/Makefile b/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/Makefile deleted file mode 100644 index db68a2ea8a..0000000000 --- a/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/Makefile +++ /dev/null @@ -1,75 +0,0 @@ -# Makefile for null-output xerbla, both C and Fortran versions. -# By default, the C version (libcerbla.a and *.so) is compiled and installed. -# Set the USE_FORTRAN option to 1 to create the Fortran instead (libxerbla): - USE_FORTRAN = 0 -# USE_FORTRAN = 1 - -VERSION = 1.0.3 -SO_VERSION = 1 - -default: library - -# compile and install in SuiteSparse/lib -library: - $(MAKE) install INSTALL=$(SUITESPARSE) - -all: library - -ifeq ($(USE_FORTRAN),0) - LIBRARY = libcerbla -else - LIBRARY = libxerbla -endif - -include ../SuiteSparse_config.mk - -ifeq ($(USE_FORTRAN),0) - COMPILE = $(CC) $(CF) -c xerbla.c - DEPENDS = xerbla.c xerbla.h -else - COMPILE = $(F77) $(F77FLAGS) -c xerbla.f - DEPENDS = xerbla.f -endif - -ccode: all - -fortran: all - -static: $(AR_TARGET) - -$(AR_TARGET): $(DEPENDS) - $(COMPILE) - $(ARCHIVE) $(AR_TARGET) xerbla.o - - $(RANLIB) $(AR_TARGET) - - $(RM) xerbla.o - -# install libcerbla / libxerbla -install: $(AR_TARGET) $(INSTALL_LIB)/$(SO_TARGET) - -$(INSTALL_LIB)/$(SO_TARGET): $(DEPENDS) - @mkdir -p $(INSTALL_LIB) - @mkdir -p $(INSTALL_INCLUDE) - @mkdir -p $(INSTALL_DOC) - $(COMPILE) - $(CC) $(SO_OPTS) xerbla.o -o $@ - - $(RM) xerbla.o - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_PLAIN) ) - ( cd $(INSTALL_LIB) ; ln -sf $(SO_TARGET) $(SO_MAIN) ) - $(CP) xerbla.h $(INSTALL_INCLUDE) - chmod 755 $(INSTALL_LIB)/$(SO_TARGET) - chmod 644 $(INSTALL_INCLUDE)/xerbla.h - -# uninstall libcerbla / libxerbla -uninstall: - $(RM) $(INSTALL_LIB)/$(SO_TARGET) - $(RM) $(INSTALL_LIB)/$(SO_PLAIN) - $(RM) $(INSTALL_INCLUDE)/xerbla.h - -distclean: purge - -purge: clean - - $(RM) -r $(PURGE) - -clean: - - $(RM) -r $(CLEAN) - diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.c b/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.c deleted file mode 100644 index 5107f0353f..0000000000 --- a/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.c +++ /dev/null @@ -1,12 +0,0 @@ - -void xerbla_ (char *srname, int *info) -{ - /* do nothing */ ; -} - - -void xerbla (char *srname, int *info) -{ - /* do nothing */ ; -} - diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.f b/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.f deleted file mode 100644 index 42720048ac..0000000000 --- a/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.f +++ /dev/null @@ -1,46 +0,0 @@ - SUBROUTINE XERBLA( SRNAME, INFO ) -* -* -- LAPACK auxiliary routine (version 3.0) -- -* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd., -* Courant Institute, Argonne National Lab, and Rice University -* September 30, 1994 -* -* .. Scalar Arguments .. - CHARACTER*6 SRNAME - INTEGER INFO -* .. -* -* Purpose -* ======= -* -* XERBLA is an error handler for the LAPACK routines. -* It is called by an LAPACK routine if an input parameter has an -* invalid value. A message is printed and execution stops. -* -* Installers may consider modifying the STOP statement in order to -* call system-specific exception-handling facilities. -* -* Arguments -* ========= -* -* SRNAME (input) CHARACTER*6 -* The name of the routine which called XERBLA. -* -* INFO (input) INTEGER -* The position of the invalid parameter in the parameter list -* of the calling routine. -* -* ===================================================================== -* -* .. Executable Statements .. -* -***** WRITE( *, FMT = 9999 )SRNAME, INFO -* -***** STOP -* -***** 9999 FORMAT( ' ** On entry to ', A6, ' parameter number ', I2, ' had ', -***** $ 'an illegal value' ) -* -* End of XERBLA -* - END diff --git a/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.h b/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.h deleted file mode 100644 index b332eb3da4..0000000000 --- a/ThirdParty/SuiteSparse/SuiteSparse_config/xerbla/xerbla.h +++ /dev/null @@ -1,2 +0,0 @@ -void xerbla_ (char *srname, int *info) ; -void xerbla (char *srname, int *info) ; diff --git a/ThirdParty/SuiteSparse/SuiteSparse_demo.m b/ThirdParty/SuiteSparse/SuiteSparse_demo.m deleted file mode 100644 index b5fce6ad15..0000000000 --- a/ThirdParty/SuiteSparse/SuiteSparse_demo.m +++ /dev/null @@ -1,212 +0,0 @@ -function SuiteSparse_demo (matrixpath, dopause) -%SUITESPARSE_DEMO a demo of all packages in SuiteSparse -% -% Example: -% SuiteSparse_demo -% -% See also umfpack, cholmod, amd, camd, colamd, ccolamd, btf, klu, spqr, -% CSparse, CXSparse, ldlsparse, mongoose - -% Copyright 2016, Timothy A. Davis, http://www.suitesparse.com. - -if (nargin < 1 || isempty (matrixpath) || ~ischar (matrixpath)) - try - % older versions of MATLAB do not have an input argument to mfilename - p = mfilename ('fullpath') ; - t = strfind (p, '/') ; - matrixpath = [ p(1:t(end)) 'CXSparse/Matrix' ] ; - catch me %#ok - % mfilename failed, assume we're in the SuiteSparse directory - matrixpath = 'CXSparse/Matrix' ; - end -end - -if (nargin < 2) - dopause = false ; -end - -if (dopause) - input ('Hit enter to run the CXSparse demo: ', 's') ; -end -try - cs_demo (0, matrixpath) -catch me - disp (me.message) ; - fprintf ('\nIf you have an older version of MATLAB, you must run the\n') ; - fprintf ('SuiteSparse_demo while in the SuiteSparse directory.\n\n') ; - fprintf ('CXSparse demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the UMFPACK demo: ', 's') ; -end -try - umfpack_demo (1) -catch me - disp (me.message) ; - fprintf ('UMFPACK demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the CHOLMOD demo: ', 's') ; -end -try - cholmod_demo -catch me - disp (me.message) ; - fprintf ('CHOLMOD demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the CHOLMOD graph partitioning demo: ', 's') ; -end -try - graph_demo -catch me - disp (me.message) ; - fprintf ('graph_demo failed, probably because METIS not installed\n') ; -end - -if (dopause) - input ('Hit enter to run the AMD demo: ', 's') ; -end -try - amd_demo -catch me - disp (me.message) ; - fprintf ('AMD demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the CAMD demo: ', 's') ; -end -try - camd_demo -catch me - disp (me.message) ; - fprintf ('CAMD demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the COLAMD demo: ', 's') ; -end -try - colamd_demo -catch me - disp (me.message) ; - fprintf ('COLAMD demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the CCOLAMD demo: ', 's') ; -end -try - ccolamd_demo -catch me - disp (me.message) ; - fprintf ('CCOLAMD demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the BTF demo: ', 's') ; -end -try - btf_demo -catch me - disp (me.message) ; - fprintf ('BTF demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the KLU demo: ', 's') ; -end -try - klu_demo -catch me - disp (me.message) ; - fprintf ('KLU demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the LDL demo: ', 's') ; -end -try - ldldemo -catch me - disp (me.message) ; - fprintf ('LDL demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the SSMULT demo: ', 's') ; -end -try - ssmult_demo -catch me - disp (me.message) ; - fprintf ('SSMULT demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the MESHND demo: ', 's') ; -end -try - meshnd_example -catch me - disp (me.message) ; - fprintf ('MESHND demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the SPARSEINV demo: ', 's') ; -end -try - sparseinv_test -catch me - disp (me.message) ; - fprintf ('SPARSEINV demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the SuiteSparseQR demo: ', 's') ; -end -try - spqr_demo -catch me - disp (me.message) ; - fprintf ('SuiteSparseQR demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the quick spqr_rank demo: ', 's') ; -end -try - quickdemo_spqr_rank -catch me - disp (me.message) ; - fprintf ('spqr_rank demo failed\n' ) -end - -if (dopause) - input ('Hit enter to run the Mongoose demo: ', 's') ; -end -try - mongoose_demo -catch me - disp (me.message) ; - fprintf ('Mongoose demo failed\n' ) -end - -%{ -if (dopause) - input ('Hit enter to run the piro_band demo: ', 's') ; -end -try - piro_band_demo -catch me - disp (me.message) ; - fprintf ('piro_band_demo failed\n' ) -end -%} - -fprintf ('\n\n---- SuiteSparse demos complete\n') ; diff --git a/ThirdParty/SuiteSparse/SuiteSparse_install.m b/ThirdParty/SuiteSparse/SuiteSparse_install.m deleted file mode 100644 index 630854975f..0000000000 --- a/ThirdParty/SuiteSparse/SuiteSparse_install.m +++ /dev/null @@ -1,344 +0,0 @@ -function SuiteSparse_install (do_demo) -%SuiteSparse_install: compiles and installs all of SuiteSparse -% A Suite of Sparse matrix packages, authored or co-authored by Tim Davis. -% -% Packages in SuiteSparse: -% -% GraphBLAS graph algorithms via sparse linear algebra (graphblas.org) -% (does not yet have a MATLAB interface) -% Mongoose graph partitioner -% UMFPACK sparse LU factorization (multifrontal) -% CHOLMOD sparse Cholesky factorization, and many other operations -% AMD sparse symmetric approximate minimum degree ordering -% COLAMD sparse column approximate minimum degree ordering -% CAMD constrained AMD -% CCOLAMD constrained COLAMD -% CSparse a Concise Sparse matrix package (32-bit or 64-bit, real only) -% CXSparse extended version of CSparse (32-bit/64-bit/real/complex) -% ssget interface to SuiteSparse Matrix Collection -% KLU sparse LU factorization (left-looking) -% BTF permutation to block triangular form (like dmperm) -% LDL sparse LDL' factorization -% SuiteSparseCollection tools for managing the SuiteSparse Matrix Collection -% RBio read/write Rutherford/Boeing files -% SSMULT sparse matrix times sparse matrix -% MESHND 2D and 3D regular mesh generation and nested dissection -% FACTORIZE an object-oriented solver for x=A\b -% SPARSEINV sparse inverse subset; computes entries of inv(sparse(A)) -% MATLAB_Tools various simple m-files and demos -% SuiteSparseQR sparse QR factorization -% spqr_rank MATLAB toolbox for sparse rank deficient matrices -% -% Example: -% SuiteSparse_install % compile and prompt to run each package's demo -% SuiteSparse_install(0) % compile but do not run the demo -% SuiteSparse_install(1) % compile and run the demos with no prompts -% help SuiteSparse % for more details -% -% See also AMD, COLAMD, CAMD, CCOLAMD, CHOLMOD, UMFPACK, CSPARSE, CXSPARSE, -% ssget, RBio, SuiteSparseCollection, KLU, BTF, MESHND, SSMULT, LINFACTOR, -% SPOK, SPQR_RANK, SuiteSparse, SPQR, PATHTOOL, PATH, FACTORIZE, -% SPARSEINV, Mongoose. -% -% This script installs the full-featured CXSparse rather than CSparse. -% -% Copyright 1990-2018, Timothy A. Davis, http://www.suitesparse.com. -% In collaboration with (in alphabetical order): Patrick Amestoy, David -% Bateman, Yanqing Chen, Iain Duff, Les Foster, William Hager, Scott Kolodziej, -% Stefan Larimore, Ekanathan Palamadai Natarajan, Sivasankaran Rajamanickam, -% Sanjay Ranka, Wissam Sid-Lakhdar, and Nuri Yeralan. - -%------------------------------------------------------------------------------- -% initializations -%------------------------------------------------------------------------------- - -paths = { } ; -SuiteSparse = pwd ; - -% determine the MATLAB version (6.1, 6.5, 7.0, ...) -v = version ; -pc = ispc ; - -% print the introduction -help SuiteSparse_install - -fprintf ('\nInstalling SuiteSparse for MATLAB version %s\n\n', v) ; - -% add SuiteSparse to the path -paths = add_to_path (paths, SuiteSparse) ; - -%------------------------------------------------------------------------------- -% compile and install the packages -%------------------------------------------------------------------------------- - -% compile and install UMFPACK -try - paths = add_to_path (paths, [SuiteSparse '/UMFPACK/MATLAB']) ; - umfpack_make ; -catch me - disp (me.message) ; - fprintf ('UMFPACK not installed\n') ; -end - -% compile and install CHOLMOD -try - paths = add_to_path (paths, [SuiteSparse '/CHOLMOD/MATLAB']) ; - cholmod_make ; -catch me - disp (me.message) ; - fprintf ('CHOLMOD not installed\n') ; -end - -% compile and install AMD -try - paths = add_to_path (paths, [SuiteSparse '/AMD/MATLAB']) ; - amd_make ; -catch me - disp (me.message) ; - fprintf ('AMD not installed\n') ; -end - -% compile and install COLAMD -try - paths = add_to_path (paths, [SuiteSparse '/COLAMD/MATLAB']) ; - colamd_make ; -catch me - disp (me.message) ; - fprintf ('COLAMD not installed\n') ; -end - -% compile and install CCOLAMD -try - paths = add_to_path (paths, [SuiteSparse '/CCOLAMD/MATLAB']) ; - ccolamd_make ; -catch me - disp (me.message) ; - fprintf ('CCOLAMD not installed\n') ; -end - -% compile and install CAMD -try - paths = add_to_path (paths, [SuiteSparse '/CAMD/MATLAB']) ; - camd_make ; -catch me - disp (me.message) ; - fprintf ('CAMD not installed\n') ; -end - -% install ssget, unless it's already in the path -try - % if this fails, then ssget is not yet installed - index = ssget ; - fprintf ('ssget already installed:\n') ; - which ssget -catch - index = [ ] ; -end -if (isempty (index)) - % ssget is not installed. Use SuiteSparse/ssget - fprintf ('Installing SuiteSparse/ssget\n') ; - try - paths = add_to_path (paths, [SuiteSparse '/ssget']) ; - catch me - disp (me.message) ; - fprintf ('ssget not installed\n') ; - end -end - -% compile and install CXSparse -try - paths = add_to_path (paths, [SuiteSparse '/CXSparse/MATLAB/Demo']) ; - paths = add_to_path (paths, [SuiteSparse '/CXSparse/MATLAB/CSparse']) ; - fprintf ('Compiling CXSparse:\n') ; - if (pc) - % Windows does not support ANSI C99 complex, which CXSparse requires - cs_make (1, 0) ; - else - cs_make (1) ; - end -catch me - disp (me.message) ; - fprintf ('CXSparse not installed\n') ; -end - -% compile and install LDL -try - paths = add_to_path (paths, [SuiteSparse '/LDL/MATLAB']) ; - ldl_make ; -catch me - disp (me.message) ; - fprintf ('LDL not installed\n') ; -end - -% compile and install BTF -try - paths = add_to_path (paths, [SuiteSparse '/BTF/MATLAB']) ; - btf_make ; -catch me - disp (me.message) ; - fprintf ('BTF not installed\n') ; -end - -% compile and install KLU -try - paths = add_to_path (paths, [SuiteSparse '/KLU/MATLAB']) ; - klu_make ; -catch me - disp (me.message) ; - fprintf ('KLU not installed\n') ; -end - -% compile and install SuiteSparseQR -try - if (pc) - fprintf ('Note that SuiteSparseQR will not compile with the lcc\n') ; - fprintf ('compiler provided with MATLAB on Windows\n') ; - end - paths = add_to_path (paths, [SuiteSparse '/SPQR/MATLAB']) ; - spqr_make ; -catch me - disp (me.message) ; - fprintf ('SuiteSparseQR not installed\n') ; -end - -% compile and install RBio -try - paths = add_to_path (paths, [SuiteSparse '/RBio/RBio']) ; - RBmake ; -catch me - disp (me.message) ; - fprintf ('RBio not installed.\n') ; -end - -% install MATLAB_Tools/* -try - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools']) ; - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/Factorize']) ; - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/MESHND']) ; - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/LINFACTOR']) ; - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/find_components']) ; - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/GEE']) ; - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/shellgui']) ; - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/waitmex']) ; - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/spqr_rank']) ; - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/spqr_rank/SJget']) ; - fprintf ('MATLAB_Tools installed\n') ; -catch me - disp (me.message) ; - fprintf ('MATLAB_Tools not installed\n') ; -end - -% compile and install SuiteSparseCollection -try - % do not try to compile with large-file I/O for MATLAB 6.5 or earlier - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/SuiteSparseCollection']) ; - ss_install (verLessThan ('matlab', '7.0')) ; -catch me - disp (me.message) ; - fprintf ('SuiteSparseCollection not installed\n') ; -end - -% compile and install SSMULT -try - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/SSMULT']) ; - ssmult_install ; -catch me - disp (me.message) ; - fprintf ('SSMULT not installed\n') ; -end - -% compile and install dimacs10 -try - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/dimacs10']) ; - dimacs10_install (0) ; -catch me - disp (me.message) ; - fprintf ('MATLAB_Tools/dimacs10 not installed\n') ; -end - -% compile and install spok -try - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/spok']) ; - spok_install ; -catch me - disp (me.message) ; - fprintf ('MATLAB_Tools/spok not installed\n') ; -end - -%{ -% compile and install PIRO_BAND -try - paths = add_to_path (paths, [SuiteSparse '/PIRO_BAND/MATLAB']) ; - piro_band_make ; -catch me - disp (me.message) ; - fprintf ('PIRO_BAND not installed\n') ; -end -%} - -% compile and install sparsinv -try - paths = add_to_path (paths, [SuiteSparse '/MATLAB_Tools/sparseinv']) ; - sparseinv_install ; -catch me - disp (me.message) ; - fprintf ('MATLAB_Tools/sparseinv not installed\n') ; -end - -% compile and install Mongoose -try - paths = add_to_path (paths, [SuiteSparse '/Mongoose/MATLAB']) ; - mongoose_make (0) ; -catch me - disp (me.message) ; - fprintf ('Mongoose not installed\n') ; -end - -%------------------------------------------------------------------------------- -% post-install wrapup -%------------------------------------------------------------------------------- - -cd (SuiteSparse) -fprintf ('SuiteSparse is now installed.\n\n') ; - -% run the demo, if requested -if (nargin < 1) - % ask if demo should be run - y = input ('Hit enter to run the SuiteSparse demo (or "n" to quit): ', 's'); - if (isempty (y)) - y = 'y' ; - end - do_demo = (y (1) ~= 'n') ; - do_pause = true ; -else - % run the demo without pausing - do_pause = false ; -end -if (do_demo) - try - SuiteSparse_demo ([ ], do_pause) ; - catch me - disp (me.message) ; - fprintf ('SuiteSparse demo failed\n') ; - end -end - -% print the list of new directories added to the path -fprintf ('\nSuiteSparse installation is complete. The following paths\n') ; -fprintf ('have been added for this session. Use pathtool to add them\n') ; -fprintf ('permanently. If you cannot save the new path because of file\n'); -fprintf ('permissions, then add these commands to your startup.m file.\n') ; -fprintf ('Type "doc startup" and "doc pathtool" for more information.\n\n') ; -for k = 1:length (paths) - fprintf ('addpath %s\n', paths {k}) ; -end -cd (SuiteSparse) - -fprintf ('\nSuiteSparse for MATLAB %s installation complete\n', v) ; - -%------------------------------------------------------------------------------- -function paths = add_to_path (paths, newpath) -% add a path -cd (newpath) ; -addpath (newpath) ; -paths = [paths { newpath } ] ; diff --git a/ThirdParty/SuiteSparse/SuiteSparse_test.m b/ThirdParty/SuiteSparse/SuiteSparse_test.m deleted file mode 100644 index 24d22fa29b..0000000000 --- a/ThirdParty/SuiteSparse/SuiteSparse_test.m +++ /dev/null @@ -1,237 +0,0 @@ -function SuiteSparse_test -% SuiteSparse_test exhaustive test of all SuiteSparse packages -% -% Your current directory must be SuiteSparse for this function to work. -% SuiteSparse_install must be run prior to running this test. Warning: -% this test takes a *** long **** time. -% -% Example: -% SuiteSparse_test -% -% See also SuiteSparse_install, SuiteSparse_demo. - -% Copyright 1990-2015, Timothy A. Davis, http://www.suitesparse.com. - -help SuiteSparse_test - -npackages = 19 ; -h = waitbar (0, 'SuiteSparse test:') ; -SuiteSparse = pwd ; -package = 0 ; - -try - - %--------------------------------------------------------------------------- - % CSparse - %--------------------------------------------------------------------------- - - % compile and install CSparse (not installed by SuiteSparse_install) - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: CSparse') ; - addpath ([SuiteSparse '/CSparse/MATLAB/CSparse']) ; - addpath ([SuiteSparse '/CSparse/MATLAB/Demo']) ; - cd ([SuiteSparse '/CSparse/MATLAB/CSparse']) ; - cs_make ; - % test CSparse - cd ([SuiteSparse '/CSparse/MATLAB/Test']) ; - testall ; - % uninstall CSparse by removing it from path - rmpath ([SuiteSparse '/CSparse/MATLAB/CSparse']) ; - rmpath ([SuiteSparse '/CSparse/MATLAB/Demo']) ; - rmpath ([SuiteSparse '/CSparse/MATLAB/ssget']) ; - - %--------------------------------------------------------------------------- - % CXSparse - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: CXSparse') ; - cd ([SuiteSparse '/CXSparse/MATLAB/Test']) ; - testall ; - - %--------------------------------------------------------------------------- - % COLAMD - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: COLAMD') ; - cd ([SuiteSparse '/COLAMD/MATLAB']) ; - colamd_test ; - - %--------------------------------------------------------------------------- - % CCOLAMD - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: CCOLAMD') ; - cd ([SuiteSparse '/CCOLAMD/MATLAB']) ; - ccolamd_test ; - - %--------------------------------------------------------------------------- - % UMFPACK - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: UMFPACK') ; - cd ([SuiteSparse '/UMFPACK/MATLAB']) ; - umfpack_test (100) ; - - %--------------------------------------------------------------------------- - % CHOLMOD - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: CHOLMOD') ; - cd ([SuiteSparse '/CHOLMOD/MATLAB/Test']) ; - cholmod_test ; - - %--------------------------------------------------------------------------- - % BTF - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: BTF') ; - cd ([SuiteSparse '/BTF/MATLAB/Test']) ; - btf_test ; - - %--------------------------------------------------------------------------- - % KLU - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: KLU') ; - cd ([SuiteSparse '/KLU/MATLAB/Test']) ; - klu_test (100) ; - - %--------------------------------------------------------------------------- - % LDL - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: LDL') ; - cd ([SuiteSparse '/LDL/MATLAB']) ; - ldlmain2 ; - ldltest ; - - %--------------------------------------------------------------------------- - % LINFACTOR: MATLAB 7.3 (R2006b) or later required - %--------------------------------------------------------------------------- - - package = package + 1 ; - if (verLessThan ('matlab', '7.3')) - % skip test of LINFACTOR - else - waitbar (package/(npackages+1), h, 'SuiteSparse test: LINFACTOR') ; - cd ([SuiteSparse '/MATLAB_Tools/LINFACTOR']) ; - lintests ; - end - - %--------------------------------------------------------------------------- - % MESHND - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: MESHND') ; - cd ([SuiteSparse '/MATLAB_Tools/MESHND']) ; - meshnd_quality ; - - %--------------------------------------------------------------------------- - % SSMULT - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: SSMULT') ; - cd ([SuiteSparse '/MATLAB_Tools/SSMULT']) ; - sstest3 ; - - %--------------------------------------------------------------------------- - % other MATLAB_Tools - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: MATLAB Tools') ; - cd ([SuiteSparse '/MATLAB_Tools']) ; - fprintf ('getversion: %g\n', getversion) ; - seashell ; - shellgui ; - cd ([SuiteSparse '/MATLAB_Tools/waitmex']) ; - waitmex ; - url = 'http://www.suitesparse.com' ; - fprintf ('Click here for more details\n', url) ; - hprintf ('or see \n', url) ; - cd ([SuiteSparse '/MATLAB_Tools/find_components']) ; - find_components_example (1, 0) ; - cd ([SuiteSparse '/MATLAB_Tools/spok']) ; - spok_test ; - - %--------------------------------------------------------------------------- - % FACTORIZE - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: FACTORIZE') ; - cd ([SuiteSparse '/MATLAB_Tools/Factorize/Test']) ; - test_all ; - - %--------------------------------------------------------------------------- - % SPARSEINV - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: SPARSEINV') ; - cd ([SuiteSparse '/MATLAB_Tools/sparseinv']) ; - sparseinv_test - - %--------------------------------------------------------------------------- - % SPQR_RANK - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: spqr_rank') ; - cd ([SuiteSparse '/MATLAB_Tools/spqr_rank']) ; - demo_spqr_rank ; - - %--------------------------------------------------------------------------- - % Mongoose - %--------------------------------------------------------------------------- - - package = package + 1 ; - waitbar (package/(npackages+1), h, 'SuiteSparse test: mongoose') ; - cd ([SuiteSparse '/Mongoose/MATLAB']) ; - mongoose_test ; - - %--------------------------------------------------------------------------- - % PIRO_BAND - %--------------------------------------------------------------------------- - -% package = package + 1 ; -% waitbar (package/(npackages+1), h, 'SuiteSparse test: PIRO_BAND') ; -% cd ([SuiteSparse '/PIRO_BAND/MATLAB/Test']) ; -% demo_spqr_rank ; - - %--------------------------------------------------------------------------- - % AMD, CAMD, SuiteSparseCollection, ssget - %--------------------------------------------------------------------------- - - % no exhaustive tests; tested via other packages - -catch - - %--------------------------------------------------------------------------- - % test failure - %--------------------------------------------------------------------------- - - cd (SuiteSparse) ; - disp (lasterr) ; %#ok - fprintf ('SuiteSparse test: FAILED\n') ; - return - -end - -%------------------------------------------------------------------------------- -% test OK -%------------------------------------------------------------------------------- - -close (h) ; -fprintf ('SuiteSparse test: OK\n') ; -cd (SuiteSparse) ; diff --git a/ThirdParty/SuiteSparse/include/SuiteSparse_config.h b/ThirdParty/SuiteSparse/include/SuiteSparse_config.h deleted file mode 100644 index 1698a79621..0000000000 --- a/ThirdParty/SuiteSparse/include/SuiteSparse_config.h +++ /dev/null @@ -1,218 +0,0 @@ -/* ========================================================================== */ -/* === SuiteSparse_config =================================================== */ -/* ========================================================================== */ - -/* Configuration file for SuiteSparse: a Suite of Sparse matrix packages - * (AMD, COLAMD, CCOLAMD, CAMD, CHOLMOD, UMFPACK, CXSparse, and others). - * - * SuiteSparse_config.h provides the definition of the long integer. On most - * systems, a C program can be compiled in LP64 mode, in which long's and - * pointers are both 64-bits, and int's are 32-bits. Windows 64, however, uses - * the LLP64 model, in which int's and long's are 32-bits, and long long's and - * pointers are 64-bits. - * - * SuiteSparse packages that include long integer versions are - * intended for the LP64 mode. However, as a workaround for Windows 64 - * (and perhaps other systems), the long integer can be redefined. - * - * If _WIN64 is defined, then the __int64 type is used instead of long. - * - * The long integer can also be defined at compile time. For example, this - * could be added to SuiteSparse_config.mk: - * - * CFLAGS = -O -D'SuiteSparse_long=long long' \ - * -D'SuiteSparse_long_max=9223372036854775801' -D'SuiteSparse_long_idd="lld"' - * - * This file defines SuiteSparse_long as either long (on all but _WIN64) or - * __int64 on Windows 64. The intent is that a SuiteSparse_long is always a - * 64-bit integer in a 64-bit code. ptrdiff_t might be a better choice than - * long; it is always the same size as a pointer. - * - * This file also defines the SUITESPARSE_VERSION and related definitions. - * - * Copyright (c) 2012, Timothy A. Davis. No licensing restrictions apply - * to this file or to the SuiteSparse_config directory. - * Author: Timothy A. Davis. - */ - -#ifndef SUITESPARSE_CONFIG_H -#define SUITESPARSE_CONFIG_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -/* ========================================================================== */ -/* === SuiteSparse_long ===================================================== */ -/* ========================================================================== */ - -#ifndef SuiteSparse_long - -#ifdef _WIN64 - -#define SuiteSparse_long __int64 -#define SuiteSparse_long_max _I64_MAX -#define SuiteSparse_long_idd "I64d" - -#else - -#define SuiteSparse_long int64_t -#define SuiteSparse_long_max INT64_MAX -#define SuiteSparse_long_idd PRId64 - -#endif -#define SuiteSparse_long_id "%" SuiteSparse_long_idd -#define SuiteSparse_unsigned_long uint64_t -#endif - -/* ========================================================================== */ -/* === SuiteSparse_config parameters and functions ========================== */ -/* ========================================================================== */ - -/* SuiteSparse-wide parameters are placed in this struct. It is meant to be - an extern, globally-accessible struct. It is not meant to be updated - frequently by multiple threads. Rather, if an application needs to modify - SuiteSparse_config, it should do it once at the beginning of the application, - before multiple threads are launched. - - The intent of these function pointers is that they not be used in your - application directly, except to assign them to the desired user-provided - functions. Rather, you should use the - */ - -struct SuiteSparse_config_struct -{ - void *(*malloc_func) (size_t) ; /* pointer to malloc */ - void *(*calloc_func) (size_t, size_t) ; /* pointer to calloc */ - void *(*realloc_func) (void *, size_t) ; /* pointer to realloc */ - void (*free_func) (void *) ; /* pointer to free */ - int (*printf_func) (const char *, ...) ; /* pointer to printf */ - double (*hypot_func) (double, double) ; /* pointer to hypot */ - int (*divcomplex_func) (double, double, double, double, double *, double *); -} ; - -extern struct SuiteSparse_config_struct SuiteSparse_config ; - -void SuiteSparse_start ( void ) ; /* called to start SuiteSparse */ - -void SuiteSparse_finish ( void ) ; /* called to finish SuiteSparse */ - -void *SuiteSparse_malloc /* pointer to allocated block of memory */ -( - size_t nitems, /* number of items to malloc (>=1 is enforced) */ - size_t size_of_item /* sizeof each item */ -) ; - -void *SuiteSparse_calloc /* pointer to allocated block of memory */ -( - size_t nitems, /* number of items to calloc (>=1 is enforced) */ - size_t size_of_item /* sizeof each item */ -) ; - -void *SuiteSparse_realloc /* pointer to reallocated block of memory, or - to original block if the realloc failed. */ -( - size_t nitems_new, /* new number of items in the object */ - size_t nitems_old, /* old number of items in the object */ - size_t size_of_item, /* sizeof each item */ - void *p, /* old object to reallocate */ - int *ok /* 1 if successful, 0 otherwise */ -) ; - -void *SuiteSparse_free /* always returns NULL */ -( - void *p /* block to free */ -) ; - -void SuiteSparse_tic /* start the timer */ -( - double tic [2] /* output, contents undefined on input */ -) ; - -double SuiteSparse_toc /* return time in seconds since last tic */ -( - double tic [2] /* input: from last call to SuiteSparse_tic */ -) ; - -double SuiteSparse_time /* returns current wall clock time in seconds */ -( - void -) ; - -/* returns sqrt (x^2 + y^2), computed reliably */ -double SuiteSparse_hypot (double x, double y) ; - -/* complex division of c = a/b */ -int SuiteSparse_divcomplex -( - double ar, double ai, /* real and imaginary parts of a */ - double br, double bi, /* real and imaginary parts of b */ - double *cr, double *ci /* real and imaginary parts of c */ -) ; - -/* determine which timer to use, if any */ -#ifndef NTIMER -#ifdef _POSIX_C_SOURCE -#if _POSIX_C_SOURCE >= 199309L -#define SUITESPARSE_TIMER_ENABLED -#endif -#endif -#endif - -/* SuiteSparse printf macro */ -#define SUITESPARSE_PRINTF(params) \ -{ \ - if (SuiteSparse_config.printf_func != NULL) \ - { \ - (void) (SuiteSparse_config.printf_func) params ; \ - } \ -} - -/* ========================================================================== */ -/* === SuiteSparse version ================================================== */ -/* ========================================================================== */ - -/* SuiteSparse is not a package itself, but a collection of packages, some of - * which must be used together (UMFPACK requires AMD, CHOLMOD requires AMD, - * COLAMD, CAMD, and CCOLAMD, etc). A version number is provided here for the - * collection itself, which is also the version number of SuiteSparse_config. - */ - -int SuiteSparse_version /* returns SUITESPARSE_VERSION */ -( - /* output, not defined on input. Not used if NULL. Returns - the three version codes in version [0..2]: - version [0] is SUITESPARSE_MAIN_VERSION - version [1] is SUITESPARSE_SUB_VERSION - version [2] is SUITESPARSE_SUBSUB_VERSION - */ - int version [3] -) ; - -/* Versions prior to 4.2.0 do not have the above function. The following - code fragment will work with any version of SuiteSparse: - - #ifdef SUITESPARSE_HAS_VERSION_FUNCTION - v = SuiteSparse_version (NULL) ; - #else - v = SUITESPARSE_VERSION ; - #endif -*/ -#define SUITESPARSE_HAS_VERSION_FUNCTION - -#define SUITESPARSE_DATE "Dec 28, 2018" -#define SUITESPARSE_VER_CODE(main,sub) ((main) * 1000 + (sub)) -#define SUITESPARSE_MAIN_VERSION 5 -#define SUITESPARSE_SUB_VERSION 4 -#define SUITESPARSE_SUBSUB_VERSION 0 -#define SUITESPARSE_VERSION \ - SUITESPARSE_VER_CODE(SUITESPARSE_MAIN_VERSION,SUITESPARSE_SUB_VERSION) - -#ifdef __cplusplus -} -#endif -#endif diff --git a/ThirdParty/SuiteSparse/include/amd.h b/ThirdParty/SuiteSparse/include/amd.h deleted file mode 100644 index a72851fcf4..0000000000 --- a/ThirdParty/SuiteSparse/include/amd.h +++ /dev/null @@ -1,400 +0,0 @@ -/* ========================================================================= */ -/* === AMD: approximate minimum degree ordering =========================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* AMD Version 2.4, Copyright (c) 1996-2013 by Timothy A. Davis, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* AMD finds a symmetric ordering P of a matrix A so that the Cholesky - * factorization of P*A*P' has fewer nonzeros and takes less work than the - * Cholesky factorization of A. If A is not symmetric, then it performs its - * ordering on the matrix A+A'. Two sets of user-callable routines are - * provided, one for int integers and the other for SuiteSparse_long integers. - * - * The method is based on the approximate minimum degree algorithm, discussed - * in Amestoy, Davis, and Duff, "An approximate degree ordering algorithm", - * SIAM Journal of Matrix Analysis and Applications, vol. 17, no. 4, pp. - * 886-905, 1996. This package can perform both the AMD ordering (with - * aggressive absorption), and the AMDBAR ordering (without aggressive - * absorption) discussed in the above paper. This package differs from the - * Fortran codes discussed in the paper: - * - * (1) it can ignore "dense" rows and columns, leading to faster run times - * (2) it computes the ordering of A+A' if A is not symmetric - * (3) it is followed by a depth-first post-ordering of the assembly tree - * (or supernodal elimination tree) - * - * For historical reasons, the Fortran versions, amd.f and amdbar.f, have - * been left (nearly) unchanged. They compute the identical ordering as - * described in the above paper. - */ - -#ifndef AMD_H -#define AMD_H - -/* make it easy for C++ programs to include AMD */ -#ifdef __cplusplus -extern "C" { -#endif - -/* get the definition of size_t: */ -#include - -#include "SuiteSparse_config.h" - -int amd_order /* returns AMD_OK, AMD_OK_BUT_JUMBLED, - * AMD_INVALID, or AMD_OUT_OF_MEMORY */ -( - int n, /* A is n-by-n. n must be >= 0. */ - const int Ap [ ], /* column pointers for A, of size n+1 */ - const int Ai [ ], /* row indices of A, of size nz = Ap [n] */ - int P [ ], /* output permutation, of size n */ - double Control [ ], /* input Control settings, of size AMD_CONTROL */ - double Info [ ] /* output Info statistics, of size AMD_INFO */ -) ; - -SuiteSparse_long amd_l_order /* see above for description of arguments */ -( - SuiteSparse_long n, - const SuiteSparse_long Ap [ ], - const SuiteSparse_long Ai [ ], - SuiteSparse_long P [ ], - double Control [ ], - double Info [ ] -) ; - -/* Input arguments (not modified): - * - * n: the matrix A is n-by-n. - * Ap: an int/SuiteSparse_long array of size n+1, containing column - * pointers of A. - * Ai: an int/SuiteSparse_long array of size nz, containing the row - * indices of A, where nz = Ap [n]. - * Control: a double array of size AMD_CONTROL, containing control - * parameters. Defaults are used if Control is NULL. - * - * Output arguments (not defined on input): - * - * P: an int/SuiteSparse_long array of size n, containing the output - * permutation. If row i is the kth pivot row, then P [k] = i. In - * MATLAB notation, the reordered matrix is A (P,P). - * Info: a double array of size AMD_INFO, containing statistical - * information. Ignored if Info is NULL. - * - * On input, the matrix A is stored in column-oriented form. The row indices - * of nonzero entries in column j are stored in Ai [Ap [j] ... Ap [j+1]-1]. - * - * If the row indices appear in ascending order in each column, and there - * are no duplicate entries, then amd_order is slightly more efficient in - * terms of time and memory usage. If this condition does not hold, a copy - * of the matrix is created (where these conditions do hold), and the copy is - * ordered. This feature is new to v2.0 (v1.2 and earlier required this - * condition to hold for the input matrix). - * - * Row indices must be in the range 0 to - * n-1. Ap [0] must be zero, and thus nz = Ap [n] is the number of nonzeros - * in A. The array Ap is of size n+1, and the array Ai is of size nz = Ap [n]. - * The matrix does not need to be symmetric, and the diagonal does not need to - * be present (if diagonal entries are present, they are ignored except for - * the output statistic Info [AMD_NZDIAG]). The arrays Ai and Ap are not - * modified. This form of the Ap and Ai arrays to represent the nonzero - * pattern of the matrix A is the same as that used internally by MATLAB. - * If you wish to use a more flexible input structure, please see the - * umfpack_*_triplet_to_col routines in the UMFPACK package, at - * http://www.suitesparse.com. - * - * Restrictions: n >= 0. Ap [0] = 0. Ap [j] <= Ap [j+1] for all j in the - * range 0 to n-1. nz = Ap [n] >= 0. Ai [0..nz-1] must be in the range 0 - * to n-1. Finally, Ai, Ap, and P must not be NULL. If any of these - * restrictions are not met, AMD returns AMD_INVALID. - * - * AMD returns: - * - * AMD_OK if the matrix is valid and sufficient memory can be allocated to - * perform the ordering. - * - * AMD_OUT_OF_MEMORY if not enough memory can be allocated. - * - * AMD_INVALID if the input arguments n, Ap, Ai are invalid, or if P is - * NULL. - * - * AMD_OK_BUT_JUMBLED if the matrix had unsorted columns, and/or duplicate - * entries, but was otherwise valid. - * - * The AMD routine first forms the pattern of the matrix A+A', and then - * computes a fill-reducing ordering, P. If P [k] = i, then row/column i of - * the original is the kth pivotal row. In MATLAB notation, the permuted - * matrix is A (P,P), except that 0-based indexing is used instead of the - * 1-based indexing in MATLAB. - * - * The Control array is used to set various parameters for AMD. If a NULL - * pointer is passed, default values are used. The Control array is not - * modified. - * - * Control [AMD_DENSE]: controls the threshold for "dense" rows/columns. - * A dense row/column in A+A' can cause AMD to spend a lot of time in - * ordering the matrix. If Control [AMD_DENSE] >= 0, rows/columns - * with more than Control [AMD_DENSE] * sqrt (n) entries are ignored - * during the ordering, and placed last in the output order. The - * default value of Control [AMD_DENSE] is 10. If negative, no - * rows/columns are treated as "dense". Rows/columns with 16 or - * fewer off-diagonal entries are never considered "dense". - * - * Control [AMD_AGGRESSIVE]: controls whether or not to use aggressive - * absorption, in which a prior element is absorbed into the current - * element if is a subset of the current element, even if it is not - * adjacent to the current pivot element (refer to Amestoy, Davis, - * & Duff, 1996, for more details). The default value is nonzero, - * which means to perform aggressive absorption. This nearly always - * leads to a better ordering (because the approximate degrees are - * more accurate) and a lower execution time. There are cases where - * it can lead to a slightly worse ordering, however. To turn it off, - * set Control [AMD_AGGRESSIVE] to 0. - * - * Control [2..4] are not used in the current version, but may be used in - * future versions. - * - * The Info array provides statistics about the ordering on output. If it is - * not present, the statistics are not returned. This is not an error - * condition. - * - * Info [AMD_STATUS]: the return value of AMD, either AMD_OK, - * AMD_OK_BUT_JUMBLED, AMD_OUT_OF_MEMORY, or AMD_INVALID. - * - * Info [AMD_N]: n, the size of the input matrix - * - * Info [AMD_NZ]: the number of nonzeros in A, nz = Ap [n] - * - * Info [AMD_SYMMETRY]: the symmetry of the matrix A. It is the number - * of "matched" off-diagonal entries divided by the total number of - * off-diagonal entries. An entry A(i,j) is matched if A(j,i) is also - * an entry, for any pair (i,j) for which i != j. In MATLAB notation, - * S = spones (A) ; - * B = tril (S, -1) + triu (S, 1) ; - * symmetry = nnz (B & B') / nnz (B) ; - * - * Info [AMD_NZDIAG]: the number of entries on the diagonal of A. - * - * Info [AMD_NZ_A_PLUS_AT]: the number of nonzeros in A+A', excluding the - * diagonal. If A is perfectly symmetric (Info [AMD_SYMMETRY] = 1) - * with a fully nonzero diagonal, then Info [AMD_NZ_A_PLUS_AT] = nz-n - * (the smallest possible value). If A is perfectly unsymmetric - * (Info [AMD_SYMMETRY] = 0, for an upper triangular matrix, for - * example) with no diagonal, then Info [AMD_NZ_A_PLUS_AT] = 2*nz - * (the largest possible value). - * - * Info [AMD_NDENSE]: the number of "dense" rows/columns of A+A' that were - * removed from A prior to ordering. These are placed last in the - * output order P. - * - * Info [AMD_MEMORY]: the amount of memory used by AMD, in bytes. In the - * current version, this is 1.2 * Info [AMD_NZ_A_PLUS_AT] + 9*n - * times the size of an integer. This is at most 2.4nz + 9n. This - * excludes the size of the input arguments Ai, Ap, and P, which have - * a total size of nz + 2*n + 1 integers. - * - * Info [AMD_NCMPA]: the number of garbage collections performed. - * - * Info [AMD_LNZ]: the number of nonzeros in L (excluding the diagonal). - * This is a slight upper bound because mass elimination is combined - * with the approximate degree update. It is a rough upper bound if - * there are many "dense" rows/columns. The rest of the statistics, - * below, are also slight or rough upper bounds, for the same reasons. - * The post-ordering of the assembly tree might also not exactly - * correspond to a true elimination tree postordering. - * - * Info [AMD_NDIV]: the number of divide operations for a subsequent LDL' - * or LU factorization of the permuted matrix A (P,P). - * - * Info [AMD_NMULTSUBS_LDL]: the number of multiply-subtract pairs for a - * subsequent LDL' factorization of A (P,P). - * - * Info [AMD_NMULTSUBS_LU]: the number of multiply-subtract pairs for a - * subsequent LU factorization of A (P,P), assuming that no numerical - * pivoting is required. - * - * Info [AMD_DMAX]: the maximum number of nonzeros in any column of L, - * including the diagonal. - * - * Info [14..19] are not used in the current version, but may be used in - * future versions. - */ - -/* ------------------------------------------------------------------------- */ -/* direct interface to AMD */ -/* ------------------------------------------------------------------------- */ - -/* amd_2 is the primary AMD ordering routine. It is not meant to be - * user-callable because of its restrictive inputs and because it destroys - * the user's input matrix. It does not check its inputs for errors, either. - * However, if you can work with these restrictions it can be faster than - * amd_order and use less memory (assuming that you can create your own copy - * of the matrix for AMD to destroy). Refer to AMD/Source/amd_2.c for a - * description of each parameter. */ - -void amd_2 -( - int n, - int Pe [ ], - int Iw [ ], - int Len [ ], - int iwlen, - int pfree, - int Nv [ ], - int Next [ ], - int Last [ ], - int Head [ ], - int Elen [ ], - int Degree [ ], - int W [ ], - double Control [ ], - double Info [ ] -) ; - -void amd_l2 -( - SuiteSparse_long n, - SuiteSparse_long Pe [ ], - SuiteSparse_long Iw [ ], - SuiteSparse_long Len [ ], - SuiteSparse_long iwlen, - SuiteSparse_long pfree, - SuiteSparse_long Nv [ ], - SuiteSparse_long Next [ ], - SuiteSparse_long Last [ ], - SuiteSparse_long Head [ ], - SuiteSparse_long Elen [ ], - SuiteSparse_long Degree [ ], - SuiteSparse_long W [ ], - double Control [ ], - double Info [ ] -) ; - -/* ------------------------------------------------------------------------- */ -/* amd_valid */ -/* ------------------------------------------------------------------------- */ - -/* Returns AMD_OK or AMD_OK_BUT_JUMBLED if the matrix is valid as input to - * amd_order; the latter is returned if the matrix has unsorted and/or - * duplicate row indices in one or more columns. Returns AMD_INVALID if the - * matrix cannot be passed to amd_order. For amd_order, the matrix must also - * be square. The first two arguments are the number of rows and the number - * of columns of the matrix. For its use in AMD, these must both equal n. - * - * NOTE: this routine returned TRUE/FALSE in v1.2 and earlier. - */ - -int amd_valid -( - int n_row, /* # of rows */ - int n_col, /* # of columns */ - const int Ap [ ], /* column pointers, of size n_col+1 */ - const int Ai [ ] /* row indices, of size Ap [n_col] */ -) ; - -SuiteSparse_long amd_l_valid -( - SuiteSparse_long n_row, - SuiteSparse_long n_col, - const SuiteSparse_long Ap [ ], - const SuiteSparse_long Ai [ ] -) ; - -/* ------------------------------------------------------------------------- */ -/* AMD memory manager and printf routines */ -/* ------------------------------------------------------------------------- */ - - /* moved to SuiteSparse_config.c */ - -/* ------------------------------------------------------------------------- */ -/* AMD Control and Info arrays */ -/* ------------------------------------------------------------------------- */ - -/* amd_defaults: sets the default control settings */ -void amd_defaults (double Control [ ]) ; -void amd_l_defaults (double Control [ ]) ; - -/* amd_control: prints the control settings */ -void amd_control (double Control [ ]) ; -void amd_l_control (double Control [ ]) ; - -/* amd_info: prints the statistics */ -void amd_info (double Info [ ]) ; -void amd_l_info (double Info [ ]) ; - -#define AMD_CONTROL 5 /* size of Control array */ -#define AMD_INFO 20 /* size of Info array */ - -/* contents of Control */ -#define AMD_DENSE 0 /* "dense" if degree > Control [0] * sqrt (n) */ -#define AMD_AGGRESSIVE 1 /* do aggressive absorption if Control [1] != 0 */ - -/* default Control settings */ -#define AMD_DEFAULT_DENSE 10.0 /* default "dense" degree 10*sqrt(n) */ -#define AMD_DEFAULT_AGGRESSIVE 1 /* do aggressive absorption by default */ - -/* contents of Info */ -#define AMD_STATUS 0 /* return value of amd_order and amd_l_order */ -#define AMD_N 1 /* A is n-by-n */ -#define AMD_NZ 2 /* number of nonzeros in A */ -#define AMD_SYMMETRY 3 /* symmetry of pattern (1 is sym., 0 is unsym.) */ -#define AMD_NZDIAG 4 /* # of entries on diagonal */ -#define AMD_NZ_A_PLUS_AT 5 /* nz in A+A' */ -#define AMD_NDENSE 6 /* number of "dense" rows/columns in A */ -#define AMD_MEMORY 7 /* amount of memory used by AMD */ -#define AMD_NCMPA 8 /* number of garbage collections in AMD */ -#define AMD_LNZ 9 /* approx. nz in L, excluding the diagonal */ -#define AMD_NDIV 10 /* number of fl. point divides for LU and LDL' */ -#define AMD_NMULTSUBS_LDL 11 /* number of fl. point (*,-) pairs for LDL' */ -#define AMD_NMULTSUBS_LU 12 /* number of fl. point (*,-) pairs for LU */ -#define AMD_DMAX 13 /* max nz. in any column of L, incl. diagonal */ - -/* ------------------------------------------------------------------------- */ -/* return values of AMD */ -/* ------------------------------------------------------------------------- */ - -#define AMD_OK 0 /* success */ -#define AMD_OUT_OF_MEMORY -1 /* malloc failed, or problem too large */ -#define AMD_INVALID -2 /* input arguments are not valid */ -#define AMD_OK_BUT_JUMBLED 1 /* input matrix is OK for amd_order, but - * columns were not sorted, and/or duplicate entries were present. AMD had - * to do extra work before ordering the matrix. This is a warning, not an - * error. */ - -/* ========================================================================== */ -/* === AMD version ========================================================== */ -/* ========================================================================== */ - -/* AMD Version 1.2 and later include the following definitions. - * As an example, to test if the version you are using is 1.2 or later: - * - * #ifdef AMD_VERSION - * if (AMD_VERSION >= AMD_VERSION_CODE (1,2)) ... - * #endif - * - * This also works during compile-time: - * - * #if defined(AMD_VERSION) && (AMD_VERSION >= AMD_VERSION_CODE (1,2)) - * printf ("This is version 1.2 or later\n") ; - * #else - * printf ("This is an early version\n") ; - * #endif - * - * Versions 1.1 and earlier of AMD do not include a #define'd version number. - */ - -#define AMD_DATE "May 4, 2016" -#define AMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) -#define AMD_MAIN_VERSION 2 -#define AMD_SUB_VERSION 4 -#define AMD_SUBSUB_VERSION 6 -#define AMD_VERSION AMD_VERSION_CODE(AMD_MAIN_VERSION,AMD_SUB_VERSION) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ThirdParty/SuiteSparse/include/camd.h b/ThirdParty/SuiteSparse/include/camd.h deleted file mode 100644 index 21898e0172..0000000000 --- a/ThirdParty/SuiteSparse/include/camd.h +++ /dev/null @@ -1,407 +0,0 @@ -/* ========================================================================= */ -/* === CAMD: approximate minimum degree ordering ========================== */ -/* ========================================================================= */ - -/* ------------------------------------------------------------------------- */ -/* CAMD Version 2.4, Copyright (c) 2013 by Timothy A. Davis, Yanqing Chen, */ -/* Patrick R. Amestoy, and Iain S. Duff. See ../README.txt for License. */ -/* email: DrTimothyAldenDavis@gmail.com */ -/* ------------------------------------------------------------------------- */ - -/* CAMD finds a symmetric ordering P of a matrix A so that the Cholesky - * factorization of P*A*P' has fewer nonzeros and takes less work than the - * Cholesky factorization of A. If A is not symmetric, then it performs its - * ordering on the matrix A+A'. Two sets of user-callable routines are - * provided, one for int integers and the other for SuiteSparse_long integers. - * - * The method is based on the approximate minimum degree algorithm, discussed - * in Amestoy, Davis, and Duff, "An approximate degree ordering algorithm", - * SIAM Journal of Matrix Analysis and Applications, vol. 17, no. 4, pp. - * 886-905, 1996. - */ - -#ifndef CAMD_H -#define CAMD_H - -/* make it easy for C++ programs to include CAMD */ -#ifdef __cplusplus -extern "C" { -#endif - -/* get the definition of size_t: */ -#include - -#include "SuiteSparse_config.h" - -int camd_order /* returns CAMD_OK, CAMD_OK_BUT_JUMBLED, - * CAMD_INVALID, or CAMD_OUT_OF_MEMORY */ -( - int n, /* A is n-by-n. n must be >= 0. */ - const int Ap [ ], /* column pointers for A, of size n+1 */ - const int Ai [ ], /* row indices of A, of size nz = Ap [n] */ - int P [ ], /* output permutation, of size n */ - double Control [ ], /* input Control settings, of size CAMD_CONTROL */ - double Info [ ], /* output Info statistics, of size CAMD_INFO */ - const int C [ ] /* Constraint set of A, of size n; can be NULL */ -) ; - -SuiteSparse_long camd_l_order /* see above for description of arguments */ -( - SuiteSparse_long n, - const SuiteSparse_long Ap [ ], - const SuiteSparse_long Ai [ ], - SuiteSparse_long P [ ], - double Control [ ], - double Info [ ], - const SuiteSparse_long C [ ] -) ; - -/* Input arguments (not modified): - * - * n: the matrix A is n-by-n. - * Ap: an int/SuiteSparse_long array of size n+1, containing column - * pointers of A. - * Ai: an int/SuiteSparse_long array of size nz, containing the row - * indices of A, where nz = Ap [n]. - * Control: a double array of size CAMD_CONTROL, containing control - * parameters. Defaults are used if Control is NULL. - * - * Output arguments (not defined on input): - * - * P: an int/SuiteSparse_long array of size n, containing the output - * permutation. If row i is the kth pivot row, then P [k] = i. In - * MATLAB notation, the reordered matrix is A (P,P). - * Info: a double array of size CAMD_INFO, containing statistical - * information. Ignored if Info is NULL. - * - * On input, the matrix A is stored in column-oriented form. The row indices - * of nonzero entries in column j are stored in Ai [Ap [j] ... Ap [j+1]-1]. - * - * If the row indices appear in ascending order in each column, and there - * are no duplicate entries, then camd_order is slightly more efficient in - * terms of time and memory usage. If this condition does not hold, a copy - * of the matrix is created (where these conditions do hold), and the copy is - * ordered. - * - * Row indices must be in the range 0 to - * n-1. Ap [0] must be zero, and thus nz = Ap [n] is the number of nonzeros - * in A. The array Ap is of size n+1, and the array Ai is of size nz = Ap [n]. - * The matrix does not need to be symmetric, and the diagonal does not need to - * be present (if diagonal entries are present, they are ignored except for - * the output statistic Info [CAMD_NZDIAG]). The arrays Ai and Ap are not - * modified. This form of the Ap and Ai arrays to represent the nonzero - * pattern of the matrix A is the same as that used internally by MATLAB. - * If you wish to use a more flexible input structure, please see the - * umfpack_*_triplet_to_col routines in the UMFPACK package, at - * http://www.suitesparse.com. - * - * Restrictions: n >= 0. Ap [0] = 0. Ap [j] <= Ap [j+1] for all j in the - * range 0 to n-1. nz = Ap [n] >= 0. Ai [0..nz-1] must be in the range 0 - * to n-1. Finally, Ai, Ap, and P must not be NULL. If any of these - * restrictions are not met, CAMD returns CAMD_INVALID. - * - * CAMD returns: - * - * CAMD_OK if the matrix is valid and sufficient memory can be allocated to - * perform the ordering. - * - * CAMD_OUT_OF_MEMORY if not enough memory can be allocated. - * - * CAMD_INVALID if the input arguments n, Ap, Ai are invalid, or if P is - * NULL. - * - * CAMD_OK_BUT_JUMBLED if the matrix had unsorted columns, and/or duplicate - * entries, but was otherwise valid. - * - * The CAMD routine first forms the pattern of the matrix A+A', and then - * computes a fill-reducing ordering, P. If P [k] = i, then row/column i of - * the original is the kth pivotal row. In MATLAB notation, the permuted - * matrix is A (P,P), except that 0-based indexing is used instead of the - * 1-based indexing in MATLAB. - * - * The Control array is used to set various parameters for CAMD. If a NULL - * pointer is passed, default values are used. The Control array is not - * modified. - * - * Control [CAMD_DENSE]: controls the threshold for "dense" rows/columns. - * A dense row/column in A+A' can cause CAMD to spend a lot of time in - * ordering the matrix. If Control [CAMD_DENSE] >= 0, rows/columns - * with more than Control [CAMD_DENSE] * sqrt (n) entries are ignored - * during the ordering, and placed last in the output order. The - * default value of Control [CAMD_DENSE] is 10. If negative, no - * rows/columns are treated as "dense". Rows/columns with 16 or - * fewer off-diagonal entries are never considered "dense". - * - * Control [CAMD_AGGRESSIVE]: controls whether or not to use aggressive - * absorption, in which a prior element is absorbed into the current - * element if is a subset of the current element, even if it is not - * adjacent to the current pivot element (refer to Amestoy, Davis, - * & Duff, 1996, for more details). The default value is nonzero, - * which means to perform aggressive absorption. This nearly always - * leads to a better ordering (because the approximate degrees are - * more accurate) and a lower execution time. There are cases where - * it can lead to a slightly worse ordering, however. To turn it off, - * set Control [CAMD_AGGRESSIVE] to 0. - * - * Control [2..4] are not used in the current version, but may be used in - * future versions. - * - * The Info array provides statistics about the ordering on output. If it is - * not present, the statistics are not returned. This is not an error - * condition. - * - * Info [CAMD_STATUS]: the return value of CAMD, either CAMD_OK, - * CAMD_OK_BUT_JUMBLED, CAMD_OUT_OF_MEMORY, or CAMD_INVALID. - * - * Info [CAMD_N]: n, the size of the input matrix - * - * Info [CAMD_NZ]: the number of nonzeros in A, nz = Ap [n] - * - * Info [CAMD_SYMMETRY]: the symmetry of the matrix A. It is the number - * of "matched" off-diagonal entries divided by the total number of - * off-diagonal entries. An entry A(i,j) is matched if A(j,i) is also - * an entry, for any pair (i,j) for which i != j. In MATLAB notation, - * S = spones (A) ; - * B = tril (S, -1) + triu (S, 1) ; - * symmetry = nnz (B & B') / nnz (B) ; - * - * Info [CAMD_NZDIAG]: the number of entries on the diagonal of A. - * - * Info [CAMD_NZ_A_PLUS_AT]: the number of nonzeros in A+A', excluding the - * diagonal. If A is perfectly symmetric (Info [CAMD_SYMMETRY] = 1) - * with a fully nonzero diagonal, then Info [CAMD_NZ_A_PLUS_AT] = nz-n - * (the smallest possible value). If A is perfectly unsymmetric - * (Info [CAMD_SYMMETRY] = 0, for an upper triangular matrix, for - * example) with no diagonal, then Info [CAMD_NZ_A_PLUS_AT] = 2*nz - * (the largest possible value). - * - * Info [CAMD_NDENSE]: the number of "dense" rows/columns of A+A' that were - * removed from A prior to ordering. These are placed last in the - * output order P. - * - * Info [CAMD_MEMORY]: the amount of memory used by CAMD, in bytes. In the - * current version, this is 1.2 * Info [CAMD_NZ_A_PLUS_AT] + 9*n - * times the size of an integer. This is at most 2.4nz + 9n. This - * excludes the size of the input arguments Ai, Ap, and P, which have - * a total size of nz + 2*n + 1 integers. - * - * Info [CAMD_NCMPA]: the number of garbage collections performed. - * - * Info [CAMD_LNZ]: the number of nonzeros in L (excluding the diagonal). - * This is a slight upper bound because mass elimination is combined - * with the approximate degree update. It is a rough upper bound if - * there are many "dense" rows/columns. The rest of the statistics, - * below, are also slight or rough upper bounds, for the same reasons. - * The post-ordering of the assembly tree might also not exactly - * correspond to a true elimination tree postordering. - * - * Info [CAMD_NDIV]: the number of divide operations for a subsequent LDL' - * or LU factorization of the permuted matrix A (P,P). - * - * Info [CAMD_NMULTSUBS_LDL]: the number of multiply-subtract pairs for a - * subsequent LDL' factorization of A (P,P). - * - * Info [CAMD_NMULTSUBS_LU]: the number of multiply-subtract pairs for a - * subsequent LU factorization of A (P,P), assuming that no numerical - * pivoting is required. - * - * Info [CAMD_DMAX]: the maximum number of nonzeros in any column of L, - * including the diagonal. - * - * Info [14..19] are not used in the current version, but may be used in - * future versions. - */ - -/* ------------------------------------------------------------------------- */ -/* direct interface to CAMD */ -/* ------------------------------------------------------------------------- */ - -/* camd_2 is the primary CAMD ordering routine. It is not meant to be - * user-callable because of its restrictive inputs and because it destroys - * the user's input matrix. It does not check its inputs for errors, either. - * However, if you can work with these restrictions it can be faster than - * camd_order and use less memory (assuming that you can create your own copy - * of the matrix for CAMD to destroy). Refer to CAMD/Source/camd_2.c for a - * description of each parameter. */ - -void camd_2 -( - int n, - int Pe [ ], - int Iw [ ], - int Len [ ], - int iwlen, - int pfree, - int Nv [ ], - int Next [ ], - int Last [ ], - int Head [ ], - int Elen [ ], - int Degree [ ], - int W [ ], - double Control [ ], - double Info [ ], - const int C [ ], - int BucketSet [ ] -) ; - -void camd_l2 -( - SuiteSparse_long n, - SuiteSparse_long Pe [ ], - SuiteSparse_long Iw [ ], - SuiteSparse_long Len [ ], - SuiteSparse_long iwlen, - SuiteSparse_long pfree, - SuiteSparse_long Nv [ ], - SuiteSparse_long Next [ ], - SuiteSparse_long Last [ ], - SuiteSparse_long Head [ ], - SuiteSparse_long Elen [ ], - SuiteSparse_long Degree [ ], - SuiteSparse_long W [ ], - double Control [ ], - double Info [ ], - const SuiteSparse_long C [ ], - SuiteSparse_long BucketSet [ ] - -) ; - -/* ------------------------------------------------------------------------- */ -/* camd_valid */ -/* ------------------------------------------------------------------------- */ - -/* Returns CAMD_OK or CAMD_OK_BUT_JUMBLED if the matrix is valid as input to - * camd_order; the latter is returned if the matrix has unsorted and/or - * duplicate row indices in one or more columns. Returns CAMD_INVALID if the - * matrix cannot be passed to camd_order. For camd_order, the matrix must also - * be square. The first two arguments are the number of rows and the number - * of columns of the matrix. For its use in CAMD, these must both equal n. - */ - -int camd_valid -( - int n_row, /* # of rows */ - int n_col, /* # of columns */ - const int Ap [ ], /* column pointers, of size n_col+1 */ - const int Ai [ ] /* row indices, of size Ap [n_col] */ -) ; - -SuiteSparse_long camd_l_valid -( - SuiteSparse_long n_row, - SuiteSparse_long n_col, - const SuiteSparse_long Ap [ ], - const SuiteSparse_long Ai [ ] -) ; - -/* ------------------------------------------------------------------------- */ -/* camd_cvalid */ -/* ------------------------------------------------------------------------- */ - -/* Returns TRUE if the constraint set is valid as input to camd_order, - * FALSE otherwise. */ - -int camd_cvalid -( - int n, - const int C [ ] -) ; - -SuiteSparse_long camd_l_cvalid -( - SuiteSparse_long n, - const SuiteSparse_long C [ ] -) ; - -/* ------------------------------------------------------------------------- */ -/* CAMD memory manager and printf routines */ -/* ------------------------------------------------------------------------- */ - - /* moved to SuiteSparse_config.c */ - -/* ------------------------------------------------------------------------- */ -/* CAMD Control and Info arrays */ -/* ------------------------------------------------------------------------- */ - -/* camd_defaults: sets the default control settings */ -void camd_defaults (double Control [ ]) ; -void camd_l_defaults (double Control [ ]) ; - -/* camd_control: prints the control settings */ -void camd_control (double Control [ ]) ; -void camd_l_control (double Control [ ]) ; - -/* camd_info: prints the statistics */ -void camd_info (double Info [ ]) ; -void camd_l_info (double Info [ ]) ; - -#define CAMD_CONTROL 5 /* size of Control array */ -#define CAMD_INFO 20 /* size of Info array */ - -/* contents of Control */ -#define CAMD_DENSE 0 /* "dense" if degree > Control [0] * sqrt (n) */ -#define CAMD_AGGRESSIVE 1 /* do aggressive absorption if Control [1] != 0 */ - -/* default Control settings */ -#define CAMD_DEFAULT_DENSE 10.0 /* default "dense" degree 10*sqrt(n) */ -#define CAMD_DEFAULT_AGGRESSIVE 1 /* do aggressive absorption by default */ - -/* contents of Info */ -#define CAMD_STATUS 0 /* return value of camd_order and camd_l_order */ -#define CAMD_N 1 /* A is n-by-n */ -#define CAMD_NZ 2 /* number of nonzeros in A */ -#define CAMD_SYMMETRY 3 /* symmetry of pattern (1 is sym., 0 is unsym.) */ -#define CAMD_NZDIAG 4 /* # of entries on diagonal */ -#define CAMD_NZ_A_PLUS_AT 5 /* nz in A+A' */ -#define CAMD_NDENSE 6 /* number of "dense" rows/columns in A */ -#define CAMD_MEMORY 7 /* amount of memory used by CAMD */ -#define CAMD_NCMPA 8 /* number of garbage collections in CAMD */ -#define CAMD_LNZ 9 /* approx. nz in L, excluding the diagonal */ -#define CAMD_NDIV 10 /* number of fl. point divides for LU and LDL' */ -#define CAMD_NMULTSUBS_LDL 11 /* number of fl. point (*,-) pairs for LDL' */ -#define CAMD_NMULTSUBS_LU 12 /* number of fl. point (*,-) pairs for LU */ -#define CAMD_DMAX 13 /* max nz. in any column of L, incl. diagonal */ - -/* ------------------------------------------------------------------------- */ -/* return values of CAMD */ -/* ------------------------------------------------------------------------- */ - -#define CAMD_OK 0 /* success */ -#define CAMD_OUT_OF_MEMORY -1 /* malloc failed, or problem too large */ -#define CAMD_INVALID -2 /* input arguments are not valid */ -#define CAMD_OK_BUT_JUMBLED 1 /* input matrix is OK for camd_order, but - * columns were not sorted, and/or duplicate entries were present. CAMD had - * to do extra work before ordering the matrix. This is a warning, not an - * error. */ - -/* ========================================================================== */ -/* === CAMD version ========================================================= */ -/* ========================================================================== */ - -/* - * As an example, to test if the version you are using is 1.2 or later: - * - * if (CAMD_VERSION >= CAMD_VERSION_CODE (1,2)) ... - * - * This also works during compile-time: - * - * #if (CAMD_VERSION >= CAMD_VERSION_CODE (1,2)) - * printf ("This is version 1.2 or later\n") ; - * #else - * printf ("This is an early version\n") ; - * #endif - */ - -#define CAMD_DATE "May 4, 2016" -#define CAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) -#define CAMD_MAIN_VERSION 2 -#define CAMD_SUB_VERSION 4 -#define CAMD_SUBSUB_VERSION 6 -#define CAMD_VERSION CAMD_VERSION_CODE(CAMD_MAIN_VERSION,CAMD_SUB_VERSION) - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ThirdParty/SuiteSparse/include/colamd.h b/ThirdParty/SuiteSparse/include/colamd.h deleted file mode 100644 index fbe9593089..0000000000 --- a/ThirdParty/SuiteSparse/include/colamd.h +++ /dev/null @@ -1,237 +0,0 @@ -/* ========================================================================== */ -/* === colamd/symamd prototypes and definitions ============================= */ -/* ========================================================================== */ - -/* COLAMD / SYMAMD include file - - You must include this file (colamd.h) in any routine that uses colamd, - symamd, or the related macros and definitions. - - Authors: - - The authors of the code itself are Stefan I. Larimore and Timothy A. - Davis (DrTimothyAldenDavis@gmail.com). The algorithm was - developed in collaboration with John Gilbert, Xerox PARC, and Esmond - Ng, Oak Ridge National Laboratory. - - Acknowledgements: - - This work was supported by the National Science Foundation, under - grants DMS-9504974 and DMS-9803599. - - Notice: - - Copyright (c) 1998-2007, Timothy A. Davis, All Rights Reserved. - See COLAMD/Doc/License.txt for the license. - - Availability: - - The colamd/symamd library is available at http://www.suitesparse.com - This file is required by the colamd.c, colamdmex.c, and symamdmex.c - files, and by any C code that calls the routines whose prototypes are - listed below, or that uses the colamd/symamd definitions listed below. - -*/ - -#ifndef COLAMD_H -#define COLAMD_H - -/* make it easy for C++ programs to include COLAMD */ -#ifdef __cplusplus -extern "C" { -#endif - -/* ========================================================================== */ -/* === Include files ======================================================== */ -/* ========================================================================== */ - -#include - -/* ========================================================================== */ -/* === COLAMD version ======================================================= */ -/* ========================================================================== */ - -/* COLAMD Version 2.4 and later will include the following definitions. - * As an example, to test if the version you are using is 2.4 or later: - * - * #ifdef COLAMD_VERSION - * if (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4)) ... - * #endif - * - * This also works during compile-time: - * - * #if defined(COLAMD_VERSION) && (COLAMD_VERSION >= COLAMD_VERSION_CODE (2,4)) - * printf ("This is version 2.4 or later\n") ; - * #else - * printf ("This is an early version\n") ; - * #endif - * - * Versions 2.3 and earlier of COLAMD do not include a #define'd version number. - */ - -#define COLAMD_DATE "May 4, 2016" -#define COLAMD_VERSION_CODE(main,sub) ((main) * 1000 + (sub)) -#define COLAMD_MAIN_VERSION 2 -#define COLAMD_SUB_VERSION 9 -#define COLAMD_SUBSUB_VERSION 6 -#define COLAMD_VERSION \ - COLAMD_VERSION_CODE(COLAMD_MAIN_VERSION,COLAMD_SUB_VERSION) - -/* ========================================================================== */ -/* === Knob and statistics definitions ====================================== */ -/* ========================================================================== */ - -/* size of the knobs [ ] array. Only knobs [0..1] are currently used. */ -#define COLAMD_KNOBS 20 - -/* number of output statistics. Only stats [0..6] are currently used. */ -#define COLAMD_STATS 20 - -/* knobs [0] and stats [0]: dense row knob and output statistic. */ -#define COLAMD_DENSE_ROW 0 - -/* knobs [1] and stats [1]: dense column knob and output statistic. */ -#define COLAMD_DENSE_COL 1 - -/* knobs [2]: aggressive absorption */ -#define COLAMD_AGGRESSIVE 2 - -/* stats [2]: memory defragmentation count output statistic */ -#define COLAMD_DEFRAG_COUNT 2 - -/* stats [3]: colamd status: zero OK, > 0 warning or notice, < 0 error */ -#define COLAMD_STATUS 3 - -/* stats [4..6]: error info, or info on jumbled columns */ -#define COLAMD_INFO1 4 -#define COLAMD_INFO2 5 -#define COLAMD_INFO3 6 - -/* error codes returned in stats [3]: */ -#define COLAMD_OK (0) -#define COLAMD_OK_BUT_JUMBLED (1) -#define COLAMD_ERROR_A_not_present (-1) -#define COLAMD_ERROR_p_not_present (-2) -#define COLAMD_ERROR_nrow_negative (-3) -#define COLAMD_ERROR_ncol_negative (-4) -#define COLAMD_ERROR_nnz_negative (-5) -#define COLAMD_ERROR_p0_nonzero (-6) -#define COLAMD_ERROR_A_too_small (-7) -#define COLAMD_ERROR_col_length_negative (-8) -#define COLAMD_ERROR_row_index_out_of_bounds (-9) -#define COLAMD_ERROR_out_of_memory (-10) -#define COLAMD_ERROR_internal_error (-999) - - -/* ========================================================================== */ -/* === Prototypes of user-callable routines ================================= */ -/* ========================================================================== */ - -#include "SuiteSparse_config.h" - -size_t colamd_recommended /* returns recommended value of Alen, */ - /* or 0 if input arguments are erroneous */ -( - int nnz, /* nonzeros in A */ - int n_row, /* number of rows in A */ - int n_col /* number of columns in A */ -) ; - -size_t colamd_l_recommended /* returns recommended value of Alen, */ - /* or 0 if input arguments are erroneous */ -( - SuiteSparse_long nnz, /* nonzeros in A */ - SuiteSparse_long n_row, /* number of rows in A */ - SuiteSparse_long n_col /* number of columns in A */ -) ; - -void colamd_set_defaults /* sets default parameters */ -( /* knobs argument is modified on output */ - double knobs [COLAMD_KNOBS] /* parameter settings for colamd */ -) ; - -void colamd_l_set_defaults /* sets default parameters */ -( /* knobs argument is modified on output */ - double knobs [COLAMD_KNOBS] /* parameter settings for colamd */ -) ; - -int colamd /* returns (1) if successful, (0) otherwise*/ -( /* A and p arguments are modified on output */ - int n_row, /* number of rows in A */ - int n_col, /* number of columns in A */ - int Alen, /* size of the array A */ - int A [], /* row indices of A, of size Alen */ - int p [], /* column pointers of A, of size n_col+1 */ - double knobs [COLAMD_KNOBS],/* parameter settings for colamd */ - int stats [COLAMD_STATS] /* colamd output statistics and error codes */ -) ; - -SuiteSparse_long colamd_l /* returns (1) if successful, (0) otherwise*/ -( /* A and p arguments are modified on output */ - SuiteSparse_long n_row, /* number of rows in A */ - SuiteSparse_long n_col, /* number of columns in A */ - SuiteSparse_long Alen, /* size of the array A */ - SuiteSparse_long A [], /* row indices of A, of size Alen */ - SuiteSparse_long p [], /* column pointers of A, of size n_col+1 */ - double knobs [COLAMD_KNOBS],/* parameter settings for colamd */ - SuiteSparse_long stats [COLAMD_STATS] /* colamd output statistics - * and error codes */ -) ; - -int symamd /* return (1) if OK, (0) otherwise */ -( - int n, /* number of rows and columns of A */ - int A [], /* row indices of A */ - int p [], /* column pointers of A */ - int perm [], /* output permutation, size n_col+1 */ - double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */ - int stats [COLAMD_STATS], /* output statistics and error codes */ - void * (*allocate) (size_t, size_t), - /* pointer to calloc (ANSI C) or */ - /* mxCalloc (for MATLAB mexFunction) */ - void (*release) (void *) - /* pointer to free (ANSI C) or */ - /* mxFree (for MATLAB mexFunction) */ -) ; - -SuiteSparse_long symamd_l /* return (1) if OK, (0) otherwise */ -( - SuiteSparse_long n, /* number of rows and columns of A */ - SuiteSparse_long A [], /* row indices of A */ - SuiteSparse_long p [], /* column pointers of A */ - SuiteSparse_long perm [], /* output permutation, size n_col+1 */ - double knobs [COLAMD_KNOBS], /* parameters (uses defaults if NULL) */ - SuiteSparse_long stats [COLAMD_STATS], /* output stats and error codes */ - void * (*allocate) (size_t, size_t), - /* pointer to calloc (ANSI C) or */ - /* mxCalloc (for MATLAB mexFunction) */ - void (*release) (void *) - /* pointer to free (ANSI C) or */ - /* mxFree (for MATLAB mexFunction) */ -) ; - -void colamd_report -( - int stats [COLAMD_STATS] -) ; - -void colamd_l_report -( - SuiteSparse_long stats [COLAMD_STATS] -) ; - -void symamd_report -( - int stats [COLAMD_STATS] -) ; - -void symamd_l_report -( - SuiteSparse_long stats [COLAMD_STATS] -) ; - -#ifdef __cplusplus -} -#endif - -#endif /* COLAMD_H */ diff --git a/cmake/AmiciConfig.cmake b/cmake/AmiciConfig.cmake index 5f56358e12..51831fe028 100644 --- a/cmake/AmiciConfig.cmake +++ b/cmake/AmiciConfig.cmake @@ -2,6 +2,8 @@ include(CMakeFindDependencyMacro) +find_package(OpenMP) + find_package(SUNDIALS REQUIRED PATHS "@CMAKE_SOURCE_DIR@/ThirdParty/sundials/build/lib/cmake/sundials/") include("${CMAKE_CURRENT_LIST_DIR}/AmiciTargets.cmake") diff --git a/cmake/version.cmake b/cmake/version.cmake index 6bde218b94..3f7b054a03 100644 --- a/cmake/version.cmake +++ b/cmake/version.cmake @@ -13,7 +13,5 @@ get_filename_component(CMAKE_PARENT_LIST_DIR ${CMAKE_PARENT_LIST_FILE} DIRECTORY) get_filename_component(CMAKE_PARENT_LIST_DIR ${CMAKE_PARENT_LIST_DIR} DIRECTORY) -execute_process( - COMMAND sh -c "cat version.txt | tr -d '\n'" - WORKING_DIRECTORY "${CMAKE_PARENT_LIST_DIR}" - OUTPUT_VARIABLE PROJECT_VERSION) +file(STRINGS "${CMAKE_PARENT_LIST_DIR}/version.txt" PROJECT_VERSION) +message(DEBUG "Version number: ${PROJECT_VERSION}") diff --git a/container/Dockerfile b/container/Dockerfile new file mode 100644 index 0000000000..324671cc1d --- /dev/null +++ b/container/Dockerfile @@ -0,0 +1,25 @@ +FROM ubuntu:22.04 + +# install dependencies + +RUN apt-get update && apt-get install -y \ + g++ \ + libatlas-base-dev \ + python-is-python3 \ + python3 \ + python3-dev \ + python3-pip \ + python3-venv \ + swig + +# prepare python install + +COPY amici.tar.gz /from_host/ + +RUN pip3 install --upgrade pip build && \ + mkdir -p /from_host/amici/ && \ + cd /from_host/amici && \ + tar -xzf ../amici.tar.gz && cd python/sdist && \ + python3 -m build --sdist && \ + pip3 install -v $(ls -t dist/amici-*.tar.gz | head -1)[petab] && \ + rm -rf /from_host diff --git a/container/README.md b/container/README.md new file mode 100644 index 0000000000..5396681df4 --- /dev/null +++ b/container/README.md @@ -0,0 +1,51 @@ +# Using AMICI inside containers + +AMICI docker images are regularly published to +https://hub.docker.com/r/dweindl/amici. + +## Docker / Podman + +The commands below are for use with Docker. When using Podman, just replace +`docker` by `podman`. + +### Create an image + +In the AMICI base directory run: + +```bash +git archive -o container/amici.tar.gz --format=tar.gz HEAD +cd container && docker build -t $USER/amici:latest . +``` +Note that this will include files from the last commit, but no uncommitted +changes. + +### Pull published image + +```bash +docker pull dweindl/amici:latest +``` + +## Singularity / Apptainer + +### Create an image + +In the AMICI base directory run: + +```bash +# prepare amici files to be copied to the image +# Note that this will include files from the last commit, but no uncommitted +# changes. +git archive -o container/amici.tar.gz --format=tar.gz HEAD +# install spython if necessary +test -x "$(command -v spython)" || pip install spython +# convert Dockerfile to singularity/apptainer definition using spython +(cd container/ && spython recipe Dockerfile amici.def) +# build image +(cd container/ && singularity build amici.sif amici.def) +``` + +### Pull published image + +```bash +singularity pull docker://dweindl/amici:latest +``` diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index b6ffd1684a..0000000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -FROM ubuntu:22.04 - -# install dependencies - -RUN apt-get update && apt-get install -y \ - g++ \ - libatlas-base-dev \ - python3 \ - python3-dev \ - python3-pip \ - python3-venv \ - swig - -# prepare python install - -COPY amici.tar.gz /tmp - -RUN pip3 install --upgrade pip build && \ - mkdir -p /tmp/amici/ && \ - cd /tmp/amici && \ - tar -xzf ../amici.tar.gz && cd /tmp/amici/python/sdist && \ - python3 -m build --sdist && \ - pip3 install -v $(ls -t /tmp/amici/python/sdist/dist/amici-*.tar.gz | head -1)[petab] && \ - rm -rf /tmp/* diff --git a/docker/README.md b/docker/README.md deleted file mode 100644 index 97c0722545..0000000000 --- a/docker/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# AMICI with Docker - -## Create image - -In the AMICI base directory run: - -```bash -git archive -o docker/amici.tar.gz --format=tar.gz HEAD -cd docker && docker build -t $USER/amici:latest . -``` - -## Published images - -AMICI docker images are regularly published to -https://hub.docker.com/r/dweindl/amici. diff --git a/documentation/CPP.rst b/documentation/CPP.rst index 9daac880d1..32e07fac4d 100644 --- a/documentation/CPP.rst +++ b/documentation/CPP.rst @@ -3,6 +3,8 @@ C++ interface .. toctree:: :maxdepth: 2 + :caption: C++ + Installation Usage diff --git a/documentation/GettingStarted.ipynb b/documentation/GettingStarted.ipynb index c1bc4df6bf..33258424b9 100644 --- a/documentation/GettingStarted.ipynb +++ b/documentation/GettingStarted.ipynb @@ -14,7 +14,7 @@ "metadata": {}, "source": [ "## Model Compilation\n", - "Before simulations can be run, the model must be imported and compiled. In this process, AMICI performs all symbolic manipulations that later enable scalable simulations and efficient sensitivity computation. The first towards model compilation is the creation of an [SbmlImporter](https://amici.readthedocs.io/en/latest/generated/amici.sbml_import.SbmlImporter.html) instance, which requires an SBML Document that specifies the model using the [Systems Biology Markup Language (SBML)](http://sbml.org/Main_Page). \n", + "Before simulations can be run, the model must be imported and compiled. In this process, AMICI performs all symbolic manipulations that later enable scalable simulations and efficient sensitivity computation. The first step towards model compilation is the creation of an [SbmlImporter](https://amici.readthedocs.io/en/latest/generated/amici.sbml_import.SbmlImporter.html) instance, which requires an SBML Document that specifies the model using the [Systems Biology Markup Language (SBML)](http://sbml.org/Main_Page). \n", "\n", "For the purpose of this tutorial, we will use `model_steadystate_scaled.xml`, which is contained in the same directory as this notebook." ] @@ -52,7 +52,7 @@ "metadata": {}, "source": [ "## Loading the model module\n", - "To run simulations, we need to instantiate [amici.Model](https://amici.readthedocs.io/en/latest/generated/amici.amici.Model.html) and [amici.Solver](https://amici.readthedocs.io/en/latest/generated/amici.amici.Solver.html) instances. As simulations requires instances matching the imported model, they have to be imported from the generated model module. " + "To run simulations, we need to instantiate [amici.Model](https://amici.readthedocs.io/en/latest/generated/amici.amici.Model.html) and [amici.Solver](https://amici.readthedocs.io/en/latest/generated/amici.amici.Solver.html) instances. As simulations require instances matching the imported model, they have to be imported from the generated model module. " ] }, { @@ -205,7 +205,7 @@ "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", - "version": "3.8.5" + "version": "3.8.10" }, "toc": { "base_numbering": 1, diff --git a/documentation/MATLAB.rst b/documentation/MATLAB.rst index 3b22878b71..f5eccdcd43 100644 --- a/documentation/MATLAB.rst +++ b/documentation/MATLAB.rst @@ -3,6 +3,7 @@ Matlab interface .. toctree:: :maxdepth: 2 + :caption: MATLAB Installation Usage diff --git a/documentation/PYTHON.rst b/documentation/PYTHON.rst index 5c53ea1e45..cba7b08ee7 100644 --- a/documentation/PYTHON.rst +++ b/documentation/PYTHON.rst @@ -3,8 +3,10 @@ Python interface .. toctree:: :maxdepth: 2 + :caption: Python Installation + Examples Usage FAQ API reference diff --git a/documentation/_templates/autosummary/module.rst b/documentation/_templates/autosummary/module.rst index c494da3a09..88a19df5fd 100644 --- a/documentation/_templates/autosummary/module.rst +++ b/documentation/_templates/autosummary/module.rst @@ -1,35 +1,62 @@ -{{ fullname | escape | underline }} +{{ fullname | escape | underline}} .. automodule:: {{ fullname }} - -.. currentmodule:: {{ fullname }} - -{% if classes %} -.. rubric:: Classes + :members: + :undoc-members: + + {% block attributes %} + {% if attributes %} + .. rubric:: {{ _('Module Attributes') }} + + .. autosummary:: + {% for item in attributes %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block functions %} + {% if functions %} + .. rubric:: {{ _('Functions') }} + + .. autosummary:: + {% for item in functions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block classes %} + {% if classes %} + .. rubric:: {{ _('Classes') }} + + .. autosummary:: + {% for item in classes %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + + {% block exceptions %} + {% if exceptions %} + .. rubric:: {{ _('Exceptions') }} + + .. autosummary:: + {% for item in exceptions %} + {{ item }} + {%- endfor %} + {% endif %} + {% endblock %} + +{% block modules %} +{% if modules %} +.. rubric:: Modules .. autosummary:: - :toctree: . - {% for class in classes %} - {{ class }} - {% endfor %} - + :toctree: + :recursive: +{% for item in modules %} + {{ item }} +{%- endfor %} {% endif %} - -{% if functions %} -.. rubric:: Functions Summary - -.. autosummary:: - {% for function in functions %} - {{ function }} - {% endfor %} - -{% endif %} - -{% if functions %} -.. rubric:: Functions - -{% for function in functions %} -.. autofunction:: {{ function }} -{% endfor %} - -{% endif %} \ No newline at end of file +{% endblock %} diff --git a/documentation/background.rst b/documentation/background.rst index d3f4badec5..6c0dd9005b 100644 --- a/documentation/background.rst +++ b/documentation/background.rst @@ -10,31 +10,31 @@ Some mathematical background for AMICI is provided in the following publications: * Fröhlich, F., Kaltenbacher, B., Theis, F. J., & Hasenauer, J. (2017). - Scalable Parameter Estimation for Genome-Scale Biochemical Reaction Networks. + **Scalable Parameter Estimation for Genome-Scale Biochemical Reaction Networks.** PLOS Computational Biology, 13(1), e1005331. doi:`10.1371/journal.pcbi.1005331 `_. * Fröhlich, F., Theis, F. J., Rädler, J. O., & Hasenauer, J. (2017). - Parameter estimation for dynamical systems with discrete events and logical - operations. Bioinformatics, 33(7), 1049-1056. + **Parameter estimation for dynamical systems with discrete events and logical + operations.** Bioinformatics, 33(7), 1049-1056. doi:`10.1093/bioinformatics/btw764 `_. * Terje Lines, Glenn, Łukasz Paszkowski, Leonard Schmiester, Daniel Weindl, - Paul Stapor, and Jan Hasenauer. 2019. "Efficient Computation of Steady States - in Large-Scale Ode Models of Biochemical Reaction Networks. + Paul Stapor, and Jan Hasenauer. 2019. **Efficient Computation of Steady States + in Large-Scale ODE Models of Biochemical Reaction Networks.** *IFAC-PapersOnLine* 52 (26): 32–37. DOI: `10.1016/j.ifacol.2019.12.232 `_. * Stapor, Paul, Fabian Fröhlich, and Jan Hasenauer. 2018. - "Optimization and Profile Calculation of ODE Models Using Second Order - Adjoint Sensitivity Analysis." *Bioinformatics* 34 (13): i151–i159. + **Optimization and Profile Calculation of ODE Models Using Second Order + Adjoint Sensitivity Analysis.** *Bioinformatics* 34 (13): i151–i159. DOI: `10.1093/bioinformatics/bty230 `_. * Lakrisenko, Polina, Paul Stapor, Stephan Grein, Łukasz Paszkowski, Dilan Pathirana, Fabian Fröhlich, Glenn Terje Lines, Daniel Weindl, and Jan Hasenauer. 2022. - "Efficient Computation of Adjoint Sensitivities at Steady-State in ODE Models - of Biochemical Reaction Networks." *bioRxiv* 2022.08.08.503176. + **Efficient Computation of Adjoint Sensitivities at Steady-State in ODE Models + of Biochemical Reaction Networks.** *bioRxiv* 2022.08.08.503176. DOI: `10.1101/2022.08.08.503176 `_. .. note:: diff --git a/documentation/cpp_interface.rst b/documentation/cpp_interface.rst index bc589986d9..751ee493a5 100644 --- a/documentation/cpp_interface.rst +++ b/documentation/cpp_interface.rst @@ -29,12 +29,13 @@ The content of a model source directory looks something like this (given CMakeLists.txt main.cpp - model_steadystate_deltaqB.cpp - model_steadystate_deltaqB.h - [... many more files model_steadystate_*.(cpp|h|md5|o) ] + deltaqB.cpp + deltaqB.h + [... many more files *.(cpp|h|md5|o) ] wrapfunctions.cpp wrapfunctions.h model_steadystate.h + model_steadystate.cpp These files provide the implementation of a model-specific subclass of :cpp:class:`amici::Model`. The ``CMakeLists.txt`` file can be used to build the diff --git a/documentation/example_large_models b/documentation/example_large_models new file mode 120000 index 0000000000..bddb4a0383 --- /dev/null +++ b/documentation/example_large_models @@ -0,0 +1 @@ +../python/examples/example_large_models/ \ No newline at end of file diff --git a/documentation/index.rst b/documentation/index.rst index 8bfa399ef5..73343e76c1 100644 --- a/documentation/index.rst +++ b/documentation/index.rst @@ -30,13 +30,9 @@ Welcome to AMICI's documentation! glossary contributing -.. toctree:: - :maxdepth: 2 - :caption: User's guide - - PYTHON - CPP - MATLAB +.. include:: PYTHON.rst +.. include:: CPP.rst +.. include:: MATLAB.rst .. toctree:: :maxdepth: 2 diff --git a/documentation/python_examples.rst b/documentation/python_examples.rst new file mode 100644 index 0000000000..e927898507 --- /dev/null +++ b/documentation/python_examples.rst @@ -0,0 +1,18 @@ +Examples +======== + +Various example notebooks. + +.. image:: https://mybinder.org/badge_logo.svg + :target: https://mybinder.org/v2/gh/AMICI-dev/AMICI/develop?labpath=binder%2Foverview.ipynb + +.. toctree:: + :maxdepth: 1 + + GettingStarted.ipynb + ExampleSteadystate.ipynb + petab.ipynb + ExampleExperimentalConditions.ipynb + ExampleEquilibrationLogic.ipynb + example_errors.ipynb + example_large_models/example_performance_optimization.ipynb diff --git a/documentation/python_interface.rst b/documentation/python_interface.rst index 4e4c607c65..6a091a6628 100644 --- a/documentation/python_interface.rst +++ b/documentation/python_interface.rst @@ -134,22 +134,6 @@ SED-ML import We also plan to implement support for the `Simulation Experiment Description Markup Language (SED-ML) `_. -Examples -======== - -.. image:: https://mybinder.org/badge_logo.svg - :target: https://mybinder.org/v2/gh/AMICI-dev/AMICI/develop?labpath=binder%2Foverview.ipynb - -.. toctree:: - :maxdepth: 1 - - GettingStarted.ipynb - ExampleSteadystate.ipynb - petab.ipynb - ExampleExperimentalConditions.ipynb - ExampleEquilibrationLogic.ipynb - example_errors.ipynb - Environment variables affecting model import ============================================ diff --git a/documentation/python_modules.rst b/documentation/python_modules.rst index a6f4a2d1f3..db97fd2776 100644 --- a/documentation/python_modules.rst +++ b/documentation/python_modules.rst @@ -25,3 +25,4 @@ AMICI Python API amici.parameter_mapping amici.conserved_quantities_demartino amici.conserved_quantities_rref + amici.numpy diff --git a/documentation/rtd_requirements.txt b/documentation/rtd_requirements.txt index c5fe2d49a9..cd37291f32 100644 --- a/documentation/rtd_requirements.txt +++ b/documentation/rtd_requirements.txt @@ -12,7 +12,7 @@ sphinx_rtd_theme>=1.0.0 petab>=0.1.20 sphinx-autodoc-typehints==1.19.2 git+https://github.com/readthedocs/sphinx-hoverxref@main -ipython==8.4.0 +ipython==8.10.0 breathe==4.34.0 #exhale>=0.3.5 -e git+https://github.com/mithro/sphinx-contrib-mithro#egg=sphinx-contrib-exhale-multiproject&subdirectory=sphinx-contrib-exhale-multiproject diff --git a/include/amici/defines.h b/include/amici/defines.h index 02437f77cb..4d5191e64d 100644 --- a/include/amici/defines.h +++ b/include/amici/defines.h @@ -79,6 +79,7 @@ constexpr int AMICI_DAMPING_FACTOR_ERROR= -86; constexpr int AMICI_SINGULAR_JACOBIAN= -809; constexpr int AMICI_NOT_IMPLEMENTED= -999; constexpr int AMICI_MAX_TIME_EXCEEDED = -1000; +constexpr int AMICI_NOT_RUN= -1001; constexpr int AMICI_SUCCESS= 0; constexpr int AMICI_DATA_RETURN= 1; constexpr int AMICI_ROOT_RETURN= 2; @@ -128,15 +129,21 @@ enum class SecondOrderMode { /** orders of sensitivity analysis */ enum class SensitivityOrder { + /** Don't compute sensitivities. */ none, + /** First-order sensitivities. */ first, + /** Second-order sensitivities. */ second }; /** methods for sensitivity computation */ enum class SensitivityMethod { + /** Don't compute sensitivities. */ none, + /** Forward sensitivity analysis. */ forward, + /** Adjoint sensitivity analysis. */ adjoint }; diff --git a/include/amici/edata.h b/include/amici/edata.h index 1f18cea991..dd6cad85ed 100644 --- a/include/amici/edata.h +++ b/include/amici/edata.h @@ -148,21 +148,21 @@ class ExpData : public SimulationParameters { int nt() const; /** - * @brief Set function that copies data from input to ExpData::ts + * @brief Set output timepoints. * * @param ts timepoints */ void setTimepoints(std::vector const& ts); /** - * @brief get function that copies data from ExpData::ts to output + * @brief Get output timepoints. * * @return ExpData::ts */ std::vector const &getTimepoints() const; /** - * @brief get function that returns timepoint at index + * @brief Get timepoint for the given index * * @param it timepoint index * @@ -171,14 +171,14 @@ class ExpData : public SimulationParameters { realtype getTimepoint(int it) const; /** - * @brief set function that copies data from input to ExpData::my + * @brief Set all measurements. * * @param observedData observed data (dimension: nt x nytrue, row-major) */ void setObservedData(std::vector const& observedData); /** - * @brief set function that copies observed data for specific observable + * @brief Set measurements for a given observable index * * @param observedData observed data (dimension: nt) * @param iy observed data index @@ -186,8 +186,8 @@ class ExpData : public SimulationParameters { void setObservedData(std::vector const& observedData, int iy); /** - * @brief get function that checks whether data at specified indices has - * been set + * @brief Whether there is a measurement for the given time- and observable- + * index. * * @param it time index * @param iy observable index @@ -197,14 +197,14 @@ class ExpData : public SimulationParameters { bool isSetObservedData(int it, int iy) const; /** - * @brief get function that copies data from ExpData::observedData to output + * @brief Get all measurements. * * @return observed data (dimension: nt x nytrue, row-major) */ std::vector const &getObservedData() const; /** - * @brief get function that returns a pointer to observed data at index + * @brief Get measurements for a given timepoint index. * * @param it timepoint index * @@ -213,8 +213,7 @@ class ExpData : public SimulationParameters { realtype const* getObservedDataPtr(int it) const; /** - * @brief set function that copies data from input to - * ExpData::observedDataStdDev + * @brief Set standard deviations for measurements. * * @param observedDataStdDev standard deviation of observed data (dimension: * nt x nytrue, row-major) @@ -222,16 +221,15 @@ class ExpData : public SimulationParameters { void setObservedDataStdDev(std::vector const& observedDataStdDev); /** - * @brief set function that sets all ExpData::observedDataStdDev to the - * input value + * @brief Set indentical standard deviation for all measurements. * * @param stdDev standard deviation (dimension: scalar) */ void setObservedDataStdDev(realtype stdDev); /** - * @brief set function that copies standard deviation of observed data for - * specific observable + * @brief Set standard deviations of observed data for a + * specific observable index. * * @param observedDataStdDev standard deviation of observed data (dimension: * nt) @@ -242,8 +240,8 @@ class ExpData : public SimulationParameters { ); /** - * @brief set function that sets all standard deviation of a specific - * observable to the input value + * @brief Set all standard deviation for a given observable index to the + * input value. * * @param stdDev standard deviation (dimension: scalar) * @param iy observed data index @@ -251,8 +249,8 @@ class ExpData : public SimulationParameters { void setObservedDataStdDev(realtype stdDev, int iy); /** - * @brief get function that checks whether standard deviation of data at - * specified indices has been set + * @brief Whether standard deviation for a measurement at + * specified timepoint- and observable index has been set. * * @param it time index * @param iy observable index @@ -261,16 +259,14 @@ class ExpData : public SimulationParameters { bool isSetObservedDataStdDev(int it, int iy) const; /** - * @brief get function that copies data from ExpData::observedDataStdDev to - * output + * @brief Get measurement standard deviations. * * @return standard deviation of observed data */ std::vector const &getObservedDataStdDev() const; /** - * @brief get function that returns a pointer to standard deviation of - * observed data at index + * @brief Get pointer to measurement standard deviations. * * @param it timepoint index * @return pointer to standard deviation of observed data at index diff --git a/include/amici/rdata.h b/include/amici/rdata.h index 852d5b464f..dd6d4ff5c3 100644 --- a/include/amici/rdata.h +++ b/include/amici/rdata.h @@ -220,33 +220,84 @@ class ReturnData: public ModelDimensions { /** employed order forward problem (shape `nt`) */ std::vector order; - /** computation time of forward solve [ms] */ + /** + * @brief computation time of forward solve [ms] + * + * .. warning:: + * This tracks the CPU-time of the current process. Therefore, + * in a multi-threaded context, this value may be incorrect. + * + */ double cpu_time = 0.0; - /** computation time of backward solve [ms] */ + /** + * @brief computation time of backward solve [ms] + * + * .. warning:: + * This tracks the CPU-time of the current process. Therefore, + * in a multi-threaded context, this value may be incorrect. + * + */ double cpu_timeB = 0.0; - /** total CPU time from entering runAmiciSimulation until exiting [ms] */ + /** + * @brief total CPU time from entering runAmiciSimulation until exiting [ms] + * + * .. warning:: + * This tracks the CPU-time of the current process. Therefore, + * in a multi-threaded context, this value may be incorrect. + * + */ double cpu_time_total = 0.0; /** flags indicating success of steady state solver (preequilibration) */ std::vector preeq_status; - /** computation time of the steady state solver [ms] (preequilibration) */ + /** + * @brief computation time of the steady state solver [ms] + * (preequilibration) + * + * .. warning:: + * This tracks the CPU-time of the current process. Therefore, + * in a multi-threaded context, this value may be incorrect. + * + */ double preeq_cpu_time = 0.0; - /** computation time of the steady state solver of the backward problem [ms] - * (preequilibration) */ + /** + * @brief computation time of the steady state solver of the backward + * problem [ms] (preequilibration) + * + * .. warning:: + * This tracks the CPU-time of the current process. Therefore, + * in a multi-threaded context, this value may be incorrect. + * + */ double preeq_cpu_timeB = 0.0; /** flags indicating success of steady state solver (postequilibration) */ std::vector posteq_status; - /** computation time of the steady state solver [ms] (postequilibration) */ + /** + * @brief computation time of the steady state solver [ms] + * (postequilibration) + * + * .. warning:: + * This tracks the CPU-time of the current process. Therefore, + * in a multi-threaded context, this value may be incorrect. + * + */ double posteq_cpu_time = 0.0; - /** computation time of the steady state solver of the backward problem [ms] - * (postequilibration) */ + /** + * @brief computation time of the steady state solver of the backward + * problem [ms] (postequilibration) + * + * .. warning:: + * This tracks the CPU-time of the current process. Therefore, + * in a multi-threaded context, this value may be incorrect. + * + */ double posteq_cpu_timeB = 0.0; /** @@ -335,8 +386,9 @@ class ReturnData: public ModelDimensions { * within the allowed time (see Solver.{set,get}MaxTime) * * AMICI_ERROR, indicating that some error occurred during simulation * (a more detailed error message will have been printed). + * * AMICI_NOT_RUN, if no simulation was started */ - int status = 0; + int status = AMICI_NOT_RUN; /** number of states (alias `nx_rdata`, kept for backward compatibility) */ int nx{0}; diff --git a/include/amici/solver.h b/include/amici/solver.h index 0168f67db6..7d829bcb14 100644 --- a/include/amici/solver.h +++ b/include/amici/solver.h @@ -7,6 +7,7 @@ #include "amici/logging.h" #include +#include #include #include #include @@ -487,8 +488,8 @@ class Solver { double getMaxTime() const; /** - * @brief Set the maximum time allowed for integration - * @param maxtime Time in seconds + * @brief Set the maximum CPU time allowed for integration + * @param maxtime Time in seconds. Zero means infinite time. */ void setMaxTime(double maxtime); @@ -499,10 +500,13 @@ class Solver { /** * @brief Check whether maximum integration time was exceeded + * @param interval Only check the time every ``interval`` ths call to avoid + * potentially relatively expensive syscalls + * @return True if the maximum integration time was exceeded, * false otherwise. */ - bool timeExceeded() const; + bool timeExceeded(int interval = 1) const; /** * @brief returns the maximum number of solver steps for the backward @@ -1602,16 +1606,16 @@ class Solver { /** interpolation type for the forward problem solution which * is then used for the backwards problem. */ - InterpolationType interp_type_ {InterpolationType::hermite}; + InterpolationType interp_type_ {InterpolationType::polynomial}; /** maximum number of allowed integration steps */ long int maxsteps_ {10000}; - /** Maximum wall-time for integration in seconds */ - std::chrono::duration> maxtime_ {std::chrono::duration::max()}; + /** Maximum CPU-time for integration in seconds */ + std::chrono::duration> maxtime_ {0}; /** Time at which solver timer was started */ - mutable std::chrono::time_point starttime_; + mutable std::clock_t starttime_; /** linear solver for the forward problem */ mutable std::unique_ptr linear_solver_; diff --git a/matlab/@amimodel/compileAndLinkModel.m b/matlab/@amimodel/compileAndLinkModel.m index 8305da7732..8410dff5e4 100644 --- a/matlab/@amimodel/compileAndLinkModel.m +++ b/matlab/@amimodel/compileAndLinkModel.m @@ -20,10 +20,12 @@ function compileAndLinkModel(modelname, modelSourceFolder, coptim, debug, funs, % if no list provided, try to determine relevant files from model % folder if(isempty(funs)) - ls = dir(fullfile(modelSourceFolder, [modelname '_*.cpp'])); + ls = dir(fullfile(modelSourceFolder, '*.cpp')); + % wrapfunctions is handled separately ls = {ls.name}; + ls = ls(cellfun(@(x) ~strcmp(x, "wrapfunctions.cpp"), ls)); % extract funs from filename (strip of modelname_ and .cpp - funs = cellfun(@(x) x((length(modelname)+2):(length(x)-4)), ls, 'UniformOutput', false); + funs = cellfun(@(x) x(1:(length(x)-4)), ls, 'UniformOutput', false); end objectFileSuffix = '.o'; @@ -74,7 +76,7 @@ function compileAndLinkModel(modelname, modelSourceFolder, coptim, debug, funs, %% Model-specific files for j=1:length(funs) - baseFileName = [modelname '_' strrep(funs{j}, 'sigma_', 'sigma')]; + baseFileName = strrep(funs{j}, 'sigma_', 'sigma'); cfun(1).(funs{j}) = sourceNeedsRecompilation(modelSourceFolder, modelObjectFolder, baseFileName, objectFileSuffix); end @@ -124,22 +126,26 @@ function compileAndLinkModel(modelname, modelSourceFolder, coptim, debug, funs, if(numel(funsForRecompile)) fprintf('ffuns | '); - sources = cellfun(@(x) ['"' fullfile(modelSourceFolder,[modelname '_' x '.cpp']) '"'],funsForRecompile,'UniformOutput',false); + sources = cellfun(@(x) ['"' fullfile(modelSourceFolder,[x '.cpp']) '"'],funsForRecompile,'UniformOutput',false); sources = strjoin(sources,' '); - eval(['mex ' DEBUG COPT ... + cmd = ['mex ' DEBUG COPT ... ' -c -outdir "' modelObjectFolder '" ' ... - sources ' ' ... - includesstr ]); - cellfun(@(x) updateFileHashSource(modelSourceFolder, modelObjectFolder, [modelname '_' x]),funsForRecompile,'UniformOutput',false); + sources ' ' includesstr]; + try + eval(cmd); + catch ME + disp(cmd); + rethrow(ME); + end + cellfun(@(x) updateFileHashSource(modelSourceFolder, modelObjectFolder, x),funsForRecompile,'UniformOutput',false); end % append model object files for j=1:length(funs) - filename = fullfile(modelObjectFolder, [modelname '_' strrep(funs{j}, 'sigma_', 'sigma') objectFileSuffix]); + filename = fullfile(modelObjectFolder, [strrep(funs{j}, 'sigma_', 'sigma') objectFileSuffix]); if(exist(filename,'file')) - objectsstr = strcat(objectsstr,... - ' "',filename,'"'); + objectsstr = strcat(objectsstr, ' "',filename,'"'); end end @@ -156,10 +162,17 @@ function compileAndLinkModel(modelname, modelSourceFolder, coptim, debug, funs, % compile the wrapfunctions object fprintf('wrapfunctions | '); - eval(['mex ' DEBUG COPT ... + cmd = ['mex ' DEBUG COPT ... ' -c -outdir "' modelObjectFolder '" "' ... fullfile(modelSourceFolder,'wrapfunctions.cpp') '" ' model_cpp ... - includesstr]); + includesstr]; + try + eval(cmd); + catch ME + disp(cmd); + rethrow(ME); + end + objectsstr = [objectsstr, ' "' fullfile(modelObjectFolder,['wrapfunctions' objectFileSuffix]) '" ' model_cpp_obj]; % now we have compiled everything model-specific, so we can replace hashes.mat to prevent recompilation @@ -186,8 +199,15 @@ function compileAndLinkModel(modelname, modelSourceFolder, coptim, debug, funs, end mexFilename = fullfile(modelSourceFolder,['ami_' modelname]); - eval(['mex ' DEBUG ' ' COPT ' ' CLIBS ... - ' -output "' mexFilename '" ' objectsstr]) + cmd = ['mex ' DEBUG ' ' COPT ' ' CLIBS ... + ' -output "' mexFilename '" ' objectsstr]; + try + eval(cmd); + catch ME + disp(cmd); + rethrow(ME); + end + end function [objectStrAmici] = compileAmiciBase(amiciRootPath, objectFolder, objectFileSuffix, includesstr, DEBUG, COPT) @@ -217,8 +237,15 @@ function compileAndLinkModel(modelname, modelSourceFolder, coptim, debug, funs, baseFilename = fullfile(amiciSourcePath, sourcesForRecompile{j}); sourceStr = [sourceStr, ' "', baseFilename, '.cpp"']; end - eval(['mex ' DEBUG COPT ' -c -outdir "' objectFolder '" ' ... - includesstr ' ' sourceStr]); + cmd = ['mex ' DEBUG COPT ' -c -outdir "' objectFolder '" ' ... + includesstr ' ' sourceStr]; + try + eval(cmd); + catch ME + disp(cmd); + rethrow(ME); + end + cellfun(@(x) updateFileHashSource(amiciSourcePath, objectFolder, x), sourcesForRecompile); updateHeaderFileHashes(amiciIncludePath, objectFolder); end diff --git a/matlab/@amimodel/generateC.m b/matlab/@amimodel/generateC.m index 331b17ba6f..39f9ab7b81 100644 --- a/matlab/@amimodel/generateC.m +++ b/matlab/@amimodel/generateC.m @@ -26,7 +26,7 @@ function generateC(this) if(bodyNotEmpty) fprintf([ifun{1} ' | ']); - fid = fopen(fullfile(this.wrap_path,'models',this.modelname,[this.modelname '_' cppFunctionName '.cpp']),'w'); + fid = fopen(fullfile(this.wrap_path,'models',this.modelname,[ cppFunctionName '.cpp']),'w'); fprintf(fid,'\n'); fprintf(fid,'#include "amici/symbolic_functions.h"\n'); fprintf(fid,'#include "amici/defines.h" //realtype definition\n'); @@ -267,7 +267,7 @@ function generateCMakeFile(this) funcName = this.funs{j}; if(checkIfFunctionBodyIsNonEmpty(this,funcName)) cppFunctionName = strrep(funcName, 'sigma_', 'sigma'); - sourceStr = [ sourceStr, sprintf('${MODEL_DIR}/%s_%s.cpp\n', this.modelname, cppFunctionName) ]; + sourceStr = [ sourceStr, sprintf('${MODEL_DIR}/%s.cpp\n', cppFunctionName) ]; end end @@ -315,5 +315,5 @@ function generateMainC(this) % if we don't have symbolic variables, it might have been generated before and symbolic expressions were simply not % regenerated. any() for empty (no generated) variables is always false. cppFunctionName = strrep(ifun, 'sigma_', 'sigma'); - nonempty = or(exist(fullfile(this.wrap_path,'models',this.modelname,[this.modelname '_' cppFunctionName '.cpp']),'file'),any(this.fun.(ifun).sym(:)~=0)); + nonempty = or(exist(fullfile(this.wrap_path,'models',this.modelname,[cppFunctionName '.cpp']),'file'),any(this.fun.(ifun).sym(:)~=0)); end diff --git a/matlab/auxiliary/compileAMICIDependencies.m b/matlab/auxiliary/compileAMICIDependencies.m index 40282b7b07..cac063df31 100644 --- a/matlab/auxiliary/compileAMICIDependencies.m +++ b/matlab/auxiliary/compileAMICIDependencies.m @@ -1,6 +1,6 @@ function [objectsstr, includesstr] = compileAMICIDependencies(dependencyPath, objectFolder, o_suffix, COPT, DEBUG) %COMPILEAMICIDEPENDENCIES Compiles Sundials and SuiteSparse libraries required by AMICI - + COPT = ['CFLAGS=''$CFLAGS -std=c99'' ' COPT]; sundials_path = fullfile(dependencyPath,'sundials'); sundials_ver = '5.2.0'; @@ -43,14 +43,17 @@ end end - % sundials compatible int type for suitesparse - COPT = [COPT ' -DDLONG']; - % compile if(~strcmp(sourcesToCompile, '')) - eval(['mex ' DEBUG ' ' COPT ' -c -outdir "' ... + cmd = ['mex ' DEBUG ' ' COPT ' -c -outdir "' ... objectFolder '" ' ... - includesstr ' ' sourcesToCompile ]); + includesstr ' ' sourcesToCompile]; + try + eval(cmd); + catch ME + disp(cmd); + rethrow(ME); + end end % only write versions.txt if we are done compiling @@ -171,40 +174,39 @@ function sources_ssparse = getSourcesSSparse() sources_ssparse = { - fullfile('KLU','Source','klu_analyze_given.c'); - fullfile('KLU','Source','klu_analyze.c'); - fullfile('KLU','Source','klu_defaults.c'); - fullfile('KLU','Source','klu_diagnostics.c'); - fullfile('KLU','Source','klu_dump.c'); - fullfile('KLU','Source','klu_extract.c'); - fullfile('KLU','Source','klu_factor.c'); - fullfile('KLU','Source','klu_free_numeric.c'); - fullfile('KLU','Source','klu_free_symbolic.c'); - fullfile('KLU','Source','klu_kernel.c'); - fullfile('KLU','Source','klu_memory.c'); - fullfile('KLU','Source','klu_refactor.c'); - fullfile('KLU','Source','klu_scale.c'); - fullfile('KLU','Source','klu_sort.c'); - fullfile('KLU','Source','klu_solve.c'); - fullfile('KLU','Source','klu_tsolve.c'); - fullfile('KLU','Source','klu.c'); - fullfile('AMD','Source','amd_1.c'); - fullfile('AMD','Source','amd_2.c'); - fullfile('AMD','Source','amd_aat.c'); - fullfile('AMD','Source','amd_control.c'); - fullfile('AMD','Source','amd_defaults.c'); - fullfile('AMD','Source','amd_dump.c'); - fullfile('AMD','Source','amd_global.c'); - fullfile('AMD','Source','amd_info.c'); - fullfile('AMD','Source','amd_order.c'); - fullfile('AMD','Source','amd_post_tree.c'); - fullfile('AMD','Source','amd_postorder.c'); - fullfile('AMD','Source','amd_preprocess.c'); - fullfile('AMD','Source','amd_valid.c'); - fullfile('COLAMD','Source','colamd.c'); - fullfile('BTF','Source','btf_maxtrans.c'); - fullfile('BTF','Source','btf_order.c'); - fullfile('BTF','Source','btf_strongcomp.c'); + fullfile('KLU','Source','klu_l_analyze_given.c'); + fullfile('KLU','Source','klu_l_analyze.c'); + fullfile('KLU','Source','klu_l_defaults.c'); + fullfile('KLU','Source','klu_l_diagnostics.c'); + fullfile('KLU','Source','klu_l_dump.c'); + fullfile('KLU','Source','klu_l_extract.c'); + fullfile('KLU','Source','klu_l_factor.c'); + fullfile('KLU','Source','klu_l_free_numeric.c'); + fullfile('KLU','Source','klu_l_free_symbolic.c'); + fullfile('KLU','Source','klu_l_kernel.c'); + fullfile('KLU','Source','klu_l_memory.c'); + fullfile('KLU','Source','klu_l_refactor.c'); + fullfile('KLU','Source','klu_l_scale.c'); + fullfile('KLU','Source','klu_l_sort.c'); + fullfile('KLU','Source','klu_l_solve.c'); + fullfile('KLU','Source','klu_l_tsolve.c'); + fullfile('KLU','Source','klu_l.c'); + fullfile('AMD','Source','amd_l1.c'); + fullfile('AMD','Source','amd_l2.c'); + fullfile('AMD','Source','amd_l_aat.c'); + fullfile('AMD','Source','amd_l_control.c'); + fullfile('AMD','Source','amd_l_defaults.c'); + fullfile('AMD','Source','amd_l_dump.c'); + fullfile('AMD','Source','amd_l_info.c'); + fullfile('AMD','Source','amd_l_order.c'); + fullfile('AMD','Source','amd_l_postorder.c'); + fullfile('AMD','Source','amd_l_post_tree.c'); + fullfile('AMD','Source','amd_l_preprocess.c'); + fullfile('AMD','Source','amd_l_valid.c'); + fullfile('COLAMD','Source','colamd_l.c'); + fullfile('BTF','Source','btf_l_maxtrans.c'); + fullfile('BTF','Source','btf_l_order.c'); + fullfile('BTF','Source','btf_l_strongcomp.c'); fullfile('SuiteSparse_config','SuiteSparse_config.c'); }; end @@ -212,40 +214,39 @@ function objects_ssparse = getObjectsSSparse(o_suffix) objects_ssparse = { - 'klu_analyze_given.o'; - 'klu_analyze.o'; - 'klu_defaults.o'; - 'klu_diagnostics.o'; - 'klu_dump.o'; - 'klu_extract.o'; - 'klu_factor.o'; - 'klu_free_numeric.o'; - 'klu_free_symbolic.o'; - 'klu_kernel.o'; - 'klu_memory.o'; - 'klu_refactor.o'; - 'klu_scale.o'; - 'klu_sort.o'; - 'klu_solve.o'; - 'klu_tsolve.o'; - 'klu.o'; - 'amd_1.o'; - 'amd_2.o'; - 'amd_aat.o'; - 'amd_control.o'; - 'amd_defaults.o'; - 'amd_dump.o'; - 'amd_global.o'; - 'amd_info.o'; - 'amd_order.o'; - 'amd_post_tree.o'; - 'amd_postorder.o'; - 'amd_preprocess.o'; - 'amd_valid.o'; - 'colamd.o'; - 'btf_maxtrans.o'; - 'btf_order.o'; - 'btf_strongcomp.o'; + 'klu_l_analyze_given.o'; + 'klu_l_analyze.o'; + 'klu_l_defaults.o'; + 'klu_l_diagnostics.o'; + 'klu_l_dump.o'; + 'klu_l_extract.o'; + 'klu_l_factor.o'; + 'klu_l_free_numeric.o'; + 'klu_l_free_symbolic.o'; + 'klu_l_kernel.o'; + 'klu_l_memory.o'; + 'klu_l_refactor.o'; + 'klu_l_scale.o'; + 'klu_l_sort.o'; + 'klu_l_solve.o'; + 'klu_l_tsolve.o'; + 'klu_l.o'; + 'amd_l1.o'; + 'amd_l2.o'; + 'amd_l_aat.o'; + 'amd_l_control.o'; + 'amd_l_defaults.o'; + 'amd_l_dump.o'; + 'amd_l_info.o'; + 'amd_l_order.o'; + 'amd_l_post_tree.o'; + 'amd_l_postorder.o'; + 'amd_l_preprocess.o'; + 'amd_l_valid.o'; + 'colamd_l.o'; + 'btf_l_maxtrans.o'; + 'btf_l_order.o'; + 'btf_l_strongcomp.o'; 'SuiteSparse_config.o'; }; diff --git a/models/model_calvetti/CMakeLists.txt b/models/model_calvetti/CMakeLists.txt index 92f8855945..e01a2cac55 100644 --- a/models/model_calvetti/CMakeLists.txt +++ b/models/model_calvetti/CMakeLists.txt @@ -1,15 +1,4 @@ -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) -endif(POLICY CMP0060) -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif(POLICY CMP0065) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(model_calvetti) @@ -30,24 +19,24 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(SRC_LIST_LIB ${MODEL_DIR}/model_calvetti_JSparse.cpp -${MODEL_DIR}/model_calvetti_Jy.cpp -${MODEL_DIR}/model_calvetti_M.cpp -${MODEL_DIR}/model_calvetti_dJydsigma.cpp -${MODEL_DIR}/model_calvetti_dJydy.cpp -${MODEL_DIR}/model_calvetti_dwdx.cpp -${MODEL_DIR}/model_calvetti_dydx.cpp -${MODEL_DIR}/model_calvetti_root.cpp -${MODEL_DIR}/model_calvetti_sigmay.cpp -${MODEL_DIR}/model_calvetti_w.cpp -${MODEL_DIR}/model_calvetti_x0.cpp -${MODEL_DIR}/model_calvetti_xdot.cpp -${MODEL_DIR}/model_calvetti_y.cpp +set(SRC_LIST_LIB ${MODEL_DIR}/JSparse.cpp +${MODEL_DIR}/Jy.cpp +${MODEL_DIR}/M.cpp +${MODEL_DIR}/dJydsigma.cpp +${MODEL_DIR}/dJydy.cpp +${MODEL_DIR}/dwdx.cpp +${MODEL_DIR}/dydx.cpp +${MODEL_DIR}/root.cpp +${MODEL_DIR}/sigmay.cpp +${MODEL_DIR}/w.cpp +${MODEL_DIR}/x0.cpp +${MODEL_DIR}/xdot.cpp +${MODEL_DIR}/y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) diff --git a/models/model_calvetti/model_calvetti_JSparse.cpp b/models/model_calvetti/JSparse.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_JSparse.cpp rename to models/model_calvetti/JSparse.cpp diff --git a/models/model_calvetti/model_calvetti_Jy.cpp b/models/model_calvetti/Jy.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_Jy.cpp rename to models/model_calvetti/Jy.cpp diff --git a/models/model_calvetti/model_calvetti_M.cpp b/models/model_calvetti/M.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_M.cpp rename to models/model_calvetti/M.cpp diff --git a/models/model_calvetti/model_calvetti_dJydsigma.cpp b/models/model_calvetti/dJydsigma.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_dJydsigma.cpp rename to models/model_calvetti/dJydsigma.cpp diff --git a/models/model_calvetti/model_calvetti_dJydy.cpp b/models/model_calvetti/dJydy.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_dJydy.cpp rename to models/model_calvetti/dJydy.cpp diff --git a/models/model_calvetti/model_calvetti_dwdx.cpp b/models/model_calvetti/dwdx.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_dwdx.cpp rename to models/model_calvetti/dwdx.cpp diff --git a/models/model_calvetti/model_calvetti_dydx.cpp b/models/model_calvetti/dydx.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_dydx.cpp rename to models/model_calvetti/dydx.cpp diff --git a/models/model_calvetti/model_calvetti.h b/models/model_calvetti/model_calvetti.h index 4728837cab..0fd8425867 100644 --- a/models/model_calvetti/model_calvetti.h +++ b/models/model_calvetti/model_calvetti.h @@ -1,6 +1,6 @@ #ifndef _amici_model_calvetti_h #define _amici_model_calvetti_h -/* Generated by amiwrap (R2017b) b04ab2326fb34f3721a15806d9783ff22b6a015a */ +/* Generated by amiwrap (R2017b) 6819ebf5b2b2a61b92214b4cfbd78c9f663f408b */ #include #include #include "amici/defines.h" @@ -70,7 +70,7 @@ class Model_model_calvetti : public amici::Model_DAE { amici::Model* clone() const override { return new Model_model_calvetti(*this); }; - std::string getAmiciCommit() const override { return "b04ab2326fb34f3721a15806d9783ff22b6a015a"; }; + std::string getAmiciCommit() const override { return "6819ebf5b2b2a61b92214b4cfbd78c9f663f408b"; }; void fJSparse(SUNMatrixContent_Sparse JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype cj, const realtype *dx, const realtype *w, const realtype *dwdx) override { JSparse_model_calvetti(JSparse, t, x, p, k, h, cj, dx, w, dwdx); diff --git a/models/model_calvetti/model_calvetti_root.cpp b/models/model_calvetti/root.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_root.cpp rename to models/model_calvetti/root.cpp diff --git a/models/model_calvetti/model_calvetti_sigmay.cpp b/models/model_calvetti/sigmay.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_sigmay.cpp rename to models/model_calvetti/sigmay.cpp diff --git a/models/model_calvetti/swig/CMakeLists.txt b/models/model_calvetti/swig/CMakeLists.txt index 6642236fda..4e20c59ff0 100644 --- a/models/model_calvetti/swig/CMakeLists.txt +++ b/models/model_calvetti/swig/CMakeLists.txt @@ -1,16 +1,4 @@ -cmake_minimum_required(VERSION 3.8) # swig_add_library - -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif(POLICY CMP0078) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif(POLICY CMP0086) - +cmake_minimum_required(VERSION 3.15) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) @@ -18,14 +6,10 @@ include(${SWIG_USE_FILE}) if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - include_directories(${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -else() - find_package(Python3 COMPONENTS Interpreter Development) - include_directories(${Python3_INCLUDE_DIRS}) -endif() +# We don't need "Interpreter" here, but without that, FindPython3 will +# ignore the Python version selected via $Python3_EXECUTABLE +find_package(Python3 COMPONENTS Interpreter Development) +include_directories(${Python3_INCLUDE_DIRS}) set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") diff --git a/models/model_calvetti/swig/model_calvetti.i b/models/model_calvetti/swig/model_calvetti.i index 29a288c129..a904745877 100644 --- a/models/model_calvetti/swig/model_calvetti.i +++ b/models/model_calvetti/swig/model_calvetti.i @@ -10,5 +10,13 @@ using namespace amici; %} +// Make model module accessible from the model +%feature("pythonappend") amici::generic_model::getModel %{ + if '.' in __name__: + import sys + val.module = sys.modules['.'.join(__name__.split('.')[:-1])] +%} + + // Process symbols in header %include "wrapfunctions.h" diff --git a/models/model_calvetti/model_calvetti_w.cpp b/models/model_calvetti/w.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_w.cpp rename to models/model_calvetti/w.cpp diff --git a/models/model_calvetti/model_calvetti_x0.cpp b/models/model_calvetti/x0.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_x0.cpp rename to models/model_calvetti/x0.cpp diff --git a/models/model_calvetti/model_calvetti_xdot.cpp b/models/model_calvetti/xdot.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_xdot.cpp rename to models/model_calvetti/xdot.cpp diff --git a/models/model_calvetti/model_calvetti_y.cpp b/models/model_calvetti/y.cpp similarity index 100% rename from models/model_calvetti/model_calvetti_y.cpp rename to models/model_calvetti/y.cpp diff --git a/models/model_dirac/CMakeLists.txt b/models/model_dirac/CMakeLists.txt index 068563d6ae..da99325bff 100644 --- a/models/model_dirac/CMakeLists.txt +++ b/models/model_dirac/CMakeLists.txt @@ -1,15 +1,4 @@ -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) -endif(POLICY CMP0060) -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif(POLICY CMP0065) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(model_dirac) @@ -30,24 +19,24 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(SRC_LIST_LIB ${MODEL_DIR}/model_dirac_JSparse.cpp -${MODEL_DIR}/model_dirac_Jy.cpp -${MODEL_DIR}/model_dirac_dJydsigma.cpp -${MODEL_DIR}/model_dirac_dJydy.cpp -${MODEL_DIR}/model_dirac_deltasx.cpp -${MODEL_DIR}/model_dirac_deltax.cpp -${MODEL_DIR}/model_dirac_dxdotdp.cpp -${MODEL_DIR}/model_dirac_dydx.cpp -${MODEL_DIR}/model_dirac_root.cpp -${MODEL_DIR}/model_dirac_sigmay.cpp -${MODEL_DIR}/model_dirac_stau.cpp -${MODEL_DIR}/model_dirac_xdot.cpp -${MODEL_DIR}/model_dirac_y.cpp +set(SRC_LIST_LIB ${MODEL_DIR}/JSparse.cpp +${MODEL_DIR}/Jy.cpp +${MODEL_DIR}/dJydsigma.cpp +${MODEL_DIR}/dJydy.cpp +${MODEL_DIR}/deltasx.cpp +${MODEL_DIR}/deltax.cpp +${MODEL_DIR}/dxdotdp.cpp +${MODEL_DIR}/dydx.cpp +${MODEL_DIR}/root.cpp +${MODEL_DIR}/sigmay.cpp +${MODEL_DIR}/stau.cpp +${MODEL_DIR}/xdot.cpp +${MODEL_DIR}/y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) diff --git a/models/model_dirac/model_dirac_JSparse.cpp b/models/model_dirac/JSparse.cpp similarity index 100% rename from models/model_dirac/model_dirac_JSparse.cpp rename to models/model_dirac/JSparse.cpp diff --git a/models/model_dirac/model_dirac_Jy.cpp b/models/model_dirac/Jy.cpp similarity index 100% rename from models/model_dirac/model_dirac_Jy.cpp rename to models/model_dirac/Jy.cpp diff --git a/models/model_dirac/model_dirac_dJydsigma.cpp b/models/model_dirac/dJydsigma.cpp similarity index 100% rename from models/model_dirac/model_dirac_dJydsigma.cpp rename to models/model_dirac/dJydsigma.cpp diff --git a/models/model_dirac/model_dirac_dJydy.cpp b/models/model_dirac/dJydy.cpp similarity index 100% rename from models/model_dirac/model_dirac_dJydy.cpp rename to models/model_dirac/dJydy.cpp diff --git a/models/model_dirac/model_dirac_deltasx.cpp b/models/model_dirac/deltasx.cpp similarity index 100% rename from models/model_dirac/model_dirac_deltasx.cpp rename to models/model_dirac/deltasx.cpp diff --git a/models/model_dirac/model_dirac_deltax.cpp b/models/model_dirac/deltax.cpp similarity index 100% rename from models/model_dirac/model_dirac_deltax.cpp rename to models/model_dirac/deltax.cpp diff --git a/models/model_dirac/model_dirac_dxdotdp.cpp b/models/model_dirac/dxdotdp.cpp similarity index 100% rename from models/model_dirac/model_dirac_dxdotdp.cpp rename to models/model_dirac/dxdotdp.cpp diff --git a/models/model_dirac/model_dirac_dydx.cpp b/models/model_dirac/dydx.cpp similarity index 100% rename from models/model_dirac/model_dirac_dydx.cpp rename to models/model_dirac/dydx.cpp diff --git a/models/model_dirac/model_dirac.h b/models/model_dirac/model_dirac.h index 18260ba5cc..082b022ed6 100644 --- a/models/model_dirac/model_dirac.h +++ b/models/model_dirac/model_dirac.h @@ -1,6 +1,6 @@ #ifndef _amici_model_dirac_h #define _amici_model_dirac_h -/* Generated by amiwrap (R2017b) b04ab2326fb34f3721a15806d9783ff22b6a015a */ +/* Generated by amiwrap (R2017b) 6819ebf5b2b2a61b92214b4cfbd78c9f663f408b */ #include #include #include "amici/defines.h" @@ -70,7 +70,7 @@ class Model_model_dirac : public amici::Model_ODE { amici::Model* clone() const override { return new Model_model_dirac(*this); }; - std::string getAmiciCommit() const override { return "b04ab2326fb34f3721a15806d9783ff22b6a015a"; }; + std::string getAmiciCommit() const override { return "6819ebf5b2b2a61b92214b4cfbd78c9f663f408b"; }; void fJSparse(SUNMatrixContent_Sparse JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx) override { JSparse_model_dirac(JSparse, t, x, p, k, h, w, dwdx); diff --git a/models/model_dirac/model_dirac_root.cpp b/models/model_dirac/root.cpp similarity index 100% rename from models/model_dirac/model_dirac_root.cpp rename to models/model_dirac/root.cpp diff --git a/models/model_dirac/model_dirac_sigmay.cpp b/models/model_dirac/sigmay.cpp similarity index 100% rename from models/model_dirac/model_dirac_sigmay.cpp rename to models/model_dirac/sigmay.cpp diff --git a/models/model_dirac/model_dirac_stau.cpp b/models/model_dirac/stau.cpp similarity index 100% rename from models/model_dirac/model_dirac_stau.cpp rename to models/model_dirac/stau.cpp diff --git a/models/model_dirac/swig/CMakeLists.txt b/models/model_dirac/swig/CMakeLists.txt index 6642236fda..4e20c59ff0 100644 --- a/models/model_dirac/swig/CMakeLists.txt +++ b/models/model_dirac/swig/CMakeLists.txt @@ -1,16 +1,4 @@ -cmake_minimum_required(VERSION 3.8) # swig_add_library - -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif(POLICY CMP0078) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif(POLICY CMP0086) - +cmake_minimum_required(VERSION 3.15) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) @@ -18,14 +6,10 @@ include(${SWIG_USE_FILE}) if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - include_directories(${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -else() - find_package(Python3 COMPONENTS Interpreter Development) - include_directories(${Python3_INCLUDE_DIRS}) -endif() +# We don't need "Interpreter" here, but without that, FindPython3 will +# ignore the Python version selected via $Python3_EXECUTABLE +find_package(Python3 COMPONENTS Interpreter Development) +include_directories(${Python3_INCLUDE_DIRS}) set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") diff --git a/models/model_dirac/swig/model_dirac.i b/models/model_dirac/swig/model_dirac.i index 908c43b490..928a883496 100644 --- a/models/model_dirac/swig/model_dirac.i +++ b/models/model_dirac/swig/model_dirac.i @@ -10,5 +10,13 @@ using namespace amici; %} +// Make model module accessible from the model +%feature("pythonappend") amici::generic_model::getModel %{ + if '.' in __name__: + import sys + val.module = sys.modules['.'.join(__name__.split('.')[:-1])] +%} + + // Process symbols in header %include "wrapfunctions.h" diff --git a/models/model_dirac/model_dirac_xdot.cpp b/models/model_dirac/xdot.cpp similarity index 100% rename from models/model_dirac/model_dirac_xdot.cpp rename to models/model_dirac/xdot.cpp diff --git a/models/model_dirac/model_dirac_y.cpp b/models/model_dirac/y.cpp similarity index 100% rename from models/model_dirac/model_dirac_y.cpp rename to models/model_dirac/y.cpp diff --git a/models/model_events/CMakeLists.txt b/models/model_events/CMakeLists.txt index 314de61be1..297c996952 100644 --- a/models/model_events/CMakeLists.txt +++ b/models/model_events/CMakeLists.txt @@ -1,15 +1,4 @@ -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) -endif(POLICY CMP0060) -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif(POLICY CMP0065) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(model_events) @@ -30,38 +19,38 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(SRC_LIST_LIB ${MODEL_DIR}/model_events_JSparse.cpp -${MODEL_DIR}/model_events_Jrz.cpp -${MODEL_DIR}/model_events_Jy.cpp -${MODEL_DIR}/model_events_Jz.cpp -${MODEL_DIR}/model_events_dJrzdsigma.cpp -${MODEL_DIR}/model_events_dJrzdz.cpp -${MODEL_DIR}/model_events_dJydsigma.cpp -${MODEL_DIR}/model_events_dJydy.cpp -${MODEL_DIR}/model_events_dJzdsigma.cpp -${MODEL_DIR}/model_events_dJzdz.cpp -${MODEL_DIR}/model_events_deltasx.cpp -${MODEL_DIR}/model_events_drzdx.cpp -${MODEL_DIR}/model_events_dxdotdp.cpp -${MODEL_DIR}/model_events_dydp.cpp -${MODEL_DIR}/model_events_dydx.cpp -${MODEL_DIR}/model_events_dzdx.cpp -${MODEL_DIR}/model_events_root.cpp -${MODEL_DIR}/model_events_rz.cpp -${MODEL_DIR}/model_events_sigmay.cpp -${MODEL_DIR}/model_events_sigmaz.cpp -${MODEL_DIR}/model_events_srz.cpp -${MODEL_DIR}/model_events_stau.cpp -${MODEL_DIR}/model_events_sz.cpp -${MODEL_DIR}/model_events_x0.cpp -${MODEL_DIR}/model_events_xdot.cpp -${MODEL_DIR}/model_events_y.cpp -${MODEL_DIR}/model_events_z.cpp +set(SRC_LIST_LIB ${MODEL_DIR}/JSparse.cpp +${MODEL_DIR}/Jrz.cpp +${MODEL_DIR}/Jy.cpp +${MODEL_DIR}/Jz.cpp +${MODEL_DIR}/dJrzdsigma.cpp +${MODEL_DIR}/dJrzdz.cpp +${MODEL_DIR}/dJydsigma.cpp +${MODEL_DIR}/dJydy.cpp +${MODEL_DIR}/dJzdsigma.cpp +${MODEL_DIR}/dJzdz.cpp +${MODEL_DIR}/deltasx.cpp +${MODEL_DIR}/drzdx.cpp +${MODEL_DIR}/dxdotdp.cpp +${MODEL_DIR}/dydp.cpp +${MODEL_DIR}/dydx.cpp +${MODEL_DIR}/dzdx.cpp +${MODEL_DIR}/root.cpp +${MODEL_DIR}/rz.cpp +${MODEL_DIR}/sigmay.cpp +${MODEL_DIR}/sigmaz.cpp +${MODEL_DIR}/srz.cpp +${MODEL_DIR}/stau.cpp +${MODEL_DIR}/sz.cpp +${MODEL_DIR}/x0.cpp +${MODEL_DIR}/xdot.cpp +${MODEL_DIR}/y.cpp +${MODEL_DIR}/z.cpp ${MODEL_DIR}/wrapfunctions.cpp ) diff --git a/models/model_events/model_events_JSparse.cpp b/models/model_events/JSparse.cpp similarity index 100% rename from models/model_events/model_events_JSparse.cpp rename to models/model_events/JSparse.cpp diff --git a/models/model_events/model_events_Jrz.cpp b/models/model_events/Jrz.cpp similarity index 100% rename from models/model_events/model_events_Jrz.cpp rename to models/model_events/Jrz.cpp diff --git a/models/model_events/model_events_Jy.cpp b/models/model_events/Jy.cpp similarity index 100% rename from models/model_events/model_events_Jy.cpp rename to models/model_events/Jy.cpp diff --git a/models/model_events/model_events_Jz.cpp b/models/model_events/Jz.cpp similarity index 100% rename from models/model_events/model_events_Jz.cpp rename to models/model_events/Jz.cpp diff --git a/models/model_events/model_events_dJrzdsigma.cpp b/models/model_events/dJrzdsigma.cpp similarity index 100% rename from models/model_events/model_events_dJrzdsigma.cpp rename to models/model_events/dJrzdsigma.cpp diff --git a/models/model_events/model_events_dJrzdz.cpp b/models/model_events/dJrzdz.cpp similarity index 100% rename from models/model_events/model_events_dJrzdz.cpp rename to models/model_events/dJrzdz.cpp diff --git a/models/model_events/model_events_dJydsigma.cpp b/models/model_events/dJydsigma.cpp similarity index 100% rename from models/model_events/model_events_dJydsigma.cpp rename to models/model_events/dJydsigma.cpp diff --git a/models/model_events/model_events_dJydy.cpp b/models/model_events/dJydy.cpp similarity index 100% rename from models/model_events/model_events_dJydy.cpp rename to models/model_events/dJydy.cpp diff --git a/models/model_events/model_events_dJzdsigma.cpp b/models/model_events/dJzdsigma.cpp similarity index 100% rename from models/model_events/model_events_dJzdsigma.cpp rename to models/model_events/dJzdsigma.cpp diff --git a/models/model_events/model_events_dJzdz.cpp b/models/model_events/dJzdz.cpp similarity index 100% rename from models/model_events/model_events_dJzdz.cpp rename to models/model_events/dJzdz.cpp diff --git a/models/model_events/model_events_deltasx.cpp b/models/model_events/deltasx.cpp similarity index 100% rename from models/model_events/model_events_deltasx.cpp rename to models/model_events/deltasx.cpp diff --git a/models/model_events/model_events_drzdx.cpp b/models/model_events/drzdx.cpp similarity index 100% rename from models/model_events/model_events_drzdx.cpp rename to models/model_events/drzdx.cpp diff --git a/models/model_events/model_events_dxdotdp.cpp b/models/model_events/dxdotdp.cpp similarity index 100% rename from models/model_events/model_events_dxdotdp.cpp rename to models/model_events/dxdotdp.cpp diff --git a/models/model_events/model_events_dydp.cpp b/models/model_events/dydp.cpp similarity index 100% rename from models/model_events/model_events_dydp.cpp rename to models/model_events/dydp.cpp diff --git a/models/model_events/model_events_dydx.cpp b/models/model_events/dydx.cpp similarity index 100% rename from models/model_events/model_events_dydx.cpp rename to models/model_events/dydx.cpp diff --git a/models/model_events/model_events_dzdx.cpp b/models/model_events/dzdx.cpp similarity index 100% rename from models/model_events/model_events_dzdx.cpp rename to models/model_events/dzdx.cpp diff --git a/models/model_events/model_events.h b/models/model_events/model_events.h index d8c4c12ffb..d9b3d78899 100644 --- a/models/model_events/model_events.h +++ b/models/model_events/model_events.h @@ -1,6 +1,6 @@ #ifndef _amici_model_events_h #define _amici_model_events_h -/* Generated by amiwrap (R2017b) b04ab2326fb34f3721a15806d9783ff22b6a015a */ +/* Generated by amiwrap (R2017b) 6819ebf5b2b2a61b92214b4cfbd78c9f663f408b */ #include #include #include "amici/defines.h" @@ -84,7 +84,7 @@ class Model_model_events : public amici::Model_ODE { amici::Model* clone() const override { return new Model_model_events(*this); }; - std::string getAmiciCommit() const override { return "b04ab2326fb34f3721a15806d9783ff22b6a015a"; }; + std::string getAmiciCommit() const override { return "6819ebf5b2b2a61b92214b4cfbd78c9f663f408b"; }; void fJSparse(SUNMatrixContent_Sparse JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx) override { JSparse_model_events(JSparse, t, x, p, k, h, w, dwdx); diff --git a/models/model_events/model_events_root.cpp b/models/model_events/root.cpp similarity index 100% rename from models/model_events/model_events_root.cpp rename to models/model_events/root.cpp diff --git a/models/model_events/model_events_rz.cpp b/models/model_events/rz.cpp similarity index 100% rename from models/model_events/model_events_rz.cpp rename to models/model_events/rz.cpp diff --git a/models/model_events/model_events_sigmay.cpp b/models/model_events/sigmay.cpp similarity index 100% rename from models/model_events/model_events_sigmay.cpp rename to models/model_events/sigmay.cpp diff --git a/models/model_events/model_events_sigmaz.cpp b/models/model_events/sigmaz.cpp similarity index 100% rename from models/model_events/model_events_sigmaz.cpp rename to models/model_events/sigmaz.cpp diff --git a/models/model_events/model_events_srz.cpp b/models/model_events/srz.cpp similarity index 100% rename from models/model_events/model_events_srz.cpp rename to models/model_events/srz.cpp diff --git a/models/model_events/model_events_stau.cpp b/models/model_events/stau.cpp similarity index 100% rename from models/model_events/model_events_stau.cpp rename to models/model_events/stau.cpp diff --git a/models/model_events/swig/CMakeLists.txt b/models/model_events/swig/CMakeLists.txt index 6642236fda..4e20c59ff0 100644 --- a/models/model_events/swig/CMakeLists.txt +++ b/models/model_events/swig/CMakeLists.txt @@ -1,16 +1,4 @@ -cmake_minimum_required(VERSION 3.8) # swig_add_library - -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif(POLICY CMP0078) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif(POLICY CMP0086) - +cmake_minimum_required(VERSION 3.15) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) @@ -18,14 +6,10 @@ include(${SWIG_USE_FILE}) if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - include_directories(${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -else() - find_package(Python3 COMPONENTS Interpreter Development) - include_directories(${Python3_INCLUDE_DIRS}) -endif() +# We don't need "Interpreter" here, but without that, FindPython3 will +# ignore the Python version selected via $Python3_EXECUTABLE +find_package(Python3 COMPONENTS Interpreter Development) +include_directories(${Python3_INCLUDE_DIRS}) set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") diff --git a/models/model_events/swig/model_events.i b/models/model_events/swig/model_events.i index e62e99d55f..e4a556aa15 100644 --- a/models/model_events/swig/model_events.i +++ b/models/model_events/swig/model_events.i @@ -10,5 +10,13 @@ using namespace amici; %} +// Make model module accessible from the model +%feature("pythonappend") amici::generic_model::getModel %{ + if '.' in __name__: + import sys + val.module = sys.modules['.'.join(__name__.split('.')[:-1])] +%} + + // Process symbols in header %include "wrapfunctions.h" diff --git a/models/model_events/model_events_sz.cpp b/models/model_events/sz.cpp similarity index 100% rename from models/model_events/model_events_sz.cpp rename to models/model_events/sz.cpp diff --git a/models/model_events/model_events_x0.cpp b/models/model_events/x0.cpp similarity index 100% rename from models/model_events/model_events_x0.cpp rename to models/model_events/x0.cpp diff --git a/models/model_events/model_events_xdot.cpp b/models/model_events/xdot.cpp similarity index 100% rename from models/model_events/model_events_xdot.cpp rename to models/model_events/xdot.cpp diff --git a/models/model_events/model_events_y.cpp b/models/model_events/y.cpp similarity index 100% rename from models/model_events/model_events_y.cpp rename to models/model_events/y.cpp diff --git a/models/model_events/model_events_z.cpp b/models/model_events/z.cpp similarity index 100% rename from models/model_events/model_events_z.cpp rename to models/model_events/z.cpp diff --git a/models/model_jakstat_adjoint/CMakeLists.txt b/models/model_jakstat_adjoint/CMakeLists.txt index 9e0f8693ec..e8b149748f 100644 --- a/models/model_jakstat_adjoint/CMakeLists.txt +++ b/models/model_jakstat_adjoint/CMakeLists.txt @@ -1,15 +1,4 @@ -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) -endif(POLICY CMP0060) -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif(POLICY CMP0065) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(model_jakstat_adjoint) @@ -30,27 +19,27 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(SRC_LIST_LIB ${MODEL_DIR}/model_jakstat_adjoint_JSparse.cpp -${MODEL_DIR}/model_jakstat_adjoint_Jy.cpp -${MODEL_DIR}/model_jakstat_adjoint_dJydsigma.cpp -${MODEL_DIR}/model_jakstat_adjoint_dJydy.cpp -${MODEL_DIR}/model_jakstat_adjoint_dsigmaydp.cpp -${MODEL_DIR}/model_jakstat_adjoint_dwdp.cpp -${MODEL_DIR}/model_jakstat_adjoint_dwdx.cpp -${MODEL_DIR}/model_jakstat_adjoint_dxdotdp.cpp -${MODEL_DIR}/model_jakstat_adjoint_dydp.cpp -${MODEL_DIR}/model_jakstat_adjoint_dydx.cpp -${MODEL_DIR}/model_jakstat_adjoint_sigmay.cpp -${MODEL_DIR}/model_jakstat_adjoint_sx0.cpp -${MODEL_DIR}/model_jakstat_adjoint_w.cpp -${MODEL_DIR}/model_jakstat_adjoint_x0.cpp -${MODEL_DIR}/model_jakstat_adjoint_xdot.cpp -${MODEL_DIR}/model_jakstat_adjoint_y.cpp +set(SRC_LIST_LIB ${MODEL_DIR}/JSparse.cpp +${MODEL_DIR}/Jy.cpp +${MODEL_DIR}/dJydsigma.cpp +${MODEL_DIR}/dJydy.cpp +${MODEL_DIR}/dsigmaydp.cpp +${MODEL_DIR}/dwdp.cpp +${MODEL_DIR}/dwdx.cpp +${MODEL_DIR}/dxdotdp.cpp +${MODEL_DIR}/dydp.cpp +${MODEL_DIR}/dydx.cpp +${MODEL_DIR}/sigmay.cpp +${MODEL_DIR}/sx0.cpp +${MODEL_DIR}/w.cpp +${MODEL_DIR}/x0.cpp +${MODEL_DIR}/xdot.cpp +${MODEL_DIR}/y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_JSparse.cpp b/models/model_jakstat_adjoint/JSparse.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_JSparse.cpp rename to models/model_jakstat_adjoint/JSparse.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_Jy.cpp b/models/model_jakstat_adjoint/Jy.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_Jy.cpp rename to models/model_jakstat_adjoint/Jy.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_dJydsigma.cpp b/models/model_jakstat_adjoint/dJydsigma.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_dJydsigma.cpp rename to models/model_jakstat_adjoint/dJydsigma.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_dJydy.cpp b/models/model_jakstat_adjoint/dJydy.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_dJydy.cpp rename to models/model_jakstat_adjoint/dJydy.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_dsigmaydp.cpp b/models/model_jakstat_adjoint/dsigmaydp.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_dsigmaydp.cpp rename to models/model_jakstat_adjoint/dsigmaydp.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_dwdp.cpp b/models/model_jakstat_adjoint/dwdp.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_dwdp.cpp rename to models/model_jakstat_adjoint/dwdp.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_dwdx.cpp b/models/model_jakstat_adjoint/dwdx.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_dwdx.cpp rename to models/model_jakstat_adjoint/dwdx.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_dxdotdp.cpp b/models/model_jakstat_adjoint/dxdotdp.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_dxdotdp.cpp rename to models/model_jakstat_adjoint/dxdotdp.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_dydp.cpp b/models/model_jakstat_adjoint/dydp.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_dydp.cpp rename to models/model_jakstat_adjoint/dydp.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_dydx.cpp b/models/model_jakstat_adjoint/dydx.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_dydx.cpp rename to models/model_jakstat_adjoint/dydx.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint.h b/models/model_jakstat_adjoint/model_jakstat_adjoint.h index 38b8b9e2e1..1e292c0447 100644 --- a/models/model_jakstat_adjoint/model_jakstat_adjoint.h +++ b/models/model_jakstat_adjoint/model_jakstat_adjoint.h @@ -1,6 +1,6 @@ #ifndef _amici_model_jakstat_adjoint_h #define _amici_model_jakstat_adjoint_h -/* Generated by amiwrap (R2017b) b04ab2326fb34f3721a15806d9783ff22b6a015a */ +/* Generated by amiwrap (R2017b) 6819ebf5b2b2a61b92214b4cfbd78c9f663f408b */ #include #include #include "amici/defines.h" @@ -73,7 +73,7 @@ class Model_model_jakstat_adjoint : public amici::Model_ODE { amici::Model* clone() const override { return new Model_model_jakstat_adjoint(*this); }; - std::string getAmiciCommit() const override { return "b04ab2326fb34f3721a15806d9783ff22b6a015a"; }; + std::string getAmiciCommit() const override { return "6819ebf5b2b2a61b92214b4cfbd78c9f663f408b"; }; void fJSparse(SUNMatrixContent_Sparse JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx) override { JSparse_model_jakstat_adjoint(JSparse, t, x, p, k, h, w, dwdx); diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_sigmay.cpp b/models/model_jakstat_adjoint/sigmay.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_sigmay.cpp rename to models/model_jakstat_adjoint/sigmay.cpp diff --git a/models/model_jakstat_adjoint/swig/CMakeLists.txt b/models/model_jakstat_adjoint/swig/CMakeLists.txt index 6642236fda..4e20c59ff0 100644 --- a/models/model_jakstat_adjoint/swig/CMakeLists.txt +++ b/models/model_jakstat_adjoint/swig/CMakeLists.txt @@ -1,16 +1,4 @@ -cmake_minimum_required(VERSION 3.8) # swig_add_library - -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif(POLICY CMP0078) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif(POLICY CMP0086) - +cmake_minimum_required(VERSION 3.15) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) @@ -18,14 +6,10 @@ include(${SWIG_USE_FILE}) if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - include_directories(${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -else() - find_package(Python3 COMPONENTS Interpreter Development) - include_directories(${Python3_INCLUDE_DIRS}) -endif() +# We don't need "Interpreter" here, but without that, FindPython3 will +# ignore the Python version selected via $Python3_EXECUTABLE +find_package(Python3 COMPONENTS Interpreter Development) +include_directories(${Python3_INCLUDE_DIRS}) set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") diff --git a/models/model_jakstat_adjoint/swig/model_jakstat_adjoint.i b/models/model_jakstat_adjoint/swig/model_jakstat_adjoint.i index 3f0f1374fe..a986a6a5d2 100644 --- a/models/model_jakstat_adjoint/swig/model_jakstat_adjoint.i +++ b/models/model_jakstat_adjoint/swig/model_jakstat_adjoint.i @@ -10,5 +10,13 @@ using namespace amici; %} +// Make model module accessible from the model +%feature("pythonappend") amici::generic_model::getModel %{ + if '.' in __name__: + import sys + val.module = sys.modules['.'.join(__name__.split('.')[:-1])] +%} + + // Process symbols in header %include "wrapfunctions.h" diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_sx0.cpp b/models/model_jakstat_adjoint/sx0.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_sx0.cpp rename to models/model_jakstat_adjoint/sx0.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_w.cpp b/models/model_jakstat_adjoint/w.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_w.cpp rename to models/model_jakstat_adjoint/w.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_x0.cpp b/models/model_jakstat_adjoint/x0.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_x0.cpp rename to models/model_jakstat_adjoint/x0.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_xdot.cpp b/models/model_jakstat_adjoint/xdot.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_xdot.cpp rename to models/model_jakstat_adjoint/xdot.cpp diff --git a/models/model_jakstat_adjoint/model_jakstat_adjoint_y.cpp b/models/model_jakstat_adjoint/y.cpp similarity index 100% rename from models/model_jakstat_adjoint/model_jakstat_adjoint_y.cpp rename to models/model_jakstat_adjoint/y.cpp diff --git a/models/model_jakstat_adjoint_o2/CMakeLists.txt b/models/model_jakstat_adjoint_o2/CMakeLists.txt index 76f52619ac..80d7f97036 100644 --- a/models/model_jakstat_adjoint_o2/CMakeLists.txt +++ b/models/model_jakstat_adjoint_o2/CMakeLists.txt @@ -1,15 +1,4 @@ -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) -endif(POLICY CMP0060) -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif(POLICY CMP0065) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(model_jakstat_adjoint_o2) @@ -30,27 +19,27 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(SRC_LIST_LIB ${MODEL_DIR}/model_jakstat_adjoint_o2_JSparse.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_Jy.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_dJydsigma.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_dJydy.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_dsigmaydp.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_dwdp.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_dwdx.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_dxdotdp.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_dydp.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_dydx.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_sigmay.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_sx0.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_w.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_x0.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_xdot.cpp -${MODEL_DIR}/model_jakstat_adjoint_o2_y.cpp +set(SRC_LIST_LIB ${MODEL_DIR}/JSparse.cpp +${MODEL_DIR}/Jy.cpp +${MODEL_DIR}/dJydsigma.cpp +${MODEL_DIR}/dJydy.cpp +${MODEL_DIR}/dsigmaydp.cpp +${MODEL_DIR}/dwdp.cpp +${MODEL_DIR}/dwdx.cpp +${MODEL_DIR}/dxdotdp.cpp +${MODEL_DIR}/dydp.cpp +${MODEL_DIR}/dydx.cpp +${MODEL_DIR}/sigmay.cpp +${MODEL_DIR}/sx0.cpp +${MODEL_DIR}/w.cpp +${MODEL_DIR}/x0.cpp +${MODEL_DIR}/xdot.cpp +${MODEL_DIR}/y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_JSparse.cpp b/models/model_jakstat_adjoint_o2/JSparse.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_JSparse.cpp rename to models/model_jakstat_adjoint_o2/JSparse.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_Jy.cpp b/models/model_jakstat_adjoint_o2/Jy.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_Jy.cpp rename to models/model_jakstat_adjoint_o2/Jy.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dJydsigma.cpp b/models/model_jakstat_adjoint_o2/dJydsigma.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dJydsigma.cpp rename to models/model_jakstat_adjoint_o2/dJydsigma.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dJydy.cpp b/models/model_jakstat_adjoint_o2/dJydy.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dJydy.cpp rename to models/model_jakstat_adjoint_o2/dJydy.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dsigmaydp.cpp b/models/model_jakstat_adjoint_o2/dsigmaydp.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dsigmaydp.cpp rename to models/model_jakstat_adjoint_o2/dsigmaydp.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dwdp.cpp b/models/model_jakstat_adjoint_o2/dwdp.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dwdp.cpp rename to models/model_jakstat_adjoint_o2/dwdp.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dwdx.cpp b/models/model_jakstat_adjoint_o2/dwdx.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dwdx.cpp rename to models/model_jakstat_adjoint_o2/dwdx.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dxdotdp.cpp b/models/model_jakstat_adjoint_o2/dxdotdp.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dxdotdp.cpp rename to models/model_jakstat_adjoint_o2/dxdotdp.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dydp.cpp b/models/model_jakstat_adjoint_o2/dydp.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dydp.cpp rename to models/model_jakstat_adjoint_o2/dydp.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dydx.cpp b/models/model_jakstat_adjoint_o2/dydx.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_dydx.cpp rename to models/model_jakstat_adjoint_o2/dydx.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2.h b/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2.h index 642afbb3ba..fd036502ff 100644 --- a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2.h +++ b/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2.h @@ -1,6 +1,6 @@ #ifndef _amici_model_jakstat_adjoint_o2_h #define _amici_model_jakstat_adjoint_o2_h -/* Generated by amiwrap (R2017b) b04ab2326fb34f3721a15806d9783ff22b6a015a */ +/* Generated by amiwrap (R2017b) 6819ebf5b2b2a61b92214b4cfbd78c9f663f408b */ #include #include #include "amici/defines.h" @@ -73,7 +73,7 @@ class Model_model_jakstat_adjoint_o2 : public amici::Model_ODE { amici::Model* clone() const override { return new Model_model_jakstat_adjoint_o2(*this); }; - std::string getAmiciCommit() const override { return "b04ab2326fb34f3721a15806d9783ff22b6a015a"; }; + std::string getAmiciCommit() const override { return "6819ebf5b2b2a61b92214b4cfbd78c9f663f408b"; }; void fJSparse(SUNMatrixContent_Sparse JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx) override { JSparse_model_jakstat_adjoint_o2(JSparse, t, x, p, k, h, w, dwdx); diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_sigmay.cpp b/models/model_jakstat_adjoint_o2/sigmay.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_sigmay.cpp rename to models/model_jakstat_adjoint_o2/sigmay.cpp diff --git a/models/model_jakstat_adjoint_o2/swig/CMakeLists.txt b/models/model_jakstat_adjoint_o2/swig/CMakeLists.txt index 6642236fda..4e20c59ff0 100644 --- a/models/model_jakstat_adjoint_o2/swig/CMakeLists.txt +++ b/models/model_jakstat_adjoint_o2/swig/CMakeLists.txt @@ -1,16 +1,4 @@ -cmake_minimum_required(VERSION 3.8) # swig_add_library - -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif(POLICY CMP0078) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif(POLICY CMP0086) - +cmake_minimum_required(VERSION 3.15) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) @@ -18,14 +6,10 @@ include(${SWIG_USE_FILE}) if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - include_directories(${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -else() - find_package(Python3 COMPONENTS Interpreter Development) - include_directories(${Python3_INCLUDE_DIRS}) -endif() +# We don't need "Interpreter" here, but without that, FindPython3 will +# ignore the Python version selected via $Python3_EXECUTABLE +find_package(Python3 COMPONENTS Interpreter Development) +include_directories(${Python3_INCLUDE_DIRS}) set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") diff --git a/models/model_jakstat_adjoint_o2/swig/model_jakstat_adjoint_o2.i b/models/model_jakstat_adjoint_o2/swig/model_jakstat_adjoint_o2.i index 97b5161c84..50591d090c 100644 --- a/models/model_jakstat_adjoint_o2/swig/model_jakstat_adjoint_o2.i +++ b/models/model_jakstat_adjoint_o2/swig/model_jakstat_adjoint_o2.i @@ -10,5 +10,13 @@ using namespace amici; %} +// Make model module accessible from the model +%feature("pythonappend") amici::generic_model::getModel %{ + if '.' in __name__: + import sys + val.module = sys.modules['.'.join(__name__.split('.')[:-1])] +%} + + // Process symbols in header %include "wrapfunctions.h" diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_sx0.cpp b/models/model_jakstat_adjoint_o2/sx0.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_sx0.cpp rename to models/model_jakstat_adjoint_o2/sx0.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_w.cpp b/models/model_jakstat_adjoint_o2/w.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_w.cpp rename to models/model_jakstat_adjoint_o2/w.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_x0.cpp b/models/model_jakstat_adjoint_o2/x0.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_x0.cpp rename to models/model_jakstat_adjoint_o2/x0.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_xdot.cpp b/models/model_jakstat_adjoint_o2/xdot.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_xdot.cpp rename to models/model_jakstat_adjoint_o2/xdot.cpp diff --git a/models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_y.cpp b/models/model_jakstat_adjoint_o2/y.cpp similarity index 100% rename from models/model_jakstat_adjoint_o2/model_jakstat_adjoint_o2_y.cpp rename to models/model_jakstat_adjoint_o2/y.cpp diff --git a/models/model_nested_events/CMakeLists.txt b/models/model_nested_events/CMakeLists.txt index 67e62cd7c8..f3ff2d4be3 100644 --- a/models/model_nested_events/CMakeLists.txt +++ b/models/model_nested_events/CMakeLists.txt @@ -1,15 +1,4 @@ -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) -endif(POLICY CMP0060) -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif(POLICY CMP0065) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(model_nested_events) @@ -30,27 +19,27 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(SRC_LIST_LIB ${MODEL_DIR}/model_nested_events_JSparse.cpp -${MODEL_DIR}/model_nested_events_Jy.cpp -${MODEL_DIR}/model_nested_events_dJydsigma.cpp -${MODEL_DIR}/model_nested_events_dJydy.cpp -${MODEL_DIR}/model_nested_events_deltaqB.cpp -${MODEL_DIR}/model_nested_events_deltasx.cpp -${MODEL_DIR}/model_nested_events_deltax.cpp -${MODEL_DIR}/model_nested_events_dxdotdp.cpp -${MODEL_DIR}/model_nested_events_dydx.cpp -${MODEL_DIR}/model_nested_events_root.cpp -${MODEL_DIR}/model_nested_events_sigmay.cpp -${MODEL_DIR}/model_nested_events_stau.cpp -${MODEL_DIR}/model_nested_events_sx0.cpp -${MODEL_DIR}/model_nested_events_x0.cpp -${MODEL_DIR}/model_nested_events_xdot.cpp -${MODEL_DIR}/model_nested_events_y.cpp +set(SRC_LIST_LIB ${MODEL_DIR}/JSparse.cpp +${MODEL_DIR}/Jy.cpp +${MODEL_DIR}/dJydsigma.cpp +${MODEL_DIR}/dJydy.cpp +${MODEL_DIR}/deltaqB.cpp +${MODEL_DIR}/deltasx.cpp +${MODEL_DIR}/deltax.cpp +${MODEL_DIR}/dxdotdp.cpp +${MODEL_DIR}/dydx.cpp +${MODEL_DIR}/root.cpp +${MODEL_DIR}/sigmay.cpp +${MODEL_DIR}/stau.cpp +${MODEL_DIR}/sx0.cpp +${MODEL_DIR}/x0.cpp +${MODEL_DIR}/xdot.cpp +${MODEL_DIR}/y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) diff --git a/models/model_nested_events/model_nested_events_JSparse.cpp b/models/model_nested_events/JSparse.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_JSparse.cpp rename to models/model_nested_events/JSparse.cpp diff --git a/models/model_nested_events/model_nested_events_Jy.cpp b/models/model_nested_events/Jy.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_Jy.cpp rename to models/model_nested_events/Jy.cpp diff --git a/models/model_nested_events/model_nested_events_dJydsigma.cpp b/models/model_nested_events/dJydsigma.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_dJydsigma.cpp rename to models/model_nested_events/dJydsigma.cpp diff --git a/models/model_nested_events/model_nested_events_dJydy.cpp b/models/model_nested_events/dJydy.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_dJydy.cpp rename to models/model_nested_events/dJydy.cpp diff --git a/models/model_nested_events/model_nested_events_deltaqB.cpp b/models/model_nested_events/deltaqB.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_deltaqB.cpp rename to models/model_nested_events/deltaqB.cpp diff --git a/models/model_nested_events/model_nested_events_deltasx.cpp b/models/model_nested_events/deltasx.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_deltasx.cpp rename to models/model_nested_events/deltasx.cpp diff --git a/models/model_nested_events/model_nested_events_deltax.cpp b/models/model_nested_events/deltax.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_deltax.cpp rename to models/model_nested_events/deltax.cpp diff --git a/models/model_nested_events/model_nested_events_dxdotdp.cpp b/models/model_nested_events/dxdotdp.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_dxdotdp.cpp rename to models/model_nested_events/dxdotdp.cpp diff --git a/models/model_nested_events/model_nested_events_dydx.cpp b/models/model_nested_events/dydx.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_dydx.cpp rename to models/model_nested_events/dydx.cpp diff --git a/models/model_nested_events/model_nested_events.h b/models/model_nested_events/model_nested_events.h index 0c8e55c7c9..9b58f59c06 100644 --- a/models/model_nested_events/model_nested_events.h +++ b/models/model_nested_events/model_nested_events.h @@ -1,6 +1,6 @@ #ifndef _amici_model_nested_events_h #define _amici_model_nested_events_h -/* Generated by amiwrap (R2017b) b04ab2326fb34f3721a15806d9783ff22b6a015a */ +/* Generated by amiwrap (R2017b) 6819ebf5b2b2a61b92214b4cfbd78c9f663f408b */ #include #include #include "amici/defines.h" @@ -73,7 +73,7 @@ class Model_model_nested_events : public amici::Model_ODE { amici::Model* clone() const override { return new Model_model_nested_events(*this); }; - std::string getAmiciCommit() const override { return "b04ab2326fb34f3721a15806d9783ff22b6a015a"; }; + std::string getAmiciCommit() const override { return "6819ebf5b2b2a61b92214b4cfbd78c9f663f408b"; }; void fJSparse(SUNMatrixContent_Sparse JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx) override { JSparse_model_nested_events(JSparse, t, x, p, k, h, w, dwdx); diff --git a/models/model_nested_events/model_nested_events_root.cpp b/models/model_nested_events/root.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_root.cpp rename to models/model_nested_events/root.cpp diff --git a/models/model_nested_events/model_nested_events_sigmay.cpp b/models/model_nested_events/sigmay.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_sigmay.cpp rename to models/model_nested_events/sigmay.cpp diff --git a/models/model_nested_events/model_nested_events_stau.cpp b/models/model_nested_events/stau.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_stau.cpp rename to models/model_nested_events/stau.cpp diff --git a/models/model_nested_events/swig/CMakeLists.txt b/models/model_nested_events/swig/CMakeLists.txt index 6642236fda..4e20c59ff0 100644 --- a/models/model_nested_events/swig/CMakeLists.txt +++ b/models/model_nested_events/swig/CMakeLists.txt @@ -1,16 +1,4 @@ -cmake_minimum_required(VERSION 3.8) # swig_add_library - -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif(POLICY CMP0078) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif(POLICY CMP0086) - +cmake_minimum_required(VERSION 3.15) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) @@ -18,14 +6,10 @@ include(${SWIG_USE_FILE}) if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - include_directories(${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -else() - find_package(Python3 COMPONENTS Interpreter Development) - include_directories(${Python3_INCLUDE_DIRS}) -endif() +# We don't need "Interpreter" here, but without that, FindPython3 will +# ignore the Python version selected via $Python3_EXECUTABLE +find_package(Python3 COMPONENTS Interpreter Development) +include_directories(${Python3_INCLUDE_DIRS}) set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") diff --git a/models/model_nested_events/swig/model_nested_events.i b/models/model_nested_events/swig/model_nested_events.i index 3c12b36d5f..bec3ccac55 100644 --- a/models/model_nested_events/swig/model_nested_events.i +++ b/models/model_nested_events/swig/model_nested_events.i @@ -10,5 +10,13 @@ using namespace amici; %} +// Make model module accessible from the model +%feature("pythonappend") amici::generic_model::getModel %{ + if '.' in __name__: + import sys + val.module = sys.modules['.'.join(__name__.split('.')[:-1])] +%} + + // Process symbols in header %include "wrapfunctions.h" diff --git a/models/model_nested_events/model_nested_events_sx0.cpp b/models/model_nested_events/sx0.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_sx0.cpp rename to models/model_nested_events/sx0.cpp diff --git a/models/model_nested_events/model_nested_events_x0.cpp b/models/model_nested_events/x0.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_x0.cpp rename to models/model_nested_events/x0.cpp diff --git a/models/model_nested_events/model_nested_events_xdot.cpp b/models/model_nested_events/xdot.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_xdot.cpp rename to models/model_nested_events/xdot.cpp diff --git a/models/model_nested_events/model_nested_events_y.cpp b/models/model_nested_events/y.cpp similarity index 100% rename from models/model_nested_events/model_nested_events_y.cpp rename to models/model_nested_events/y.cpp diff --git a/models/model_neuron/CMakeLists.txt b/models/model_neuron/CMakeLists.txt index 1dc56d5ffe..77b71bb7b2 100644 --- a/models/model_neuron/CMakeLists.txt +++ b/models/model_neuron/CMakeLists.txt @@ -1,15 +1,4 @@ -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) -endif(POLICY CMP0060) -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif(POLICY CMP0065) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(model_neuron) @@ -30,41 +19,41 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(SRC_LIST_LIB ${MODEL_DIR}/model_neuron_JSparse.cpp -${MODEL_DIR}/model_neuron_Jrz.cpp -${MODEL_DIR}/model_neuron_Jy.cpp -${MODEL_DIR}/model_neuron_Jz.cpp -${MODEL_DIR}/model_neuron_dJrzdsigma.cpp -${MODEL_DIR}/model_neuron_dJrzdz.cpp -${MODEL_DIR}/model_neuron_dJydsigma.cpp -${MODEL_DIR}/model_neuron_dJydy.cpp -${MODEL_DIR}/model_neuron_dJzdsigma.cpp -${MODEL_DIR}/model_neuron_dJzdz.cpp -${MODEL_DIR}/model_neuron_deltaqB.cpp -${MODEL_DIR}/model_neuron_deltasx.cpp -${MODEL_DIR}/model_neuron_deltax.cpp -${MODEL_DIR}/model_neuron_deltaxB.cpp -${MODEL_DIR}/model_neuron_drzdx.cpp -${MODEL_DIR}/model_neuron_dxdotdp.cpp -${MODEL_DIR}/model_neuron_dydx.cpp -${MODEL_DIR}/model_neuron_dzdx.cpp -${MODEL_DIR}/model_neuron_root.cpp -${MODEL_DIR}/model_neuron_rz.cpp -${MODEL_DIR}/model_neuron_sigmay.cpp -${MODEL_DIR}/model_neuron_sigmaz.cpp -${MODEL_DIR}/model_neuron_srz.cpp -${MODEL_DIR}/model_neuron_stau.cpp -${MODEL_DIR}/model_neuron_sx0.cpp -${MODEL_DIR}/model_neuron_sz.cpp -${MODEL_DIR}/model_neuron_x0.cpp -${MODEL_DIR}/model_neuron_xdot.cpp -${MODEL_DIR}/model_neuron_y.cpp -${MODEL_DIR}/model_neuron_z.cpp +set(SRC_LIST_LIB ${MODEL_DIR}/JSparse.cpp +${MODEL_DIR}/Jrz.cpp +${MODEL_DIR}/Jy.cpp +${MODEL_DIR}/Jz.cpp +${MODEL_DIR}/dJrzdsigma.cpp +${MODEL_DIR}/dJrzdz.cpp +${MODEL_DIR}/dJydsigma.cpp +${MODEL_DIR}/dJydy.cpp +${MODEL_DIR}/dJzdsigma.cpp +${MODEL_DIR}/dJzdz.cpp +${MODEL_DIR}/deltaqB.cpp +${MODEL_DIR}/deltasx.cpp +${MODEL_DIR}/deltax.cpp +${MODEL_DIR}/deltaxB.cpp +${MODEL_DIR}/drzdx.cpp +${MODEL_DIR}/dxdotdp.cpp +${MODEL_DIR}/dydx.cpp +${MODEL_DIR}/dzdx.cpp +${MODEL_DIR}/root.cpp +${MODEL_DIR}/rz.cpp +${MODEL_DIR}/sigmay.cpp +${MODEL_DIR}/sigmaz.cpp +${MODEL_DIR}/srz.cpp +${MODEL_DIR}/stau.cpp +${MODEL_DIR}/sx0.cpp +${MODEL_DIR}/sz.cpp +${MODEL_DIR}/x0.cpp +${MODEL_DIR}/xdot.cpp +${MODEL_DIR}/y.cpp +${MODEL_DIR}/z.cpp ${MODEL_DIR}/wrapfunctions.cpp ) diff --git a/models/model_neuron/model_neuron_JSparse.cpp b/models/model_neuron/JSparse.cpp similarity index 100% rename from models/model_neuron/model_neuron_JSparse.cpp rename to models/model_neuron/JSparse.cpp diff --git a/models/model_neuron/model_neuron_Jrz.cpp b/models/model_neuron/Jrz.cpp similarity index 100% rename from models/model_neuron/model_neuron_Jrz.cpp rename to models/model_neuron/Jrz.cpp diff --git a/models/model_neuron/model_neuron_Jy.cpp b/models/model_neuron/Jy.cpp similarity index 100% rename from models/model_neuron/model_neuron_Jy.cpp rename to models/model_neuron/Jy.cpp diff --git a/models/model_neuron/model_neuron_Jz.cpp b/models/model_neuron/Jz.cpp similarity index 100% rename from models/model_neuron/model_neuron_Jz.cpp rename to models/model_neuron/Jz.cpp diff --git a/models/model_neuron/model_neuron_dJrzdsigma.cpp b/models/model_neuron/dJrzdsigma.cpp similarity index 100% rename from models/model_neuron/model_neuron_dJrzdsigma.cpp rename to models/model_neuron/dJrzdsigma.cpp diff --git a/models/model_neuron/model_neuron_dJrzdz.cpp b/models/model_neuron/dJrzdz.cpp similarity index 100% rename from models/model_neuron/model_neuron_dJrzdz.cpp rename to models/model_neuron/dJrzdz.cpp diff --git a/models/model_neuron/model_neuron_dJydsigma.cpp b/models/model_neuron/dJydsigma.cpp similarity index 100% rename from models/model_neuron/model_neuron_dJydsigma.cpp rename to models/model_neuron/dJydsigma.cpp diff --git a/models/model_neuron/model_neuron_dJydy.cpp b/models/model_neuron/dJydy.cpp similarity index 100% rename from models/model_neuron/model_neuron_dJydy.cpp rename to models/model_neuron/dJydy.cpp diff --git a/models/model_neuron/model_neuron_dJzdsigma.cpp b/models/model_neuron/dJzdsigma.cpp similarity index 100% rename from models/model_neuron/model_neuron_dJzdsigma.cpp rename to models/model_neuron/dJzdsigma.cpp diff --git a/models/model_neuron/model_neuron_dJzdz.cpp b/models/model_neuron/dJzdz.cpp similarity index 100% rename from models/model_neuron/model_neuron_dJzdz.cpp rename to models/model_neuron/dJzdz.cpp diff --git a/models/model_neuron/model_neuron_deltaqB.cpp b/models/model_neuron/deltaqB.cpp similarity index 100% rename from models/model_neuron/model_neuron_deltaqB.cpp rename to models/model_neuron/deltaqB.cpp diff --git a/models/model_neuron/model_neuron_deltasx.cpp b/models/model_neuron/deltasx.cpp similarity index 100% rename from models/model_neuron/model_neuron_deltasx.cpp rename to models/model_neuron/deltasx.cpp diff --git a/models/model_neuron/model_neuron_deltax.cpp b/models/model_neuron/deltax.cpp similarity index 100% rename from models/model_neuron/model_neuron_deltax.cpp rename to models/model_neuron/deltax.cpp diff --git a/models/model_neuron/model_neuron_deltaxB.cpp b/models/model_neuron/deltaxB.cpp similarity index 100% rename from models/model_neuron/model_neuron_deltaxB.cpp rename to models/model_neuron/deltaxB.cpp diff --git a/models/model_neuron/model_neuron_drzdx.cpp b/models/model_neuron/drzdx.cpp similarity index 100% rename from models/model_neuron/model_neuron_drzdx.cpp rename to models/model_neuron/drzdx.cpp diff --git a/models/model_neuron/model_neuron_dxdotdp.cpp b/models/model_neuron/dxdotdp.cpp similarity index 100% rename from models/model_neuron/model_neuron_dxdotdp.cpp rename to models/model_neuron/dxdotdp.cpp diff --git a/models/model_neuron/model_neuron_dydx.cpp b/models/model_neuron/dydx.cpp similarity index 100% rename from models/model_neuron/model_neuron_dydx.cpp rename to models/model_neuron/dydx.cpp diff --git a/models/model_neuron/model_neuron_dzdx.cpp b/models/model_neuron/dzdx.cpp similarity index 100% rename from models/model_neuron/model_neuron_dzdx.cpp rename to models/model_neuron/dzdx.cpp diff --git a/models/model_neuron/model_neuron.h b/models/model_neuron/model_neuron.h index 0c54682f0d..fd7518e7b7 100644 --- a/models/model_neuron/model_neuron.h +++ b/models/model_neuron/model_neuron.h @@ -1,6 +1,6 @@ #ifndef _amici_model_neuron_h #define _amici_model_neuron_h -/* Generated by amiwrap (R2017b) b04ab2326fb34f3721a15806d9783ff22b6a015a */ +/* Generated by amiwrap (R2017b) 6819ebf5b2b2a61b92214b4cfbd78c9f663f408b */ #include #include #include "amici/defines.h" @@ -87,7 +87,7 @@ class Model_model_neuron : public amici::Model_ODE { amici::Model* clone() const override { return new Model_model_neuron(*this); }; - std::string getAmiciCommit() const override { return "b04ab2326fb34f3721a15806d9783ff22b6a015a"; }; + std::string getAmiciCommit() const override { return "6819ebf5b2b2a61b92214b4cfbd78c9f663f408b"; }; void fJSparse(SUNMatrixContent_Sparse JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx) override { JSparse_model_neuron(JSparse, t, x, p, k, h, w, dwdx); diff --git a/models/model_neuron/model_neuron_root.cpp b/models/model_neuron/root.cpp similarity index 100% rename from models/model_neuron/model_neuron_root.cpp rename to models/model_neuron/root.cpp diff --git a/models/model_neuron/model_neuron_rz.cpp b/models/model_neuron/rz.cpp similarity index 100% rename from models/model_neuron/model_neuron_rz.cpp rename to models/model_neuron/rz.cpp diff --git a/models/model_neuron/model_neuron_sigmay.cpp b/models/model_neuron/sigmay.cpp similarity index 100% rename from models/model_neuron/model_neuron_sigmay.cpp rename to models/model_neuron/sigmay.cpp diff --git a/models/model_neuron/model_neuron_sigmaz.cpp b/models/model_neuron/sigmaz.cpp similarity index 100% rename from models/model_neuron/model_neuron_sigmaz.cpp rename to models/model_neuron/sigmaz.cpp diff --git a/models/model_neuron/model_neuron_srz.cpp b/models/model_neuron/srz.cpp similarity index 100% rename from models/model_neuron/model_neuron_srz.cpp rename to models/model_neuron/srz.cpp diff --git a/models/model_neuron/model_neuron_stau.cpp b/models/model_neuron/stau.cpp similarity index 100% rename from models/model_neuron/model_neuron_stau.cpp rename to models/model_neuron/stau.cpp diff --git a/models/model_neuron/swig/CMakeLists.txt b/models/model_neuron/swig/CMakeLists.txt index 6642236fda..4e20c59ff0 100644 --- a/models/model_neuron/swig/CMakeLists.txt +++ b/models/model_neuron/swig/CMakeLists.txt @@ -1,16 +1,4 @@ -cmake_minimum_required(VERSION 3.8) # swig_add_library - -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif(POLICY CMP0078) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif(POLICY CMP0086) - +cmake_minimum_required(VERSION 3.15) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) @@ -18,14 +6,10 @@ include(${SWIG_USE_FILE}) if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - include_directories(${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -else() - find_package(Python3 COMPONENTS Interpreter Development) - include_directories(${Python3_INCLUDE_DIRS}) -endif() +# We don't need "Interpreter" here, but without that, FindPython3 will +# ignore the Python version selected via $Python3_EXECUTABLE +find_package(Python3 COMPONENTS Interpreter Development) +include_directories(${Python3_INCLUDE_DIRS}) set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") diff --git a/models/model_neuron/swig/model_neuron.i b/models/model_neuron/swig/model_neuron.i index 4511c79a44..856ba04978 100644 --- a/models/model_neuron/swig/model_neuron.i +++ b/models/model_neuron/swig/model_neuron.i @@ -10,5 +10,13 @@ using namespace amici; %} +// Make model module accessible from the model +%feature("pythonappend") amici::generic_model::getModel %{ + if '.' in __name__: + import sys + val.module = sys.modules['.'.join(__name__.split('.')[:-1])] +%} + + // Process symbols in header %include "wrapfunctions.h" diff --git a/models/model_neuron/model_neuron_sx0.cpp b/models/model_neuron/sx0.cpp similarity index 100% rename from models/model_neuron/model_neuron_sx0.cpp rename to models/model_neuron/sx0.cpp diff --git a/models/model_neuron/model_neuron_sz.cpp b/models/model_neuron/sz.cpp similarity index 100% rename from models/model_neuron/model_neuron_sz.cpp rename to models/model_neuron/sz.cpp diff --git a/models/model_neuron/model_neuron_x0.cpp b/models/model_neuron/x0.cpp similarity index 100% rename from models/model_neuron/model_neuron_x0.cpp rename to models/model_neuron/x0.cpp diff --git a/models/model_neuron/model_neuron_xdot.cpp b/models/model_neuron/xdot.cpp similarity index 100% rename from models/model_neuron/model_neuron_xdot.cpp rename to models/model_neuron/xdot.cpp diff --git a/models/model_neuron/model_neuron_y.cpp b/models/model_neuron/y.cpp similarity index 100% rename from models/model_neuron/model_neuron_y.cpp rename to models/model_neuron/y.cpp diff --git a/models/model_neuron/model_neuron_z.cpp b/models/model_neuron/z.cpp similarity index 100% rename from models/model_neuron/model_neuron_z.cpp rename to models/model_neuron/z.cpp diff --git a/models/model_neuron_o2/CMakeLists.txt b/models/model_neuron_o2/CMakeLists.txt index ca9d1e1794..ef803c72dd 100644 --- a/models/model_neuron_o2/CMakeLists.txt +++ b/models/model_neuron_o2/CMakeLists.txt @@ -1,15 +1,4 @@ -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) -endif(POLICY CMP0060) -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif(POLICY CMP0065) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(model_neuron_o2) @@ -30,43 +19,43 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(SRC_LIST_LIB ${MODEL_DIR}/model_neuron_o2_JSparse.cpp -${MODEL_DIR}/model_neuron_o2_Jrz.cpp -${MODEL_DIR}/model_neuron_o2_Jy.cpp -${MODEL_DIR}/model_neuron_o2_Jz.cpp -${MODEL_DIR}/model_neuron_o2_dJrzdsigma.cpp -${MODEL_DIR}/model_neuron_o2_dJrzdz.cpp -${MODEL_DIR}/model_neuron_o2_dJydsigma.cpp -${MODEL_DIR}/model_neuron_o2_dJydy.cpp -${MODEL_DIR}/model_neuron_o2_dJzdsigma.cpp -${MODEL_DIR}/model_neuron_o2_dJzdz.cpp -${MODEL_DIR}/model_neuron_o2_deltaqB.cpp -${MODEL_DIR}/model_neuron_o2_deltasx.cpp -${MODEL_DIR}/model_neuron_o2_deltax.cpp -${MODEL_DIR}/model_neuron_o2_deltaxB.cpp -${MODEL_DIR}/model_neuron_o2_drzdx.cpp -${MODEL_DIR}/model_neuron_o2_dwdx.cpp -${MODEL_DIR}/model_neuron_o2_dxdotdp.cpp -${MODEL_DIR}/model_neuron_o2_dydx.cpp -${MODEL_DIR}/model_neuron_o2_dzdx.cpp -${MODEL_DIR}/model_neuron_o2_root.cpp -${MODEL_DIR}/model_neuron_o2_rz.cpp -${MODEL_DIR}/model_neuron_o2_sigmay.cpp -${MODEL_DIR}/model_neuron_o2_sigmaz.cpp -${MODEL_DIR}/model_neuron_o2_srz.cpp -${MODEL_DIR}/model_neuron_o2_stau.cpp -${MODEL_DIR}/model_neuron_o2_sx0.cpp -${MODEL_DIR}/model_neuron_o2_sz.cpp -${MODEL_DIR}/model_neuron_o2_w.cpp -${MODEL_DIR}/model_neuron_o2_x0.cpp -${MODEL_DIR}/model_neuron_o2_xdot.cpp -${MODEL_DIR}/model_neuron_o2_y.cpp -${MODEL_DIR}/model_neuron_o2_z.cpp +set(SRC_LIST_LIB ${MODEL_DIR}/JSparse.cpp +${MODEL_DIR}/Jrz.cpp +${MODEL_DIR}/Jy.cpp +${MODEL_DIR}/Jz.cpp +${MODEL_DIR}/dJrzdsigma.cpp +${MODEL_DIR}/dJrzdz.cpp +${MODEL_DIR}/dJydsigma.cpp +${MODEL_DIR}/dJydy.cpp +${MODEL_DIR}/dJzdsigma.cpp +${MODEL_DIR}/dJzdz.cpp +${MODEL_DIR}/deltaqB.cpp +${MODEL_DIR}/deltasx.cpp +${MODEL_DIR}/deltax.cpp +${MODEL_DIR}/deltaxB.cpp +${MODEL_DIR}/drzdx.cpp +${MODEL_DIR}/dwdx.cpp +${MODEL_DIR}/dxdotdp.cpp +${MODEL_DIR}/dydx.cpp +${MODEL_DIR}/dzdx.cpp +${MODEL_DIR}/root.cpp +${MODEL_DIR}/rz.cpp +${MODEL_DIR}/sigmay.cpp +${MODEL_DIR}/sigmaz.cpp +${MODEL_DIR}/srz.cpp +${MODEL_DIR}/stau.cpp +${MODEL_DIR}/sx0.cpp +${MODEL_DIR}/sz.cpp +${MODEL_DIR}/w.cpp +${MODEL_DIR}/x0.cpp +${MODEL_DIR}/xdot.cpp +${MODEL_DIR}/y.cpp +${MODEL_DIR}/z.cpp ${MODEL_DIR}/wrapfunctions.cpp ) diff --git a/models/model_neuron_o2/model_neuron_o2_JSparse.cpp b/models/model_neuron_o2/JSparse.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_JSparse.cpp rename to models/model_neuron_o2/JSparse.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_Jrz.cpp b/models/model_neuron_o2/Jrz.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_Jrz.cpp rename to models/model_neuron_o2/Jrz.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_Jy.cpp b/models/model_neuron_o2/Jy.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_Jy.cpp rename to models/model_neuron_o2/Jy.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_Jz.cpp b/models/model_neuron_o2/Jz.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_Jz.cpp rename to models/model_neuron_o2/Jz.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_dJrzdsigma.cpp b/models/model_neuron_o2/dJrzdsigma.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_dJrzdsigma.cpp rename to models/model_neuron_o2/dJrzdsigma.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_dJrzdz.cpp b/models/model_neuron_o2/dJrzdz.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_dJrzdz.cpp rename to models/model_neuron_o2/dJrzdz.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_dJydsigma.cpp b/models/model_neuron_o2/dJydsigma.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_dJydsigma.cpp rename to models/model_neuron_o2/dJydsigma.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_dJydy.cpp b/models/model_neuron_o2/dJydy.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_dJydy.cpp rename to models/model_neuron_o2/dJydy.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_dJzdsigma.cpp b/models/model_neuron_o2/dJzdsigma.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_dJzdsigma.cpp rename to models/model_neuron_o2/dJzdsigma.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_dJzdz.cpp b/models/model_neuron_o2/dJzdz.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_dJzdz.cpp rename to models/model_neuron_o2/dJzdz.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_deltaqB.cpp b/models/model_neuron_o2/deltaqB.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_deltaqB.cpp rename to models/model_neuron_o2/deltaqB.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_deltasx.cpp b/models/model_neuron_o2/deltasx.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_deltasx.cpp rename to models/model_neuron_o2/deltasx.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_deltax.cpp b/models/model_neuron_o2/deltax.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_deltax.cpp rename to models/model_neuron_o2/deltax.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_deltaxB.cpp b/models/model_neuron_o2/deltaxB.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_deltaxB.cpp rename to models/model_neuron_o2/deltaxB.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_drzdx.cpp b/models/model_neuron_o2/drzdx.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_drzdx.cpp rename to models/model_neuron_o2/drzdx.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_dwdx.cpp b/models/model_neuron_o2/dwdx.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_dwdx.cpp rename to models/model_neuron_o2/dwdx.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_dxdotdp.cpp b/models/model_neuron_o2/dxdotdp.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_dxdotdp.cpp rename to models/model_neuron_o2/dxdotdp.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_dydx.cpp b/models/model_neuron_o2/dydx.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_dydx.cpp rename to models/model_neuron_o2/dydx.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_dzdx.cpp b/models/model_neuron_o2/dzdx.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_dzdx.cpp rename to models/model_neuron_o2/dzdx.cpp diff --git a/models/model_neuron_o2/model_neuron_o2.h b/models/model_neuron_o2/model_neuron_o2.h index bb8f565576..b3ef18e5e7 100644 --- a/models/model_neuron_o2/model_neuron_o2.h +++ b/models/model_neuron_o2/model_neuron_o2.h @@ -1,6 +1,6 @@ #ifndef _amici_model_neuron_o2_h #define _amici_model_neuron_o2_h -/* Generated by amiwrap (R2017b) b04ab2326fb34f3721a15806d9783ff22b6a015a */ +/* Generated by amiwrap (R2017b) 6819ebf5b2b2a61b92214b4cfbd78c9f663f408b */ #include #include #include "amici/defines.h" @@ -89,7 +89,7 @@ class Model_model_neuron_o2 : public amici::Model_ODE { amici::Model* clone() const override { return new Model_model_neuron_o2(*this); }; - std::string getAmiciCommit() const override { return "b04ab2326fb34f3721a15806d9783ff22b6a015a"; }; + std::string getAmiciCommit() const override { return "6819ebf5b2b2a61b92214b4cfbd78c9f663f408b"; }; void fJSparse(SUNMatrixContent_Sparse JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx) override { JSparse_model_neuron_o2(JSparse, t, x, p, k, h, w, dwdx); diff --git a/models/model_neuron_o2/model_neuron_o2_root.cpp b/models/model_neuron_o2/root.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_root.cpp rename to models/model_neuron_o2/root.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_rz.cpp b/models/model_neuron_o2/rz.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_rz.cpp rename to models/model_neuron_o2/rz.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_sigmay.cpp b/models/model_neuron_o2/sigmay.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_sigmay.cpp rename to models/model_neuron_o2/sigmay.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_sigmaz.cpp b/models/model_neuron_o2/sigmaz.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_sigmaz.cpp rename to models/model_neuron_o2/sigmaz.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_srz.cpp b/models/model_neuron_o2/srz.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_srz.cpp rename to models/model_neuron_o2/srz.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_stau.cpp b/models/model_neuron_o2/stau.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_stau.cpp rename to models/model_neuron_o2/stau.cpp diff --git a/models/model_neuron_o2/swig/CMakeLists.txt b/models/model_neuron_o2/swig/CMakeLists.txt index 6642236fda..4e20c59ff0 100644 --- a/models/model_neuron_o2/swig/CMakeLists.txt +++ b/models/model_neuron_o2/swig/CMakeLists.txt @@ -1,16 +1,4 @@ -cmake_minimum_required(VERSION 3.8) # swig_add_library - -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif(POLICY CMP0078) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif(POLICY CMP0086) - +cmake_minimum_required(VERSION 3.15) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) @@ -18,14 +6,10 @@ include(${SWIG_USE_FILE}) if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - include_directories(${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -else() - find_package(Python3 COMPONENTS Interpreter Development) - include_directories(${Python3_INCLUDE_DIRS}) -endif() +# We don't need "Interpreter" here, but without that, FindPython3 will +# ignore the Python version selected via $Python3_EXECUTABLE +find_package(Python3 COMPONENTS Interpreter Development) +include_directories(${Python3_INCLUDE_DIRS}) set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") diff --git a/models/model_neuron_o2/swig/model_neuron_o2.i b/models/model_neuron_o2/swig/model_neuron_o2.i index 978b2ffb14..6c9c51ddb2 100644 --- a/models/model_neuron_o2/swig/model_neuron_o2.i +++ b/models/model_neuron_o2/swig/model_neuron_o2.i @@ -10,5 +10,13 @@ using namespace amici; %} +// Make model module accessible from the model +%feature("pythonappend") amici::generic_model::getModel %{ + if '.' in __name__: + import sys + val.module = sys.modules['.'.join(__name__.split('.')[:-1])] +%} + + // Process symbols in header %include "wrapfunctions.h" diff --git a/models/model_neuron_o2/model_neuron_o2_sx0.cpp b/models/model_neuron_o2/sx0.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_sx0.cpp rename to models/model_neuron_o2/sx0.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_sz.cpp b/models/model_neuron_o2/sz.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_sz.cpp rename to models/model_neuron_o2/sz.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_w.cpp b/models/model_neuron_o2/w.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_w.cpp rename to models/model_neuron_o2/w.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_x0.cpp b/models/model_neuron_o2/x0.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_x0.cpp rename to models/model_neuron_o2/x0.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_xdot.cpp b/models/model_neuron_o2/xdot.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_xdot.cpp rename to models/model_neuron_o2/xdot.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_y.cpp b/models/model_neuron_o2/y.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_y.cpp rename to models/model_neuron_o2/y.cpp diff --git a/models/model_neuron_o2/model_neuron_o2_z.cpp b/models/model_neuron_o2/z.cpp similarity index 100% rename from models/model_neuron_o2/model_neuron_o2_z.cpp rename to models/model_neuron_o2/z.cpp diff --git a/models/model_robertson/CMakeLists.txt b/models/model_robertson/CMakeLists.txt index 92be289a22..29988f6dc8 100644 --- a/models/model_robertson/CMakeLists.txt +++ b/models/model_robertson/CMakeLists.txt @@ -1,15 +1,4 @@ -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) -endif(POLICY CMP0060) -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif(POLICY CMP0065) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(model_robertson) @@ -30,25 +19,25 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(SRC_LIST_LIB ${MODEL_DIR}/model_robertson_JSparse.cpp -${MODEL_DIR}/model_robertson_Jy.cpp -${MODEL_DIR}/model_robertson_M.cpp -${MODEL_DIR}/model_robertson_dJydsigma.cpp -${MODEL_DIR}/model_robertson_dJydy.cpp -${MODEL_DIR}/model_robertson_dwdp.cpp -${MODEL_DIR}/model_robertson_dwdx.cpp -${MODEL_DIR}/model_robertson_dxdotdp.cpp -${MODEL_DIR}/model_robertson_dydx.cpp -${MODEL_DIR}/model_robertson_sigmay.cpp -${MODEL_DIR}/model_robertson_w.cpp -${MODEL_DIR}/model_robertson_x0.cpp -${MODEL_DIR}/model_robertson_xdot.cpp -${MODEL_DIR}/model_robertson_y.cpp +set(SRC_LIST_LIB ${MODEL_DIR}/JSparse.cpp +${MODEL_DIR}/Jy.cpp +${MODEL_DIR}/M.cpp +${MODEL_DIR}/dJydsigma.cpp +${MODEL_DIR}/dJydy.cpp +${MODEL_DIR}/dwdp.cpp +${MODEL_DIR}/dwdx.cpp +${MODEL_DIR}/dxdotdp.cpp +${MODEL_DIR}/dydx.cpp +${MODEL_DIR}/sigmay.cpp +${MODEL_DIR}/w.cpp +${MODEL_DIR}/x0.cpp +${MODEL_DIR}/xdot.cpp +${MODEL_DIR}/y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) diff --git a/models/model_robertson/model_robertson_JSparse.cpp b/models/model_robertson/JSparse.cpp similarity index 100% rename from models/model_robertson/model_robertson_JSparse.cpp rename to models/model_robertson/JSparse.cpp diff --git a/models/model_robertson/model_robertson_Jy.cpp b/models/model_robertson/Jy.cpp similarity index 100% rename from models/model_robertson/model_robertson_Jy.cpp rename to models/model_robertson/Jy.cpp diff --git a/models/model_robertson/model_robertson_M.cpp b/models/model_robertson/M.cpp similarity index 100% rename from models/model_robertson/model_robertson_M.cpp rename to models/model_robertson/M.cpp diff --git a/models/model_robertson/model_robertson_dJydsigma.cpp b/models/model_robertson/dJydsigma.cpp similarity index 100% rename from models/model_robertson/model_robertson_dJydsigma.cpp rename to models/model_robertson/dJydsigma.cpp diff --git a/models/model_robertson/model_robertson_dJydy.cpp b/models/model_robertson/dJydy.cpp similarity index 100% rename from models/model_robertson/model_robertson_dJydy.cpp rename to models/model_robertson/dJydy.cpp diff --git a/models/model_robertson/model_robertson_dwdp.cpp b/models/model_robertson/dwdp.cpp similarity index 100% rename from models/model_robertson/model_robertson_dwdp.cpp rename to models/model_robertson/dwdp.cpp diff --git a/models/model_robertson/model_robertson_dwdx.cpp b/models/model_robertson/dwdx.cpp similarity index 100% rename from models/model_robertson/model_robertson_dwdx.cpp rename to models/model_robertson/dwdx.cpp diff --git a/models/model_robertson/model_robertson_dxdotdp.cpp b/models/model_robertson/dxdotdp.cpp similarity index 100% rename from models/model_robertson/model_robertson_dxdotdp.cpp rename to models/model_robertson/dxdotdp.cpp diff --git a/models/model_robertson/model_robertson_dydx.cpp b/models/model_robertson/dydx.cpp similarity index 100% rename from models/model_robertson/model_robertson_dydx.cpp rename to models/model_robertson/dydx.cpp diff --git a/models/model_robertson/model_robertson.h b/models/model_robertson/model_robertson.h index 85ef3fb920..c275a80d24 100644 --- a/models/model_robertson/model_robertson.h +++ b/models/model_robertson/model_robertson.h @@ -1,6 +1,6 @@ #ifndef _amici_model_robertson_h #define _amici_model_robertson_h -/* Generated by amiwrap (R2017b) b04ab2326fb34f3721a15806d9783ff22b6a015a */ +/* Generated by amiwrap (R2017b) 6819ebf5b2b2a61b92214b4cfbd78c9f663f408b */ #include #include #include "amici/defines.h" @@ -71,7 +71,7 @@ class Model_model_robertson : public amici::Model_DAE { amici::Model* clone() const override { return new Model_model_robertson(*this); }; - std::string getAmiciCommit() const override { return "b04ab2326fb34f3721a15806d9783ff22b6a015a"; }; + std::string getAmiciCommit() const override { return "6819ebf5b2b2a61b92214b4cfbd78c9f663f408b"; }; void fJSparse(SUNMatrixContent_Sparse JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype cj, const realtype *dx, const realtype *w, const realtype *dwdx) override { JSparse_model_robertson(JSparse, t, x, p, k, h, cj, dx, w, dwdx); diff --git a/models/model_robertson/model_robertson_sigmay.cpp b/models/model_robertson/sigmay.cpp similarity index 100% rename from models/model_robertson/model_robertson_sigmay.cpp rename to models/model_robertson/sigmay.cpp diff --git a/models/model_robertson/swig/CMakeLists.txt b/models/model_robertson/swig/CMakeLists.txt index 6642236fda..4e20c59ff0 100644 --- a/models/model_robertson/swig/CMakeLists.txt +++ b/models/model_robertson/swig/CMakeLists.txt @@ -1,16 +1,4 @@ -cmake_minimum_required(VERSION 3.8) # swig_add_library - -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif(POLICY CMP0078) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif(POLICY CMP0086) - +cmake_minimum_required(VERSION 3.15) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) @@ -18,14 +6,10 @@ include(${SWIG_USE_FILE}) if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - include_directories(${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -else() - find_package(Python3 COMPONENTS Interpreter Development) - include_directories(${Python3_INCLUDE_DIRS}) -endif() +# We don't need "Interpreter" here, but without that, FindPython3 will +# ignore the Python version selected via $Python3_EXECUTABLE +find_package(Python3 COMPONENTS Interpreter Development) +include_directories(${Python3_INCLUDE_DIRS}) set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") diff --git a/models/model_robertson/swig/model_robertson.i b/models/model_robertson/swig/model_robertson.i index 1027282a23..a6b8705783 100644 --- a/models/model_robertson/swig/model_robertson.i +++ b/models/model_robertson/swig/model_robertson.i @@ -10,5 +10,13 @@ using namespace amici; %} +// Make model module accessible from the model +%feature("pythonappend") amici::generic_model::getModel %{ + if '.' in __name__: + import sys + val.module = sys.modules['.'.join(__name__.split('.')[:-1])] +%} + + // Process symbols in header %include "wrapfunctions.h" diff --git a/models/model_robertson/model_robertson_w.cpp b/models/model_robertson/w.cpp similarity index 100% rename from models/model_robertson/model_robertson_w.cpp rename to models/model_robertson/w.cpp diff --git a/models/model_robertson/model_robertson_x0.cpp b/models/model_robertson/x0.cpp similarity index 100% rename from models/model_robertson/model_robertson_x0.cpp rename to models/model_robertson/x0.cpp diff --git a/models/model_robertson/model_robertson_xdot.cpp b/models/model_robertson/xdot.cpp similarity index 100% rename from models/model_robertson/model_robertson_xdot.cpp rename to models/model_robertson/xdot.cpp diff --git a/models/model_robertson/model_robertson_y.cpp b/models/model_robertson/y.cpp similarity index 100% rename from models/model_robertson/model_robertson_y.cpp rename to models/model_robertson/y.cpp diff --git a/models/model_steadystate/CMakeLists.txt b/models/model_steadystate/CMakeLists.txt index b82e866169..069bb69d70 100644 --- a/models/model_steadystate/CMakeLists.txt +++ b/models/model_steadystate/CMakeLists.txt @@ -1,15 +1,4 @@ -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) -endif(POLICY CMP0060) -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif(POLICY CMP0065) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(model_steadystate) @@ -30,24 +19,24 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) -set(SRC_LIST_LIB ${MODEL_DIR}/model_steadystate_JSparse.cpp -${MODEL_DIR}/model_steadystate_Jy.cpp -${MODEL_DIR}/model_steadystate_dJydsigma.cpp -${MODEL_DIR}/model_steadystate_dJydy.cpp -${MODEL_DIR}/model_steadystate_dwdp.cpp -${MODEL_DIR}/model_steadystate_dwdx.cpp -${MODEL_DIR}/model_steadystate_dxdotdp.cpp -${MODEL_DIR}/model_steadystate_dydx.cpp -${MODEL_DIR}/model_steadystate_sigmay.cpp -${MODEL_DIR}/model_steadystate_w.cpp -${MODEL_DIR}/model_steadystate_x0.cpp -${MODEL_DIR}/model_steadystate_xdot.cpp -${MODEL_DIR}/model_steadystate_y.cpp +set(SRC_LIST_LIB ${MODEL_DIR}/JSparse.cpp +${MODEL_DIR}/Jy.cpp +${MODEL_DIR}/dJydsigma.cpp +${MODEL_DIR}/dJydy.cpp +${MODEL_DIR}/dwdp.cpp +${MODEL_DIR}/dwdx.cpp +${MODEL_DIR}/dxdotdp.cpp +${MODEL_DIR}/dydx.cpp +${MODEL_DIR}/sigmay.cpp +${MODEL_DIR}/w.cpp +${MODEL_DIR}/x0.cpp +${MODEL_DIR}/xdot.cpp +${MODEL_DIR}/y.cpp ${MODEL_DIR}/wrapfunctions.cpp ) diff --git a/models/model_steadystate/model_steadystate_JSparse.cpp b/models/model_steadystate/JSparse.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_JSparse.cpp rename to models/model_steadystate/JSparse.cpp diff --git a/models/model_steadystate/model_steadystate_Jy.cpp b/models/model_steadystate/Jy.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_Jy.cpp rename to models/model_steadystate/Jy.cpp diff --git a/models/model_steadystate/model_steadystate_dJydsigma.cpp b/models/model_steadystate/dJydsigma.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_dJydsigma.cpp rename to models/model_steadystate/dJydsigma.cpp diff --git a/models/model_steadystate/model_steadystate_dJydy.cpp b/models/model_steadystate/dJydy.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_dJydy.cpp rename to models/model_steadystate/dJydy.cpp diff --git a/models/model_steadystate/model_steadystate_dwdp.cpp b/models/model_steadystate/dwdp.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_dwdp.cpp rename to models/model_steadystate/dwdp.cpp diff --git a/models/model_steadystate/model_steadystate_dwdx.cpp b/models/model_steadystate/dwdx.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_dwdx.cpp rename to models/model_steadystate/dwdx.cpp diff --git a/models/model_steadystate/model_steadystate_dxdotdp.cpp b/models/model_steadystate/dxdotdp.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_dxdotdp.cpp rename to models/model_steadystate/dxdotdp.cpp diff --git a/models/model_steadystate/model_steadystate_dydx.cpp b/models/model_steadystate/dydx.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_dydx.cpp rename to models/model_steadystate/dydx.cpp diff --git a/models/model_steadystate/model_steadystate.h b/models/model_steadystate/model_steadystate.h index 6694fc6b36..ca903269eb 100644 --- a/models/model_steadystate/model_steadystate.h +++ b/models/model_steadystate/model_steadystate.h @@ -1,6 +1,6 @@ #ifndef _amici_model_steadystate_h #define _amici_model_steadystate_h -/* Generated by amiwrap (R2017b) b04ab2326fb34f3721a15806d9783ff22b6a015a */ +/* Generated by amiwrap (R2017b) 6819ebf5b2b2a61b92214b4cfbd78c9f663f408b */ #include #include #include "amici/defines.h" @@ -70,7 +70,7 @@ class Model_model_steadystate : public amici::Model_ODE { amici::Model* clone() const override { return new Model_model_steadystate(*this); }; - std::string getAmiciCommit() const override { return "b04ab2326fb34f3721a15806d9783ff22b6a015a"; }; + std::string getAmiciCommit() const override { return "6819ebf5b2b2a61b92214b4cfbd78c9f663f408b"; }; void fJSparse(SUNMatrixContent_Sparse JSparse, const realtype t, const realtype *x, const realtype *p, const realtype *k, const realtype *h, const realtype *w, const realtype *dwdx) override { JSparse_model_steadystate(JSparse, t, x, p, k, h, w, dwdx); diff --git a/models/model_steadystate/model_steadystate_sigmay.cpp b/models/model_steadystate/sigmay.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_sigmay.cpp rename to models/model_steadystate/sigmay.cpp diff --git a/models/model_steadystate/swig/CMakeLists.txt b/models/model_steadystate/swig/CMakeLists.txt index 6642236fda..4e20c59ff0 100644 --- a/models/model_steadystate/swig/CMakeLists.txt +++ b/models/model_steadystate/swig/CMakeLists.txt @@ -1,16 +1,4 @@ -cmake_minimum_required(VERSION 3.8) # swig_add_library - -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif(POLICY CMP0078) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif(POLICY CMP0086) - +cmake_minimum_required(VERSION 3.15) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) @@ -18,14 +6,10 @@ include(${SWIG_USE_FILE}) if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - include_directories(${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -else() - find_package(Python3 COMPONENTS Interpreter Development) - include_directories(${Python3_INCLUDE_DIRS}) -endif() +# We don't need "Interpreter" here, but without that, FindPython3 will +# ignore the Python version selected via $Python3_EXECUTABLE +find_package(Python3 COMPONENTS Interpreter Development) +include_directories(${Python3_INCLUDE_DIRS}) set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") diff --git a/models/model_steadystate/swig/model_steadystate.i b/models/model_steadystate/swig/model_steadystate.i index f8f6865dac..e96f7db31d 100644 --- a/models/model_steadystate/swig/model_steadystate.i +++ b/models/model_steadystate/swig/model_steadystate.i @@ -10,5 +10,13 @@ using namespace amici; %} +// Make model module accessible from the model +%feature("pythonappend") amici::generic_model::getModel %{ + if '.' in __name__: + import sys + val.module = sys.modules['.'.join(__name__.split('.')[:-1])] +%} + + // Process symbols in header %include "wrapfunctions.h" diff --git a/models/model_steadystate/model_steadystate_w.cpp b/models/model_steadystate/w.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_w.cpp rename to models/model_steadystate/w.cpp diff --git a/models/model_steadystate/model_steadystate_x0.cpp b/models/model_steadystate/x0.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_x0.cpp rename to models/model_steadystate/x0.cpp diff --git a/models/model_steadystate/model_steadystate_xdot.cpp b/models/model_steadystate/xdot.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_xdot.cpp rename to models/model_steadystate/xdot.cpp diff --git a/models/model_steadystate/model_steadystate_y.cpp b/models/model_steadystate/y.cpp similarity index 100% rename from models/model_steadystate/model_steadystate_y.cpp rename to models/model_steadystate/y.cpp diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 4657580721..e94a0a2a0b 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -1,11 +1,7 @@ if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonInterp 3.8 REQUIRED) -else() - find_package(Python3 COMPONENTS Interpreter) -endif() +find_package(Python3 COMPONENTS Interpreter) add_custom_target( install-python diff --git a/python/examples/example_errors.ipynb b/python/examples/example_errors.ipynb index d4f207c819..31325d4dd7 100644 --- a/python/examples/example_errors.ipynb +++ b/python/examples/example_errors.ipynb @@ -91,7 +91,7 @@ " scaled_parameters=True\n", ")\n", "print(\"Status:\", [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]])\n", - "assert [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]] == ['AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_TOO_MUCH_WORK', 'AMICI_SUCCESS', 'AMICI_SUCCESS']" + "assert [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]] == ['AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_TOO_MUCH_WORK', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN']" ] }, { @@ -201,7 +201,7 @@ "source": [ "**What happened?**\n", "\n", - "The forward simulation failed because AMICI the solver exceeded the maximum number of steps. Unlike in the previous case of `mxstep steps taken before reaching tout` (see above), here we got several additional warnings that the current step size $h$ is numerically zero.\n", + "The forward simulation failed because the AMICI solver exceeded the maximum number of steps. Unlike in the previous case of `mxstep steps taken before reaching tout` (see above), here we got several additional warnings that the current step size $h$ is numerically zero.\n", "\n", "**How to address?**\n", "\n", @@ -291,7 +291,7 @@ ")\n", "print(\"Status:\", [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]])\n", "\n", - "assert [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]] == ['AMICI_SUCCESS', 'AMICI_ERR_FAILURE', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS']" + "assert [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]] == ['AMICI_SUCCESS', 'AMICI_ERR_FAILURE', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN']" ] }, { @@ -397,7 +397,7 @@ " scaled_parameters=True\n", ")\n", "print(\"Status:\", [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]])\n", - "assert [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]] == ['AMICI_ERROR', 'AMICI_SUCCESS']" + "assert [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]] == ['AMICI_ERROR', 'AMICI_NOT_RUN']" ] }, { @@ -502,7 +502,7 @@ "[![](https://mermaid.ink/img/pako:eNpdkrFuwyAQhl8FIWVL1MwMndKFtd1wBmJIg2IDwucCivLuxQp2zvaA_P1398Od7kFbpzRl9DdIfyM_p8aS8t3FnZHW2QGkheH8Er3wjHgZZK9Bh1kFAYyA6XXldBTpyIixBozsSHGAJSQSWwlccEa4bN3FSFu1KCIjOvmgh8GUF8y1yoGYDkZU-lBQ5SwyI-4y6PAnL52esl-B3a68pDZDDofPhfyKYEVLacSVERdGXFchzYAu59iBYweOHTh2qBAxvLupI3s9eJ41pndqGdOqvYXThv2G7xuOiBf7jHMzNsr41oyvzNgv0z3tdeilUWXzHlOooXDTvW4oK79KX-XYQUMb-yypcgT3nW1LGYRR7-noVVmhk5FlZ3vKrrIbFvVLGXChis9_j9jNUw?type=png)](https://mermaid.live/edit#pako:eNpdkrFuwyAQhl8FIWVL1MwMndKFtd1wBmJIg2IDwucCivLuxQp2zvaA_P1398Od7kFbpzRl9DdIfyM_p8aS8t3FnZHW2QGkheH8Er3wjHgZZK9Bh1kFAYyA6XXldBTpyIixBozsSHGAJSQSWwlccEa4bN3FSFu1KCIjOvmgh8GUF8y1yoGYDkZU-lBQ5SwyI-4y6PAnL52esl-B3a68pDZDDofPhfyKYEVLacSVERdGXFchzYAu59iBYweOHTh2qBAxvLupI3s9eJ41pndqGdOqvYXThv2G7xuOiBf7jHMzNsr41oyvzNgv0z3tdeilUWXzHlOooXDTvW4oK79KX-XYQUMb-yypcgT3nW1LGYRR7-noVVmhk5FlZ3vKrrIbFvVLGXChis9_j9jNUw)\n", "\n", "Always look for the most basic (furthest up) model quantities.\n", - "In cases where there non-finite values occur in expressions further down, rerunning the simulation after calling `Model.setAlwaysCheckFinite(True)` may give some further hints on where the issue originates.\n", + "In cases where non-finite values occur in expressions further down, rerunning the simulation after calling `Model.setAlwaysCheckFinite(True)` may give some further hints on where the issue originates.\n", "\n", "The `NaN` in $w$ occurred for `flux_v7_v_6` (see error log), i.e., when computing the reaction flux for reaction `v7_v_6`. As $w$ only depends on $(t, p, k, x)$ and no non-finite values have been reported for those, the issue has to be in the respective flux equation.\n", "\n", @@ -516,12 +516,11 @@ "metadata": {}, "outputs": [], "source": [ - "# model name and source code location\n", - "model_name = amici_model.module.__package__\n", + "# model source code location\n", "model_src_dir = Path(amici_model.module.__file__).parents[1]\n", "\n", "# find the problematic expression in the model source code\n", - "!grep flux_v7_v_6 {model_src_dir}/{model_name}_w.cpp" + "!grep flux_v7_v_6 {model_src_dir}/w.cpp" ] }, { @@ -529,7 +528,7 @@ "id": "9f49a00a", "metadata": {}, "source": [ - "What could go wrong? We can obtain `NaN` from any of these symbols symbols being `NaN`, or through division by zero.\n", + "What could go wrong? We can obtain `NaN` from any of these symbols being `NaN`, or through division by zero.\n", "\n", "Let's let's check the denominator first: $$(A\\_state^2 + Kp^2)*(Kd^{n\\_par} + Z\\_state^{n\\_par})$$\n", "\n", @@ -670,7 +669,7 @@ "source": [ "**What happened?**\n", "\n", - "AMICI failed to compute steadystate sensitivities, because it was not able to factorize the Jacobian.\n", + "AMICI failed to compute steady-state sensitivities, because it was not able to factorize the Jacobian.\n", "\n", "**How to address?**\n", "\n", @@ -805,7 +804,7 @@ "\n", "# hard to reproduce on GHA\n", "if os.getenv('GITHUB_ACTIONS') is None:\n", - " assert [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]] == ['AMICI_ERROR', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS']" + " assert [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]] == ['AMICI_ERROR', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN']" ] }, { @@ -815,7 +814,7 @@ "source": [ "**What happened?**\n", "\n", - "All given experimental conditions require pre-equilibration, i.e., finding a steady state. AMICI first tries find a steady state using the Newton solver, if that fails, it tries simulating until steady state, if that also failes, it tries the Newton solver from the end of the simulation. In this case, all three failed. Neither Newton's method nor simulation yielded a steadystate satisfying the required tolerances.\n", + "All given experimental conditions require pre-equilibration, i.e., finding a steady state. AMICI first tries to find a steady state using the Newton solver, if that fails, it tries simulating until steady state, if that also failes, it tries the Newton solver from the end of the simulation. In this case, all three failed. Neither Newton's method nor simulation yielded a steady state satisfying the required tolerances.\n", "\n", "This can also be seen in `ReturnDataView.preeq_status` (the three statuses corresponds to Newton \\#1, Simulation, Newton \\#2):" ] @@ -842,7 +841,7 @@ "\n", "1. Stricter integration tolerances (preferred if affordable - higher accuracy, but generally slower)\n", "\n", - "2. Looser steadystate tolerances (lower accuracy, generally faster)\n", + "2. Looser steady-state tolerances (lower accuracy, generally faster)\n", "\n", "3. Increase the number of allowed steps for Newton's method\n", "\n", @@ -947,7 +946,7 @@ "print(f\"{rdata.preeq_numsteps=}\")\n", "# hard to reproduce on GHA\n", "if os.getenv('GITHUB_ACTIONS') is None:\n", - " assert [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]] == ['AMICI_ERROR', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS', 'AMICI_SUCCESS']" + " assert [amici.simulation_status_to_str(rdata.status) for rdata in res[RDATAS]] == ['AMICI_ERROR', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN', 'AMICI_NOT_RUN']" ] }, { diff --git a/python/examples/example_large_models/example_performance_optimization.ipynb b/python/examples/example_large_models/example_performance_optimization.ipynb new file mode 100644 index 0000000000..9f4cefb144 --- /dev/null +++ b/python/examples/example_large_models/example_performance_optimization.ipynb @@ -0,0 +1,530 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dbe0a770", + "metadata": {}, + "source": [ + "# Speeding up model import and simulation - with a focus on large models\n", + "\n", + "**Objective:** Give some hints to speed up import and simulation of larger models\n", + "\n", + "This notebook gives some hints that may help to speed up import and simulation of (mostly) larger models. While some of these settings may also yield slight performance improvements for smaller models, other settings may make things slower. The impact may be highly model-dependent (number of states, number of parameters, rate expressions) or system-dependent and it's worthile doing some benchmarking.\n", + "\n", + "To simulate models in AMICI, a model specified in a high-level format needs to be imported first, as shown in the following figure. This rougly involves the following steps:\n", + "\n", + "1. Generating the ODEs\n", + "2. Computing derivatives\n", + "3. Generating C++ code\n", + "4. Compiling the generated code\n", + "5. Simulating the model\n", + "\n", + "![AMICI workflow](https://raw.githubusercontent.com/AMICI-dev/AMICI/master/documentation/gfx/amici_workflow.png)\n", + "\n", + "There are various options to speed up individual steps of this process. Generally, faster import comes with slower simulation and vice versa. During parameter estimation, a model is often imported only once, and then millions of simulations are run. Therefore, faster simulation will easily compensate for slower import (one-off cost). In other cases, many models may to have to be imported, but only few simulations will be executed. In this case, faster import may bee more relevant.\n", + "\n", + "In the following, we will present various settings that (may) influence import and simulation time. We will follow the order of steps outlined above.\n", + "\n", + "Since many of the following demonstrations take quite some time to compute, this notebook mostly shows pre-generated results." + ] + }, + { + "cell_type": "code", + "execution_count": 1, + "id": "411be08a", + "metadata": {}, + "outputs": [], + "source": [ + "from IPython.core.pylabtools import figsize, getfigs\n", + "import matplotlib.pyplot as plt\n", + "import pandas as pd\n", + "\n", + "plt.rcParams.update({'font.size': 12})" + ] + }, + { + "cell_type": "markdown", + "id": "bfd50810", + "metadata": {}, + "source": [ + "## Examples\n", + "\n", + "The demos below make use of the following models contained in the [PEtab benchmark collection](https://github.com/Benchmarking-Initiative/Benchmark-Models-PEtab) and other publications:\n", + "\n", + "| Model | # parameters | # states |\n", + "|----------------------------------------------------------------------------------------------------------------------------------------------------------|--------------|----------|\n", + "| [Chen_MSB2009](https://github.com/Benchmarking-Initiative/Benchmark-Models-PEtab/tree/master/Benchmark-Models/Chen_MSB2009) | 155 | 500 |\n", + "| [Froehlich_CellSystems2018](https://github.com/Benchmarking-Initiative/Benchmark-Models-PEtab/tree/master/Benchmark-Models/Froehlich_CellSystems2018) | 4231 | 1396 |\n", + "| [FröhlichGer2022 (RTKERK__base)](https://doi.org/10.1101/2022.02.17.480899) | 105 | 2272 |\n", + "| [hello_pysb](https://github.com/pysb/pysb/blob/master/pysb/examples/hello_pysb.py) | 4 | 3 |\n", + "\n", + "All data has been generated with AMICI v0.15.0 or v0.16.0 unless stated otherwise." + ] + }, + { + "cell_type": "markdown", + "id": "b772af14", + "metadata": {}, + "source": [ + "## Model import\n", + "\n", + "### Symbolic processing\n", + "\n", + "#### Parameters as constants\n", + "\n", + "By default, AMICI will generate sensitivity equations with respect to all model parameters. If it is clear upfront, that sensitivities with respect to certain parameters will not be required, their IDs can be passed to [amici.sbml_import.SbmlImporter.sbml2amici](https://amici.readthedocs.io/en/latest/generated/amici.sbml_import.SbmlImporter.html#amici.sbml_import.SbmlImporter.sbml2amici) or [amici.pysb_import.pysb2amici](https://amici.readthedocs.io/en/latest/generated/amici.pysb_import.html?highlight=pysb2amici#amici.pysb_import.pysb2amici) via the `constant_parameters` argument to not generate the respective equations. This will reduce CPU time and RAM requirements during import and simulation.\n", + "The PEtab import will automatically pass all parameters with `petab.ESTIMATE==False` as `constant_parameters` arguments.\n", + "\n", + "See also the following section for the case that no sensitivities are required at all.\n", + "\n", + "\n", + "#### Not generating sensivitiy code\n", + "\n", + "If only forward simulations of a model are required, a modest import speedup can be obtained from not generating sensitivity code. This can be enabled via the `generate_sensitivity_code` argument of [amici.sbml_import.SbmlImporter.sbml2amici](https://amici.readthedocs.io/en/latest/generated/amici.sbml_import.SbmlImporter.html#amici.sbml_import.SbmlImporter.sbml2amici) or [amici.pysb_import.pysb2amici](https://amici.readthedocs.io/en/latest/generated/amici.pysb_import.html?highlight=pysb2amici#amici.pysb_import.pysb2amici).\n", + "\n", + "Example:\n", + "```bash\n", + "petab_yaml=\"https://raw.githubusercontent.com/Benchmarking-Initiative/Benchmark-Models-PEtab/master/Benchmark-Models/Froehlich_CellSystems2018/Froehlich_CellSystems2018.yaml\"\n", + "/usr/bin/time -v amici_import_petab -y \"$petab_yaml\" --no-compile\n", + "# vs.\n", + "/usr/bin/time -v amici_import_petab -y \"$petab_yaml\" --no-compile --no-sensitivities\n", + "```" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "4f3af02d", + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYUAAAEmCAYAAACNq4wIAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/av/WaAAAACXBIWXMAAAsTAAALEwEAmpwYAAAnIUlEQVR4nO3dd9wcZbn/8c+XJPROYiAFghQ9UZGDUekE4aAUBZUiUpVj5IiiIiL6wwN4LKBYQCwgIKEIIoh0aSGhhyQQAqFGCITQApJAqEm4fn/c904mm919Nnmyzz7J832/Xvva6XvN7MxcM/fM3KOIwMzMDGC5dgdgZmbdh5OCmZkVnBTMzKzgpGBmZgUnBTMzKzgpmJlZwUmhh5M0RFJI6t3uWCokHSrp9nbH0ZNJWl/SbEm92h1LZ0maLGl4g/7XSTqkielsJ+nRJRlbZ7Vi+13mkoKkqZJ2bnccAJJGS/rvdsdhrZE3xo3bHceSUL3dRMTTEbFqRMxrZ1xLQkR8ICJGA0g6QdIFVf13jYiRTUzntoh4X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jMwUzQNLlzH8VacX3IuL6dsSzpEn6HemOsLJTI6LuNQfrmZwUzMys4AvNZmZWcFIwM7OCk4KZmRWcFMzMrPD/AZNexy9UmSkAAAAAAElFTkSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "speedup: 1.25x\n" + ] + } + ], + "source": [ + "figsize(4, 4)\n", + "plt.bar([\"True\", \"False\"], [873.54, 697.85])\n", + "plt.xlabel(\"generate_sensitivity_code\")\n", + "plt.ylabel(\"Import time (s)\")\n", + "plt.title(\"Import speed-up when not generating sensitivity code\\n(Froehlich_CellSystems2018)\");\n", + "plt.show()\n", + "\n", + "print(f\"speedup: {873.54/697.85:.2f}x\")" + ] + }, + { + "cell_type": "markdown", + "id": "490d8987", + "metadata": {}, + "source": [ + "#### Extracting common subexpressions\n", + "\n", + "For some models, the size of the generated model code can be significantly reduced by extracting common subexpressions. This can yield substantial reductions of compile times and RAM-requirements. Very large models might not compile without this option. Extracting common subexpressions can be enabled by setting an environment variable `AMICI_EXTRACT_CSE=1` before model import.\n", + "The downside is, that the generated model code becomes rather unreadable. The increase in import time when enabling this feature is usually <15%, the effect on code size and compile time is highly model dependent. Mostly models with tightly coupled ODEs, as obtained from complex rate laws or spatial discretizations of ODEs, seem to benefit. For models with mass action or similar kinetics, this option seems to not be helpful and rather increases compile time (e.g., for FröhlichGer2022, the compile time doubles).\n", + "\n", + "Benchmark result from [here](https://github.com/AMICI-dev/AMICI/pull/1852) (SBML import, `AMICI_IMPORT_NPROCS=2`, sequential compilation with clang14, `CFLAGS=-O2`):\n", + "\n", + "| | default | `AMICI_EXTRACT_CSE=1` |\n", + "|---------------------|----------------|-----------------------|\n", + "| import time | 160 min (100%) | 164 min (103%) |\n", + "| code size | 89 MB (100%) | 27 MB (30%) |\n", + "| compile time | 169 min (100%) | 90 min (53%) |\n", + "| compile RAM | 7.49 GB (100%) | 1.18 GB (16%) |\n", + "| simulation time (*) | 100% | 97% |\n", + "\n", + "(*) lowest out of 20 identical simulations using ASA" + ] + }, + { + "cell_type": "markdown", + "id": "21421f47", + "metadata": {}, + "source": [ + "#### Parallelization\n", + "\n", + "For large models or complex model expressions, symbolic computation of the derivatives can be quite time consuming. This can be parallelized by setting the environment variable `AMICI_IMPORT_NPROCS` to the number of parallel processes that should be used. The impact strongly depends on the model. Note that setting this value too high may have a negative performance impact (benchmark!).\n", + "\n", + "Impact for a large and a tiny model:" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "49cd66c1", + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEXCAYAAABcRGizAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/av/WaAAAACXBIWXMAAAsTAAALEwEAmpwYAAArkElEQVR4nO3deZhcZZn+8e/de5JOZyeELIQlRGLYM4CgrIqADOGHjIKioGh0RMERRVBn1HFAQEVhUBwUBBxWWSQKCMgiisCQQEwCYQlLNrLvC510d57fH+ftTqXpTnU63V2V9P25rrrqnPdsT1egnnqX8x5FBGZmZltSUugAzMys+DlZmJlZXk4WZmaWl5OFmZnl5WRhZmZ5OVmYmVleThbW7Uj6pKSHCx3HjkRSSNqz0HFY53GysK0m6S1JHyx0HACSnpD0uS1sH5m+yMoayyLilog4roviC0lrJa2RNE/SlZJKJT2YytZIqpO0IWf9l5KOkjQ35zwVku6R9JSkGknfS8etyXmtyHfdnO2bfW7pesslnd4Vn4ttf8ry72JWfCQJUKHjaKP9ImJm+uX9F2BGRJzQuFHSjcDciPhOTtlROcuVwN1AT+C4iFib/fncERFnbs11gV8130nSccCdwNkR8fv2/pG2Y3PNwraJpLPTr92fSloh6Q1Jh6XyOZIWSTorZ/8b0y/nRyStlvQXSbvmbD9M0nOSVqb3w3K2PSHpEklPAeuA3wIfAK5Jv6Cva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xSyGsMfJL0M/AG4MJU33zeA/yLrQG5vfEvIPretavqJiBeAqcAZEfEOWX/RdyS9QtbH8RxZMmtsjvsqcJukGcB0sj4agOOA6ZL+ATxEVmta0N6/x4qTpyg3M7O8XLMwM7O82tzGabYjkfQs7262+VSx3SMg6dtkNyDm+l1EXFKIeKz7cjOUmZnl5WYoMzPLy8nCzMzycrIwM7O8nCzMzCyv/w/kZ8/smJYAIQAAAABJRU5ErkJggg==\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Import time decreased by up to ~44%.\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEXCAYAAACqIS9uAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/av/WaAAAACXBIWXMAAAsTAAALEwEAmpwYAAAp+klEQVR4nO3deZgcZ3Xv8e+ZXbNppJE02ldrF7YBgW0gGGxDDBjMzQMBJ3ZMIHFICJjEwGVJLskNa1hNDCG+YOywGIiBYLPaGBuzKpaMbE9Lsmxrn5Y0I400PZqRZj33j6oe9Yw1UmvU3dU99fs8Tz/TXVVddbpsnXrrvFVvmbsjIiLxURZ1ACIiUlhK/CIiMaPELyISM0r8IiIxo8QvIhIzSvwiIjGjxC+xYmZ/amb3Fmhbbmbnnet3zex2M/tQbqM7d2a2y8yuiDoOOXtK/HJWiukfu5k9aGZ/cZr5i8MEWpGe5u5fd/eXFyZCkeJUceZFRIqLmRlgUcchUqrU4pcJM7M3mdmvzewzZnbUzHaY2QvC6XvNrN3Mrs9Y/nYz+6KZ3Wdm3Wb2CzNblDH/BWb2sJl1hX9fkDHvQTP7sJn9GugFvgr8AXCLmR0zs1tOEeJD4d+j4TKXhLH9KmO9bmZ/Y2ZPhjH9i5ktM7PfmFnKzL5tZlUZy19lZpvD3/sbMz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XfkKJ70NmuA8xlneGwzWwosJWgFrwXGjia6MZw+1pXAf08wtmMEyX/cJ7SF49S/gmBIg8zp5QRnQneHk54Rs7s/DdSH+3Td2PkZPgP83Mx+bMETsZrO/qdIsVPil3y6hiDZEv7NLPf8hKDc8kbgW4UIxt0fAxaHcfzoFIu8wcw2E5wJ/JW7j30oxng+YWbbgW8AHz+HED8HXG9mDWOmTwnj2kgwmNmXx0xPj9N+3zlsGwB3/wqwGvgvgpLX78ys+lzXK8VFiV/yIixZXAZ8KRyG+d3AHxPW5929n6DVeRPB4FzPEJZ3joUt8Fy5m6Bmf6oyz7fC2vZF7v69cNoW4Lljlnsuo/sk3u3uK4D/TdBqn5Dw6VvfIKzVZ8jsJ3h7uO9GphOUpCzje8+IOdyHx8J9mjjFb8qMI+nut7n71QSPDl030d8kxUmJX/LldcBX3X2Ruy929wUEnboLMpb5FPC/z9Cy/ijw+bBEgZnVp6/qmaDbgH8+i9r1J4H3WfD0tPRT1N5PEPtYtwBlZvaH5xDfp4G/InhIS1bCGv47gJvCctDXgReZ2RVhzFMIzib+NfzKJ4D3m9mKcH5Z2ImOmV1pwfMjMLPZQDPP7ASXEqfEL/lyDfC9MdO+A7wv/cHdE1l01P478ADwsJm1EnRuTvixje6+7wxX14xdfjNBS/4eM9sG3AO8J5w+dlkHPkTQeTrR+A4R7LezKq+4+++Bx4Br3P04Qf/KP5jZEwR9Ag8THJjSJa93Anea2VaglaBPA+DlQKuZPQr8lOBs5sBEf48UJw3LLCISM2rxi4jETNZ1RJFiZWYbeGZp5LpiuwbdzD5AcLNapv9y9w9HEY/El0o9IiIxo1KPiEjMKPGLiMSMEr+ISMwo8YuIxMz/B6q2ki00MzIEAAAAAElFTkSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Import time increased by at least ~774%.\n" + ] + } + ], + "source": [ + "df_import = pd.read_csv(\"results_import.tsv\", sep=\"\\t\")\n", + "for model_name, df in df_import.groupby(\"model_name\"):\n", + " plt.plot(df.nprocs, df.time)\n", + " plt.title(f\"Import time {model_name}\")\n", + " plt.xlabel(\"AMICI_IMPORT_NPROCS\")\n", + " plt.ylabel(\"Import time (s)\")\n", + " plt.ylim(ymin=0)\n", + " plt.show()\n", + " \n", + " import_times = df.sort_values(\"nprocs\")[\"time\"].values\n", + " percent_change = (import_times[0] - min(import_times[1:])) / import_times[0] * 100\n", + " if percent_change > 0:\n", + " print(f\"Import time decreased by up to ~{percent_change:.0f}%.\")\n", + " else:\n", + " print(f\"Import time increased by at least ~{-percent_change:.0f}%.\")" + ] + }, + { + "cell_type": "markdown", + "id": "c32065a1", + "metadata": {}, + "source": [ + "### Compilation\n", + "\n", + "#### Choice of compiler\n", + "\n", + "From own experience, `clang` seems to handle larger models, or more specifically, their large source files, better than `g++`, both in terms of memory requirement and compile time. You can use a different compiler by setting the `CC` and `CXX` environment variables to, e.g., `CC=clang`, `CXX=clang`." + ] + }, + { + "cell_type": "code", + "execution_count": 4, + "id": "62cfce84", + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAfsAAAEWCAYAAABhUT6OAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/av/WaAAAACXBIWXMAAAsTAAALEwEAmpwYAAArnUlEQVR4nO3de7xc873/8ddbCOoWJPVzSQTVo7SkmqrbaRV1L3qhVAnVpnpcD0dLq41rq8e16ta0Upcq1eJISUuOogdFgojEpYJoEkGIRNwrPr8/vt+RlcnM7LWTmb2zJ+/n4zGPPfNd37XWZ9aemc/6ftd3raWIwMzMzNrXUt0dgJmZmbWWk72ZmVmbc7I3MzNrc072ZmZmbc7J3szMrM052ZuZmbU5J3vrkSSdLOm3CznvpZJ+1OyYOljndyW9KOl1Sat35brLyrGtn59fLun07o6pFkkHSLpNUq8c84D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WVP7iASL54y91Kd/OboHQXtcqV5baTdJekm5TuAnimpAOU7lr2aL5AE0r3Gb9UC96hcb67A1Yo3Z3teklj8mObXH6ypKsk3UO6n4KZLSS37M2WXB+n9l0Xv0y60tlmpCuTjZFUuZLjZsDHgJmkmzH9OiK2kHQ0cCTp7mUw7w6NGwB3SCpeFrraz4HzIuJupUv93prXAelmL9t24u5xZlaDk72ZVdsWuCZf1fFFSXeR7iz2GjCmcgMSSU8Dt+V5HiX1FFRcl++T8JSkju7QuCPp3gKV1ysrXXMdYKQTvdmic7I3W3JNpPM3Pire6e39wuv3mf/3pN4dBmtZCtgy3+vhAzn5v9HJ+MysBh+zN1ty/RVYVtLQSoHSrXFnAV+T1EtSP9INjB7o5LJr3aGxnttIhwAqMQzq5LrMrANu2ZstofJ9y78EnC/p+8DbpNuxHgOsCDxCapF/LyJekNSoK75a5Q6NK5Pv0Fjopq92FHBRviva0qSbTx1Wr7KZdZ6vjW9mTSXpcuDmiPhjd8diZom78c3MzNqcW/ZmZmZtzi17MzOzNudkb2Zm1uac7M3MzNqck72ZmVmbc7I3MzNrc/8f/+A1IoMatRMAAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Clang was ~10x as fast as g++.\n" + ] + } + ], + "source": [ + "figsize(8, 4)\n", + "compilation_time_s = [3022.453, 289.518]\n", + "labels = [\"g++ (Ubuntu 12.2.0-3ubuntu1) 12.2.0\", \"Ubuntu clang version 15.0.2-1\"]\n", + "plt.bar(labels, compilation_time_s)\n", + "plt.ylim(ymin=0)\n", + "plt.title(\"Choice of compiler - FröhlichGer2022\")\n", + "plt.xlabel(\"Compiler\")\n", + "plt.ylabel(\"Walltime for compilation (s)\");\n", + "plt.show()\n", + "print(f\"Clang was ~{compilation_time_s[0] / compilation_time_s[1]:.0f}x as fast as g++.\")" + ] + }, + { + "cell_type": "markdown", + "id": "ee9e4b2a", + "metadata": {}, + "source": [ + "#### Parallel compilation\n", + "\n", + "It's possible to compile multiple source files in parallel by specifying the number of parallel processes via the `AMICI_PARALLEL_COMPILE` environment variable. This is also beneficial for small models.\n", + "Note, however, that for large models, this may require significant amounts of RAM. \n", + "\n", + "Example for a large and tiny model:" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "779b773a", + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYsAAAEXCAYAAABcRGizAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/av/WaAAAACXBIWXMAAAsTAAALEwEAmpwYAAAp+UlEQVR4nO3deZwdVZn/8c+3l+yBEBIwhEBiEn+ssrUhIlsAZXEJomIYQVwjSkTEDRlHcIZRxhk3ZBlxRIMiiCwaFFmEsChbOsgWAqaBQBICSQiELCSku5/fH3VuctN097293L433d/363Vft+pU1annVif11Dm1KSIwMzNrT1W5AzAzs8rnZGFmZgU5WZiZWUFOFmZmVpCThZmZFeRkYWZmBTlZ2FZD0jxJh6fh8yT9ppvq3UXSGknV3VGfgaQ7JX2m3HFY93GysIIk/Yuk+rRDXSrpL5IO7uk4ImLPiLizq/VIWijpqLx6n4+IIRHR1NW6i1j3nZLWp225QtL1kkZJOieVrUnTm/LG56VlQ9KEvLq+mv4ee0o6XFJz3jK5zzvbW29eXVskX0mjJT0p6UJJKvV2scrnZGHtknQW8GPgu8COwC7AJcDUMoa1tZsREUOACcAQ4H8i4rspYQ0BTgPuy41HxJ4tK5D0LeBM4LCImJeKX8hbJve5r731thacpF2Bu4FZEXFG+M5dw8nC2iFpW+DfgdMj4vqIWBsRGyPixoj4Wpqnv6QfS3ohfX4sqX+adrikxZK+LmlZOgo+XtJxkv4paaWkc/LWd56kayX9TtJqSQ9J2idv+hYtghaxTpZ0r6RXJT2S665qZb5fkyW8G9NR9tcljU1H7TVpnjsl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XWdvanvvgj3RMT7Ov9zuuxl4BVJ08gexreuxfRDJP2D7L0iF0TEPEmHF1n3lIhY0W2RWlk4WViPkjQcOALYW1KQnSMI4GLI3v4maS7wFWAP4AMt64iI1yStkfTWLrQuttiBSToJ2E3Z49ABtgE+BOS6cr4WEddK+iJwOXCApL2BicBtkgD6kZ136Uyy6Kp5wAHAHfmFaVutbWVbHQDc1aKO35H9HT7RSv3lTmZWZu6Gsp72YeDXEbFrRIyNiDFkO9gxefP8APhG3lF9a74HXJy6WZA0JHc1VEdJqgJOBPZOMY0l6yprrSvqIqBK0tFp+nm5ZSJiJ2AnSbt2Jo4u+h5Z6+ctAJL6SfpMmvbfwIWSBqZpR5GdM/ptizpuAL4P3NIzIdvWxC0L62knAf/Vouw6shO0AETEPAr3iV9KdmJ5jqSNwEayJNMZhwBLcieHk7uBPZReIpMXW+7y3q+TvaGt5ePjbyA7j/EAcKSkxXnTPpK+/5xihuyE+cWkcxZ5854fEdcCg1rU8cPW3nMSETel8yV/VdbMCbIWEMBPge2Ax1LX24vA1Ih4vUUdq0l/m9RS6qhPSDo+b3xy+s51+QE8GhGdSupWXn5EuZmZFeRuKDMzK8jdUNZrSXoA6N+i+JSIeKy1+bcGkv6Vzd1ZOb+PiP8sRzzWd7gbyszMCnI3lJmZFeRkYWZmBTlZmJlZQU4WZmZW0P8H2vej7mrrqbAAAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "We were able to reduce compile time by up to ~45%.\n" + ] + }, + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYgAAAEXCAYAAAC3c9OwAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/av/WaAAAACXBIWXMAAAsTAAALEwEAmpwYAAAvKklEQVR4nO3deZxcVZn/8c+3t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tmtwEXpr9kasszvL6k/0C8iXm2DWM4mmaYBki/IW0m+HBv6sj8TuDdj+aJ0m6dIpjto6dTKJ9XrYjpwP7c/guSLex/pZ9Uny2dVCRyesXwXb7aAzgHuz3YQSYNJWidZW3YN+HPG+/r3/djOOpGCXAdgPcbFJHdGg+TL9WKgrv/6j8C3gLXAbe0Yw58l1QDPA19JWy2vR8QySSuB6yWVRkTdzVh+IOk7QBmQeZvPi4HzI6JW0l0k3WJv6Ytvhqci4uyWv51W2wC8IekikgnvdtQrP0nScyT35PheRCyUdEoz931qRLzeZpFaTjhBWLuTVAq8HThSUpD0+QdwDSR3SZM0G/gsMBF4T/19RMQWSdskHdCKVsQ+X1qSLgYOVTKtOEB/4H1AXTfN5yPiTkmfBK4Hpkg6EpgAPCoJoIhkHKUlCaK1FgJTgMczV6af1fYsn9UU4C/19nEbyd/hg1n2n+sEZjnmLibrCBcAN0bE2IgYFxHlJF+q5Rl1fgj8R8av92y+C1yTdqEgqW/dWUz7S1IecCFwZBrTOJJusGzdTFcDeZLOSMu/UbdNRIwCRkka25I4Wum7JK2cEQCSiiR9NC37AfATSb3TstNIxoB+V28f9wDfBx7umJCtK3ELwjrCxcD/1Ft3F8kgKwARsZCm+7h/TjI4/KykKqCKJLG0xEnAyroB3tSTwESlN17JiK3uVNwvkNzJrP5U7PeQjEvMAt4haUVG2fT0+YE0ZkgGva8hHYPIqPvtiLgTKKm3jx9lu09IRDyYjn/8SUlzJkhaOgA/BQYB89NutTXAuRGxs94+tpL+bdIW0f76oKTzMpanpc913XkAz0dEixK55Zan+zYzs6zcxWRmZlm5i8m6FUmzgF71Vl8WEfOz1e8KJP0nb3ZV1bkjIv47F/FYz+EuJjMzy8pdTGZmlpUThJmZZeUEYWZmWTlBmJlZVv8f0XB9oNOov3YAAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + }, + { + "name": "stdout", + "output_type": "stream", + "text": [ + "We were able to reduce compile time by up to ~73%.\n" + ] + } + ], + "source": [ + "df_compile = pd.read_csv(\"results_compile.tsv\", sep=\"\\t\")\n", + "figsize(6, 4)\n", + "\n", + "for model_name, df in df_compile.groupby(\"model_name\"):\n", + " plt.plot(df.nprocs, df.time)\n", + " plt.title(f\"Compile time {model_name}\")\n", + " plt.xlabel(\"AMICI_PARALLEL_COMPILE\")\n", + " plt.ylabel(\"Compile time (s)\")\n", + " plt.ylim(ymin=0)\n", + " plt.show()\n", + " \n", + " compilation_time_s = df.sort_values(\"nprocs\")[\"time\"].values\n", + " print(\"We were able to reduce compile time by up to \"\n", + " f\"~{(compilation_time_s[0] - min(compilation_time_s[1:])) / compilation_time_s[0] * 100:.0f}%.\")" + ] + }, + { + "cell_type": "markdown", + "id": "0f68459d", + "metadata": {}, + "source": [ + "#### Compiler flags\n", + "\n", + "For most compilers, different machine code optimizations can be enabled/disabled by the `-O0`, `-O1`, `-O2`, `-O3` flags, where a higher number enables more optimizations. For fastet simulation, `-O3` should be used. However, these optimizations come at the cost of increased compile times. If models grow very large, some optimizations (especially with `g++`, see above) become prohibitively slow. In this case, a lower optimization level may be necessary to be able to compile models at all.\n", + "\n", + "Another potential performance gain can be obtained from using CPU-specific instructions using `-march=native`. The disadvantage is, that the compiled model extension will only run on CPUs supporting the same instruction set. This may be become problematic when attempting to use an AMICI model on a machine other than on which it was compiled (e.g. on hetergenous compute clusters).\n", + "\n", + "These compiler flags should be set for both, AMICI installation installation and model compilation. \n", + "\n", + "For AMICI installation, e.g.,\n", + "```bash\n", + "CFLAGS=\"-O3 -march=native\" pip install amici\n", + "```\n", + "\n", + "For model compilation, flags can be passed via the `AMICI_CXXFLAGS` environment variable.\n", + "\n", + "\n", + "Example:\n", + "```bash\n", + "petab_yaml=\"https://raw.githubusercontent.com/Benchmarking-Initiative/Benchmark-Models-PEtab/master/Benchmark-Models/Chen_MSB2009/Chen_MSB2009.yaml\"\n", + "amici_import_petab -y \"${petab_yaml}\" --no-compile\n", + "cd Chen_MSB2009-amici0.16.0/\n", + "for cflags in \"-O0\" \"-O1\" \"-O2\" \"-O3\" \"-O3 -march=native\"\n", + " # this line only builds the model extension, and is normally performed automatically during import\n", + " do AMICI_PARALLEL_COMPILE=1 AMICI_CXXFLAGS=${cflags} /usr/bin/time -v python setup.py build_ext --force --build-lib .\n", + "done\n", + "```" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "b94b979b", + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAiYAAAEXCAYAAACZAI/TAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/av/WaAAAACXBIWXMAAAsTAAALEwEAmpwYAAAiFklEQVR4nO3dd7hlVX3/8fdHkCIdIQQUGCFoAiojjiVIVNQYFBSNBUfFEg0aUTGxgBVbIj8VxIIYVAIaC0YhoCBqUDRYmRGkSgAF6VWaFCnf3x97X+ZwvWXPnXvuOXPP+/U8+zln9+9e58yc71177bVSVUiSJA2D+w06AEmSpDEmJpIkaWiYmEiSpKFhYiJJkoaGiYkkSRoaJiaSJGlomJhIfZLkuUkuSXJLkkf1+VwvSfLdGe77N0nOG6aYOhz7n5Jc1ZbtA5NUkr/ox7lGwfjPakXKs5+fu0ZD7MdEwyDJRcCrq+p/Bh3LmCQFbFNVF8xw/wuBf6mqY2c5rgXAb4H7V9Vds3nsmZrLmJLcH7gJeHxV/apdtkKfle6ra3kO43dRKz9rTKT+2RI4e9BBzEObAGtg2UrzkomJhk6SVyT5cZKPJbkhyW+S7NguvyTJ1Ule3rP9EUk+k+R7SW5O8sMkW/as/3i7301Jlib5m551qyR5R5IL232XJtk8yY/aTX7V3i7YY4I475fkXUkubmP6QpL1kqye5BZglXb/Cye5zh2TnJrkxvZ1x551Jyf5UJJftHEfm2TDdvVYbDe0sf11Wzan9OxfSV6X5Pz2uj6QZOskP2mP97Ukq7XbPjnJpe37P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YSX1jYiLNf4uBY8Yt+wbw9rGZqjq7qqZryHoo8AOa2xlnAf8L3NMxhlcDmwAXtPseAVwN/CPwu6r6Xrvdp4G/SvIk4N3AMVV1TrvuvcDiDu083pXk0rGJya9/cTvU/XOAJ7WPKf+CpkHvvu12WwM/bIeMP40mwfpGx2uWNANp/l1KkiQNnjUmkiRpaNj4VdKsSfJzYPVxi/ds24hI0rS8lSNJkoaGt3IkSdLQMDGRJElDw8REkiQNDRMTSZI0NP4/C+pMYA/qCXwAAAAASUVORK5CYII=\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "compilation_time_s = [20.01, 24.62, 25.59, 25.63, 28.21]\n", + "labels = [\"-O0\", \"-O1\", \"-O2\", \"-O3\", \"-O3 -march=native\"]\n", + "figsize(9, 4)\n", + "plt.bar(labels, compilation_time_s)\n", + "plt.title(\"Impact of optimization flags on compilation\")\n", + "plt.xlabel(\"AMICI_CXXFLAGS\")\n", + "plt.ylabel(\"Walltime for compilation (s)\");" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "id": "33ebf019", + "metadata": {}, + "outputs": [ + { + "data": { + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjIAAAEXCAYAAAC3Ra5BAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjYuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/av/WaAAAACXBIWXMAAAsTAAALEwEAmpwYAAAi6UlEQVR4nO3de9xlZV338c9XkINyFh7kMDiKqIEmKqIpmaIpKokWCuQBDeOpqOypNPGQplKUiadQIyWBFCTIwEIQESQ0hEFUThqDgIAICHIKRJDf88e6btje3Id1D7Nnz5r5vF+v/dprXev0W2vvPfO7r+ta60pVIUmSNEQPmXQAkiRJy8pERpIkDZaJjCRJGiwTGUmSNFgmMpIkabBMZCRJ0mCZyEgrqSSvSHJVktuTPGXMx3p1ki8t47a/muR7K1NMPfb9+0m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v5ZVX1iaqWqupJudGLoRhO+cmTZ9x7E8SXNwxoZSbPZAzi5jVt0Y5LRAfWOAfZOsohukLoHjCuTZANg/ar6/jIcewfgW1X185kWVtXdwJvpEpo/afNTy26mq6X5G+CAaZv+6kjT0tvnCqCd2xZVdQ5dojY1kvAOwDfn2PRw4C9ac9P7kmw313EkPTgmMpJmsw9dwkJ7H21eOpmuyWhv7h/ldkV7MXAt8MRZll0HbD+tfLRp6aB59j9V0wQPPP/7JDk0ybeTnAtQVd8CHkM30OImwLlJfqnH+UhaBjYtSXqA1pF2V+BJSYpuAL2iDRLXBrA7j67ZZXvgZdP3UVW3Jrk9yWOWoVbmIuDJSdaYqVYmyY50idQzgbOSHDM1wnuS3elG730R8Pkkp1TVHQs8PnSJyyOTvLrNb9lqVy6iG0AQgKo6IMmmdIPrTZXdTjcS978luZduENdLliEGSfOwRkbSTPYEjqqqR1XV4qpaRNc/ZdHIOh8A/qKqbppjP38DHNqamabuRHrdfAevqsvoEoO/ap1rp+6Yemmb/zhdk9IP6Go+/r6tsy5wCHBAVV0AnADM2YQ0kySPA9arqq3a+S9u57IP8BVgnSS/P7LJw0a2fXaSjdv0WnSJ3pVIGgsTGUkz2Qf4/LSy44EDp2aq6qKqmq/j7seB0+maVy4E/gu4t2cMbwQ2B5a2bT8NXA/8LvCDqjq1rfcx4JeS/BrwTuDzVXVxW/ZuYJ8e/VTekeTqqRezn/8+VVXAy4Ffa7d9n0PXgfkv2nrbAl9NcgFwPl1CdnzPc5a0QOl+k5IkScNjjYwkSRosO/tKmqgk3wDWnlb82tbHRZLmZNOSJEkaLJuWJEnSYJnISJKkwTKRkSRJg2UiI0mSBuv/Aw7BkY1LC4jhAAAAAElFTkSuQmCC\n", + "text/plain": [ + "
" + ] + }, + "metadata": { + "needs_background": "light" + }, + "output_type": "display_data" + } + ], + "source": [ + "plt.bar(\n", + " [\"-O0\", \"-O1\", \"-O2\", \"-O3\", \"-O3 -march=native\"],\n", + " [4357.768, 3276.873, 3140.092, 3069.855, 3039.262],\n", + ")\n", + "plt.title(\"Impact of optimization flags on simulation\")\n", + "plt.xlabel(\"AMICI_CXXFLAGS\")\n", + "plt.ylabel(\"Simulation time (s)\");" + ] + }, + { + "cell_type": "markdown", + "id": "37d0713f", + "metadata": {}, + "source": [ + "#### Using some optimized BLAS\n", + "\n", + "You might have access to some custom [BLAS](https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms) optimized for your hardware which might speed up your simulations somewhat. We are not aware of any systematic evaluation and cannot make any recomendation. You pass the respective compiler and linker flags via the environment variables `BLAS_CFLAGS` and `BLAS_LIBS`, respectively." + ] + }, + { + "cell_type": "markdown", + "id": "47781b8c", + "metadata": {}, + "source": [ + "## Model simulation\n", + "\n", + "A major determinant of simulation time for a given model is the required accuracy and the selected solvers. This has been evaluated, for example, in https://doi.org/10.1038/s41598-021-82196-2 and is not covered further here. \n", + "\n", + "### Adjoint *vs.* forward sensivities\n", + "\n", + "If only the objective function gradient is required, adjoint sensitivity analysis are often preferable over forward sensitivity analysis. As a rule of thumb, adjoint sensitivity analysis seems to outperform forward sensitivity analysis for models with more than 20 parameters:\n", + "\n", + "![](https://journals.plos.org/ploscompbiol/article/figure/image?size=medium&id=10.1371/journal.pcbi.1005331.g002)\n", + "\n", + "*CC BY 4.0 Fröhlich et al., [DOI:10.1371/journal.pcbi.1005331](https://doi.org/10.1371/journal.pcbi.1005331)*\n", + "\n", + "### Sensitivities w.r.t. a subset of parameters\n", + "\n", + "If only sensitivities with respect to a subset of model parameters are of interest to you (see also *Parameters as constants* above), you can speed up the simulation by selecting the relevant parameter indices via [amici.Model.setParameterList](https://amici.readthedocs.io/en/latest/generated/amici.amici.Model.html#amici.amici.Model.setParameterList).\n" + ] + }, + { + "cell_type": "markdown", + "id": "af4bd3d5", + "metadata": {}, + "source": [ + "\n", + "### Parallel simulation of multiple conditions\n", + "\n", + "Whenever there are multiple independent simulations to perform, you can use [amici.runAmiciSimulations(..., num_threads=...)](https://amici.readthedocs.io/en/latest/generated/amici.amici.html#amici.amici.runAmiciSimulations) instead of [amici.runAmiciSimulations(...)](https://amici.readthedocs.io/en/latest/generated/amici.amici.html#amici.amici.runAmiciSimulation) to run them in parallel. Note that all simulation results have to be kept in memory, which may become problematic for very large numbers of simulations.\n", + "Parallelization is based on OpenMP and does not come with the issues associated with Python's multiprocessing or multithreading (spawning extra processes or limitations related to the global interpreter lock).\n", + "\n", + "### Reporting mode\n", + "\n", + "During model simulation, many quantities are calculated, but not all might be of interest for you. For example, for parameter estimation you might only be interested in the likelihood and gradient. In this case, you can save time and memory using \n", + "[amici.Solver.setReturnDataReportingMode(amici.RDataReporting.likelihood)](https://amici.readthedocs.io/en/latest/generated/amici.amici.Solver.html#amici.amici.Solver.setReturnDataReportingMode)." + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.10.6" + }, + "toc": { + "base_numbering": 1, + "nav_menu": {}, + "number_sections": true, + "sideBar": true, + "skip_h1_title": false, + "title_cell": "Table of Contents", + "title_sidebar": "Contents", + "toc_cell": false, + "toc_position": {}, + "toc_section_display": true, + "toc_window_display": false + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/python/examples/example_large_models/results_compile.tsv b/python/examples/example_large_models/results_compile.tsv new file mode 100644 index 0000000000..6b7a9bfe31 --- /dev/null +++ b/python/examples/example_large_models/results_compile.tsv @@ -0,0 +1,21 @@ + model_name task nprocs time +0 hello_pysb compile 1 20.741835117340088 +1 hello_pysb compile 2 11.944610834121704 +2 hello_pysb compile 3 9.319742441177368 +3 hello_pysb compile 4 7.94843316078186 +4 hello_pysb compile 5 7.121765375137329 +5 hello_pysb compile 6 6.689377069473267 +6 hello_pysb compile 7 6.251616954803467 +7 hello_pysb compile 8 6.100285291671753 +8 hello_pysb compile 9 5.753735780715942 +9 hello_pysb compile 10 5.667196750640869 +10 RTKERK__base compile 1 3067.3388171195984 +11 RTKERK__base compile 2 2061.4823524951935 +12 RTKERK__base compile 3 1754.1764636039734 +13 RTKERK__base compile 4 1725.0178718566895 +14 RTKERK__base compile 5 1697.654798746109 +15 RTKERK__base compile 6 1691.5322842597961 +16 RTKERK__base compile 7 1720.0398466587067 +17 RTKERK__base compile 8 1714.9537448883057 +18 RTKERK__base compile 9 1721.5932655334473 +19 RTKERK__base compile 10 1726.7770998477936 diff --git a/python/examples/example_large_models/results_import.tsv b/python/examples/example_large_models/results_import.tsv new file mode 100644 index 0000000000..6770fc5c91 --- /dev/null +++ b/python/examples/example_large_models/results_import.tsv @@ -0,0 +1,21 @@ + Unnamed: 0 model_name task nprocs time size +0 0 hello_pysb import 1 1.787031888961792 12054809 +1 1 hello_pysb import 2 15.872491359710692 12067022 +2 2 hello_pysb import 3 16.68442177772522 12054052 +3 3 hello_pysb import 4 16.014235973358154 12067022 +4 4 hello_pysb import 5 15.72178030014038 12054052 +5 5 hello_pysb import 6 16.097049713134766 12067022 +6 6 hello_pysb import 7 15.62270975112915 12054052 +7 7 hello_pysb import 8 16.196629762649536 12067022 +8 8 hello_pysb import 9 16.08016848564148 12054052 +9 9 hello_pysb import 10 16.345548152923584 12067022 +10 10 RTKERK__base import 1 1376.1798136234283 43516541 +11 11 RTKERK__base import 2 1041.8015067577362 43349758 +12 12 RTKERK__base import 3 927.154144525528 43336620 +13 13 RTKERK__base import 4 878.066201210022 43349758 +14 14 RTKERK__base import 5 837.5367295742035 43336620 +15 15 RTKERK__base import 6 823.1699328422546 43349758 +16 16 RTKERK__base import 7 811.7395029067993 43336620 +17 17 RTKERK__base import 8 789.2430837154388 43349758 +18 18 RTKERK__base import 9 772.3326945304871 43336620 +19 19 RTKERK__base import 10 784.638739824295 43349758 diff --git a/python/sdist/amici/__init__.py b/python/sdist/amici/__init__.py index a55bfd5115..14d5955d61 100644 --- a/python/sdist/amici/__init__.py +++ b/python/sdist/amici/__init__.py @@ -4,20 +4,6 @@ The AMICI Python module provides functionality for importing SBML or PySB models and turning them into C++ Python extensions. - -:var amici_path: - absolute root path of the amici repository or Python package -:var amiciSwigPath: - absolute path of the amici swig directory -:var amiciSrcPath: - absolute path of the amici source directory -:var amiciModulePath: - absolute root path of the amici module -:var hdf5_enabled: - boolean indicating if amici was compiled with hdf5 support -:var has_clibs: - boolean indicating if this is the full package with swig interface or - the raw package without """ @@ -87,14 +73,20 @@ def _imported_from_setup() -> bool: # Initialize AMICI paths +#: absolute root path of the amici repository or Python package amici_path = _get_amici_path() +#: absolute path of the amici swig directory amiciSwigPath = os.path.join(amici_path, 'swig') +#: absolute path of the amici source directory amiciSrcPath = os.path.join(amici_path, 'src') +#: absolute root path of the amici module amiciModulePath = os.path.dirname(__file__) - -has_clibs = any(os.path.isfile(os.path.join(amici_path, wrapper)) - for wrapper in ['amici.py', 'amici_without_hdf5.py']) -hdf5_enabled = False +#: boolean indicating if this is the full package with swig interface or +# the raw package without extension +has_clibs: bool = any(os.path.isfile(os.path.join(amici_path, wrapper)) + for wrapper in ['amici.py', 'amici_without_hdf5.py']) +#: boolean indicating if amici was compiled with hdf5 support +hdf5_enabled: bool = False # Get version number from file with open(os.path.join(amici_path, 'version.txt')) as f: @@ -125,13 +117,16 @@ def _imported_from_setup() -> bool: @runtime_checkable class ModelModule(Protocol): - """Enable Python static type checking for AMICI-generated model - modules""" + """Type of AMICI-generated model modules. + + To enable static type checking.""" def getModel(self) -> amici.Model: + """Create a model instance.""" ... def get_model(self) -> amici.Model: + """Create a model instance.""" ... diff --git a/python/sdist/amici/cxxcodeprinter.py b/python/sdist/amici/cxxcodeprinter.py index 7a27892ab9..1a5f106850 100644 --- a/python/sdist/amici/cxxcodeprinter.py +++ b/python/sdist/amici/cxxcodeprinter.py @@ -30,12 +30,7 @@ class AmiciCxxCodePrinter(CXX11CodePrinter): optimizations: Iterable[Optimization] = () def __init__(self): - """ - Create code printer - - :param optimize_code: - Whether to apply code optimizations such as log(1 + x) --> logp1(x) - """ + """Create code printer""" super().__init__() # extract common subexpressions in matrix functions? @@ -301,7 +296,6 @@ def get_switch_statement(condition: str, cases: Dict[int, List[str]], :return: Code for switch expression as list of strings - """ lines = [] diff --git a/python/sdist/amici/logging.py b/python/sdist/amici/logging.py index f115a1b2e7..0f11dc2e8a 100644 --- a/python/sdist/amici/logging.py +++ b/python/sdist/amici/logging.py @@ -188,15 +188,18 @@ def wrapper_timer(*args, **kwargs): recursion = '' level = logging.INFO + level_length = len('INFO') if recursion_level > 1: recursion = '+' * (recursion_level - 1) level = logging.DEBUG + level_length = len('DEBUG') + tstart = time.perf_counter() rval = func(*args, **kwargs) tend = time.perf_counter() - spacers = ' ' * max(54 - len(description) - len(logger.name) - - len(recursion), 0) + spacers = ' ' * max(59 - len(description) - len(logger.name) - + len(recursion) - level_length, 0) logger.log( level, f'Finished {description}{spacers}{recursion} ({(tend - tstart):.2E}s)' ) diff --git a/python/sdist/amici/numpy.py b/python/sdist/amici/numpy.py index ce767679f3..ea83ac2984 100644 --- a/python/sdist/amici/numpy.py +++ b/python/sdist/amici/numpy.py @@ -15,13 +15,13 @@ class SwigPtrView(collections.abc.Mapping): """ - Interface class to expose std::vector and scalar members of + Interface class to expose ``std::vector`` and scalar members of swig wrapped C++ objects as numpy array attributes and fields. This class is memory efficient as copies of the underlying C++ objects is only created when respective fields are accessed for the first time. Cached copies are used for all subsequent calls. - :ivar _swigptr: pointer to the c++ object + :ivar _swigptr: pointer to the C++ object :ivar _field_names: names of members that will be exposed as numpy arrays :ivar _field_dimensions: dimensions of numpy arrays :ivar _cache: dictionary with cached values @@ -55,7 +55,7 @@ def __getitem__(self, item: str) -> Union[np.ndarray, float]: if item not in self._field_names: self.__missing__(item) - value = field_as_numpy( + value = _field_as_numpy( self._field_dimensions, item, self._swigptr ) self._cache[item] = value @@ -86,7 +86,7 @@ def __init__(self, swigptr): :param swigptr: pointer to the C++ object """ self._swigptr = swigptr - self._cache = dict() + self._cache = {} super(SwigPtrView, self).__init__() def __len__(self) -> int: @@ -119,7 +119,7 @@ def __copy__(self): def __contains__(self, item) -> bool: """ - Faster implementation of __contains__ that avoids copy of the field + Faster implementation of ``__contains__`` that avoids copy of the field :param item: item to check for @@ -152,8 +152,8 @@ def __repr__(self): class ReturnDataView(SwigPtrView): """ - Interface class for C++ Return Data objects that avoids possibly costly - copies of member data. + Interface class for C++ :class:`amici.ReturnData` objects that avoids + possibly costly copies of member data. """ _field_names = [ @@ -174,7 +174,7 @@ def __init__(self, rdata: Union[ReturnDataPtr, ReturnData]): """ Constructor - :param rdata: pointer to the ReturnData instance + :param rdata: pointer to the ``ReturnData`` instance """ if not isinstance(rdata, (ReturnDataPtr, ReturnData)): raise TypeError(f'Unsupported pointer {type(rdata)}, must be' @@ -237,7 +237,9 @@ def __init__(self, rdata: Union[ReturnDataPtr, ReturnData]): def __getitem__(self, item: str) -> Union[np.ndarray, ReturnDataPtr, ReturnData, float]: """ - Custom getitem implementation shim to map `t` to `ts` + Access fields by name.s + + Custom ``__getitem__`` implementation shim to map ``t`` to ``ts``. :param item: field/attribute key @@ -334,16 +336,16 @@ def __init__(self, edata: Union[ExpDataPtr, ExpData]): super(ExpDataView, self).__init__(edata) -def field_as_numpy(field_dimensions: Dict[str, List[int]], - field: str, data: SwigPtrView) -> Union[np.ndarray, - float, - None]: +def _field_as_numpy( + field_dimensions: Dict[str, List[int]], + field: str, data: SwigPtrView +) -> Union[np.ndarray, float, None]: """ Convert data object field to numpy array with dimensions according to specified field dimensions :param field_dimensions: dimension specifications - dict({field: list([dim1, dim2, ...])}) + ``dict({field: list([dim1, dim2, ...])})`` :param data: object with fields :param field: Name of field @@ -351,13 +353,9 @@ def field_as_numpy(field_dimensions: Dict[str, List[int]], specified field dimensions """ attr = getattr(data, field) - if field in field_dimensions: - if len(attr) == 0: - return None - else: - return np.array(attr).reshape(field_dimensions[field]) - else: - return float(attr) + if field_dim := field_dimensions.get(field, None): + return None if len(attr) == 0 else np.array(attr).reshape(field_dim) + return float(attr) def _entity_type_from_id( @@ -384,5 +382,3 @@ def _entity_type_from_id( return symbol raise KeyError(f"Unknown symbol {entity_id}.") - - diff --git a/python/sdist/amici/ode_export.py b/python/sdist/amici/ode_export.py index bc669374af..98010994a0 100644 --- a/python/sdist/amici/ode_export.py +++ b/python/sdist/amici/ode_export.py @@ -593,7 +593,7 @@ class ODEModel: :ivar _observables: list of observables - :ivar _event_observables: + :ivar _eventobservables: list of event observables :ivar _sigmays: @@ -637,7 +637,7 @@ class ODEModel: variables of the model :ivar _names: - carries names of symbolic identifiers of the symbolic variables + carries the names of symbolic identifiers of the symbolic variables of the model :ivar _syms: @@ -2267,7 +2267,7 @@ def _collect_heaviside_roots( root_funs.extend(self._collect_heaviside_roots(arg.args)) # substitute 'w' expressions into root expressions now, to avoid - # rewriting '{model_name}_root.cpp' and '{model_name}_stau.cpp' headers + # rewriting 'root.cpp' and 'stau.cpp' headers # to include 'w.h' w_sorted = toposort_symbols(dict(zip( [expr.get_id() for expr in self._expressions], @@ -2625,7 +2625,7 @@ def _write_index_files(self, name: str) -> None: # we only need a single macro, as all entries have the same symbol break - filename = os.path.join(self.model_path, f'{self.model_name}_{name}.h') + filename = os.path.join(self.model_path, f'{name}.h') with open(filename, 'w') as fileout: fileout.write('\n'.join(lines)) @@ -2683,12 +2683,12 @@ def _write_function_file(self, function: str) -> None: if iszero: continue - lines.append(f'#include "{self.model_name}_{sym}.h"') + lines.append(f'#include "{sym}.h"') # include return symbols if function in self.model.sym_names() and \ function not in non_unique_id_symbols: - lines.append(f'#include "{self.model_name}_{function}.h"') + lines.append(f'#include "{function}.h"') lines.extend([ '', @@ -2733,7 +2733,7 @@ def _write_function_file(self, function: str) -> None: # if not body is None: filename = os.path.join(self.model_path, - f'{self.model_name}_{function}.cpp') + f'{function}.cpp') with open(filename, 'w') as fileout: fileout.write('\n'.join(lines)) @@ -2823,7 +2823,7 @@ def _write_function_index(self, function: str, indextype: str) -> None: '} // namespace amici\n', ]) - filename = f'{self.model_name}_{function}_{indextype}.cpp' + filename = f'{function}_{indextype}.cpp' filename = os.path.join(self.model_path, filename) with open(filename, 'w') as fileout: diff --git a/python/sdist/amici/petab_import.py b/python/sdist/amici/petab_import.py index cf248c2372..6d23d759fe 100644 --- a/python/sdist/amici/petab_import.py +++ b/python/sdist/amici/petab_import.py @@ -287,20 +287,22 @@ def import_petab_problem( :return: The imported model. """ + # extract model name from pysb + if PysbPetabProblem and isinstance(petab_problem, PysbPetabProblem) \ + and model_name is None: + model_name = petab_problem.pysb_model.name + # generate folder and model name if necessary if model_output_dir is None: if PysbPetabProblem and isinstance(petab_problem, PysbPetabProblem): raise ValueError("Parameter `model_output_dir` is required.") model_output_dir = \ - _create_model_output_dir_name(petab_problem.sbml_model) + _create_model_output_dir_name(petab_problem.sbml_model, model_name) else: model_output_dir = os.path.abspath(model_output_dir) - if PysbPetabProblem and isinstance(petab_problem, PysbPetabProblem) \ - and model_name is None: - model_name = petab_problem.pysb_model.name - elif model_name is None: + if model_name is None: model_name = _create_model_name(model_output_dir) # create folder @@ -374,7 +376,7 @@ def check_model( ) -def _create_model_output_dir_name(sbml_model: 'libsbml.Model') -> Path: +def _create_model_output_dir_name(sbml_model: 'libsbml.Model', model_name: Optional[str] = None) -> Path: """ Find a folder for storing the compiled amici model. If possible, use the sbml model id, otherwise create a random folder. @@ -383,6 +385,10 @@ def _create_model_output_dir_name(sbml_model: 'libsbml.Model') -> Path: """ BASE_DIR = Path("amici_models").absolute() BASE_DIR.mkdir(exist_ok=True) + # try model_name + if model_name: + return BASE_DIR / model_name + # try sbml model id if sbml_model_id := sbml_model.getId(): return BASE_DIR / sbml_model_id @@ -430,6 +436,7 @@ def import_model_sbml( allow_reinit_fixpar_initcond: bool = True, validate: bool = True, non_estimated_parameters_as_constants=True, + output_parameter_defaults: Optional[Dict[str, float]] = None, **kwargs) -> amici.SbmlImporter: """ Create AMICI model from PEtab problem @@ -478,6 +485,11 @@ def import_model_sbml( model size and simulation times. If sensitivities with respect to those parameters are required, this should be set to ``False``. + :param output_parameter_defaults: + Optional default parameter values for output parameters introduced in + the PEtab observables table, in particular for placeholder parameters. + Dictionary mapping parameter IDs to default values. + :param kwargs: Additional keyword arguments to be passed to :meth:`amici.sbml_import.SbmlImporter.sbml2amici`. @@ -592,8 +604,20 @@ def import_model_sbml( output_parameters[sym] = None logger.debug("Adding output parameters to model: " f"{list(output_parameters.keys())}") + output_parameter_defaults = output_parameter_defaults or {} + if extra_pars := (set(output_parameter_defaults) + - set(output_parameters.keys())): + raise ValueError( + f"Default output parameter values were given for {extra_pars}, " + "but they those are not output parameters." + ) + for par in output_parameters.keys(): - _add_global_parameter(sbml_model, par) + _add_global_parameter( + sbml_model=sbml_model, + parameter_id=par, + value=output_parameter_defaults.get(par, 0.0) + ) # # TODO: to parameterize initial states or compartment sizes, we currently @@ -825,6 +849,9 @@ def _parse_cli_args(): parser.add_argument('--no-compile', action='store_false', dest='compile', help='Only generate model code, do not compile') + parser.add_argument('--no-validate', action='store_false', + dest='validate', + help='Skip validation of PEtab files') parser.add_argument('--flatten', dest='flatten', default=False, action='store_true', help='Flatten measurement specific overrides of ' @@ -863,7 +890,7 @@ def _parse_cli_args(): return args -def main(): +def _main(): """ Command line interface to import a model in the PEtab (https://github.com/PEtab-dev/PEtab/) format into AMICI. @@ -881,7 +908,8 @@ def main(): observable_files=args.observable_file_name) # Check for valid PEtab before potentially modifying it - petab.lint_problem(pp) + if args.validate: + petab.lint_problem(pp) if args.flatten: petab.flatten_timepoint_specific_output_overrides(pp) @@ -899,4 +927,4 @@ def main(): if __name__ == '__main__': - main() + _main() diff --git a/python/sdist/amici/petab_objective.py b/python/sdist/amici/petab_objective.py index 4f03e66647..b1405a4d70 100644 --- a/python/sdist/amici/petab_objective.py +++ b/python/sdist/amici/petab_objective.py @@ -63,9 +63,9 @@ def simulate_petab( :param solver: An AMICI solver. Will use default options if None. :param problem_parameters: - Run simulation with these parameters. If None, PEtab `nominalValues` - will be used). To be provided as dict, mapping PEtab problem - parameters to SBML IDs. + Run simulation with these parameters. If ``None``, PEtab + ``nominalValues`` will be used. To be provided as dict, mapping PEtab + problem parameters to SBML IDs. :param simulation_conditions: Result of :py:func:`petab.get_simulation_conditions`. Can be provided to save time if this has be obtained before. @@ -185,9 +185,9 @@ def create_parameterized_edatas( :param petab_problem: PEtab problem to work on. :param problem_parameters: - Run simulation with these parameters. If None, PEtab `nominalValues` - will be used). To be provided as dict, mapping PEtab problem - parameters to SBML IDs. + Run simulation with these parameters. If ``None``, PEtab + ``nominalValues`` will be used. To be provided as dict, mapping PEtab + problem parameters to SBML IDs. :param scaled_parameters: If ``True``, ``problem_parameters`` are assumed to be on the scale provided in the PEtab parameter table and will be unscaled. @@ -464,16 +464,16 @@ def _set_initial_state(condition_id, element_id, init_par_id, fixed_par_ids = amici_model.getFixedParameterIds() condition_map_preeq_var, condition_map_preeq_fix = \ - subset_dict(condition_map_preeq, variable_par_ids, fixed_par_ids) + _subset_dict(condition_map_preeq, variable_par_ids, fixed_par_ids) condition_scale_map_preeq_var, condition_scale_map_preeq_fix = \ - subset_dict(condition_scale_map_preeq, variable_par_ids, fixed_par_ids) + _subset_dict(condition_scale_map_preeq, variable_par_ids, fixed_par_ids) condition_map_sim_var, condition_map_sim_fix = \ - subset_dict(condition_map_sim, variable_par_ids, fixed_par_ids) + _subset_dict(condition_map_sim, variable_par_ids, fixed_par_ids) condition_scale_map_sim_var, condition_scale_map_sim_fix = \ - subset_dict(condition_scale_map_sim, variable_par_ids, fixed_par_ids) + _subset_dict(condition_scale_map_sim, variable_par_ids, fixed_par_ids) logger.debug("Fixed parameters preequilibration: " f"{condition_map_preeq_fix}") @@ -631,8 +631,8 @@ def create_edata_for_condition( return edata -def subset_dict(full: Dict[Any, Any], - *args: Collection[Any]) -> Iterator[Dict[Any, Any]]: +def _subset_dict(full: Dict[Any, Any], + *args: Collection[Any]) -> Iterator[Dict[Any, Any]]: """Get subset of dictionary based on provided keys :param full: diff --git a/python/sdist/amici/petab_simulate.py b/python/sdist/amici/petab_simulate.py index 71744ff51b..09403153b1 100644 --- a/python/sdist/amici/petab_simulate.py +++ b/python/sdist/amici/petab_simulate.py @@ -74,7 +74,7 @@ def simulate_without_noise(self, **kwargs) -> pd.DataFrame: kwargs[MODEL_NAME] += str(self.rng.integers(10)) if MODEL_OUTPUT_DIR not in kwargs: kwargs[MODEL_OUTPUT_DIR] = self.working_dir - self.amici_model = subset_call(import_petab_problem, kwargs) + self.amici_model = _subset_call(import_petab_problem, kwargs) kwargs[AMICI_MODEL] = self.amici_model self.amici_model = kwargs[AMICI_MODEL] @@ -83,13 +83,13 @@ def simulate_without_noise(self, **kwargs) -> pd.DataFrame: kwargs[AMICI_SOLVER].setSensitivityMethod( SensitivityMethod_none) - result = subset_call(simulate_petab, kwargs) + result = _subset_call(simulate_petab, kwargs) return rdatas_to_measurement_df(result[RDATAS], self.amici_model, self.petab_problem.measurement_df) -def subset_call(method: Callable, kwargs: dict): +def _subset_call(method: Callable, kwargs: dict): """ Helper function to call a method with the intersection of arguments in the method signature and the supplied arguments. @@ -97,11 +97,11 @@ def subset_call(method: Callable, kwargs: dict): :param method: The method to be called. :param kwargs: - The argument superset as a dictionary, similar to `**kwargs` in method - signatures. + The argument superset as a dictionary, similar to ``**kwargs`` in + method signatures. :return: - The output of `method`, called with the applicable arguments in - `kwargs`. + The output of ``method``, called with the applicable arguments in + ``kwargs``. """ method_args = inspect.signature(method).parameters subset_kwargs = {k: v diff --git a/python/sdist/amici/plotting.py b/python/sdist/amici/plotting.py index 6b3eade225..d21bea6a99 100644 --- a/python/sdist/amici/plotting.py +++ b/python/sdist/amici/plotting.py @@ -17,7 +17,8 @@ def plot_state_trajectories( rdata: ReturnDataView, state_indices: Optional[Iterable[int]] = None, ax: Optional[Axes] = None, - model: Model = None + model: Model = None, + prefer_names: bool = True, ) -> None: """ Plot state trajectories @@ -34,6 +35,9 @@ def plot_state_trajectories( :param model: amici model instance + + :param prefer_names: + Whether state names should be preferred over IDs, if available. """ if not ax: fig, ax = plt.subplots() @@ -42,7 +46,7 @@ def plot_state_trajectories( for ix in state_indices: if model is None: label = f'$x_{{{ix}}}$' - elif model.getStateNames()[ix]: + elif prefer_names and model.getStateNames()[ix]: label = model.getStateNames()[ix] else: label = model.getStateIds()[ix] @@ -57,7 +61,8 @@ def plot_observable_trajectories( rdata: ReturnDataView, observable_indices: Optional[Iterable[int]] = None, ax: Optional[Axes] = None, - model: Model = None + model: Model = None, + prefer_names: bool = True, ) -> None: """ Plot observable trajectories @@ -74,6 +79,9 @@ def plot_observable_trajectories( :param model: amici model instance + + :param prefer_names: + Whether observables names should be preferred over IDs, if available. """ if not ax: fig, ax = plt.subplots() @@ -82,7 +90,7 @@ def plot_observable_trajectories( for iy in observable_indices: if model is None: label = f'$y_{{{iy}}}$' - elif model.getObservableNames()[iy]: + elif prefer_names and model.getObservableNames()[iy]: label = model.getObservableNames()[iy] else: label = model.getObservableIds()[iy] diff --git a/python/sdist/amici/pysb_import.py b/python/sdist/amici/pysb_import.py index 0648a0b478..5429a4adf2 100644 --- a/python/sdist/amici/pysb_import.py +++ b/python/sdist/amici/pysb_import.py @@ -26,7 +26,8 @@ noise_distribution_to_observable_transformation) from .logging import get_logger, log_execution_time, set_log_level from .ode_export import (Constant, Expression, LogLikelihoodY, ODEExporter, - ODEModel, Observable, Parameter, SigmaY, State) + ODEModel, Observable, Parameter, SigmaY, State, + _default_simplify) CL_Prototype = Dict[str, Dict[str, Any]] ConservationLaw = Dict[str, Union[Dict, str, sp.Basic]] @@ -46,7 +47,7 @@ def pysb2amici( compiler: str = None, compute_conservation_laws: bool = True, compile: bool = True, - simplify: Callable = lambda x: sp.powsimp(x, deep=True), + simplify: Callable = _default_simplify, # Do not enable by default without testing. # See https://github.com/AMICI-dev/AMICI/pull/1672 cache_simplify: bool = False, @@ -441,8 +442,9 @@ def _process_pysb_expressions( observables :param sigmas: - dict with names of observable pysb.Expressions/pysb.Observables - names as keys and names of sigma pysb.Expressions as values + dict with names of observable :class:`pysb.Expression` / + :class:`pysb.Observable` names as keys and names of sigma + :class:`pysb.Expressions` as values :param noise_distributions: see :func:`amici.pysb_import.pysb2amici` diff --git a/python/sdist/amici/sbml_import.py b/python/sdist/amici/sbml_import.py index e1f35245e4..34a63bdb91 100644 --- a/python/sdist/amici/sbml_import.py +++ b/python/sdist/amici/sbml_import.py @@ -174,13 +174,16 @@ def __init__(self, sbml.L3P_MODULO_IS_PIECEWISE ) + @log_execution_time('loading SBML', logger) def _process_document(self) -> None: """ Validate and simplify document. """ # Ensure we got a valid SBML model, otherwise further processing # might lead to undefined results - self.sbml_doc.validateSBML() + log_execution_time(f'validating SBML', logger)( + self.sbml_doc.validateSBML + )() _check_lib_sbml_errors(self.sbml_doc, self.show_sbml_warnings) # apply several model simplifications that make our life substantially @@ -188,11 +191,15 @@ def _process_document(self) -> None: if self.sbml_doc.getModel().getNumFunctionDefinitions(): convert_config = sbml.SBMLFunctionDefinitionConverter()\ .getDefaultProperties() - self.sbml_doc.convert(convert_config) + log_execution_time(f'converting SBML functions', logger)( + self.sbml_doc.convert + )(convert_config) convert_config = sbml.SBMLLocalParameterConverter().\ getDefaultProperties() - self.sbml_doc.convert(convert_config) + dec_fun = log_execution_time(f'converting SBML local parameters', logger)( + self.sbml_doc.convert + )(convert_config) # If any of the above calls produces an error, this will be added to # the SBMLError log in the sbml document. Thus, it is sufficient to @@ -318,10 +325,10 @@ def sbml2amici( case of stoichiometric coefficients with many significant digits. :param simplify: - see :attr:`ODEModel._simplify` + see :attr:`amici.ODEModel._simplify` :param cache_simplify: - see :func:`amici.ODEModel.__init__` + see :meth:`amici.ODEModel.__init__` :param log_as_log10: If ``True``, log in the SBML model will be parsed as ``log10`` @@ -2140,11 +2147,14 @@ def assignmentRules2observables(sbml_model: sbml.Model, }) """ observables = {} - for p in sbml_model.getListOfParameters(): - parameter_id = p.getId() - if filter_function(p): + for rule in sbml_model.getListOfRules(): + if rule.getTypeCode() != sbml.SBML_ASSIGNMENT_RULE: + continue + parameter_id = rule.getVariable() + if (p := sbml_model.getParameter(parameter_id)) \ + and filter_function(p): observables[parameter_id] = { - 'name': p.getName() if p.isSetName() else p.getId(), + 'name': p.getName() if p.isSetName() else parameter_id, 'formula': sbml_model.getAssignmentRuleByVariable( parameter_id ).getFormula() diff --git a/python/sdist/amici/setuptools.py b/python/sdist/amici/setuptools.py index bd51a4af88..4451e1f6ef 100644 --- a/python/sdist/amici/setuptools.py +++ b/python/sdist/amici/setuptools.py @@ -73,7 +73,7 @@ def get_blas_config() -> PackageInfo: # Try pkgconfig if pkgconfig: - for blas_name in ['cblas', 'openblas']: + for blas_name in ['cblas', 'blas-atlas', 'openblas', 'blas']: if pkgconfig.exists(blas_name): blaspkgcfg = pkgconfig.parse(blas_name) blaspkgcfg['extra_compile_args'] = [ @@ -215,8 +215,13 @@ def add_debug_flags_if_required(cxx_flags: List[str], and os.environ['ENABLE_AMICI_DEBUGGING'] == 'TRUE': print("ENABLE_AMICI_DEBUGGING was set to TRUE." " Building AMICI with debug symbols.") - cxx_flags.extend(['-g', '-O0', '-UNDEBUG', '-Werror', - '-Wno-error=deprecated-declarations']) + cxx_flags.extend(['-g', '-O0', '-UNDEBUG']) + if sys.platform != "win32": + # these options are incompatible with MSVC, but there is no easy + # way to detect which compiler will be used. so we just skip them + # altogether on windows. + cxx_flags.extend(['-Werror', '-Wno-error=deprecated-declarations']) + linker_flags.extend(['-g']) @@ -232,12 +237,13 @@ def generate_swig_interface_files(swig_outdir: str = None, swig_args = [ '-c++', '-python', - '-py3', '-threads', '-Wall', f'-Iamici{os.sep}swig', f'-Iamici{os.sep}include', ] + if swig_version < (4, 1, 0): + swig_args.insert(2, '-py3') print(f"Found SWIG version {swig_version}") diff --git a/python/sdist/amici/swig_wrappers.py b/python/sdist/amici/swig_wrappers.py index cf998970e6..8601b97c0f 100644 --- a/python/sdist/amici/swig_wrappers.py +++ b/python/sdist/amici/swig_wrappers.py @@ -75,7 +75,7 @@ def runAmiciSimulation( :param model: Model instance -` :param solver: + :param solver: Solver instance, must be generated from :py:meth:`amici.amici.Model.getSolver` diff --git a/python/sdist/setup.cfg b/python/sdist/setup.cfg index 0893437f59..e77a8e94de 100644 --- a/python/sdist/setup.cfg +++ b/python/sdist/setup.cfg @@ -69,5 +69,5 @@ amici = ; amici_import_petab.py is kept for backwards compatibility console_scripts = - amici_import_petab = amici.petab_import:main - amici_import_petab.py = amici.petab_import:main + amici_import_petab = amici.petab_import:_main + amici_import_petab.py = amici.petab_import:_main diff --git a/python/sdist/setup.py b/python/sdist/setup.py index 4b35aa6ba9..e69d0f4d68 100755 --- a/python/sdist/setup.py +++ b/python/sdist/setup.py @@ -101,7 +101,7 @@ def main(): extra_compiler_flags=cxx_flags ) libsuitesparse = setup_clibs.get_lib_suite_sparse( - extra_compiler_flags=cxx_flags + ['-DDLONG'], + extra_compiler_flags=cxx_flags, suitesparse_base_dir=suitesparse_base_dir ) diff --git a/python/sdist/setup_clibs.py b/python/sdist/setup_clibs.py index e91831b58f..bb14171f3c 100644 --- a/python/sdist/setup_clibs.py +++ b/python/sdist/setup_clibs.py @@ -119,40 +119,39 @@ def get_suite_sparse_sources(ss_base_dir: Path) -> List[str]: :param ss_base_dir: SuiteSparse base directory """ return list(map(str, [ - ss_base_dir / 'KLU' / 'Source' / 'klu_analyze_given.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_analyze.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_defaults.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_diagnostics.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_dump.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_extract.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_factor.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_free_numeric.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_free_symbolic.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_kernel.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_memory.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_refactor.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_scale.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_sort.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_solve.c', - ss_base_dir / 'KLU' / 'Source' / 'klu_tsolve.c', - ss_base_dir / 'KLU' / 'Source' / 'klu.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_1.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_2.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_aat.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_control.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_defaults.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_dump.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_global.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_info.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_order.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_post_tree.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_postorder.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_preprocess.c', - ss_base_dir / 'AMD' / 'Source' / 'amd_valid.c', - ss_base_dir / 'COLAMD' / 'Source' / 'colamd.c', - ss_base_dir / 'BTF' / 'Source' / 'btf_maxtrans.c', - ss_base_dir / 'BTF' / 'Source' / 'btf_order.c', - ss_base_dir / 'BTF' / 'Source' / 'btf_strongcomp.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_analyze_given.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_analyze.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_defaults.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_diagnostics.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_dump.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_extract.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_factor.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_free_numeric.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_free_symbolic.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_kernel.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_memory.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_refactor.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_scale.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_sort.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_solve.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l_tsolve.c', + ss_base_dir / 'KLU' / 'Source' / 'klu_l.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l1.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l2.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l_aat.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l_control.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l_defaults.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l_dump.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l_info.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l_order.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l_post_tree.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l_postorder.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l_preprocess.c', + ss_base_dir / 'AMD' / 'Source' / 'amd_l_valid.c', + ss_base_dir / 'COLAMD' / 'Source' / 'colamd_l.c', + ss_base_dir / 'BTF' / 'Source' / 'btf_l_maxtrans.c', + ss_base_dir / 'BTF' / 'Source' / 'btf_l_order.c', + ss_base_dir / 'BTF' / 'Source' / 'btf_l_strongcomp.c', ss_base_dir / 'SuiteSparse_config' / 'SuiteSparse_config.c', ])) diff --git a/python/tests/conftest.py b/python/tests/conftest.py index 33b71294c7..adfe6b93c8 100644 --- a/python/tests/conftest.py +++ b/python/tests/conftest.py @@ -8,6 +8,7 @@ import pytest import amici +from amici.testing import TemporaryDirectoryWinSafe @pytest.fixture(scope="session") @@ -26,27 +27,26 @@ def sbml_example_presimulation_module(): sbml_importer.sbml, # the libsbml model object filter_function=lambda variable: variable.getName() == 'pPROT_obs' ) - outdir = 'test_model_presimulation' module_name = 'test_model_presimulation' - sbml_importer.sbml2amici( - model_name=module_name, - output_dir=outdir, - verbose=False, - observables=observables, - constant_parameters=constant_parameters) - model_module = amici.import_model_module(module_name=module_name, - module_path=outdir) - yield model_module + with TemporaryDirectoryWinSafe(prefix=module_name) as outdir: + sbml_importer.sbml2amici( + model_name=module_name, + output_dir=outdir, + verbose=False, + observables=observables, + constant_parameters=constant_parameters) - shutil.rmtree(outdir, ignore_errors=True) + yield amici.import_model_module( + module_name=module_name, module_path=outdir + ) @pytest.fixture(scope="session") def pysb_example_presimulation_module(): """PySB example_presimulation model module fixture""" - pysb = pytest.importorskip("pysb") + from amici.pysb_import import pysb2amici constant_parameters = ['DRUG_0', 'KIN_0'] @@ -65,17 +65,10 @@ def pysb_example_presimulation_module(): model = copy.deepcopy(model_module.model) model.name = 'test_model_presimulation_pysb' - outdir = model.name - - from amici.pysb_import import pysb2amici - - pysb2amici(model, outdir, verbose=True, - observables=['pPROT_obs'], - constant_parameters=constant_parameters) - - with amici.add_path(outdir): - model_module_pysb = importlib.import_module(outdir) - yield model_module_pysb + with TemporaryDirectoryWinSafe(prefix=model.name) as outdir: + pysb2amici(model, outdir, verbose=True, + observables=['pPROT_obs'], + constant_parameters=constant_parameters) - shutil.rmtree(outdir, ignore_errors=True) + yield amici.import_model_module(model.name, outdir) diff --git a/python/tests/test_bngl.py b/python/tests/test_bngl.py index 8c409ddae6..b1b0c117e5 100644 --- a/python/tests/test_bngl.py +++ b/python/tests/test_bngl.py @@ -1,15 +1,16 @@ -import pytest import os -import amici -import shutil + import numpy as np +import pytest + +import amici pysb = pytest.importorskip("pysb") from amici.bngl_import import bngl2amici from pysb.simulator import ScipyOdeSimulator from pysb.importers.bngl import model_from_bngl -from amici.testing import skip_on_valgrind +from amici.testing import skip_on_valgrind, TemporaryDirectoryWinSafe tests = [ @@ -26,7 +27,6 @@ @skip_on_valgrind @pytest.mark.parametrize('example', tests) def test_compare_to_pysb_simulation(example): - atol = 1e-8 rtol = 1e-8 @@ -47,40 +47,37 @@ def test_compare_to_pysb_simulation(example): pysb_simres = sim.run() # amici part - - outdir = pysb_model.name - cl = example not in ['Motivating_example_cBNGL', 'univ_synth'] kwargs = { 'compute_conservation_laws': cl, 'observables': list(pysb_model.observables.keys()) } - if not cl: - with pytest.raises(ValueError, match="Conservation laws"): - bngl2amici(model_file, outdir, compute_conservation_laws=True) - if example in ['empty_compartments_block', 'motor']: - with pytest.raises(ValueError, match="Cannot add"): - bngl2amici(model_file, outdir, **kwargs) - return - else: - bngl2amici(model_file, outdir, **kwargs) + with TemporaryDirectoryWinSafe(prefix=pysb_model.name) as outdir: + if not cl: + with pytest.raises(ValueError, match="Conservation laws"): + bngl2amici(model_file, outdir, compute_conservation_laws=True) - amici_model_module = amici.import_model_module(pysb_model.name, - outdir) + if example in ['empty_compartments_block', 'motor']: + with pytest.raises(ValueError, match="Cannot add"): + bngl2amici(model_file, outdir, **kwargs) + return + else: + bngl2amici(model_file, outdir, **kwargs) - model_amici = amici_model_module.getModel() + amici_model_module = amici.import_model_module(pysb_model.name, + outdir) - model_amici.setTimepoints(tspan) + model_amici = amici_model_module.getModel() - solver = model_amici.getSolver() - solver.setMaxSteps(10**6) - solver.setAbsoluteTolerance(atol) - solver.setRelativeTolerance(rtol) - rdata = amici.runAmiciSimulation(model_amici, solver) + model_amici.setTimepoints(tspan) - # check agreement of species simulation - assert np.isclose(rdata.x, pysb_simres.species, 1e-4, 1e-4).all() + solver = model_amici.getSolver() + solver.setMaxSteps(10**6) + solver.setAbsoluteTolerance(atol) + solver.setRelativeTolerance(rtol) + rdata = amici.runAmiciSimulation(model_amici, solver) - shutil.rmtree(outdir, ignore_errors=True) + # check agreement of species simulation + assert np.isclose(rdata.x, pysb_simres.species, 1e-4, 1e-4).all() diff --git a/python/tests/test_conserved_quantities_demartino.py b/python/tests/test_conserved_quantities_demartino.py index 476d456411..d6808c6202 100644 --- a/python/tests/test_conserved_quantities_demartino.py +++ b/python/tests/test_conserved_quantities_demartino.py @@ -190,13 +190,13 @@ def test_fill_demartino2014(data_demartino2014): assert not any(fields[len(ref_for_fields):]) -@skip_on_valgrind -def test_compute_moiety_conservation_laws_demartino2014( +def compute_moiety_conservation_laws_demartino2014( data_demartino2014, quiet=False ): - """Invoke test case and benchmarking for De Martino's published results + """Compute conserved quantities for De Martino's published results for E. coli network""" stoichiometric_list, row_names = data_demartino2014 + num_species = 1668 num_reactions = 2381 assert len(stoichiometric_list) == num_species * num_reactions, \ @@ -216,6 +216,15 @@ def test_compute_moiety_conservation_laws_demartino2014( return runtime +@skip_on_valgrind +def test_compute_moiety_conservation_laws_demartino2014(data_demartino2014): + """Invoke test case and benchmarking for De Martino's published results + for E. coli network""" + compute_moiety_conservation_laws_demartino2014( + data_demartino2014, quiet=False + ) + + @skip_on_valgrind @log_execution_time("Detecting moiety conservation laws", logger) def test_cl_detect_execution_time(data_demartino2014): @@ -229,7 +238,7 @@ def test_cl_detect_execution_time(data_demartino2014): runtime = np.Inf for _ in range(max_tries): - runtime = test_compute_moiety_conservation_laws_demartino2014( + runtime = compute_moiety_conservation_laws_demartino2014( data_demartino2014, quiet=True) if runtime < max_time_seconds: break diff --git a/python/tests/test_misc.py b/python/tests/test_misc.py index df24f7397c..6ba5f55973 100644 --- a/python/tests/test_misc.py +++ b/python/tests/test_misc.py @@ -2,7 +2,7 @@ import os import subprocess - +from pathlib import Path import pytest import sympy as sp @@ -56,12 +56,21 @@ def test_cmake_compilation(sbml_example_presimulation_module): Python tests""" source_dir = os.path.dirname(sbml_example_presimulation_module.__path__[0]) - - cmd = f"set -e; cd {source_dir}; mkdir -p build; cd build; "\ - "cmake ..; make" - - subprocess.run(cmd, shell=True, check=True, - stdout=subprocess.PIPE, stderr=subprocess.PIPE) + build_dir = f"{source_dir}/build" + # path hint for amici base installation, in case CMake configuration has + # not been exported + amici_dir = (Path(__file__).parents[2] / 'build').absolute() + cmd = f"set -e; " \ + f"cmake -S {source_dir} -B '{build_dir}' -DAmici_DIR={amici_dir}; " \ + f"cmake --build '{build_dir}'" + + try: + subprocess.run(cmd, shell=True, check=True, + stdout=subprocess.PIPE, stderr=subprocess.PIPE) + except subprocess.CalledProcessError as e: + print(e.stdout.decode()) + print(e.stderr.decode()) + raise @skip_on_valgrind diff --git a/python/tests/test_petab_import.py b/python/tests/test_petab_import.py index 77b8331c48..eeaf21a3e9 100644 --- a/python/tests/test_petab_import.py +++ b/python/tests/test_petab_import.py @@ -3,7 +3,7 @@ import libsbml import pytest import pandas as pd -from amici.testing import skip_on_valgrind +from amici.testing import skip_on_valgrind, TemporaryDirectoryWinSafe petab = pytest.importorskip("petab", reason="Missing petab") @@ -16,6 +16,7 @@ def simple_sbml_model(): document = libsbml.SBMLDocument(3, 1) model = document.createModel() + model.setId("simple_sbml_model") model.setTimeUnits("second") model.setExtentUnits("mole") model.setSubstanceUnits('mole') @@ -32,6 +33,7 @@ def simple_sbml_model(): s.setId('x1') s.setConstant(True) s.setInitialConcentration(1.0) + s.setCompartment(c.getId()) return document, model @@ -73,3 +75,51 @@ def test_get_fixed_parameters(simple_sbml_model): petab_problem, non_estimated_parameters_as_constants=False)) \ == {"p1", "p5"} + + +@skip_on_valgrind +def test_default_output_parameters(simple_sbml_model): + from petab.models.sbml_model import SbmlModel + sbml_doc, sbml_model = simple_sbml_model + condition_df = petab.get_condition_df( + pd.DataFrame({ + petab.CONDITION_ID: ["condition0"], + }) + ) + parameter_df = petab.get_parameter_df( + pd.DataFrame({ + petab.PARAMETER_ID: [], + petab.ESTIMATE: [] + }) + ) + observable_df = petab.get_observable_df( + pd.DataFrame({ + petab.OBSERVABLE_ID: ["obs1"], + petab.OBSERVABLE_FORMULA: ["observableParameter1_obs1"], + petab.NOISE_FORMULA: [1], + }) + ) + petab_problem = petab.Problem( + model=SbmlModel(sbml_model), + parameter_df=parameter_df, + condition_df=condition_df, + observable_df=observable_df, + ) + + with TemporaryDirectoryWinSafe() as outdir: + sbml_importer = amici_petab_import.import_model( + petab_problem=petab_problem, + output_parameter_defaults={'observableParameter1_obs1': 1.0}, + compile=False, + model_output_dir=outdir, + ) + assert 1.0 == sbml_importer.sbml\ + .getParameter("observableParameter1_obs1").getValue() + + with pytest.raises(ValueError): + amici_petab_import.import_model( + petab_problem=petab_problem, + output_parameter_defaults={'nonExistentParameter': 1.0}, + compile=False, + model_output_dir=outdir, + ) diff --git a/python/tests/test_preequilibration.py b/python/tests/test_preequilibration.py index 0c390e0456..7c8365457b 100644 --- a/python/tests/test_preequilibration.py +++ b/python/tests/test_preequilibration.py @@ -405,4 +405,47 @@ def test_newton_steadystate_check(preeq_fixture): ).all(), variable +def test_simulation_errors(preeq_fixture): + model, solver, edata, edata_preeq, edata_presim, edata_sim, pscales, \ + plists = preeq_fixture + + solver.setSensitivityOrder(amici.SensitivityOrder.first) + solver.setSensitivityMethodPreequilibration(amici.SensitivityMethod.forward) + model.setSteadyStateSensitivityMode(amici.SteadyStateSensitivityMode.integrationOnly) + solver.setMaxSteps(1) + + # exceeded maxsteps + # preeq & posteq + for e in [edata, edata_preeq]: + rdata = amici.runAmiciSimulation(model, solver, e) + assert rdata['status'] != amici.AMICI_SUCCESS + assert rdata._swigptr.messages[0].severity == amici.LogSeverity_debug + assert rdata._swigptr.messages[0].identifier == 'EQUILIBRATION_FAILURE' + assert 'exceeded maximum number of integration steps' in rdata._swigptr.messages[0].message + assert rdata._swigptr.messages[1].severity == amici.LogSeverity_error + assert rdata._swigptr.messages[1].identifier == 'OTHER' + assert rdata._swigptr.messages[2].severity == amici.LogSeverity_debug + assert rdata._swigptr.messages[2].identifier == 'BACKTRACE' + + # too long simulations + solver.setMaxSteps(int(1e4)) + solver.setRelativeToleranceSteadyState(0.0) + solver.setAbsoluteToleranceSteadyState(0.0) + # preeq & posteq + for e in [edata_preeq, edata]: + rdata = amici.runAmiciSimulation(model, solver, e) + assert rdata['status'] != amici.AMICI_SUCCESS + assert rdata._swigptr.messages[0].severity == amici.LogSeverity_debug + assert rdata._swigptr.messages[0].identifier == 'CVODES:CVode:RHSFUNC_FAIL' + assert rdata._swigptr.messages[1].severity == amici.LogSeverity_debug + assert rdata._swigptr.messages[1].identifier == 'EQUILIBRATION_FAILURE' + assert 'exceedingly long simulation time' in rdata._swigptr.messages[1].message + assert rdata._swigptr.messages[2].severity == amici.LogSeverity_error + assert rdata._swigptr.messages[2].identifier == 'OTHER' + assert rdata._swigptr.messages[3].severity == amici.LogSeverity_debug + assert rdata._swigptr.messages[3].identifier == 'BACKTRACE' + + + + diff --git a/python/tests/test_pysb.py b/python/tests/test_pysb.py index 9be4b6b086..12aa5e406c 100644 --- a/python/tests/test_pysb.py +++ b/python/tests/test_pysb.py @@ -3,7 +3,7 @@ import importlib import logging import os -import shutil + import pytest pysb = pytest.importorskip("pysb") @@ -18,7 +18,7 @@ from pysb.simulator import ScipyOdeSimulator from amici.gradient_check import check_derivatives -from amici.testing import skip_on_valgrind +from amici.testing import skip_on_valgrind, TemporaryDirectoryWinSafe @skip_on_valgrind @@ -132,67 +132,66 @@ def test_compare_to_pysb_simulation(example): pysb_simres = sim.run() # amici part - - outdir = pysb_model.name - - if pysb_model.name in ['move_connected_amici']: - with pytest.raises(Exception): - pysb2amici(pysb_model, outdir, verbose=logging.INFO, - compute_conservation_laws=True) - compute_conservation_laws = False - else: - compute_conservation_laws = True - - pysb2amici( - pysb_model, - outdir, - verbose=logging.INFO, - compute_conservation_laws=compute_conservation_laws, - observables=list(pysb_model.observables.keys()) - ) - - amici_model_module = amici.import_model_module(pysb_model.name, - outdir) - - model_pysb = amici_model_module.getModel() - - model_pysb.setTimepoints(tspan) - - solver = model_pysb.getSolver() - solver.setMaxSteps(int(1e6)) - solver.setAbsoluteTolerance(atol) - solver.setRelativeTolerance(rtol) - rdata = amici.runAmiciSimulation(model_pysb, solver) - - # check agreement of species simulations - assert np.isclose(rdata['x'], - pysb_simres.species, 1e-4, 1e-4).all() - - if example not in ['fricker_2010_apoptosis', 'fixed_initial', - 'bngwiki_egfr_simple_deletemolecules']: - if example in ['tyson_oscillator', 'bax_pore_sequential', - 'bax_pore', 'kinase_cascade', - 'bngwiki_egfr_simple', - 'bngwiki_enzymatic_cycle_mm', - 'bngwiki_simple']: - solver.setAbsoluteTolerance(1e-14) - solver.setRelativeTolerance(1e-14) - epsilon = 1e-4 + with TemporaryDirectoryWinSafe(prefix=pysb_model.name) as outdir: + if pysb_model.name in ['move_connected_amici']: + with pytest.raises(Exception): + pysb2amici(pysb_model, outdir, verbose=logging.INFO, + compute_conservation_laws=True) + compute_conservation_laws = False else: - solver.setAbsoluteTolerance(1e-10) - solver.setRelativeTolerance(1e-10) - epsilon = 1e-3 - model_pysb.setParameterScale(parameterScalingFromIntVector([ - ParameterScaling.log10 if p > 0 else ParameterScaling.none - for p in model_pysb.getParameters() - ])) - check_derivatives(model_pysb, solver, - epsilon=epsilon, - rtol=1e-2, - atol=1e-2, - skip_zero_pars=True) - - shutil.rmtree(outdir, ignore_errors=True) + compute_conservation_laws = True + + pysb2amici( + pysb_model, + outdir, + verbose=logging.INFO, + compute_conservation_laws=compute_conservation_laws, + observables=list(pysb_model.observables.keys()) + ) + + amici_model_module = amici.import_model_module(pysb_model.name, + outdir) + model_pysb = amici_model_module.getModel() + model_pysb.setTimepoints(tspan) + + solver = model_pysb.getSolver() + solver.setMaxSteps(int(1e6)) + solver.setAbsoluteTolerance(atol) + solver.setRelativeTolerance(rtol) + rdata = amici.runAmiciSimulation(model_pysb, solver) + + # check agreement of species simulations + assert np.isclose(rdata['x'], + pysb_simres.species, 1e-4, 1e-4).all() + + if example not in ['fricker_2010_apoptosis', 'fixed_initial', + 'bngwiki_egfr_simple_deletemolecules']: + if example in ['tyson_oscillator', 'bax_pore_sequential', + 'bax_pore', 'kinase_cascade', + 'bngwiki_egfr_simple', + 'bngwiki_enzymatic_cycle_mm', + 'bngwiki_simple']: + solver.setAbsoluteTolerance(1e-14) + solver.setRelativeTolerance(1e-14) + epsilon = 1e-4 + else: + solver.setAbsoluteTolerance(1e-10) + solver.setRelativeTolerance(1e-10) + epsilon = 1e-3 + model_pysb.setParameterScale( + parameterScalingFromIntVector( + [ + ParameterScaling.log10 if p > 0 + else ParameterScaling.none + for p in model_pysb.getParameters() + ] + ) + ) + check_derivatives(model_pysb, solver, + epsilon=epsilon, + rtol=1e-2, + atol=1e-2, + skip_zero_pars=True) def get_data(model): @@ -286,22 +285,16 @@ def test_heavyside_and_special_symbols(): ) ) - outdir = model.name - pysb2amici(model, outdir, verbose=True, - observables=['a']) + with TemporaryDirectoryWinSafe(prefix=model.name) as outdir: + pysb2amici(model, outdir, verbose=True, observables=['a']) - model_module = amici.import_model_module(module_name=model.name, - module_path=outdir) - amici_model = model_module.getModel() - assert amici_model.ne + model_module = amici.import_model_module(module_name=model.name, + module_path=outdir) + amici_model = model_module.getModel() + assert amici_model.ne @skip_on_valgrind -# TODO: remove me -@pytest.mark.skipif( - not hasattr(pysb, 'EnergyPattern'), - reason='pysb energy not yet available' -) def test_energy(): model_pysb = pysb.Model('energy') pysb.Monomer('A', ['a', 'b']) @@ -322,18 +315,19 @@ def test_energy(): pysb.EnergyPattern('epAAB', A(a=1) % A(a=1, b=2) % B(a=2), E_AAB_RT) pysb.Initial(A(a=None, b=None), A_0) pysb.Initial(A(a=None, b=1) % B(a=1), AB_0) - outdir = model_pysb.name - pysb2amici(model_pysb, model_pysb.name) - - model_module = amici.import_model_module(module_name=model_pysb.name, - module_path=outdir) - amici_model = model_module.getModel() - amici_model.setTimepoints(np.logspace(-4, 5, 10)) - solver = amici_model.getSolver() - solver.setRelativeTolerance(1e-14) - solver.setAbsoluteTolerance(1e-14) - - check_derivatives(amici_model, solver, - epsilon=1e-4, - rtol=1e-2, - atol=1e-2) + + with TemporaryDirectoryWinSafe(prefix=model_pysb.name) as outdir: + pysb2amici(model_pysb, output_dir=outdir) + + model_module = amici.import_model_module(module_name=model_pysb.name, + module_path=outdir) + amici_model = model_module.getModel() + amici_model.setTimepoints(np.logspace(-4, 5, 10)) + solver = amici_model.getSolver() + solver.setRelativeTolerance(1e-14) + solver.setAbsoluteTolerance(1e-14) + + check_derivatives(amici_model, solver, + epsilon=1e-4, + rtol=1e-2, + atol=1e-2) diff --git a/python/tests/test_sbml_import.py b/python/tests/test_sbml_import.py index f70cb773ab..813690170d 100644 --- a/python/tests/test_sbml_import.py +++ b/python/tests/test_sbml_import.py @@ -1,7 +1,6 @@ """Tests related to amici.sbml_import""" import os import re -import shutil from numbers import Number from pathlib import Path from urllib.request import urlopen @@ -198,19 +197,17 @@ def model_steadystate_module(): not variable.getId().endswith('_sigma') ) - outdir = 'test_model_steadystate_scaled' module_name = 'test_model_steadystate_scaled' - sbml_importer.sbml2amici( - model_name=module_name, - output_dir=outdir, - observables=observables, - constant_parameters=['k0'], - sigmas={'observable_x1withsigma': 'observable_x1withsigma_sigma'}) - - yield amici.import_model_module(module_name=module_name, - module_path=outdir) + with TemporaryDirectory(prefix=module_name) as outdir: + sbml_importer.sbml2amici( + model_name=module_name, + output_dir=outdir, + observables=observables, + constant_parameters=['k0'], + sigmas={'observable_x1withsigma': 'observable_x1withsigma_sigma'}) - shutil.rmtree(outdir, ignore_errors=True) + yield amici.import_model_module(module_name=module_name, + module_path=outdir) @pytest.fixture(scope='session') @@ -384,19 +381,17 @@ def model_test_likelihoods(): } module_name = 'model_test_likelihoods' - outdir = 'model_test_likelihoods' - sbml_importer.sbml2amici( - model_name=module_name, - output_dir=outdir, - observables=observables, - constant_parameters=['k0'], - noise_distributions=noise_distributions, - ) - - yield amici.import_model_module(module_name=module_name, - module_path=outdir) + with TemporaryDirectory(prefix=module_name) as outdir: + sbml_importer.sbml2amici( + model_name=module_name, + output_dir=outdir, + observables=observables, + constant_parameters=['k0'], + noise_distributions=noise_distributions, + ) - shutil.rmtree(outdir, ignore_errors=True) + yield amici.import_model_module(module_name=module_name, + module_path=outdir) @skip_on_valgrind @@ -607,7 +602,7 @@ def test_code_gen_uses_cse(extract_cse): generate_sensitivity_code=False, output_dir = tmpdir ) - xdot = Path(tmpdir, f'{model_name}_xdot.cpp').read_text() + xdot = Path(tmpdir, 'xdot.cpp').read_text() assert ("__amici_cse_0 = " in xdot) == extract_cse finally: os.environ = old_environ @@ -625,5 +620,5 @@ def test_code_gen_uses_lhs_symbol_ids(): generate_sensitivity_code=False, output_dir=tmpdir ) - dwdx = Path(tmpdir, f'{model_name}_dwdx.cpp').read_text() + dwdx = Path(tmpdir, 'dwdx.cpp').read_text() assert "dobservable_x1_dx1 = " in dwdx diff --git a/python/tests/test_sbml_import_special_functions.py b/python/tests/test_sbml_import_special_functions.py index 5f3207878c..6615828992 100644 --- a/python/tests/test_sbml_import_special_functions.py +++ b/python/tests/test_sbml_import_special_functions.py @@ -5,7 +5,6 @@ """ import os -import shutil import numpy as np import pytest @@ -13,7 +12,7 @@ import amici from amici.gradient_check import check_derivatives -from amici.testing import skip_on_valgrind +from amici.testing import TemporaryDirectoryWinSafe, skip_on_valgrind @pytest.fixture(scope="session") @@ -37,19 +36,17 @@ def model_special_likelihoods(): } module_name = 'test_special_likelihoods' - outdir = 'test_special_likelihoods' - sbml_importer.sbml2amici( - model_name=module_name, - output_dir=outdir, - observables=observables, - constant_parameters=['k0'], - noise_distributions=noise_distributions, - ) - - yield amici.import_model_module(module_name=module_name, - module_path=outdir) - - shutil.rmtree(outdir, ignore_errors=True) + with TemporaryDirectoryWinSafe(prefix=module_name) as outdir: + sbml_importer.sbml2amici( + model_name=module_name, + output_dir=outdir, + observables=observables, + constant_parameters=['k0'], + noise_distributions=noise_distributions, + ) + + yield amici.import_model_module(module_name=module_name, + module_path=outdir) @skip_on_valgrind diff --git a/python/tests/test_swig_interface.py b/python/tests/test_swig_interface.py index e7c52d1982..eeaebceede 100644 --- a/python/tests/test_swig_interface.py +++ b/python/tests/test_swig_interface.py @@ -362,9 +362,7 @@ def get_mod_val(val, attr): def set_val(obj, attr, val): if callable(getattr(obj, attr)): - getattr(obj, 'set' + attr[3:])( - val - ) + getattr(obj, 'set' + attr[3:])(val) else: setattr(obj, attr, val) diff --git a/scripts/buildSuiteSparse.sh b/scripts/buildSuiteSparse.sh index 1c339d59bc..36b493b62d 100755 --- a/scripts/buildSuiteSparse.sh +++ b/scripts/buildSuiteSparse.sh @@ -8,7 +8,7 @@ script_path=$(dirname "$BASH_SOURCE") amici_path=$(cd "$script_path/.." && pwd) suitesparse_root="${amici_path}/ThirdParty/SuiteSparse" - +export CMAKE_OPTIONS="-DBLA_VENDOR=All -DENABLE_CUDA=FALSE -DNFORTRAN=TRUE -DNCHOLMOD=TRUE" for subdir in SuiteSparse_config BTF AMD CAMD COLAMD KLU - do cd "${suitesparse_root}/${subdir}" && make library + do cd "${suitesparse_root}/${subdir}" && make local install done diff --git a/scripts/compileBLAS.cmd b/scripts/compileBLAS.cmd index 909d55a0b8..4fe0552848 100644 --- a/scripts/compileBLAS.cmd +++ b/scripts/compileBLAS.cmd @@ -1,13 +1,14 @@ echo compileBLAS.cmd started for openBLAS version %1 cd /D "C:\BLAS\OpenBLAS-%1\OpenBLAS-%1" call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvars64.bat" -cmake -G "Ninja" ^ +cmake -S . -B build ^ + -G "Ninja" ^ -DBUILD_DOUBLE=1 ^ -DBUILD_SHARED_LIBS=ON ^ - -DCMAKE_INSTALL_PREFIX:PATH="C:\BLAS\OpenBLAS-%1\OpenBLAS-%1\out\install\x64-Release" ^ + -DCMAKE_INSTALL_PREFIX:PATH="C:/BLAS/OpenBLAS" ^ -DCMAKE_C_COMPILER:FILEPATH=cl ^ -DCMAKE_BUILD_TYPE=Release ^ - -DCMAKE_MAKE_PROGRAM=ninja ^ - "C:\BLAS\OpenBLAS-%1\OpenBLAS-%1" -cmake --build "C:\BLAS\OpenBLAS-%1\OpenBLAS-%1" --parallel 2 + -DCMAKE_MAKE_PROGRAM=ninja +cmake --build build --parallel 2 +cmake --install build echo compileBLAS.cmd completed diff --git a/scripts/installOpenBLAS.ps1 b/scripts/installOpenBLAS.ps1 index 0aa4f856aa..9e23237f13 100644 --- a/scripts/installOpenBLAS.ps1 +++ b/scripts/installOpenBLAS.ps1 @@ -9,13 +9,10 @@ $webclient = New-Object System.Net.WebClient $webclient.DownloadFile($uri,"$output") Expand-Archive -Path "C:\BLAS\v$version.zip" -DestinationPath "C:\BLAS\OpenBLAS-$version" -Force # expand zip file cmd /c "scripts\compileBLAS.cmd $version" -cmd /c dumpbin /DEPENDENTS "C:\BLAS\OpenBLAS-$version\OpenBLAS-$version\lib\openblas.dll" -New-Item -Path 'C:\BLAS\lib' -ItemType Directory -Force # create directory -Copy-Item "C:\BLAS\OpenBLAS-$version\OpenBLAS-$version\lib\Release\openblas.lib" -Destination "C:\BLAS\lib" -Recurse -New-Item -Path 'C:\BLAS\bin' -ItemType Directory -Force # create directory -Copy-Item "C:\BLAS\OpenBLAS-$version\OpenBLAS-$version\lib\openblas.dll" -Destination "C:\BLAS\bin" -Recurse +cmd /c dumpbin /DEPENDENTS "C:\BLAS\OpenBLAS\bin\openblas.dll" Get-ChildItem -Path "C:\BLAS" -Include "openblas.lib" -Recurse # check for file Get-ChildItem -Path "C:\BLAS" -Include "openblas.dll" -Recurse # check for file +Get-ChildItem -Path "C:\BLAS" -Include "cblas.h" -Recurse # check for file Get-Item -Path Env:BLAS_* # check environment variables $VerbosePreference = "SilentlyContinue" # don't display verbose messages Write-Host 'script installOpenBLAS.ps1 completed' diff --git a/src/CMakeLists.template.cmake b/src/CMakeLists.template.cmake index 6aa13400be..ff20044c1a 100644 --- a/src/CMakeLists.template.cmake +++ b/src/CMakeLists.template.cmake @@ -1,15 +1,4 @@ -cmake_minimum_required(VERSION 3.3) - -if(POLICY CMP0060) - cmake_policy(SET CMP0060 NEW) -endif(POLICY CMP0060) -if(POLICY CMP0065) - cmake_policy(SET CMP0065 NEW) -endif(POLICY CMP0065) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) +cmake_minimum_required(VERSION 3.15) project(TPL_MODELNAME) @@ -30,7 +19,7 @@ foreach(FLAG ${MY_CXX_FLAGS}) endif() endforeach(FLAG) -find_package(Amici TPL_AMICI_VERSION HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) +find_package(Amici TPL_AMICI_VERSION REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") set(MODEL_DIR ${CMAKE_CURRENT_LIST_DIR}) diff --git a/src/amici.cpp b/src/amici.cpp index 55060e083a..534b1f5cbf 100644 --- a/src/amici.cpp +++ b/src/amici.cpp @@ -61,6 +61,7 @@ std::map simulation_status_to_str_map = { {AMICI_NOT_IMPLEMENTED, "AMICI_NOT_IMPLEMENTED"}, {AMICI_MAX_TIME_EXCEEDED, "AMICI_MAX_TIME_EXCEEDED"}, {AMICI_SUCCESS, "AMICI_SUCCESS"}, + {AMICI_NOT_RUN, "AMICI_NOT_RUN"}, }; std::unique_ptr runAmiciSimulation( @@ -194,9 +195,13 @@ std::unique_ptr runAmiciSimulation( throw; logger.log( LogSeverity::error, "OTHER", - "AMICI simulation failed: %s\nError occurred in:\n%s", ex.what(), - ex.getBacktrace() + "AMICI simulation failed: %s", ex.what() ); + logger.log( + LogSeverity::debug, "BACKTRACE", + "The previous error occurred at:\n%s", ex.getBacktrace() + ); + } catch (std::exception const& ex) { rdata->status = AMICI_ERROR; if (rethrow) diff --git a/src/model.cpp b/src/model.cpp index db36040167..010fe051e1 100644 --- a/src/model.cpp +++ b/src/model.cpp @@ -1476,7 +1476,7 @@ int Model::checkFinite(gsl::span array, if(hasObservableIds()) row_id += " " + getObservableIds()[row]; if(hasParameterIds()) - col_id += " " + getParameterIds()[plist(col)]; + col_id += " " + getParameterIds()[plist(gsl::narrow(col))]; break; case ModelQuantity::dydx: if(hasObservableIds()) @@ -1488,7 +1488,7 @@ int Model::checkFinite(gsl::span array, if(hasStateIds()) row_id += " " + getStateIdsSolver()[row]; if(hasParameterIds()) - col_id += " " + getParameterIds()[plist(col)]; + col_id += " " + getParameterIds()[plist(gsl::narrow(col))]; break; case ModelQuantity::dJydy: case ModelQuantity::dJydy_matlab: @@ -1510,7 +1510,7 @@ int Model::checkFinite(gsl::span array, case ModelQuantity::drzdp: case ModelQuantity::dsigmazdp: if(hasParameterIds()) - col_id += " " + getParameterIds()[plist(col)]; + col_id += " " + getParameterIds()[plist(gsl::narrow(col))]; break; case ModelQuantity::dsigmaydy: if(hasObservableIds()) { @@ -1610,7 +1610,7 @@ int Model::checkFinite(SUNMatrix m, ModelQuantity model_quantity, realtype t) co if(hasExpressionIds()) row_id += " " + getExpressionIds()[row]; if(hasParameterIds()) - col_id += " " + getParameterIds()[plist(col)]; + col_id += " " + getParameterIds()[plist(gsl::narrow(col))]; break; default: break; diff --git a/src/solver.cpp b/src/solver.cpp index 6bb20abe74..76994700f3 100644 --- a/src/solver.cpp +++ b/src/solver.cpp @@ -859,12 +859,24 @@ void Solver::setMaxTime(double maxtime) void Solver::startTimer() const { - starttime_ = std::chrono::system_clock::now(); + starttime_ = std::clock(); } -bool Solver::timeExceeded() const +bool Solver::timeExceeded(int interval) const { - return std::chrono::system_clock::now() - starttime_ > maxtime_; + static int eval_counter = 0; + + // 0 means infinite time + if(maxtime_.count() == 0) + return false; + + if (++eval_counter % interval) + return false; + + eval_counter = 0; + auto cputime_exceed = static_cast(std::clock() - starttime_) + / CLOCKS_PER_SEC; + return std::chrono::duration(cputime_exceed) > maxtime_; } void Solver::setMaxSteps(const long int maxsteps) { @@ -1226,21 +1238,29 @@ void wrapErrHandlerFn(int error_code, const char *module, snprintf(buffid, BUF_SIZE, "%s:%s:WARNING", module, function); break; - case -1: + case AMICI_TOO_MUCH_WORK: snprintf(buffid, BUF_SIZE, "%s:%s:TOO_MUCH_WORK", module, function); break; - case -2: + case AMICI_TOO_MUCH_ACC: snprintf(buffid, BUF_SIZE, "%s:%s:TOO_MUCH_ACC", module, function); break; - case -3: + case AMICI_ERR_FAILURE: snprintf(buffid, BUF_SIZE, "%s:%s:ERR_FAILURE", module, function); break; - case -4: + case AMICI_CONV_FAILURE: snprintf(buffid, BUF_SIZE, "%s:%s:CONV_FAILURE", module, function); break; + + case AMICI_RHSFUNC_FAIL: + snprintf(buffid, BUF_SIZE, "%s:%s:RHSFUNC_FAIL", module, function); + break; + + case AMICI_FIRST_RHSFUNC_ERR: + snprintf(buffid, BUF_SIZE, "%s:%s:FIRST_RHSFUNC_ERR", module, function); + break; default: snprintf(buffid, BUF_SIZE, "%s:%s:OTHER", module, function); diff --git a/src/solver_cvodes.cpp b/src/solver_cvodes.cpp index 5d02c9b7b6..9903c2b514 100644 --- a/src/solver_cvodes.cpp +++ b/src/solver_cvodes.cpp @@ -1036,7 +1036,7 @@ static int fxdot(realtype t, N_Vector x, N_Vector xdot, void *user_data) { auto solver = dynamic_cast(typed_udata->second); Expects(model); - if(solver->timeExceeded()) { + if (solver->timeExceeded(500)) { return AMICI_MAX_TIME_EXCEEDED; } @@ -1072,7 +1072,7 @@ static int fxBdot(realtype t, N_Vector x, N_Vector xB, N_Vector xBdot, auto solver = dynamic_cast(typed_udata->second); Expects(model); - if(solver->timeExceeded()) { + if (solver->timeExceeded(500)) { return AMICI_MAX_TIME_EXCEEDED; } diff --git a/src/solver_idas.cpp b/src/solver_idas.cpp index 6b5dd11fca..b68cb357e3 100644 --- a/src/solver_idas.cpp +++ b/src/solver_idas.cpp @@ -1045,7 +1045,7 @@ int fxdot(realtype t, N_Vector x, N_Vector dx, N_Vector xdot, auto solver = dynamic_cast(typed_udata->second); Expects(model); - if(solver->timeExceeded()) { + if (solver->timeExceeded(500)) { return AMICI_MAX_TIME_EXCEEDED; } @@ -1082,7 +1082,7 @@ int fxBdot(realtype t, N_Vector x, N_Vector dx, N_Vector xB, auto solver = dynamic_cast(typed_udata->second); Expects(model); - if(solver->timeExceeded()) { + if (solver->timeExceeded(500)) { return AMICI_MAX_TIME_EXCEEDED; } @@ -1111,7 +1111,6 @@ int fqBdot(realtype t, N_Vector x, N_Vector dx, N_Vector xB, model->fqBdot(t, x, dx, xB, dxB, qBdot); return model->checkFinite(gsl::make_span(qBdot), ModelQuantity::qBdot); - } diff --git a/src/steadystateproblem.cpp b/src/steadystateproblem.cpp index 0f7f5361ac..25fad2b693 100644 --- a/src/steadystateproblem.cpp +++ b/src/steadystateproblem.cpp @@ -103,11 +103,19 @@ void SteadystateProblem::findSteadyState( Solver const& solver, Model& model, int it ) { steady_state_status_.resize(3, SteadyStateStatus::not_run); - bool turnOffNewton = model.getSteadyStateSensitivityMode() == + /* Turn off Newton's method if newton_maxsteps is set to 0 or + if 'integrationOnly' approach is chosen for sensitivity computation + in combination with forward sensitivities approach. The latter is necessary + as numerical integration of the model ODEs and corresponding + forward sensitivities ODEs is coupled. If 'integrationOnly' approach is + chosen for sensitivity computation it is enforced that steady state is + computed only by numerical integration as well. */ + bool turnOffNewton = solver.getNewtonMaxSteps() == 0 || ( + model.getSteadyStateSensitivityMode() == SteadyStateSensitivityMode::integrationOnly && ((it == -1 && solver.getSensitivityMethodPreequilibration() == SensitivityMethod::forward) || solver.getSensitivityMethod() == - SensitivityMethod::forward); + SensitivityMethod::forward)); /* First, try to run the Newton solver */ if (!turnOffNewton) @@ -171,27 +179,39 @@ void SteadystateProblem::findSteadyStateBySimulation( runSteadystateSimulation(solver, model, false); } steady_state_status_[1] = SteadyStateStatus::success; - } catch (NewtonFailure const &ex) { + } catch (IntegrationFailure const &ex) { switch (ex.error_code) { case AMICI_TOO_MUCH_WORK: steady_state_status_[1] = SteadyStateStatus::failed_convergence; + if(model.logger) + model.logger->log( + LogSeverity::debug, "EQUILIBRATION_FAILURE", + "AMICI equilibration exceeded maximum number of" + " integration steps at t=%g.", ex.time + ); break; - case AMICI_NO_STEADY_STATE: + case AMICI_RHSFUNC_FAIL: steady_state_status_[1] = SteadyStateStatus::failed_too_long_simulation; + if(model.logger) + model.logger->log( + LogSeverity::debug, "EQUILIBRATION_FAILURE", + "AMICI equilibration was stopped after exceedingly" + " long simulation time at t=%g.", ex.time + ); break; default: + steady_state_status_[1] = SteadyStateStatus::failed; if(model.logger) model.logger->log( - LogSeverity::error, "NEWTON_FAILURE", - "AMICI newton method failed: %s", ex.what() + LogSeverity::debug, "OTHER", + "AMICI equilibration failed at t=%g.", ex.time ); - steady_state_status_[1] = SteadyStateStatus::failed; } } catch (AmiException const &ex) { if(model.logger) model.logger->log( - LogSeverity::error, "EQUILIBRATION_FAILURE", + LogSeverity::debug, "OTHER", "AMICI equilibration failed: %s", ex.what() ); steady_state_status_[1] = SteadyStateStatus::failed; @@ -362,9 +382,7 @@ void SteadystateProblem::writeErrorString(std::string *errorString, /* write error message according to steady state status */ switch (status) { case SteadyStateStatus::failed_too_long_simulation: - (*errorString) - .append(": System could not be equilibrated via" - " simulating to a late time point."); + (*errorString).append(": System could not be equilibrated."); break; case SteadyStateStatus::failed_damping: (*errorString).append(": Damping factor reached lower bound."); @@ -375,10 +393,8 @@ void SteadystateProblem::writeErrorString(std::string *errorString, case SteadyStateStatus::failed_convergence: (*errorString).append(": No convergence was achieved."); break; - case SteadyStateStatus::failed: - (*errorString).append("."); - break; default: + (*errorString).append("."); break; } } @@ -663,13 +679,7 @@ void SteadystateProblem::runSteadystateSimulation( while (true) { /* check for maxsteps */ if (sim_steps >= solver.getMaxSteps()) { - throw NewtonFailure(AMICI_TOO_MUCH_WORK, - "exceeded maximum number of steps"); - } - if (state_.t >= 1e200) { - throw NewtonFailure(AMICI_NO_STEADY_STATE, - "simulated to late time" - " point without convergence of RHS"); + throw IntegrationFailure(AMICI_TOO_MUCH_WORK, state_.t); } /* increase counter */ sim_steps++; @@ -716,6 +726,8 @@ std::unique_ptr SteadystateProblem::createSteadystateSimSolver( ) const { /* Create new CVode solver object */ auto sim_solver = std::unique_ptr(solver.clone()); + + sim_solver->logger = solver.logger; switch (solver.getLinearSolver()) { case LinearSolver::dense: @@ -723,8 +735,7 @@ std::unique_ptr SteadystateProblem::createSteadystateSimSolver( case LinearSolver::KLU: break; default: - throw NewtonFailure(AMICI_NOT_IMPLEMENTED, - "invalid solver for steadystate simulation"); + throw AmiException("invalid solver for steadystate simulation"); } /* do we need sensitivities? */ if (forwardSensis) { diff --git a/swig/CMakeLists_model.cmake b/swig/CMakeLists_model.cmake index 0c4136b816..4e20c59ff0 100644 --- a/swig/CMakeLists_model.cmake +++ b/swig/CMakeLists_model.cmake @@ -1,16 +1,4 @@ -cmake_minimum_required(VERSION 3.8) # swig_add_library - -if(POLICY CMP0078) - cmake_policy(SET CMP0078 NEW) -endif(POLICY CMP0078) -if(POLICY CMP0074) - # Use package_ROOT environment variables - cmake_policy(SET CMP0074 NEW) -endif(POLICY CMP0074) -if(POLICY CMP0086) - cmake_policy(SET CMP0086 NEW) -endif(POLICY CMP0086) - +cmake_minimum_required(VERSION 3.15) find_package(SWIG REQUIRED) include(${SWIG_USE_FILE}) @@ -18,16 +6,10 @@ include(${SWIG_USE_FILE}) if(DEFINED ENV{PYTHON_EXECUTABLE}) set(Python3_EXECUTABLE $ENV{PYTHON_EXECUTABLE}) endif() -if(${CMAKE_VERSION} VERSION_LESS "3.12.0") - find_package(PythonLibs REQUIRED) - include_directories(${PYTHON_INCLUDE_DIRS}) - set(Python3_LIBRARIES ${PYTHON_LIBRARIES}) -else() - # We don't need "Interpreter" here, but without that, FindPython3 will - # ignore the Python version selected via $Python3_EXECUTABLE - find_package(Python3 COMPONENTS Interpreter Development) - include_directories(${Python3_INCLUDE_DIRS}) -endif() +# We don't need "Interpreter" here, but without that, FindPython3 will +# ignore the Python version selected via $Python3_EXECUTABLE +find_package(Python3 COMPONENTS Interpreter Development) +include_directories(${Python3_INCLUDE_DIRS}) set(SWIG_LIBRARY_NAME _${PROJECT_NAME}) set(CMAKE_SWIG_FLAGS "") diff --git a/swig/amici.i b/swig/amici.i index 2091ae558e..4b2b5d7eaf 100644 --- a/swig/amici.i +++ b/swig/amici.i @@ -82,13 +82,48 @@ import_array(); // Expose vectors %include %template(DoubleVector) std::vector; +%extend std::vector { +%pythoncode %{ +def __repr__(self): + return self.this.__repr__()[:-1] + '; ' + repr(np.asarray(self, dtype=np.float64)) + ' >' + +%} +}; %template(IntVector) std::vector; +%extend std::vector { +%pythoncode %{ +def __repr__(self): + return self.this.__repr__()[:-1] + '; ' + repr(np.asarray(self, dtype=np.int64)) + ' >' + +%} +}; %template(BoolVector) std::vector; +%extend std::vector { +%pythoncode %{ +def __repr__(self): + return self.this.__repr__()[:-1] + '; ' + repr(np.asarray(self, dtype=np.bool_)) + ' >' + +%} +}; %template(StringVector) std::vector; +%extend std::vector { +%pythoncode %{ +def __repr__(self): + return self.this.__repr__()[:-1] + '; ' + repr(list(self)) + ' >' + +%} +}; %feature("docstring") std::map "Swig-Generated class templating :class:`Dict` [:class:`str`, :class:`float`] to facilitate interfacing with C++ bindings."; %template(StringDoubleMap) std::map; +%extend std::map { +%pythoncode %{ +def __repr__(self): + return self.this.__repr__()[:-1] + '; ' + repr(dict(self)) + ' >' + +%} +}; // Let numpy access std::vector %{ @@ -124,6 +159,7 @@ wrap_unique_ptr(ExpDataPtr, amici::ExpData) %ignore amici::ModelState; %ignore amici::ModelStateDerived; %ignore amici::unravel_index; +%ignore amici::backtraceString; // Include before any other header which uses enums defined there %include "amici/defines.h" @@ -166,13 +202,34 @@ using namespace amici; // Prevent using ValueWrapper, but don't expose unique_ptr vector %ignore std::vector>; %template(ReturnDataPtrVector) std::vector>; +%extend std::vector> { +%pythoncode %{ +def __repr__(self): + return self.this.__repr__()[:-1] + '; ' + repr(list(self)) + ' >' + +%} +}; // Process symbols in header %include "amici/amici.h" // Expose vectors %template(ExpDataPtrVector) std::vector; +%extend std::vector { +%pythoncode %{ +def __repr__(self): + return self.this.__repr__()[:-1] + '; ' + repr(list(self)) + ' >' + +%} +}; %template(LogItemVector) std::vector; +%extend std::vector { +%pythoncode %{ +def __repr__(self): + return self.this.__repr__()[:-1] + '; ' + repr(list(self)) + ' >' + +%} +}; // Convert integer values to enum class @@ -208,6 +265,13 @@ namespace amici { void Model::setParameterScale(std::vector const& intVec); } %template(ParameterScalingVector) std::vector; +%extend std::vector { +%pythoncode %{ +def __repr__(self): + return self.this.__repr__()[:-1] + '; ' + repr(list(self)) + ' >' + +%} +}; // Add function to check if amici was compiled with OpenMP @@ -253,6 +317,13 @@ RDataReporting = enum('RDataReporting') %} %template(SteadyStateStatusVector) std::vector; +%extend std::vector { +%pythoncode %{ +def __repr__(self): + return self.this.__repr__()[:-1] + '; ' + repr(list(self)) + ' >' + +%} +}; // Handle AMICI_DLL_DIRS environment variable %pythonbegin %{ @@ -265,9 +336,11 @@ if sys.platform == 'win32': %} -// import additional types for typehints +// import additional types for typehintsn +// also import np for use in __repr__ functions %pythonbegin %{ from typing import TYPE_CHECKING, Iterable, List, Tuple, Sequence +import numpy as np if TYPE_CHECKING: import numpy %} diff --git a/swig/edata.i b/swig/edata.i index 310869768c..59dcb4fa8a 100644 --- a/swig/edata.i +++ b/swig/edata.i @@ -62,7 +62,7 @@ def _edata_repr(self: "ExpData"): return "\n".join([ self.this.__repr__()[:-1], - f" condition {id} starting at t={self.tstart_}" + custom_simulation_settings, + f" condition '{self.id}' starting at t={self.tstart_}" + custom_simulation_settings, f" {self.nt()}x{self.nytrue()} time-resolved datapoints", f" ({n_data_y}/{self.nt()*self.nytrue()} measurements & {n_sigma_y}/{self.nt()*self.nytrue()} sigmas set)", f" {self.nmaxevent()}x{self.nztrue()} event-resolved datapoints", diff --git a/swig/modelname.template.i b/swig/modelname.template.i index 33804a1800..69015dc793 100644 --- a/swig/modelname.template.i +++ b/swig/modelname.template.i @@ -12,8 +12,9 @@ using namespace amici; // Make model module accessible from the model %feature("pythonappend") amici::generic_model::getModel %{ - import sys - val.module = sys.modules['.'.join(__name__.split('.')[:-1])] + if '.' in __name__: + import sys + val.module = sys.modules['.'.join(__name__.split('.')[:-1])] %} diff --git a/tests/cpp/steadystate/tests1.cpp b/tests/cpp/steadystate/tests1.cpp index 93f48ceb27..e939a84ff2 100644 --- a/tests/cpp/steadystate/tests1.cpp +++ b/tests/cpp/steadystate/tests1.cpp @@ -121,6 +121,10 @@ TEST(ExampleSteadystate, Maxtime) amici::hdf5::readSolverSettingsFromHDF5( NEW_OPTION_FILE, *solver, "/model_steadystate/nosensi/options"); + // Ensure the solver needs sufficiently many steps that time is checked + // at least once during integration + solver->setRelativeTolerance(1e-14); + auto rdata = runAmiciSimulation(*solver, nullptr, *model); ASSERT_EQ(amici::AMICI_SUCCESS, rdata->status); diff --git a/version.txt b/version.txt index 04a373efe6..2a0970ca75 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -0.16.0 +0.16.1