contract_cost_tensors

Function contract_cost_tensors 

Source
pub fn contract_cost_tensors(t_1: &Tensor, t_2: &Tensor) -> f64
Expand description

Returns Schroedinger contraction time complexity of contracting two Tensor objects. Considers cost of complex operations.

ยงExamples

let bond_dims = FxHashMap::from_iter([(0, 5),(1, 7), (2, 9), (3, 11), (4, 13)]);
let tensor1 = Tensor::new_from_map(vec![0, 1, 2], &bond_dims);
let tensor2 = Tensor::new_from_map(vec![2, 3, 4], &bond_dims);
// result = [0, 1, 2, 3, 4] // cost of (9-1)*54*5005 = 350350;
let tn = Tensor::new_composite(vec![tensor1, tensor2]);
assert_eq!(contract_cost_tensors(&tn.tensor(0), &tn.tensor(1)), 350350.);