Crate sparse_ir_capi

Crate sparse_ir_capi 

Source
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§

MemoryOrder
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_FLOAT64
SPIR_TWORK_FLOAT64X2

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§

StatusCode
Error codes for C API (compatible with libsparseir)