Sweeping Strategy

class trainsum.sweepingstrategy.SweepingStrategy(min_size=None, ncores=2, mode='connected', nsweeps=1)

Strategy for sweeping through a tensor train. Used heavily in the arithmetic algorithms and solvers.

Parameters:
  • min_size (None | int)

  • ncores (int)

  • mode (Literal['connected', 'interleaved'])

  • nsweeps (int)

ncores: int = 2

Number of cores that are contracted together to create a super-core.

mode: Literal['connected', 'interleaved'] = 'connected'

Mode defines the overlap of the consecutive super-cores. In “connected” mode, the super-cores overlap by one core, while in “interleaved” mode, they overlap by ncores-1.

nsweeps: int = 1

Number of sweeps to perform. If None, the strategy will sweep indefinitely.

right_sweep(shape)

Returns the local ranges for a single right sweep.

Parameters:

shape (TrainShape)

Return type:

Sequence[LocalRange]

left_sweep(shape)

Returns the local ranges for a single left sweep.

Parameters:

shape (TrainShape)

Return type:

Sequence[LocalRange]