Contraction
Contraction path optimization and execution is delegated to the EinExprs
library. A EinExpr
is a lower-level form of a Tensor Network, in which the contraction path has been laid out as a tree. It is similar to a symbolic expression (i.e. Expr
) but in which every node represents an Einstein summation expression (aka einsum
).
EinExprs.einexpr
— Methodeinexpr(tn::TensorNetwork; optimizer = EinExprs.Greedy, output = inds(tn, :open), kwargs...)
Search a contraction path for the given TensorNetwork
and return it as a EinExpr
.
Keyword Arguments
optimizer
Contraction path optimizer. CheckEinExprs
documentation for more info.outputs
Indices that won't be contracted. Defaults to open indices.kwargs
Options to be passed to the optimizer.
See also: contract
.
Tenet.contract
— Methodcontract(tn::TensorNetwork; kwargs...)
Contract a TensorNetwork
. The contraction order will be first computed by einexpr
.
The kwargs
will be passed down to the einexpr
function.
Tenet.contract!
— Functioncontract!(tn::TensorNetwork, index)
In-place contraction of tensors connected to index
.
See also: contract
.
Tenet.contract!(tn::Chain, ::Val{:between}, site1::Site, site2::Site; direction::Symbol = :left, delete_Λ = true)
For a given Chain
tensor network, contracts the singular values Λ between two sites site1
and site2
. The direction
keyword argument specifies the direction of the contraction, and the delete_Λ
keyword argument specifies whether to delete the singular values tensor after the contraction.