Skip to main content

sparse_ir_core/
lib.rs

1//! # sparse-ir-core
2//!
3//! The representation-independent layer of sparse-ir: statistics and
4//! Matsubara frequencies, the error type, GEMM dispatch, the least-squares
5//! fitters, the [`Basis`] trait, and sparse sampling in imaginary time and
6//! Matsubara frequency for any [`Basis`].
7//!
8//! Most users depend on the `sparse-ir` crate, which re-exports this crate
9//! together with the IR basis, the DLR and MiniPole.
10
11/// Print a warning to stderr only when the `SPARSEIR_DEBUG` environment
12/// variable enables debug diagnostics (see [`is_debug_enabled`] for the
13/// accepted values).
14///
15/// Library code must not write to stderr unconditionally; these are advisory
16/// diagnostics (e.g. ill-conditioned sampling) for debugging, not error reports.
17#[macro_export]
18macro_rules! debug_warn {
19    ($($arg:tt)*) => {
20        if $crate::is_debug_enabled() {
21            eprintln!("[SPARSEIR WARN] {}", format!($($arg)*));
22        }
23    };
24}
25
26pub mod basis_trait; // Common trait for basis representations
27mod debug; // SPARSEIR_DEBUG switch for debug diagnostics
28pub mod error; // Error type of the public API
29pub mod fitters; // Least-squares fitters (real/complex matrices)
30pub use sparse_ir_sve::unstable::fpu_check; // FPU state checking for Intel Fortran compatibility
31pub mod freq;
32pub mod gemm; // Matrix multiplication utilities (Faer backend)
33pub mod matrix; // Column-major dense containers for internal numerics
34#[doc(hidden)]
35pub use sparse_ir_sve::mat; // `mat!`, at its path before the split
36pub mod matsubara_sampling; // Sparse sampling in Matsubara frequencies
37#[doc(hidden)]
38pub use sparse_ir_sve::unstable::parallel; // Parallel execution on the rayon pool (internal)
39pub mod sampling; // Sparse sampling in imaginary time
40pub mod taufuncs; // Imaginary time τ normalization utilities
41pub mod traits;
42
43pub use basis_trait::Basis;
44pub use debug::is_debug_enabled;
45pub use error::{ArrayRole, Error, ErrorKind, Result};
46pub use fitters::InplaceFitter;
47pub use freq::{BosonicFreq, FermionicFreq, MatsubaraFreq};
48pub use matsubara_sampling::{MatsubaraSampling, MatsubaraSamplingPositiveOnly};
49pub use sampling::TauSampling;
50pub use traits::{Bosonic, Fermionic, Statistics, StatisticsMarker, StatisticsType};
51
52// Re-export external dependencies for convenience
53pub use tenferro_tensor::{
54    DynRank, Rank, TensorScalar, TypedTensor, TypedTensorView, TypedTensorViewMut,
55};
56
57/// Dense column-major host matrix used by the public API.
58pub type Matrix<T> = tenferro_tensor::TypedTensor<T, tenferro_tensor::Rank<2>>;