FiniteTempBasis

Struct FiniteTempBasis 

Source
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 1:L)

This basis is inferred from a reduced form by appropriate scaling of the variables.

§Type Parameters

  • K - Kernel type implementing KernelProperties + CentrosymmKernel
  • S - Statistics type (Fermionic or Bosonic)

Implementations§

Source§

impl<K, S> FiniteTempBasis<K, S>

Source

pub fn kernel(&self) -> &K

Get a reference to the kernel

Source

pub fn sve_result(&self) -> &Arc<SVEResult>

Get the SVE result

Source

pub fn accuracy(&self) -> f64

Get the accuracy of the basis

Source

pub fn beta(&self) -> f64

Get the inverse temperature β

Source

pub fn u(&self) -> &Arc<PiecewiseLegendrePolyVector>

Get the left singular functions (u) on imaginary time axis

Source

pub fn v(&self) -> &Arc<PiecewiseLegendrePolyVector>

Get the right singular functions (v) on real frequency axis

Source

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

Get the singular values

Source

pub fn uhat(&self) -> &Arc<PiecewiseLegendreFTVector<S>>

Get the left singular functions on Matsubara frequency axis (uhat)

Source

pub fn uhat_full(&self) -> &Arc<PiecewiseLegendreFTVector<S>>

Get the full uhat (before truncation)

Source

pub fn wmax(&self) -> f64

Get the frequency cutoff ωmax

Source

pub fn default_matsubara_sampling_points_i64( &self, positive_only: bool, ) -> Vec<i64>
where S: 'static,

Get default Matsubara sampling points as i64 indices (for C-API)

Source

pub fn default_matsubara_sampling_points_i64_with_mitigate( &self, positive_only: bool, mitigate: bool, n_points: usize, ) -> Vec<i64>
where S: 'static,

Get default Matsubara sampling points as i64 indices with mitigate parameter (for C-API)

§Panics

Panics if the kernel is not centrosymmetric. This method relies on centrosymmetry to generate sampling points.

Source

pub fn new( kernel: K, beta: f64, epsilon: Option<f64>, max_size: Option<usize>, ) -> Self

Create a new FiniteTempBasis

§Arguments
  • kernel - Kernel implementing KernelProperties + CentrosymmKernel
  • beta - Inverse temperature (β > 0)
  • epsilon - Accuracy parameter (optional, defaults to NaN for auto)
  • max_size - Maximum number of basis functions (optional)
§Returns

A new FiniteTempBasis

Source

pub fn from_sve_result( kernel: K, beta: f64, sve_result: SVEResult, epsilon: Option<f64>, max_size: Option<usize>, ) -> Self

Create basis from existing SVE result

This is useful when you want to reuse the same SVE computation for both fermionic and bosonic bases.

Source

pub fn size(&self) -> usize

Get the size of the basis (number of basis functions)

Source

pub fn lambda(&self) -> f64

Get the cutoff parameter Λ = β * ωmax

Source

pub fn omega_max(&self) -> f64

Get the frequency cutoff ωmax

Source

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

Get significance of each singular value (s[i] / s[0])

Source

pub fn default_tau_sampling_points(&self) -> Vec<f64>

Get default tau sampling points

C++ implementation: libsparseir/include/sparseir/basis.hpp:229-270

Returns sampling points in imaginary time τ ∈ [-β/2, β/2].

§Panics

Panics if the kernel is not centrosymmetric. This method relies on centrosymmetry to generate symmetric sampling points.

Source

pub fn default_tau_sampling_points_size_requested( &self, size_requested: usize, ) -> Vec<f64>

Get default tau sampling points with a requested size

§Panics

Panics if the kernel is not centrosymmetric. This method relies on centrosymmetry to generate symmetric sampling points.

Source

pub fn default_matsubara_sampling_points( &self, positive_only: bool, ) -> Vec<MatsubaraFreq<S>>
where S: 'static,

Get default Matsubara frequency sampling points

Returns sampling points as MatsubaraFreq objects based on extrema of the Matsubara basis functions (same algorithm as C++/Julia).

§Arguments
  • positive_only - If true, returns only non-negative frequencies
§Returns

Vector of Matsubara frequency sampling points

§Panics

Panics if the kernel is not centrosymmetric. This method relies on centrosymmetry to generate sampling points.

Source

pub fn default_matsubara_sampling_points_impl( uhat_full: &PiecewiseLegendreFTVector<S>, l: usize, fence: bool, positive_only: bool, ) -> Vec<MatsubaraFreq<S>>
where S: StatisticsType + 'static,

Source

pub fn default_omega_sampling_points(&self) -> Vec<f64>

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]

Trait Implementations§

Source§

impl<K, S> Basis<S> for FiniteTempBasis<K, S>
where K: KernelProperties + CentrosymmKernel + Clone + 'static, S: StatisticsType + 'static,

Source§

type Kernel = K

Associated kernel type
Source§

fn kernel(&self) -> &Self::Kernel

Get reference to the kernel Read more
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) -> Vec<f64>

Get default tau sampling points Read more
Source§

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

Get default Matsubara sampling points Read more
Source§

fn evaluate_tau(&self, tau: &[f64]) -> DTensor<f64, 2>

Evaluate basis functions at imaginary time points Read more
Source§

fn evaluate_matsubara( &self, freqs: &[MatsubaraFreq<S>], ) -> DTensor<Complex<f64>, 2>

Evaluate basis functions at Matsubara frequencies Read more
Source§

fn evaluate_omega(&self, omega: &[f64]) -> DTensor<f64, 2>

Evaluate spectral basis functions at real frequencies Read more
Source§

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

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

impl<K, S> Clone for FiniteTempBasis<K, S>

Source§

fn clone(&self) -> FiniteTempBasis<K, S>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<K, S> Freeze for FiniteTempBasis<K, S>
where K: Freeze,

§

impl<K, S> RefUnwindSafe for FiniteTempBasis<K, S>

§

impl<K, S> Send for FiniteTempBasis<K, S>
where S: Send + Sync,

§

impl<K, S> Sync for FiniteTempBasis<K, S>
where S: Sync + Send,

§

impl<K, S> Unpin for FiniteTempBasis<K, S>
where K: Unpin, S: Unpin,

§

impl<K, S> UnwindSafe for FiniteTempBasis<K, S>

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

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

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.

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> IntoCloned<T> for T

Source§

fn clone_to(self, target: &mut T)

Moves an existing object or clones from a reference to the target object.
Source§

fn into_cloned(self) -> T

Returns an existing object or a new clone from a reference.
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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

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

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

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

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

fn is_in_subset(&self) -> bool

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

fn to_subset_unchecked(&self) -> SS

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

fn from_subset(element: &SS) -> SP

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

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

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

Source§

fn vzip(self) -> V