Skip to main content

contract

Function contract 

Source
pub fn contract(
    a: &TensorTrain,
    b: &TensorTrain,
    options: &ContractOptions,
) -> Result<TensorTrain>
Expand description

Contract two tensor trains, returning a new tensor train.

This performs element-wise contraction of corresponding sites, similar to MPO-MPO contraction in ITensor.

§Arguments

  • a - The first tensor train
  • b - The second tensor train
  • options - Contraction options (method, max_rank, rtol, nhalfsweeps)

§Returns

A new tensor train resulting from the contraction.

§Errors

Returns an error if:

  • Either tensor train is empty
  • The tensor trains have different lengths
  • The contraction algorithm fails