pub fn contract_size_tensors_exact(i: &Tensor, j: &Tensor) -> f64Expand description
Returns a rather exact estimate of the memory requirements for
contracting tensors i and j.
This takes into account if tensors need to be transposed (which doubles the required memory). It does not include memory of additional data like shape, bonddims, legs, etc..
ยงExamples
let bond_dims = FxHashMap::from_iter([(0, 5),(1, 7), (2, 9), (3, 11)]);
let tensor1 = Tensor::new_from_map(vec![0, 1, 2], &bond_dims); // requires 5040 bytes
let tensor2 = Tensor::new_from_map(vec![3, 2], &bond_dims); // requires 1584 bytes
// result = [0, 1, 3], requires 6160 bytes
let tn = Tensor::new_composite(vec![tensor1, tensor2]);
assert_eq!(contract_size_tensors_exact(&tn.tensor(0), &tn.tensor(1)), 12784.);