pub fn einsum_with_plan_into<Alg, Backend>(
ctx: &mut BackendContext<Alg, Backend>,
tree: &ContractionTree,
operands: &[&Tensor<Alg::Scalar>],
alpha: Alg::Scalar,
beta: Alg::Scalar,
output: &mut Tensor<Alg::Scalar>,
size_dict: Option<&HashMap<u32, usize>>,
) -> Result<()>where
Alg: Semiring,
Alg::Scalar: Scalar + Conjugate + HasAlgebra<Algebra = Alg>,
Backend: EinsumBackend<Alg>,
BackendContext<Alg, Backend>: TensorTempPoolContext,Expand description
Execute einsum with a pre-optimized ContractionTree, accumulating
into an existing output.
§Examples
ⓘ
use tenferro_algebra::Standard;
use tenferro_einsum::{einsum_with_plan_into, ContractionTree, Subscripts};
use tenferro_prims::{CpuBackend, CpuContext};
let mut ctx = CpuContext::new(1);
let subs = Subscripts::new(&[&[0, 1], &[1, 2]], &[0, 2]);
let tree = ContractionTree::optimize(&subs, &[&[2, 3], &[3, 4]]).unwrap();
einsum_with_plan_into::<Standard<f64>, CpuBackend>(
&mut ctx, &tree, &[&a, &b], 1.0, 0.0, &mut c, None,
).unwrap();