einsum_with_plan_owned

Function einsum_with_plan_owned 

Source
pub fn einsum_with_plan_owned<Alg, Backend>(
    ctx: &mut BackendContext<Alg, Backend>,
    tree: &ContractionTree,
    operands: Vec<Tensor<Alg::Scalar>>,
    size_dict: Option<&HashMap<u32, usize>>,
) -> Result<Tensor<Alg::Scalar>>
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, consuming the input tensors.

This is the lowest-level owning entry point and materializes canonical owned operands before dispatching to the execution tree.

§Examples

use tenferro_algebra::Standard;
use tenferro_einsum::{einsum_with_plan_owned, 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();
let out =
    einsum_with_plan_owned::<Standard<f64>, CpuBackend>(&mut ctx, &tree, vec![a, b], None)
        .unwrap();