Expand description
C API for SparseIR Rust implementation
This crate provides a C-compatible interface to the SparseIR library, enabling usage from languages like Julia, Python, Fortran, and C++.
Macros§
- debug_
eprintln - Debug print macro for errors that only outputs if SPARSEIR_DEBUG is set
- debug_
println - Debug print macro that only outputs if SPARSEIR_DEBUG is set
- impl_
opaque_ type_ common - Generate common opaque type functions: release, clone, is_assigned, get_raw_ptr
Structs§
- Complex64
- Complex number type for C API (compatible with C’s double complex)
- spir_
basis - Opaque basis type for C API (compatible with libsparseir)
- spir_
funcs - Opaque funcs type for C API (compatible with libsparseir)
- spir_
gemm_ backend - Opaque pointer type for GEMM backend handle
- spir_
kernel - Opaque kernel type for C API (compatible with libsparseir)
- spir_
sampling - Sampling type for C API (unified type for all domains)
- spir_
sve_ result - Opaque SVE result type for C API (compatible with libsparseir)
Enums§
- Memory
Order - Memory layout order
Constants§
- SPIR_
COMPUTATION_ SUCCESS - SPIR_
GET_ IMPL_ FAILED - SPIR_
INPUT_ DIMENSION_ MISMATCH - SPIR_
INTERNAL_ ERROR - SPIR_
INVALID_ ARGUMENT - SPIR_
INVALID_ DIMENSION - SPIR_
NOT_ SUPPORTED - SPIR_
ORDER_ COLUMN_ MAJOR - SPIR_
ORDER_ ROW_ MAJOR - SPIR_
OUTPUT_ DIMENSION_ MISMATCH - SPIR_
STATISTICS_ BOSONIC - SPIR_
STATISTICS_ FERMIONIC - SPIR_
SVDSTRAT_ ACCURATE - SPIR_
SVDSTRAT_ AUTO - SPIR_
SVDSTRAT_ FAST - SPIR_
TWORK_ AUTO - SPIR_
TWORK_ FLOA T64 - SPIR_
TWORK_ FLOA T64X2
Functions§
- convert_
dims_ for_ row_ major - Convert dimensions and target_dim for row-major mdarray
- is_
debug_ enabled - Check if SPARSEIR_DEBUG environment variable is set
- spir_
basis_ ⚠clone - Manual clone function (replaces macro-generated one)
- spir_
basis_ get_ default_ matsus - Get default Matsubara sampling points
- spir_
basis_ get_ default_ matsus_ ext - Get default Matsubara sampling points with custom limit (extended version)
- spir_
basis_ get_ default_ taus - Get default tau sampling points
- spir_
basis_ get_ default_ taus_ ext - Get default tau sampling points with custom limit (extended version)
- spir_
basis_ get_ default_ ws - Gets the default omega (real frequency) sampling points
- spir_
basis_ get_ n_ default_ matsus - Get the number of default Matsubara sampling points
- spir_
basis_ get_ n_ default_ matsus_ ext - Get number of default Matsubara sampling points with custom limit (extended version)
- spir_
basis_ get_ n_ default_ taus - Get the number of default tau sampling points
- spir_
basis_ get_ n_ default_ ws - Gets the number of default omega (real frequency) sampling points
- spir_
basis_ get_ singular_ values - Get singular values (alias for spir_basis_get_svals for libsparseir compatibility)
- spir_
basis_ get_ size - Get the number of basis functions
- spir_
basis_ get_ stats - Get statistics type (Fermionic or Bosonic) of a basis
- spir_
basis_ get_ svals - Get singular values from a basis
- spir_
basis_ ⚠get_ u - Gets the basis functions in imaginary time (τ) domain
- spir_
basis_ ⚠get_ uhat - Gets the basis functions in Matsubara frequency domain
- spir_
basis_ ⚠get_ uhat_ full - Gets the full (untruncated) Matsubara-frequency basis functions
- spir_
basis_ ⚠get_ v - Gets the basis functions in real frequency (ω) domain
- spir_
basis_ is_ assigned - Manual is_assigned function (replaces macro-generated one)
- spir_
basis_ new - Create a finite temperature basis (libsparseir compatible)
- spir_
basis_ new_ from_ sve_ and_ regularizer - Create a finite temperature basis from SVE result and custom regularizer function
- spir_
basis_ release - Manual release function (replaces macro-generated one)
- spir_
choose_ working_ type - Choose the working type (Twork) based on epsilon value
- spir_
dlr2ir_ dd - Convert DLR coefficients to IR (real-valued)
- spir_
dlr2ir_ zz - Convert DLR coefficients to IR (complex-valued)
- spir_
dlr_ get_ npoles - Gets the number of poles in a DLR
- spir_
dlr_ get_ poles - Gets the pole locations in a DLR
- spir_
dlr_ new - Creates a new DLR from an IR basis with default poles
- spir_
dlr_ new_ with_ poles - Creates a new DLR with custom poles
- spir_
funcs_ batch_ eval - Batch evaluate functions at multiple points (continuous functions only)
- spir_
funcs_ batch_ eval_ matsu - Batch evaluate functions at multiple Matsubara frequencies
- spir_
funcs_ clone - Manual clone function (replaces macro-generated one)
- spir_
funcs_ deriv - Compute the n-th derivative of basis functions
- spir_
funcs_ eval - Evaluate functions at a single point (continuous functions only)
- spir_
funcs_ eval_ matsu - Evaluate functions at a single Matsubara frequency
- spir_
funcs_ from_ piecewise_ legendre - Create a spir_funcs object from piecewise Legendre polynomial coefficients
- spir_
funcs_ get_ knots - Gets the knot positions for continuous functions
- spir_
funcs_ get_ n_ knots - Gets the number of knots for continuous functions
- spir_
funcs_ get_ size - Gets the number of basis functions
- spir_
funcs_ get_ slice - Extract a subset of functions by indices
- spir_
funcs_ is_ assigned - Manual is_assigned function (replaces macro-generated one)
- spir_
funcs_ release - Manual release function (replaces macro-generated one)
- spir_
gauss_ legendre_ rule_ piecewise_ ddouble - Compute piecewise Gauss-Legendre quadrature rule (DDouble precision)
- spir_
gauss_ legendre_ rule_ piecewise_ double - Compute piecewise Gauss-Legendre quadrature rule (double precision)
- spir_
gemm_ backend_ new_ from_ fblas_ ilp64 - Create GEMM backend from Fortran BLAS function pointers (ILP64)
- spir_
gemm_ backend_ new_ from_ fblas_ lp64 - Create GEMM backend from Fortran BLAS function pointers (LP64)
- spir_
gemm_ backend_ release - Release GEMM backend handle
- spir_
ir2dlr_ dd - Convert IR coefficients to DLR (real-valued)
- spir_
ir2dlr_ zz - Convert IR coefficients to DLR (complex-valued)
- spir_
kernel_ clone - Manual clone function (replaces macro-generated one)
- spir_
kernel_ compute - Compute kernel value K(x, y)
- spir_
kernel_ get_ domain - Get kernel domain boundaries
- spir_
kernel_ get_ lambda - Get the lambda parameter of a kernel
- spir_
kernel_ get_ sve_ hints_ ngauss - Get the number of Gauss points hint from a kernel
- spir_
kernel_ get_ sve_ hints_ nsvals - Get the number of singular values hint from a kernel
- spir_
kernel_ get_ sve_ hints_ segments_ x - Get x-segments for SVE discretization hints from a kernel
- spir_
kernel_ get_ sve_ hints_ segments_ y - Get y-segments for SVE discretization hints from a kernel
- spir_
kernel_ is_ assigned - Manual is_assigned function (replaces macro-generated one)
- spir_
kernel_ release - Manual release function (replaces macro-generated one)
- spir_
logistic_ kernel_ new - Create a new Logistic kernel
- spir_
matsu_ sampling_ new - Creates a new Matsubara sampling object for sparse sampling in Matsubara frequencies
- spir_
matsu_ sampling_ new_ with_ matrix - Creates a new Matsubara sampling object with custom sampling points and pre-computed matrix
- spir_
reg_ bose_ kernel_ new - Create a new RegularizedBose kernel
- spir_
sampling_ clone - Manual clone function (replaces macro-generated one)
- spir_
sampling_ eval_ dd - Evaluates basis coefficients at sampling points (double to double version).
- spir_
sampling_ eval_ dz - Evaluate basis coefficients at sampling points (double → complex)
- spir_
sampling_ eval_ zz - Evaluate basis coefficients at sampling points (complex → complex)
- spir_
sampling_ fit_ dd - Fits values at sampling points to basis coefficients (double to double version).
- spir_
sampling_ fit_ zd - Fit basis coefficients from Matsubara sampling points (complex input, real output)
- spir_
sampling_ fit_ zz - Fits values at sampling points to basis coefficients (complex to complex version).
- spir_
sampling_ get_ cond_ num - Gets the condition number of the sampling matrix.
- spir_
sampling_ get_ matsus - Gets the Matsubara frequency sampling points
- spir_
sampling_ get_ npoints - Gets the number of sampling points in a sampling object.
- spir_
sampling_ get_ taus - Gets the imaginary time (τ) sampling points used in the specified sampling object.
- spir_
sampling_ is_ assigned - Manual is_assigned function (replaces macro-generated one)
- spir_
sampling_ release - Manual release function (replaces macro-generated one)
- spir_
sve_ result_ clone - Manual clone function (replaces macro-generated one)
- spir_
sve_ result_ from_ matrix - Create a SVE result from a discretized kernel matrix
- spir_
sve_ result_ from_ matrix_ centrosymmetric - Create a SVE result from centrosymmetric discretized kernel matrices
- spir_
sve_ result_ get_ size - Get the number of singular values in an SVE result
- spir_
sve_ result_ get_ svals - Get singular values from an SVE result
- spir_
sve_ result_ is_ assigned - Manual is_assigned function (replaces macro-generated one)
- spir_
sve_ result_ new - Compute Singular Value Expansion (SVE) of a kernel (libsparseir compatible)
- spir_
sve_ result_ release - Manual release function (replaces macro-generated one)
- spir_
sve_ result_ truncate - Truncate an SVE result based on epsilon and max_size
- spir_
tau_ sampling_ new - Creates a new tau sampling object for sparse sampling in imaginary time
- spir_
tau_ sampling_ new_ with_ matrix - Creates a new tau sampling object with custom sampling points and pre-computed matrix
- spir_
uhat_ get_ default_ matsus - Get default Matsubara sampling points from a Matsubara-space spir_funcs
Type Aliases§
- Status
Code - Error codes for C API (compatible with libsparseir)