Skip to main content

DmrgHeffError

Enum DmrgHeffError 

Source
#[non_exhaustive]
pub enum DmrgHeffError { InvalidSite { site: usize, n_sites: usize, }, StaleEnv { side: &'static str, index: usize, }, LengthMismatch { mps: usize, mpo: usize, envs: usize, }, InvalidEigensolverParams { detail: &'static str, }, ShapeMismatch { site: usize, field: &'static str, expected: usize, actual: usize, }, QnMismatch { site: usize, field: &'static str, detail: String, }, OrderMismatch { operand: &'static str, detail: String, }, Contract(LinalgError), Lanczos(LanczosError), }
Expand description

Errors raised by the 2-site DMRG step entry points (dmrg_2site_step for the Dense path, and dmrg_2site_step_block_sparse for the BlockSparse / U(1) path; both crate-internal). Most variants are produced by both; the DmrgHeffError::QnMismatch variant is BlockSparse-specific and only surfaces from the BlockSparse entry point’s QN / Direction / sector / per-site-flux pre-validation.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

InvalidSite

site + 1 was not a valid two-site index for the chain.

Fields

§site: usize

The requested left site of the two-site block.

§n_sites: usize

Chain length the index was checked against.

§

StaleEnv

The env slot required for the two-site step (left(site) for the left side, right(site + 2) for the right side) was None. Indicates the caller has not built / advanced the envs into a state where this site can be optimized.

Fields

§side: &'static str

Which side’s env is stale ("left" / "right").

§index: usize

Index of the stale (None) env slot.

§

LengthMismatch

MPS and MPO chain lengths disagree, or disagree with the envs the function was given.

Fields

§mps: usize

Site count reported by the MPS.

§mpo: usize

Site count reported by the MPO.

§envs: usize

Site count reported by the environments.

§

InvalidEigensolverParams

The selected eigensolver’s params (Lanczos or, behind the arpack feature, ARPACK) violated their preconditions. Surfaced here so callers see a fallible Result instead of the underlying solver panic / upstream error.

Fields

§detail: &'static str

Human-readable description of the violated precondition.

§

ShapeMismatch

A bond / physical dimension on one of the inputs to the 2-site step did not match the expectation derived from the surrounding tensors. Surfaced before the matvec runs so the operator’s .expect calls can stay infallible. field names the constraint that failed (e.g., "left.bot_ket vs mps[i].left_bond").

Fields

§site: usize

Left site of the two-site block being stepped.

§field: &'static str

Names the dimension constraint that failed.

§expected: usize

Extent derived from the surrounding tensors.

§actual: usize

Extent actually found on the input.

§

QnMismatch

A QNIndex / Direction / sector / per-site-flux compatibility check on a BlockSparse 2-site step’s inputs failed. Surfaced up front by dmrg_2site_step_block_sparse so the matvec body’s .expect calls cannot fire on user input. field names the leg pair (or single leg for MPO well-formedness checks), and detail carries a human-readable summary of the offending (sector list, direction, flux-if-applicable) data on each side.

Fields

§site: usize

Left site of the two-site block being stepped.

§field: &'static str

Names the offending leg pair (or single leg).

§detail: String

Human-readable summary of the incompatible QN data on each side.

§

OrderMismatch

The layout MemoryOrder of one of the BlockSparse 2-site step’s four contracted operands diverged from the host substrate’s preferred_order(). Surfaced by EffectiveHamiltonian2SiteBlockSparse::new before any contract runs so the apply body’s .expect calls cannot fire on a mixed-order operand set. operand names which of the four contracted operands ("left_env", "w_i", "w_ip1", "right_env") carried a non-matching layout order, and detail carries a human-readable summary of the offending vs expected layout order. The MPS sites passed to new are template-derivation-only and not asserted here; the psi template they derive is built in host order, so the matvec stays self-consistent. detail holds a rendered MemoryOrder to keep that layout type off the public error surface (it is workspace-internal).

Fields

§operand: &'static str

Which of the four contracted operands ("left_env", "w_i", "w_ip1", "right_env") carried a non-matching layout order.

§detail: String

Human-readable summary of the offending vs expected layout order.

§

Contract(LinalgError)

An underlying ariadnetor linalg call (currently the truncated SVD) failed. The matvec body itself is shape-validated up front and never reaches this branch.

§

Lanczos(LanczosError)

The native Lanczos local eigensolver produced a non-finite result (NaN/Inf eigenpair). Forwarded without information loss from crate::krylov::LanczosError. Always present, since Lanczos is the default eigensolver and is not feature-gated.

Trait Implementations§

Source§

impl Debug for DmrgHeffError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for DmrgHeffError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for DmrgHeffError

Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<LanczosError> for DmrgHeffError

Source§

fn from(source: LanczosError) -> Self

Converts to this type from the input type.
Source§

impl From<LinalgError> for DmrgHeffError

Source§

fn from(source: LinalgError) -> Self

Converts to this type from the input type.

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

impl<T> ByRef<T> for T

Source§

fn by_ref(&self) -> &T

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> 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
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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