Idenso · latest
On this page

chain

symbolica.community.tensor Function

chain(start_slot: Slot, end_slot: Slot, *factors: TensorExpression | Expression | FactorProjector[TensorExpression]) -> TensorExpression

Compose an ordered product with explicitly labeled endpoints.

Parameters

start_slot, end_slot Slot

External input and output indices, compatible with the factors' matrix channel. Matching endpoint labels close a trace.

*factors TensorExpression, scalar expression, Tensor, TensorNetwork, or FactorProjector

Ordered matrix factors, each with a unique compatible channel. Spectator axes remain external. Supply constituent factors separately when using a factor projector. Scalar factors multiply the whole chain. In the overloads, factor, first, and second name leading entries in this same sequence of positional factors.

Returns

TensorExpression or TensorNetwork

A symbolic chain when all factors are symbolic; a lazy TensorNetwork if any factor or projector contains component data.

Examples

from symbolica.community.tensor import Representation, TensorName, TensorExpression
space = Representation.euc(2)
A = TensorName("M")(space, space)
from symbolica.community.tensor import chain
product = chain(space("i"), space("j"), A, A)
product.rank

Member details

Overloads

Overload 1 #

chain(start_slot: Slot, end_slot: Slot, *factors: TensorExpression | Expression | FactorProjector[TensorExpression]) -> TensorExpression

Compose an ordered product with explicitly labeled endpoints.

Returns

TensorExpression or TensorNetwork

A symbolic chain when all factors are symbolic; a lazy TensorNetwork if any factor or projector contains component data.

Examples
from symbolica.community.tensor import Representation, TensorName, TensorExpression
space = Representation.euc(2)
A = TensorName("M")(space, space)
from symbolica.community.tensor import chain
product = chain(space("i"), space("j"), A, A)
product.rank
Parameters
NameTypeDefaultDescription
start_slotSlot—

External input and output indices, compatible with the factors' matrix channel. Matching endpoint labels close a trace.

end_slotSlot—

External input and output indices, compatible with the factors' matrix channel. Matching endpoint labels close a trace.

factorsTensorExpression | Expression | FactorProjector[TensorExpression]——

Overload 2 #

chain(start_slot: Slot, end_slot: Slot, factor: Tensor | TensorNetwork | FactorProjector[TensorNetwork], /, *factors: TensorExpression | _ScalarInput | Tensor | TensorNetwork | FactorProjector[TensorExpression] | FactorProjector[TensorNetwork]) -> TensorNetwork

Compose an ordered product with explicitly labeled endpoints.

Returns

TensorExpression or TensorNetwork

A symbolic chain when all factors are symbolic; a lazy TensorNetwork if any factor or projector contains component data.

Examples
from symbolica.community.tensor import Representation, TensorName, TensorExpression
space = Representation.euc(2)
A = TensorName("M")(space, space)
from symbolica.community.tensor import chain
product = chain(space("i"), space("j"), A, A)
product.rank
Parameters
NameTypeDefaultDescription
start_slotSlot—

External input and output indices, compatible with the factors' matrix channel. Matching endpoint labels close a trace.

end_slotSlot—

External input and output indices, compatible with the factors' matrix channel. Matching endpoint labels close a trace.

factorTensor | TensorNetwork | FactorProjector[TensorNetwork]——
factorsTensorExpression | _ScalarInput | Tensor | TensorNetwork | FactorProjector[TensorExpression] | FactorProjector[TensorNetwork]——

Overload 3 #

chain(start_slot: Slot, end_slot: Slot, first: _ScalarInput | TensorExpression | TensorNetwork | Tensor | FactorProjector[TensorExpression] | FactorProjector[TensorNetwork], second: Tensor | TensorNetwork | FactorProjector[TensorNetwork], /, *factors: TensorExpression | _ScalarInput | Tensor | TensorNetwork | FactorProjector[TensorExpression] | FactorProjector[TensorNetwork]) -> TensorNetwork

Compose an ordered product with explicitly labeled endpoints.

Returns

TensorExpression or TensorNetwork

A symbolic chain when all factors are symbolic; a lazy TensorNetwork if any factor or projector contains component data.

Examples
from symbolica.community.tensor import Representation, TensorName, TensorExpression
space = Representation.euc(2)
A = TensorName("M")(space, space)
from symbolica.community.tensor import chain
product = chain(space("i"), space("j"), A, A)
product.rank
Parameters
NameTypeDefaultDescription
start_slotSlot—

External input and output indices, compatible with the factors' matrix channel. Matching endpoint labels close a trace.

end_slotSlot—

External input and output indices, compatible with the factors' matrix channel. Matching endpoint labels close a trace.

first_ScalarInput | TensorExpression | TensorNetwork | Tensor | FactorProjector[TensorExpression] | FactorProjector[TensorNetwork]——
secondTensor | TensorNetwork | FactorProjector[TensorNetwork]——
factorsTensorExpression | _ScalarInput | Tensor | TensorNetwork | FactorProjector[TensorExpression] | FactorProjector[TensorNetwork]——

Overload 4 #

chain(start_slot: Slot, end_slot: Slot, *factors: TensorExpression | _ScalarInput | Tensor | TensorNetwork | FactorProjector[TensorExpression] | FactorProjector[TensorNetwork]) -> TensorExpression | TensorNetwork

Compose an ordered product with explicitly labeled endpoints.

Returns

TensorExpression or TensorNetwork

A symbolic chain when all factors are symbolic; a lazy TensorNetwork if any factor or projector contains component data.

Examples
from symbolica.community.tensor import Representation, TensorName, TensorExpression
space = Representation.euc(2)
A = TensorName("M")(space, space)
from symbolica.community.tensor import chain
product = chain(space("i"), space("j"), A, A)
product.rank
Parameters
NameTypeDefaultDescription
start_slotSlot—

External input and output indices, compatible with the factors' matrix channel. Matching endpoint labels close a trace.

end_slotSlot—

External input and output indices, compatible with the factors' matrix channel. Matching endpoint labels close a trace.

factorsTensorExpression | _ScalarInput | Tensor | TensorNetwork | FactorProjector[TensorExpression] | FactorProjector[TensorNetwork]——