Skip to main content

CausalTensorTrainOperator

Struct CausalTensorTrainOperator 

Source
pub struct CausalTensorTrainOperator<T: ConjugateScalar> { /* private fields */ }
Expand description

A matrix-product operator (MPO) over the same site structure as a CausalTensorTrain.

A linear operator M[(i₀,j₀),…,(i_{d-1},j_{d-1})] is stored as a chain of rank-4 cores W_k of shape [r_k, n_out_k, n_in_k, r_{k+1}], boundary bonds r₀ = r_d = 1. It maps a train over the input dimensions to a train over the output dimensions.

The operator carries a round_policy Truncation used by its Arrow realization (run = apply-then-round), so EndoArrow iteration is a bounded time-march. The explicit apply/compose/round methods take their own truncation and ignore this field.

Implementations§

Source§

impl<T: ConjugateScalar> CausalTensorTrainOperator<T>

Source

pub fn cores(&self) -> &[CausalTensor<T>]

The cores, in order; core k has shape [r_k, n_out_k, n_in_k, r_{k+1}].

Source

pub fn order(&self) -> usize

The number of sites.

Source

pub fn out_dims(&self) -> &[usize]

The output physical dimensions.

Source

pub fn in_dims(&self) -> &[usize]

The input physical dimensions.

Source

pub fn bond_dims(&self) -> Vec<usize>

The interior bond dimensions [r_1, …, r_{order-1}].

Source

pub fn max_bond(&self) -> usize

The largest bond dimension over the whole operator (at least 1).

Source

pub fn round_policy(&self) -> &Truncation<<T as ConjugateScalar>::Real>

The truncation used by the Arrow::run realization.

Source§

impl<T> CausalTensorTrainOperator<T>
where T: ConjugateScalar,

Source

pub fn from_cores( cores: Vec<CausalTensor<T>>, ) -> Result<Self, CausalTensorError>

Builds an operator from an explicit chain of rank-4 cores, validating the bond structure.

§Errors
Source

pub fn identity(dims: &[usize]) -> Self

The identity operator on the given physical dimensions: apply(identity, x) = x.

Source

pub fn from_dense( dense: &CausalTensor<T>, out_dims: &[usize], in_dims: &[usize], trunc: &Truncation<<T as ConjugateScalar>::Real>, ) -> Result<Self, CausalTensorError>

Factors a dense operator into an MPO via operator TT-SVD.

dense must be in site-interleaved layout [out_0, in_0, …, out_{d-1}, in_{d-1}].

§Errors
Source

pub fn add(&self, other: &Self) -> Result<Self, CausalTensorError>

Sums two operators on the same physical dimensions: (a.add(b))·x = a·x + b·x.

The operators form an algebra — this completes it alongside compose (operator product) and scale. Realized as the tensor-train sum of the combined-index views, so the bond dimensions add (r ← rₐ + r_b); call round afterwards to recompress (e.g. assembling a finite-difference Laplacian (S₊ + S₋ − 2·I)/Δx² from shift operators).

§Errors

CausalTensorError::ShapeMismatch if the operators disagree on input or output dimensions.

Source

pub fn scale(&self, s: T) -> Self

Scales the operator by a scalar: (a.scale(s))·x = s·(a·x) (exact, rank-preserving).

Source

pub fn neg(&self) -> Self

Negates the operator (the additive inverse): (a.neg())·x = −(a·x).

Source

pub fn sub(&self, other: &Self) -> Result<Self, CausalTensorError>

Difference of two operators: (a.sub(b))·x = a·x − b·x. Completes the additive group alongside add/neg (e.g. a centered first difference (S₊ − S₋)/2Δx from two shift operators).

§Errors

CausalTensorError::ShapeMismatch if the operators disagree on input or output dimensions.

Source

pub fn with_rounding( self, trunc: Truncation<<T as ConjugateScalar>::Real>, ) -> Self

Sets the rounding policy used by the Arrow::run realization.

Trait Implementations§

Source§

impl<T> Arrow for CausalTensorTrainOperator<T>
where T: ConjugateScalar,

Source§

type In = CausalTensorTrain<T>

The input object the arrow consumes.
Source§

type Out = CausalTensorTrain<T>

The output object the arrow produces.
Source§

fn run(&self, input: Self::In) -> Self::Out

Apply the arrow to an input.
Source§

fn compose<G>(self, g: G) -> Compose<Self, G>
where Self: Sized, G: Arrow<In = Self::Out>,

Sequential composition f >>> g: run self, then g on its output.
Source§

fn first<C>(self) -> First<Self, C>
where Self: Sized,

first: lift A → B to (A, C) → (B, C), passing the second component through.
Source§

fn second<C>(self) -> Second<Self, C>
where Self: Sized,

second: lift A → B to (C, A) → (C, B), passing the first component through.
Source§

fn split<G>(self, g: G) -> Split<Self, G>
where Self: Sized, G: Arrow,

The monoidal product ***: run self and g in parallel on a pair — (A, C) → (B, D) from self: A → B and g: C → D.
Source§

fn fanout<G>(self, g: G) -> Fanout<Self, G>
where Self: Sized, G: Arrow<In = Self::In>, Self::In: Clone,

Fanout &&&: feed one input to two arrows — A → (B, C) from self: A → B and g: A → C. Requires In: Clone.
Source§

fn left<C>(self) -> Left<Self, C>
where Self: Sized,

left: lift A → B to Either<A, C> → Either<B, C>, passing a Right value through (the twin of first; Hughes 2000 §5).
Source§

fn right<C>(self) -> Right<Self, C>
where Self: Sized,

right: lift A → B to Either<C, A> → Either<C, B>, passing a Left value through (the twin of second).
Source§

fn choice<G>(self, g: G) -> Choice<Self, G>
where Self: Sized, G: Arrow,

The coproduct sum +++: route each summand to its own arrow — Either<A, C> → Either<B, D> (the twin of split).
Source§

fn fanin<G>(self, g: G) -> Fanin<Self, G>
where Self: Sized, G: Arrow<Out = Self::Out>,

Fanin |||: the coproduct elimination — both branches converge on one output type, Either<A, C> → B (the twin of fanout, with no Clone needed: a sum routes, it never copies).
Source§

impl<T: Clone + ConjugateScalar> Clone for CausalTensorTrainOperator<T>

Source§

fn clone(&self) -> CausalTensorTrainOperator<T>

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl<T> Debug for CausalTensorTrainOperator<T>

Source§

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

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

impl<T: PartialEq + ConjugateScalar> PartialEq for CausalTensorTrainOperator<T>

Source§

fn eq(&self, other: &CausalTensorTrainOperator<T>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<T: PartialEq + ConjugateScalar> StructuralPartialEq for CausalTensorTrainOperator<T>

Source§

impl<T> TensorTrainOperator<T> for CausalTensorTrainOperator<T>
where T: ConjugateScalar,

Source§

fn apply( &self, state: &CausalTensorTrain<T>, trunc: &Truncation<<T as ConjugateScalar>::Real>, ) -> Result<CausalTensorTrain<T>, CausalTensorError>

Applies the operator to a state train (MPO · MPS), then rounds to trunc. Read more
Source§

fn compose( &self, other: &Self, trunc: &Truncation<<T as ConjugateScalar>::Real>, ) -> Result<Self, CausalTensorError>

Composes two operators (MPO · MPO, self after other is not implied — this is self ∘ other acting as self(other(·))), then rounds to trunc. Read more
Source§

fn round( &self, trunc: &Truncation<<T as ConjugateScalar>::Real>, ) -> Result<Self, CausalTensorError>

Recompresses the operator to trunc.
Source§

fn transpose(&self) -> Self

The transpose operator (swaps the input and output physical legs of every core).
Source§

fn to_dense(&self) -> Result<CausalTensor<T>, CausalTensorError>

Contracts the operator to a dense tensor of shape [out_0, in_0, out_1, in_1, …, out_{d-1}, in_{d-1}] (site-interleaved). 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
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<S, A> EndoArrow<S> for A
where A: Arrow<In = S, Out = S>,

Source§

fn iterate_n(&self, initial: S, n: usize) -> S

Apply the endo-arrow exactly n times — a fixed-horizon march.
Source§

fn iterate_to_fixpoint(&self, initial: S, max_steps: usize) -> (S, bool)
where S: Clone + PartialEq,

Apply until a fixpoint (the next state equals the current) or max_steps is reached. Returns the final state and true if a fixpoint was reached, false if the bound hit.
Source§

fn iterate_until<P>( &self, initial: S, predicate: P, max_steps: usize, ) -> (S, bool)
where P: FnMut(&S) -> bool,

Apply until predicate holds or max_steps is reached. The predicate is checked on the initial state first. Returns the final state and whether the predicate was met in time.
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> Satisfies<NoConstraint> for T

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.