pub enum EinSumOp<T> {
TensorSource {
tensor: CausalTensor<T>,
},
Contraction {
lhs_axes: Vec<usize>,
rhs_axes: Vec<usize>,
},
Reduction {
axes: Vec<usize>,
},
MatMul,
DotProd,
Trace {
axes1: usize,
axes2: usize,
},
TensorProduct,
ElementWiseProduct,
Transpose {
new_order: Vec<usize>,
},
DiagonalExtraction {
axes1: usize,
axes2: usize,
},
BatchMatMul,
}Variants§
TensorSource
Fields
tensor: CausalTensor<T>Contraction
Reduction
MatMul
Standard matrix multiplication (rank-2 tensors)
DotProd
Dot product (rank-1 tensors)
Trace
Trace over two specified axes
TensorProduct
Outer product
ElementWiseProduct
Hadamard product
Transpose
DiagonalExtraction
BatchMatMul
Batch matrix multiplication (rank-3 tensors)
Implementations§
Source§impl<T> EinSumOp<T>
impl<T> EinSumOp<T>
Sourcepub fn tensor_source(tensor: CausalTensor<T>) -> EinSumAST<T>
pub fn tensor_source(tensor: CausalTensor<T>) -> EinSumAST<T>
Sourcepub fn contraction<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>(
lhs: L,
rhs: R,
lhs_axes: Vec<usize>,
rhs_axes: Vec<usize>,
) -> EinSumAST<T>
pub fn contraction<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>( lhs: L, rhs: R, lhs_axes: Vec<usize>, rhs_axes: Vec<usize>, ) -> EinSumAST<T>
Creates an EinSumAST node for a generic tensor contraction operation.
This node represents a contraction between two CausalTensors along specified axes.
§Arguments
lhs- The left-hand sideCausalTensor.rhs- The right-hand sideCausalTensor.lhs_axes- AVec<usize>specifying the axes of thelhstensor to contract.rhs_axes- AVec<usize>specifying the axes of therhstensor to contract.
§Returns
An EinSumAST<T> node representing the contraction operation.
Sourcepub fn reduction<O: Into<CausalTensor<T>>>(
operand: O,
axes: Vec<usize>,
) -> EinSumAST<T>
pub fn reduction<O: Into<CausalTensor<T>>>( operand: O, axes: Vec<usize>, ) -> EinSumAST<T>
Creates an EinSumAST node for a reduction operation.
This node represents summing elements of a CausalTensor along specified axes.
§Arguments
operand- TheCausalTensorto perform the reduction on.axes- AVec<usize>specifying the axes along which to sum.
§Returns
An EinSumAST<T> node representing the reduction operation.
Sourcepub fn mat_mul<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>(
lhs: L,
rhs: R,
) -> EinSumAST<T>
pub fn mat_mul<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>( lhs: L, rhs: R, ) -> EinSumAST<T>
Creates an EinSumAST node for a standard 2D matrix multiplication operation.
This node represents the multiplication of two rank-2 CausalTensors.
§Arguments
lhs- The left-hand sideCausalTensor(matrix).rhs- The right-hand sideCausalTensor(matrix).
§Returns
An EinSumAST<T> node representing the matrix multiplication operation.
Sourcepub fn dot_prod<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>(
lhs: L,
rhs: R,
) -> EinSumAST<T>
pub fn dot_prod<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>( lhs: L, rhs: R, ) -> EinSumAST<T>
Creates an EinSumAST node for a dot product operation.
This node represents the dot product of two rank-1 CausalTensors (vectors).
§Arguments
lhs- The left-hand sideCausalTensor(vector).rhs- The right-hand sideCausalTensor(vector).
§Returns
An EinSumAST<T> node representing the dot product operation.
Sourcepub fn trace<O: Into<CausalTensor<T>>>(
operand: O,
axes1: usize,
axes2: usize,
) -> EinSumAST<T>
pub fn trace<O: Into<CausalTensor<T>>>( operand: O, axes1: usize, axes2: usize, ) -> EinSumAST<T>
Creates an EinSumAST node for a trace operation.
This node represents summing the diagonal elements of a CausalTensor over two specified axes.
§Arguments
operand- TheCausalTensorto perform the trace on.axes1- The first axis to trace over.axes2- The second axis to trace over.
§Returns
An EinSumAST<T> node representing the trace operation.
Sourcepub fn tensor_product<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>(
lhs: L,
rhs: R,
) -> EinSumAST<T>
pub fn tensor_product<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>( lhs: L, rhs: R, ) -> EinSumAST<T>
Sourcepub fn element_wise_product<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>(
lhs: L,
rhs: R,
) -> EinSumAST<T>
pub fn element_wise_product<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>( lhs: L, rhs: R, ) -> EinSumAST<T>
Creates an EinSumAST node for an element-wise product (Hadamard product) operation.
This node represents the element-wise multiplication of two CausalTensors.
§Arguments
lhs- The left-hand sideCausalTensor.rhs- The right-hand sideCausalTensor.
§Returns
An EinSumAST<T> node representing the element-wise product operation.
Sourcepub fn transpose<O: Into<CausalTensor<T>>>(
operand: O,
new_order: Vec<usize>,
) -> EinSumAST<T>
pub fn transpose<O: Into<CausalTensor<T>>>( operand: O, new_order: Vec<usize>, ) -> EinSumAST<T>
Creates an EinSumAST node for a transpose operation.
This node represents permuting the axes of a CausalTensor according to a new order.
§Arguments
operand- TheCausalTensorto transpose.new_order- AVec<usize>specifying the new order of axes.
§Returns
An EinSumAST<T> node representing the transpose operation.
Sourcepub fn diagonal_extraction<O: Into<CausalTensor<T>>>(
operand: O,
axes1: usize,
axes2: usize,
) -> EinSumAST<T>
pub fn diagonal_extraction<O: Into<CausalTensor<T>>>( operand: O, axes1: usize, axes2: usize, ) -> EinSumAST<T>
Creates an EinSumAST node for a diagonal extraction operation.
This node represents extracting the diagonal elements of a CausalTensor over two specified axes.
§Arguments
operand- TheCausalTensorfrom which to extract the diagonal.axes1- The first axis defining the 2D plane for diagonal extraction.axes2- The second axis defining the 2D plane for diagonal extraction.
§Returns
An EinSumAST<T> node representing the diagonal extraction operation.
Sourcepub fn batch_mat_mul<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>(
lhs: L,
rhs: R,
) -> EinSumAST<T>
pub fn batch_mat_mul<L: Into<CausalTensor<T>>, R: Into<CausalTensor<T>>>( lhs: L, rhs: R, ) -> EinSumAST<T>
Creates an EinSumAST node for a batch matrix multiplication operation.
This node represents performing matrix multiplication on batches of CausalTensors.
§Arguments
lhs- The left-hand sideCausalTensorwith a batch dimension.rhs- The right-hand sideCausalTensorwith a batch dimension.
§Returns
An EinSumAST<T> node representing the batch matrix multiplication operation.