pub struct FiniteTempBasis<K, S>{ /* private fields */ }Expand description
Finite temperature basis for imaginary time/frequency Green’s functions
For a continuation kernel K from real frequencies ω ∈ [-ωmax, ωmax] to
imaginary time τ ∈ [0, β], this type stores the truncated singular
value expansion or IR basis:
K(τ, ω) ≈ sum(u[l](τ) * s[l] * v[l](ω) for l in 0..L)This basis is inferred from a reduced form by appropriate scaling of the variables.
§Type Parameters
K- Kernel type implementingKernelProperties + CentrosymmKernelS- Statistics type (FermionicorBosonic)
Implementations§
Source§impl<K, S> FiniteTempBasis<K, S>
impl<K, S> FiniteTempBasis<K, S>
Sourcepub fn sve_result(&self) -> &Arc<SVEResult> ⓘ
pub fn sve_result(&self) -> &Arc<SVEResult> ⓘ
Get the SVE result the basis was built from
It is not truncated to the basis size: a basis limited by max_size
or epsilon keeps all singular functions of the SVE.
Sourcepub fn u(&self) -> &Arc<PiecewiseLegendrePolyVector> ⓘ
pub fn u(&self) -> &Arc<PiecewiseLegendrePolyVector> ⓘ
Get the left singular functions (u) on imaginary time axis
Sourcepub fn v(&self) -> &Arc<PiecewiseLegendrePolyVector> ⓘ
pub fn v(&self) -> &Arc<PiecewiseLegendrePolyVector> ⓘ
Get the right singular functions (v) on real frequency axis
Sourcepub fn uhat(&self) -> &Arc<PiecewiseLegendreFTVector<S>> ⓘ
pub fn uhat(&self) -> &Arc<PiecewiseLegendreFTVector<S>> ⓘ
Get the left singular functions on Matsubara frequency axis (uhat)
Sourcepub fn uhat_full(&self) -> &Arc<PiecewiseLegendreFTVector<S>> ⓘ
pub fn uhat_full(&self) -> &Arc<PiecewiseLegendreFTVector<S>> ⓘ
Get the full uhat (before truncation)
Holds the Matsubara transforms of all singular functions of
sve_result, not only of the size() basis
functions; the default Matsubara sampling points use them.
Sourcepub fn default_matsubara_sampling_points_i64(
&self,
positive_only: bool,
) -> Result<Vec<i64>, Error>where
S: 'static,
pub fn default_matsubara_sampling_points_i64(
&self,
positive_only: bool,
) -> Result<Vec<i64>, Error>where
S: 'static,
Get default Matsubara sampling points as i64 indices (for C-API)
§Errors
Error::NotSupported if the basis functions have no definite parity
(an SVE that is not centrosymmetric, e.g. from compute_sve_general;
#183)
Sourcepub fn default_matsubara_sampling_points_i64_with_mitigate(
&self,
positive_only: bool,
mitigate: bool,
n_points: usize,
) -> Result<Vec<i64>, Error>where
S: 'static,
pub fn default_matsubara_sampling_points_i64_with_mitigate(
&self,
positive_only: bool,
mitigate: bool,
n_points: usize,
) -> Result<Vec<i64>, Error>where
S: 'static,
Get default Matsubara sampling points as i64 indices with mitigate parameter (for C-API)
§Errors
Error::NotSupported if the basis functions have no definite parity
(an SVE that is not centrosymmetric, e.g. from compute_sve_general;
#183)
Sourcepub fn new(
kernel: K,
beta: f64,
epsilon: Option<f64>,
max_size: Option<usize>,
) -> Result<FiniteTempBasis<K, S>, Error>
pub fn new( kernel: K, beta: f64, epsilon: Option<f64>, max_size: Option<usize>, ) -> Result<FiniteTempBasis<K, S>, Error>
Create a new FiniteTempBasis
§Arguments
kernel- Kernel implementingKernelProperties + CentrosymmKernelbeta- Inverse temperature (β > 0)epsilon- Accuracy of the basis, in (0, 1).Noneselects the best accuracy of the working precision (about 1.6e-16).max_size- Maximum number of basis functions (optional). It limits the basis, not the SVE: the SVE is computed and kept in full, as infrom_sve_resultwith an untruncated SVE. The default sampling points andaccuracyof the basis use the singular functions beyond it.
§Returns
A new FiniteTempBasis
§Errors
Error::InvalidParameterifbetais not positive and finite,epsilonis not in (0, 1), ormax_sizeisSome(0). These are checked before the SVE is computed.- The errors of
compute_sve:Error::NonFiniteInputif the discretized kernel has a non-finite entry,Error::DecompositionFailedif an SVD of the SVE fails - The errors of
from_sve_result
Sourcepub fn from_sve_result(
kernel: K,
beta: f64,
sve_result: SVEResult,
epsilon: Option<f64>,
max_size: Option<usize>,
) -> Result<FiniteTempBasis<K, S>, Error>
pub fn from_sve_result( kernel: K, beta: f64, sve_result: SVEResult, epsilon: Option<f64>, max_size: Option<usize>, ) -> Result<FiniteTempBasis<K, S>, Error>
Create basis from existing SVE result
This is useful when you want to reuse the same SVE computation for both fermionic and bosonic bases.
max_size (and epsilon) truncate the basis functions and singular
values only. sve_result is kept as given: the default sampling points
and accuracy use its singular functions beyond the
basis, so pass an untruncated SVE to get the points of SparseIR.jl.
§Errors
Error::InvalidParameterifbetais not positive and finite,epsilonis not in [0, 1) (0 keeps every singular value),max_sizeisSome(0), orsve_resultis not an SVE on [-1, 1] × [-1, 1]Error::EmptyInputifsve_resulthas no singular functions- The errors of
SVEResult::part(for anSVEResultwhose public fields break its invariants)
Sourcepub fn significance(&self) -> Vec<f64>
pub fn significance(&self) -> Vec<f64>
Get significance of each singular value (s[i] / s[0])
Sourcepub fn default_tau_sampling_points(&self) -> Result<Vec<f64>, Error>
pub fn default_tau_sampling_points(&self) -> Result<Vec<f64>, Error>
Get default tau sampling points
Returns sampling points in imaginary time τ ∈ [-β/2, β/2].
Roots are found with symmetry exploitation (matching Python 1.x / Julia v1), then mapped to [-β/2, β/2] by folding τ_physical ∈ [0, β] around β/2.
§Errors
Error::NotSupportedif the default points are not defined for this basis: its SVE has so few singular functions that the last one has no extrema (e.g.compute_svewithmax_num_svals = Some(2))
Sourcepub fn default_tau_sampling_points_size_requested(
&self,
size_requested: usize,
) -> Result<Vec<f64>, Error>
pub fn default_tau_sampling_points_size_requested( &self, size_requested: usize, ) -> Result<Vec<f64>, Error>
Get default tau sampling points with a requested size
Returns sampling points in τ ∈ [-β/2, β/2].
§Errors
Error::NotSupportedif the default points are not defined for this basis: its SVE has so few singular functions that the last one has no extrema (e.g.compute_svewithmax_num_svals = Some(2))
Sourcepub fn default_matsubara_sampling_points(
&self,
positive_only: bool,
) -> Result<Vec<MatsubaraFreq<S>>, Error>where
S: 'static,
pub fn default_matsubara_sampling_points(
&self,
positive_only: bool,
) -> Result<Vec<MatsubaraFreq<S>>, Error>where
S: 'static,
Get default Matsubara frequency sampling points
Returns sampling points as MatsubaraFreq objects: the sign changes of the first discarded Matsubara basis function (its extrema when that function is not available); bosonic sets always include n = 0.
§Arguments
positive_only- If true, returns only non-negative frequencies
§Returns
Vector of Matsubara frequency sampling points
§Errors
Error::NotSupported if the basis functions have no definite parity
(an SVE that is not centrosymmetric, e.g. from compute_sve_general;
#183)
Sourcepub fn default_omega_sampling_points(&self) -> Result<Vec<f64>, Error>
pub fn default_omega_sampling_points(&self) -> Result<Vec<f64>, Error>
Get default omega (real frequency) sampling points
Returns sampling points on the real-frequency axis ω ∈ [-ωmax, ωmax]. These are used as pole locations for the Discrete Lehmann Representation (DLR).
The sampling points are chosen as the roots of the L-th basis function in the spectral domain (v), which provides near-optimal conditioning.
§Returns
Vector of real-frequency sampling points in [-ωmax, ωmax]
§Errors
Error::NotSupportedif the default points are not defined for this basis: its SVE has so few singular functions that the last one has no extrema (e.g.compute_svewithmax_num_svals = Some(2))
Trait Implementations§
Source§impl<K, S> Basis<S> for FiniteTempBasis<K, S>
impl<K, S> Basis<S> for FiniteTempBasis<K, S>
Source§fn default_tau_sampling_points(&self) -> Result<Vec<f64>, Error>
fn default_tau_sampling_points(&self) -> Result<Vec<f64>, Error>
Source§fn default_matsubara_sampling_points(
&self,
positive_only: bool,
) -> Result<Vec<MatsubaraFreq<S>>, Error>
fn default_matsubara_sampling_points( &self, positive_only: bool, ) -> Result<Vec<MatsubaraFreq<S>>, Error>
Source§fn evaluate_tau(&self, tau: &[f64]) -> Result<TypedTensor<f64, Rank<2>>, Error>
fn evaluate_tau(&self, tau: &[f64]) -> Result<TypedTensor<f64, Rank<2>>, Error>
Source§fn evaluate_matsubara(
&self,
freqs: &[MatsubaraFreq<S>],
) -> Result<TypedTensor<Complex<f64>, Rank<2>>, Error>
fn evaluate_matsubara( &self, freqs: &[MatsubaraFreq<S>], ) -> Result<TypedTensor<Complex<f64>, Rank<2>>, Error>
Source§fn evaluate_omega(
&self,
omega: &[f64],
) -> Result<TypedTensor<f64, Rank<2>>, Error>
fn evaluate_omega( &self, omega: &[f64], ) -> Result<TypedTensor<f64, Rank<2>>, Error>
Source§impl<K, S> Clone for FiniteTempBasis<K, S>
impl<K, S> Clone for FiniteTempBasis<K, S>
Source§fn clone(&self) -> FiniteTempBasis<K, S>
fn clone(&self) -> FiniteTempBasis<K, S>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<K, S> IrBasis<S> for FiniteTempBasis<K, S>
impl<K, S> IrBasis<S> for FiniteTempBasis<K, S>
Source§fn dlr_transform(
&self,
dlr: &DiscreteLehmannRepresentation<S>,
) -> Result<IrDlrTransform, Error>where
S: 'static,
fn dlr_transform(
&self,
dlr: &DiscreteLehmannRepresentation<S>,
) -> Result<IrDlrTransform, Error>where
S: 'static,
dlr. Read moreAuto Trait Implementations§
impl<K, S> Freeze for FiniteTempBasis<K, S>where
K: Freeze,
impl<K, S> RefUnwindSafe for FiniteTempBasis<K, S>where
K: RefUnwindSafe,
S: RefUnwindSafe,
impl<K, S> Send for FiniteTempBasis<K, S>
impl<K, S> Sync for FiniteTempBasis<K, S>
impl<K, S> Unpin for FiniteTempBasis<K, S>
impl<K, S> UnsafeUnpin for FiniteTempBasis<K, S>where
K: UnsafeUnpin,
impl<K, S> UnwindSafe for FiniteTempBasis<K, S>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreimpl<T> MaybeSend for Twhere
T: Send,
impl<T> MaybeSendSync for T
impl<T> MaybeSync for Twhere
T: Sync,
§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.