Skip to main content

sparse_ir_basis/
lib.rs

1//! # sparse-ir-basis
2//!
3//! The intermediate representation (IR) basis: the kernels and their physical
4//! properties ([`KernelProperties`]), the Fourier transforms of the singular
5//! functions, and [`FiniteTempBasis`]. Also the DLR built from an IR basis
6//! ([`DlrFromIr`]) and the IR <-> DLR transform. The singular value expansion
7//! and the piecewise Legendre polynomials come from `sparse-ir-sve`,
8//! re-exported here under the same paths.
9//!
10//! Most users depend on the `sparse-ir` crate, which re-exports this crate.
11
12#[macro_use]
13extern crate sparse_ir_core;
14
15// Modules and items of the core and the DLR, under the paths the code uses
16#[allow(unused_imports)]
17use sparse_ir_core::{
18    ArrayRole, Matrix, MatsubaraFreq, StatisticsType, TypedTensor, basis_trait, error, fitters,
19    fpu_check, freq, matrix, matsubara_sampling, parallel, sampling, taufuncs, traits,
20};
21#[allow(unused_imports)]
22use sparse_ir_dlr::{dlr, fermionic_single_pole, giwn_single_pole, gtau_single_pole};
23// Names the tests of this crate use at the crate root
24#[cfg(test)]
25#[allow(unused_imports)]
26use sparse_ir_core::{
27    Basis, Bosonic, Error, Fermionic, MatsubaraSampling, MatsubaraSamplingPositiveOnly, Statistics,
28    TauSampling,
29};
30#[cfg(test)]
31#[allow(unused_imports)]
32use sparse_ir_dlr::{
33    DiscreteLehmannRepresentation, DlrBuilder, IrDlrTransform, bosonic_single_pole,
34};
35
36pub mod basis;
37pub mod ir_dlr; // DLR built from an IR basis, and the IR <-> DLR transform
38pub mod kernel;
39pub(crate) mod pair_select; // Matsubara sampling-point selection by pairs of rows
40pub mod polyfourier;
41pub mod special_functions;
42
43// The SVE and the numerics it is built on, under the paths of this crate
44pub use sparse_ir_sve::unstable::{kernelmatrix, tsvd};
45pub use sparse_ir_sve::{gauss, hints, numeric, poly};
46
47/// Singular value expansion (SVE) of the kernels, from `sparse-ir-sve`
48pub mod sve {
49    pub use sparse_ir_sve::sve::*;
50    pub use sparse_ir_sve::unstable::sve::*;
51    pub use sparse_ir_sve::{Error, ErrorKind};
52}
53
54pub use basis::{BosonicBasis, FermionicBasis, FiniteTempBasis, MatsubaraPointMethod};
55pub use gauss::{Rule, legendre};
56pub use hints::SegmentHints;
57pub use ir_dlr::{DlrFromIr, IrBasis};
58pub use kernel::{
59    AbstractKernel, BasisKernel, CentrosymmKernel, ExpandableKernel, KernelProperties,
60    LogisticKernel, LogisticKernelWindowed, LogisticSVEHints, LogisticWindowedSVEHints,
61    ReducedKernel, RegularizedBoseKernel, RegularizedBoseSVEHints, SVEHints, SVEKernel,
62    SymmetryType, compute_logistic_kernel,
63};
64pub use kernelmatrix::{
65    DiscretizedKernel, matrix_from_gauss, matrix_from_gauss_noncentrosymmetric,
66    matrix_from_gauss_with_segments,
67};
68pub use numeric::CustomNumeric;
69pub use poly::{PiecewiseLegendrePoly, PiecewiseLegendrePolyVector};
70pub use polyfourier::{
71    BosonicPiecewiseLegendreFT, BosonicPiecewiseLegendreFTVector, FermionicPiecewiseLegendreFT,
72    FermionicPiecewiseLegendreFTVector, PiecewiseLegendreFT, PiecewiseLegendreFTVector, PowerModel,
73};
74pub use sparse_ir_sve::Df64;
75pub use sve::{
76    CentrosymmSVE, KernelBlock, SVEOptions, SVEResult, SVEStrategy, SamplingSVE, TworkType,
77    compute_sve, compute_sve_with,
78};
79pub use tsvd::{
80    SVDResult, TSVDConfig, svd_decompose, tsvd, tsvd_df64, tsvd_df64_from_f64, tsvd_f64,
81};
82
83// Test utilities (only available in test mode)
84#[cfg(test)]
85pub mod test_utils;
86
87// Tests of the core samplings, the Basis trait and the DLR on an IR basis
88#[cfg(test)]
89mod basis_trait_tests;
90#[cfg(test)]
91mod dlr_independent_tests;
92#[cfg(test)]
93mod dlr_tests;
94#[cfg(test)]
95mod matsubara_sampling_tests;
96#[cfg(test)]
97mod tau_sampling_tests;
98// Tests of the SVE of the kernels of this crate
99#[cfg(test)]
100mod sve_tests;