pub trait TensorContractionLike: TensorIndex {
// Required methods
fn conj(&self) -> Self;
fn direct_sum(
&self,
other: &Self,
pairs: &[(<Self as TensorIndex>::Index, <Self as TensorIndex>::Index)],
) -> Result<DirectSumResult<Self>>;
fn outer_product(&self, other: &Self) -> Result<Self>;
fn permuteinds(
&self,
new_order: &[<Self as TensorIndex>::Index],
) -> Result<Self>;
fn fuse_indices(
&self,
old_indices: &[<Self as TensorIndex>::Index],
new_index: <Self as TensorIndex>::Index,
order: LinearizationOrder,
) -> Result<Self>;
fn contract(tensors: &[&Self]) -> Result<Self>;
// Provided methods
fn contract_pair(&self, other: &Self) -> Result<Self> { ... }
fn validate(&self) -> Result<()> { ... }
}Expand description
Contraction/einsum-style operations for tensor-like values.
Types that only need vector-space algebra should not implement or require this trait. Tree tensor-network algorithms should use this trait when they truly need index-based contraction.
Required Methods§
Sourcefn direct_sum(
&self,
other: &Self,
pairs: &[(<Self as TensorIndex>::Index, <Self as TensorIndex>::Index)],
) -> Result<DirectSumResult<Self>>
fn direct_sum( &self, other: &Self, pairs: &[(<Self as TensorIndex>::Index, <Self as TensorIndex>::Index)], ) -> Result<DirectSumResult<Self>>
Direct sum of two tensors along specified index pairs.
Sourcefn outer_product(&self, other: &Self) -> Result<Self>
fn outer_product(&self, other: &Self) -> Result<Self>
Outer product (tensor product) of two tensors.
Sourcefn permuteinds(
&self,
new_order: &[<Self as TensorIndex>::Index],
) -> Result<Self>
fn permuteinds( &self, new_order: &[<Self as TensorIndex>::Index], ) -> Result<Self>
Permute tensor indices to match the specified order.
Sourcefn fuse_indices(
&self,
old_indices: &[<Self as TensorIndex>::Index],
new_index: <Self as TensorIndex>::Index,
order: LinearizationOrder,
) -> Result<Self>
fn fuse_indices( &self, old_indices: &[<Self as TensorIndex>::Index], new_index: <Self as TensorIndex>::Index, order: LinearizationOrder, ) -> Result<Self>
Fuse local tensor indices into one replacement index.
Provided Methods§
Sourcefn contract_pair(&self, other: &Self) -> Result<Self>
fn contract_pair(&self, other: &Self) -> Result<Self>
Contract this tensor with one other tensor using default pairwise semantics.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.