pub struct EinsumCode {
pub root: EinsumNode,
pub output_ids: Vec<char>,
}Expand description
Parsed einsum code: contraction tree + final output indices.
Fields§
§root: EinsumNode§output_ids: Vec<char>Implementations§
Source§impl EinsumCode
impl EinsumCode
Sourcepub fn evaluate<'a>(
&self,
operands: Vec<EinsumOperand<'a>>,
size_dict: Option<&HashMap<char, usize>>,
) -> Result<EinsumOperand<'a>>
pub fn evaluate<'a>( &self, operands: Vec<EinsumOperand<'a>>, size_dict: Option<&HashMap<char, usize>>, ) -> Result<EinsumOperand<'a>>
Evaluate the einsum contraction tree with the given operands.
Borrowed view operands are propagated through the tree without copying.
The result lifetime matches the input operand lifetime: if all inputs
are owned ('static), the result is also 'static.
Pass size_dict to specify sizes for output indices not present in any
input (generative outputs like "->ii" or "i->ij").
Source§impl EinsumCode
impl EinsumCode
Sourcepub fn evaluate_into<T: EinsumScalar>(
&self,
operands: Vec<EinsumOperand<'_>>,
output: StridedViewMut<'_, T>,
alpha: T,
beta: T,
size_dict: Option<&HashMap<char, usize>>,
) -> Result<()>
pub fn evaluate_into<T: EinsumScalar>( &self, operands: Vec<EinsumOperand<'_>>, output: StridedViewMut<'_, T>, alpha: T, beta: T, size_dict: Option<&HashMap<char, usize>>, ) -> Result<()>
Evaluate the einsum contraction tree, writing the result directly into a user-provided output buffer with alpha/beta scaling.
output = alpha * einsum(operands) + beta * output
The output element type T must match the computation: use f64 when
all operands are real, Complex64 when any operand is complex.
If T = f64 but any operand is complex, returns TypeMismatch error.
If T = Complex64, real operands are promoted automatically.
Pass size_dict to specify sizes for output indices not present in any
input (generative outputs like "->ii" or "i->ij").
Trait Implementations§
Source§impl Clone for EinsumCode
impl Clone for EinsumCode
Source§fn clone(&self) -> EinsumCode
fn clone(&self) -> EinsumCode
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EinsumCode
impl Debug for EinsumCode
Source§impl PartialEq for EinsumCode
impl PartialEq for EinsumCode
impl StructuralPartialEq for EinsumCode
Auto Trait Implementations§
impl Freeze for EinsumCode
impl RefUnwindSafe for EinsumCode
impl Send for EinsumCode
impl Sync for EinsumCode
impl Unpin for EinsumCode
impl UnwindSafe for EinsumCode
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,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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