Idenso · latest
On this page

ExecutionMode

symbolica.community.tensor Class

ExecutionMode()

Choose how network execution schedules contractions.

All uses the default contraction schedule. Single selects one contraction at a time. Scalar restricts contraction to scalar work. Use execute(n_steps=...) to bound the number of execution rounds; the mode by itself does not bound the total number of rounds.

Examples

from symbolica.community.tensor import Representation, TensorName, TensorExpression
space = Representation.euc(2)
A = TensorName("M")(space, space)
from symbolica.community.tensor import Tensor
tensor = Tensor.dense(A, [1.0, 2.0, 3.0, 4.0])
from symbolica.community.tensor import TensorNetwork
network = TensorNetwork(tensor)
from symbolica.community.tensor import ExecutionMode
network.execute(n_steps=1, mode=ExecutionMode.Single)

Member details

Single

Field#
Single: typing.ClassVar[ExecutionMode]

Select one smallest-degree rewrite per step; without n_steps, continue until no work remains

Scalar

Field#
Scalar: typing.ClassVar[ExecutionMode]

Restrict each execution step to scalar work.

All

Field#
All: typing.ClassVar[ExecutionMode]

Use the default contraction schedule.

__int__

Method#
__int__() -> int

Return the underlying integer discriminant.