Skip to main content

DiscreteLehmannRepresentation

Struct DiscreteLehmannRepresentation 

Source
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 axis
  • a[i] are expansion coefficients
  • reg[i] are the kernel regularizers w(β, ω_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 / DlrBuilder select 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 (trait DlrFromIr of the IR crate) uses the default real-frequency sampling points of an IR basis as poles, and from_ir_with_poles takes 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,

Source

pub fn kernel_ypower(&self) -> i32

Source

pub fn pole_weights(&self) -> &[f64]

Source

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)

Source

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)

Source

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.

Source

pub fn ir_transform(&self) -> Option<&IrDlrTransform>

IR <-> DLR transform of the source basis (IR-derived DLR only).

Source

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.

Source

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 (f64 or Complex<f64>)
§Arguments
  • gl - IR coefficients as N-D tensor
  • dim - 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

The mathematical transform does not depend on the axis placement or the memory order of the arrays, but the floating-point result can: a different axis placement selects a different contraction geometry, and the GEMM backend decides how that geometry is blocked. Bitwise agreement across axis placements is not guaranteed, and conditioning or cancellation can amplify the difference (SpM-lab/sparse-ir-rs#326).

Source

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 (f64 or Complex<f64>)
§Arguments
  • g_dlr - DLR coefficients as N-D tensor
  • dim - 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

The mathematical transform does not depend on the axis placement or the memory order of the arrays, but the floating-point result can: a different axis placement selects a different contraction geometry, and the GEMM backend decides how that geometry is blocked. Bitwise agreement across axis placements is not guaranteed, and conditioning or cancellation can amplify the difference (SpM-lab/sparse-ir-rs#326).

Source§

impl<S> DiscreteLehmannRepresentation<S>
where S: StatisticsType + 'static,

Source

pub fn tau_nodes(&self) -> &[f64]

Imaginary-time interpolation nodes (sorted), one per pole.

Source

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,

Source§

fn beta(&self) -> f64

Inverse temperature β Read more
Source§

fn wmax(&self) -> f64

Maximum frequency ωmax Read more
Source§

fn lambda(&self) -> f64

Kernel parameter Λ = β × ωmax Read more
Source§

fn size(&self) -> usize

Number of basis functions Read more
Source§

fn accuracy(&self) -> f64

Accuracy of the basis Read more
Source§

fn significance(&self) -> Vec<f64>

Significance of each basis function Read more
Source§

fn svals(&self) -> Vec<f64>

Get singular values (non-normalized) Read more
Source§

fn default_tau_sampling_points(&self) -> Result<Vec<f64>, Error>

Get default tau sampling points Read more
Source§

fn default_matsubara_sampling_points( &self, positive_only: bool, ) -> Result<Vec<MatsubaraFreq<S>>, Error>

Get default Matsubara sampling points Read more
Source§

fn evaluate_tau(&self, tau: &[f64]) -> Result<TypedTensor<f64, Rank<2>>, Error>

Evaluate basis functions at imaginary time points Read more
Source§

fn evaluate_matsubara( &self, freqs: &[MatsubaraFreq<S>], ) -> Result<TypedTensor<Complex<f64>, Rank<2>>, Error>

Evaluate basis functions at Matsubara frequencies Read more
Source§

fn evaluate_omega( &self, _omega: &[f64], ) -> Result<TypedTensor<f64, Rank<2>>, Error>

Evaluate spectral basis functions at real frequencies Read more
Source§

fn default_omega_sampling_points(&self) -> Result<Vec<f64>, Error>

Get default omega (real frequency) sampling points Read more
Source§

impl<S> DlrFromIr<S> for DiscreteLehmannRepresentation<S>
where S: StatisticsType + 'static,

Source§

fn from_ir_with_poles<B>( basis: &B, poles: Vec<f64>, ) -> Result<DiscreteLehmannRepresentation<S>, Error>
where B: IrBasis<S>,

Create a DLR from an IR basis with custom poles Read more
Source§

fn from_ir<B>(basis: &B) -> Result<DiscreteLehmannRepresentation<S>, Error>
where B: IrBasis<S>,

Create a DLR from an IR basis with its default pole locations Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> DistributionExt for T
where T: ?Sized,

§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Imply<T> for U
where T: ?Sized, U: ?Sized,

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

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

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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 more
§

impl<T> MaybeSend for T
where T: Send,

§

impl<T> MaybeSendSync for T
where T: Send + Sync,

§

impl<T> MaybeSync for T
where T: Sync,

§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V