Skip to main content

contract

Function contract 

Source
pub fn contract(tensors: &[&IdxTensor]) -> Result<IdxTensor, IdxTensorError>
Expand description

Contract a connected tensor network with the default semantics.

This is the normal public entry point for N-ary tensor contraction. It contracts all common contractable indices and requires the input tensors to form one connected tensor graph. Disconnected inputs are rejected so missing links do not silently become outer products.

Use explicit outer_product calls when an outer product of disconnected components is intentional.

ยงErrors

Returns an error when the network is disconnected (a disconnected-network /// failure), when indices are incompatible (a shape or index mismatch), or /// when the contraction reports a failure (a backend failure).