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>
impl<T: ConjugateScalar> CausalTensorTrainOperator<T>
Sourcepub fn cores(&self) -> &[CausalTensor<T>]
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}].
Sourcepub fn max_bond(&self) -> usize
pub fn max_bond(&self) -> usize
The largest bond dimension over the whole operator (at least 1).
Sourcepub fn round_policy(&self) -> &Truncation<<T as ConjugateScalar>::Real>
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,
impl<T> CausalTensorTrainOperator<T>where
T: ConjugateScalar,
Sourcepub fn from_cores(
cores: Vec<CausalTensor<T>>,
) -> Result<Self, CausalTensorError>
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
CausalTensorError::EmptyTensorifcoresis empty or any core has a zero dimension.CausalTensorError::DimensionMismatchif any core is not 4-dimensional.CausalTensorError::BondDimensionMismatchif the boundary bonds are not 1 or adjacent cores disagree on the shared bond.
Sourcepub fn identity(dims: &[usize]) -> Self
pub fn identity(dims: &[usize]) -> Self
The identity operator on the given physical dimensions: apply(identity, x) = x.
Sourcepub fn from_dense(
dense: &CausalTensor<T>,
out_dims: &[usize],
in_dims: &[usize],
trunc: &Truncation<<T as ConjugateScalar>::Real>,
) -> Result<Self, CausalTensorError>
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
CausalTensorError::ShapeMismatchifdense’s shape does not match the interleavedout_dims/in_dims.- Propagates SVD/reshape errors.
Sourcepub fn add(&self, other: &Self) -> Result<Self, CausalTensorError>
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.
Sourcepub fn scale(&self, s: T) -> Self
pub fn scale(&self, s: T) -> Self
Scales the operator by a scalar: (a.scale(s))·x = s·(a·x) (exact, rank-preserving).
Sourcepub fn sub(&self, other: &Self) -> Result<Self, CausalTensorError>
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.
Sourcepub fn with_rounding(
self,
trunc: Truncation<<T as ConjugateScalar>::Real>,
) -> Self
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,
impl<T> Arrow for CausalTensorTrainOperator<T>where
T: ConjugateScalar,
Source§type In = CausalTensorTrain<T>
type In = CausalTensorTrain<T>
Source§type Out = CausalTensorTrain<T>
type Out = CausalTensorTrain<T>
Source§fn compose<G>(self, g: G) -> Compose<Self, G>
fn compose<G>(self, g: G) -> Compose<Self, G>
f >>> g: run self, then g on its output.Source§fn first<C>(self) -> First<Self, C>where
Self: Sized,
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,
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>
fn split<G>(self, g: G) -> Split<Self, G>
***: 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>
fn fanout<G>(self, g: G) -> Fanout<Self, G>
&&&: 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,
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,
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§impl<T: Clone + ConjugateScalar> Clone for CausalTensorTrainOperator<T>
impl<T: Clone + ConjugateScalar> Clone for CausalTensorTrainOperator<T>
Source§fn clone(&self) -> CausalTensorTrainOperator<T>
fn clone(&self) -> CausalTensorTrainOperator<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> Debug for CausalTensorTrainOperator<T>
impl<T> Debug for CausalTensorTrainOperator<T>
Source§impl<T: PartialEq + ConjugateScalar> PartialEq for CausalTensorTrainOperator<T>
impl<T: PartialEq + ConjugateScalar> PartialEq for CausalTensorTrainOperator<T>
impl<T: PartialEq + ConjugateScalar> StructuralPartialEq for CausalTensorTrainOperator<T>
Source§impl<T> TensorTrainOperator<T> for CausalTensorTrainOperator<T>where
T: ConjugateScalar,
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>
fn apply( &self, state: &CausalTensorTrain<T>, trunc: &Truncation<<T as ConjugateScalar>::Real>, ) -> Result<CausalTensorTrain<T>, CausalTensorError>
trunc. Read moreSource§fn compose(
&self,
other: &Self,
trunc: &Truncation<<T as ConjugateScalar>::Real>,
) -> Result<Self, CausalTensorError>
fn compose( &self, other: &Self, trunc: &Truncation<<T as ConjugateScalar>::Real>, ) -> Result<Self, CausalTensorError>
self after other is not implied — this is
self ∘ other acting as self(other(·))), then rounds to trunc. Read moreSource§fn round(
&self,
trunc: &Truncation<<T as ConjugateScalar>::Real>,
) -> Result<Self, CausalTensorError>
fn round( &self, trunc: &Truncation<<T as ConjugateScalar>::Real>, ) -> Result<Self, CausalTensorError>
trunc.Source§fn transpose(&self) -> Self
fn transpose(&self) -> Self
Source§fn to_dense(&self) -> Result<CausalTensor<T>, CausalTensorError>
fn to_dense(&self) -> Result<CausalTensor<T>, CausalTensorError>
[out_0, in_0, out_1, in_1, …, out_{d-1}, in_{d-1}] (site-interleaved). Read moreAuto Trait Implementations§
impl<T> Freeze for CausalTensorTrainOperator<T>
impl<T> RefUnwindSafe for CausalTensorTrainOperator<T>
impl<T> Send for CausalTensorTrainOperator<T>
impl<T> Sync for CausalTensorTrainOperator<T>
impl<T> Unpin for CausalTensorTrainOperator<T>
impl<T> UnsafeUnpin for CausalTensorTrainOperator<T>
impl<T> UnwindSafe for CausalTensorTrainOperator<T>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, A> EndoArrow<S> for Awhere
A: Arrow<In = S, Out = S>,
impl<S, A> EndoArrow<S> for Awhere
A: Arrow<In = S, Out = S>,
Source§fn iterate_n(&self, initial: S, n: usize) -> S
fn iterate_n(&self, initial: S, n: usize) -> S
n times — a fixed-horizon march.Source§fn iterate_to_fixpoint(&self, initial: S, max_steps: usize) -> (S, bool)
fn iterate_to_fixpoint(&self, initial: S, max_steps: usize) -> (S, bool)
max_steps is reached.
Returns the final state and true if a fixpoint was reached, false if the bound hit.