pub struct DiscreteLehmannRepresentation<S>where
S: StatisticsType,{ /* private fields */ }Expand description
Discrete Lehmann Representation (DLR)
The DLR is a variant of the IR basis based on a “sketching” of the analytic continuation kernel K. Instead of using singular value expansion, it represents Green’s functions as a linear combination of poles on the real-frequency axis:
G(iν) = Σ_i a[i] * reg[i] / (iν - ω[i])where:
ω[i]are pole positions on the real axisa[i]are expansion coefficientsreg[i]are the kernel regularizersw(β, ω_i)
regularizers() returns w(β, ω_i): 1 for fermions
and tanh(βω_i/2) for bosons with LogisticKernel, and ω_i for
RegularizedBoseKernel. The DLR functions are -K(τ, ω_i) and its Fourier
transform for the physical kernel K(τ, ω) = Σ_l u_l(τ) s_l v_l(ω) of the
source basis.
Two constructions are available:
- independent (default):
DiscreteLehmannRepresentation::new/DlrBuilderselect the poles by an interpolative decomposition of the discretized logistic kernel (Kaye, Chen, Parcollet, PRB 105, 235115), without building an IR basis; - IR-derived:
DiscreteLehmannRepresentation::from_ir(traitDlrFromIrof the IR crate) uses the default real-frequency sampling points of an IR basis as poles, andfrom_ir_with_polestakes the poles.
Conversions to and from an IR basis are provided by IrDlrTransform;
an IR-derived DLR carries one for its source basis.
Imaginary-time and Matsubara nodes for square interpolation are selected
by a row interpolative decomposition and are exposed through
Basis::default_tau_sampling_points
and
Basis::default_matsubara_sampling_points,
so TauSampling::new and
MatsubaraSampling::new work on a DLR.
§Type Parameters
S- Statistics type (Fermionic or Bosonic)
Implementations§
Source§impl<S> DiscreteLehmannRepresentation<S>where
S: StatisticsType,
impl<S> DiscreteLehmannRepresentation<S>where
S: StatisticsType,
pub fn kernel_ypower(&self) -> i32
pub fn pole_weights(&self) -> &[f64]
Sourcepub fn poles(&self) -> &[f64]
pub fn poles(&self) -> &[f64]
Pole positions on the real-frequency axis, in the order they were
given to from_ir_with_poles (sorted ascending when chosen by
Self::new or from_ir)
Sourcepub fn regularizers(&self) -> &[f64]
pub fn regularizers(&self) -> &[f64]
Regularizers of the poles: regularizers[i] = w(β, poles[i]) of the
kernel of the IR basis this DLR was built from (of the logistic
kernel for an independent DLR)
Sourcepub fn ir_basis_size(&self) -> Option<usize>
pub fn ir_basis_size(&self) -> Option<usize>
Number of functions of the IR basis this DLR was built from: the
extent of the IR axis of Self::from_ir_nd and Self::to_ir_nd.
None for a DLR built independently of an IR basis.
Sourcepub fn ir_transform(&self) -> Option<&IrDlrTransform>
pub fn ir_transform(&self) -> Option<&IrDlrTransform>
IR <-> DLR transform of the source basis (IR-derived DLR only).
Sourcepub fn new(
beta: f64,
wmax: f64,
accuracy: f64,
) -> Result<DiscreteLehmannRepresentation<S>, Error>where
S: 'static,
pub fn new(
beta: f64,
wmax: f64,
accuracy: f64,
) -> Result<DiscreteLehmannRepresentation<S>, Error>where
S: 'static,
Build a DLR independently of any IR basis (default construction).
Equivalent to DlrBuilder::new(beta, wmax).accuracy(accuracy).build().
An accuracy below about 1e-14 is beyond double-precision
resolution and makes the DLR larger without making it more accurate;
see DlrBuilder::DEFAULT_ACCURACY.
§Errors
See DlrBuilder::build.
Sourcepub fn from_ir_nd<T>(
&self,
backend: Option<&GemmBackendHandle>,
gl: &TypedTensor<T>,
dim: usize,
) -> Result<TypedTensor<T>, Error>where
T: FitScalar,
pub fn from_ir_nd<T>(
&self,
backend: Option<&GemmBackendHandle>,
gl: &TypedTensor<T>,
dim: usize,
) -> Result<TypedTensor<T>, Error>where
T: FitScalar,
Convert IR coefficients to DLR (N-dimensional, generic over real/complex)
§Type Parameters
T- Element type (f64orComplex<f64>)
§Arguments
gl- IR coefficients as N-D tensordim- Dimension along which to transform
§Returns
DLR coefficients as N-D tensor, with Basis::size
(the number of poles) entries along dim. An empty batch (a zero
extent on another axis) gives an empty result.
§Errors
Error::AxisOutOfRangeifdimis not an axis ofglError::ShapeMismatchof the input ifgldoes not haveSelf::ir_basis_sizeentries alongdimError::DecompositionFailedif the SVD of the fitting matrix fails (its entries are finite, since the poles are)
Sourcepub fn to_ir_nd<T>(
&self,
backend: Option<&GemmBackendHandle>,
g_dlr: &TypedTensor<T>,
dim: usize,
) -> Result<TypedTensor<T>, Error>where
T: FitScalar,
pub fn to_ir_nd<T>(
&self,
backend: Option<&GemmBackendHandle>,
g_dlr: &TypedTensor<T>,
dim: usize,
) -> Result<TypedTensor<T>, Error>where
T: FitScalar,
Convert DLR coefficients to IR (N-dimensional, generic over real/complex)
§Type Parameters
T- Element type (f64orComplex<f64>)
§Arguments
g_dlr- DLR coefficients as N-D tensordim- Dimension along which to transform
§Returns
IR coefficients as N-D tensor, with Self::ir_basis_size entries
along dim. An empty batch gives an empty result.
§Errors
Error::AxisOutOfRangeifdimis not an axis ofg_dlrError::ShapeMismatchof the input ifg_dlrdoes not haveBasis::size(the number of poles) entries alongdim
Source§impl<S> DiscreteLehmannRepresentation<S>where
S: StatisticsType + 'static,
impl<S> DiscreteLehmannRepresentation<S>where
S: StatisticsType + 'static,
Sourcepub fn matsubara_nodes(&self, positive_only: bool) -> &[i64]
pub fn matsubara_nodes(&self, positive_only: bool) -> &[i64]
Matsubara interpolation nodes as indices n (ν = nπ/β, sorted).
With positive_only, nodes are chosen among n >= 0 so that the
stacked real and imaginary parts determine the coefficients of a
Green’s function with G(-iν) = conj(G(iν)).
Trait Implementations§
Source§impl<S> Basis<S> for DiscreteLehmannRepresentation<S>where
S: StatisticsType + 'static,
impl<S> Basis<S> for DiscreteLehmannRepresentation<S>where
S: StatisticsType + 'static,
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<S> DlrFromIr<S> for DiscreteLehmannRepresentation<S>where
S: StatisticsType + 'static,
impl<S> DlrFromIr<S> for DiscreteLehmannRepresentation<S>where
S: StatisticsType + 'static,
Auto Trait Implementations§
impl<S> !Freeze for DiscreteLehmannRepresentation<S>
impl<S> !RefUnwindSafe for DiscreteLehmannRepresentation<S>
impl<S> !UnwindSafe for DiscreteLehmannRepresentation<S>
impl<S> Send for DiscreteLehmannRepresentation<S>where
S: Send,
impl<S> Sync for DiscreteLehmannRepresentation<S>where
S: Sync,
impl<S> Unpin for DiscreteLehmannRepresentation<S>where
S: Unpin,
impl<S> UnsafeUnpin for DiscreteLehmannRepresentation<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
§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.