LinSolver

class trainsum.trainsum.LinSolver(rhs, *maps, method, solver, decomposition, strategy, optimizer)

Variationally solve linear equation systems for quantics tensor trains. The equation is defined by the provided linear maps and the right hand side. Using the canonical format, the global linear problem is mapped to a sequence of local problems, which are solved by the provided local solver. If the sweeping strategy has ncores>=2 the decomposition is used to recover the single cores, thereby defining the rank. The method can be specified to use the DMRG algorithm or the AMEn algorithm.

Parameters:
  • rhs (TensorTrain)

  • maps (LinearMap)

  • method (Literal['dmrg', 'amen'])

  • solver (LocalLinSolver)

  • strategy (SweepingStrategy)

  • optimizer (Literal['optimal', 'dp', 'greedy', 'random-greedy', 'random-greedy-128', 'branch-all', 'branch-2', 'auto', 'auto-hq'])

property solver: LocalLinSolver

Iterative linear solver for the local problems.

property decomposition: MatrixDecomposition

Matrix decomposition for recovering single cores in multi-core sweeping strategies.

property strategy: SweepingStrategy

Sweeping strategy defining the order of the local problems and the number of cores to be optimized simultaneously.

property eps: float

Convergence criterion.

__call__(guess, callback=None)

Start with the sweeping DMRG or AMEn algorithm to solve the linear equation system with an initial guess. The callback is called after each local problem is solved and can be used to monitor the convergence of the algorithm. Returning True from the callback will stop the algorithm.

Parameters:
  • guess (TensorTrain)

  • callback (Callable[[LocalRange, T], bool] | None)

Return type:

TensorTrain