tt_sketch.tt_gmres

Implements the TT-GMRES algorithm for solving linear systems in the TT-format, as described in Dolgov, arXiv:1206.5512, but with rounding step optionally replaced by sketching.

class tt_sketch.tt_gmres.MPO(cores: List[ndarray[Any, dtype[float64]]])[source]

MPO with order 4 tensor cores of shape (rank[mu-1],in_shape[mu],out_shape[mu],rank[mu])

Used as linear map in the tensor train format

property T: MPO

Transposition here is that of a linear map, this is different from other tensors.

cores: List[ndarray[Any, dtype[float64]]]
classmethod eye(shape) MPO[source]
in_shape: Tuple[int, ...]
out_shape: Tuple[int, ...]
classmethod random(rank: Union[int, Tuple[int, ...]], in_shape: Tuple[int, ...], out_shape: Tuple[int, ...]) MPO[source]
rank: Tuple[int, ...]
shape: Tuple[int, ...]

The shape of the tensor

property size: int

Number of floating point elements used to store the tensor.

to_numpy() ndarray[Any, dtype[ScalarType]][source]

Contract to dense array of shape (in_shape[0], out_shape[0], ..., in_shape[d-1], outs_shape[d-1])

to_tt() TensorTrain[source]
class tt_sketch.tt_gmres.TTLinearMap[source]

Abstract class for linear maps in the TT-format.

in_shape: Tuple[int, ...]
out_shape: Tuple[int, ...]
class tt_sketch.tt_gmres.TTLinearMapSum(linear_maps: List[TTLinearMap])[source]

Linear map that eats a TT and returns a sum of TTs.

This is essentially just a container for a list of TTLinearMap objects.

in_shape: Tuple[int, ...]
linear_maps: List[TTLinearMap]
out_shape: Tuple[int, ...]
class tt_sketch.tt_gmres.TTPrecond(A, shape, mode=0)[source]

TTLinearMap that acts by multiplying by the inverse of a matrix on a specified mode.

The inverse is computed from the precomputed QR factorization of the matrix.

backward_call(other: TensorTrain) TensorTrain[source]
forward_call(other: TensorTrain) TensorTrain[source]
in_shape: Tuple[int, ...]
out_shape: Tuple[int, ...]
tt_sketch.tt_gmres.round_tt_sum(tt_sum: TensorSum[TensorTrain], max_rank: Union[int, Tuple[int, ...]], eps: Optional[float] = None, method: Literal['exact', 'pairwise', 'sketch', 'orth_sketch', None] = 'sketch', oversample_factor: float = 2) TensorTrain[source]

Round a sum of tensor trains to a given rank.

method can be one of: - “exact”: Add all TTs to one big TT and round it using TT-SVD - “pairwise”: Add each TT to the next one and round them separately - “sketch”: Use streaming sketch for rounding - “orth_sketch”: Use orthogonal sketch for rounding. - None: Do not round (for debugging purposes mostly).

tt_sketch.tt_gmres.tt_sum_gmres(A: TTLinearMapSum, b: TensorTrain, max_rank: Union[int, Tuple[int, ...]], precond: Optional[TTPrecond] = None, final_round_rank: Optional[Union[int, Tuple[int, ...]]] = None, x0: Optional[TensorTrain] = None, tolerance: float = 1e-06, maxiter: int = 100, symmetric: bool = False, rounding_method: Literal['exact', 'pairwise', 'sketch', 'orth_sketch', None] = 'pairwise', rounding_method_final: Optional[Literal['exact', 'pairwise', 'sketch', 'orth_sketch', None]] = None, save_basis: bool = False, verbose: bool = False) Tuple[TensorTrain, Dict[str, List]][source]

GMRES solver for TTLinearMapSum.

The TTLinearMapSum takes as input a TT and returns a sum of TTs. This means additional rounding steps are required in comparison to a version of TT-GMRES where the output of the linear map is a TT.