Warning
This C++ project is still under construction. Please use other repositories:
This C++ library provides routines for constructing and working with the intermediate representation of correlation functions. It provides:
- on-the-fly computation of basis functions for arbitrary cutoff Λ
- basis functions and singular values are accurate to full precision
- routines for sparse sampling
We use tuwien-cms/libxprec as a double-double precision arithmetic library.
- CMake (>= 3.10)
- C++ compiler with C++11 support
- Fortran compiler (optional, for Fortran bindings)
All other dependencies (including libxprec) are automatically downloaded and built during the build process using CMake's FetchContent feature. You do not need to install these manually.
Three build scripts are provided for easy building and installation:
-
build_capi.sh: Builds and installs only the C API
./build_capi.sh
-
build_fortran.sh: Builds and installs the C API and Fortran bindings
./build_fortran.sh
-
build_with_tests.sh: Builds everything including tests
./build_with_tests.sh # After testing, you can install with: cd build && cmake --install .
By default, all scripts will install to $HOME/opt/libsparseir
. You can override this by setting the CMAKE_INSTALL_PREFIX
environment variable:
CMAKE_INSTALL_PREFIX=/usr/local ./build_capi.sh
If you prefer to build manually, you can use the following commands:
mkdir -p build
cd build
# For C API only
cmake .. -DSPARSEIR_BUILD_FORTRAN=OFF -DSPARSEIR_BUILD_TESTING=OFF
# For C API and Fortran bindings
cmake .. -DSPARSEIR_BUILD_FORTRAN=ON -DSPARSEIR_BUILD_TESTING=OFF
# For everything including tests
cmake .. -DSPARSEIR_BUILD_FORTRAN=ON -DSPARSEIR_BUILD_TESTING=ON
# Build
cmake --build .
# Install
cmake --install .
For a quick test build with all options enabled:
rm -rf ./build && cmake -S . -B ./build -DSPARSEIR_BUILD_TESTING=ON && cmake --build ./build -j && ./build/test/libsparseirtests
After building with Fortran bindings enabled, you can run the Fortran test:
cd build
./test_kernel
Install doxygen
and graphviz
. Then, run the following command:
bash generate_docs.sh
This will create the docs/html
directory. Open docs/html/index.html
with your browser to see it.
Please refer ./sample_c/README.md
to learn more.