#### Previous topic

Tensor Train Vectors

#### Next topic

Quantics Tensor Train Vectors

# Tensor Train Matrices¶

class TensorToolbox.core.TTmat(A, nrows, ncols, is_sparse=None, sparse_ranks=None, store_location='', store_object=None, store_freq=1, store_overwrite=False)

Constructor of multidimensional matrix in Tensor Train format

Parameters: A (Candecomp,ndarray,TT) – Available input formats are Candecomp, full tensor in numpy.ndarray, Tensor Train structure (list of cores), list of sparse matrices of sizes (r_{i-1}*r_{i}*nrows x ncols) (used for fast dot product - limited support for other functionalities) nrows (list,int) – If int then the row size will be the same in all dimensions, if list then len(nrows) == len(self.TT) (numer of cores) and row size will change for each dimension. ncols (list,int) – If int then the column size will be the same in all dimensions, if list then len(ncols) == len(self.TT) (numer of cores) and column size will change for each dimension. is_sparse (bool) – [default == False] if True it uses sparsity to accelerate some computations sparse_ranks (list) – [default==None] mandatory argument when A is a list of sparse matrices. It contains integers listing the TT-ranks of the matrix.

Note

the method __getitem__ is not overwritten, thus the indices used to access the tensor refer to the flatten versions of the matrices composing the matrix tensor.

build(eps=1e-10, method='svd', rs=None, fix_rank=False, Jinit=None, delta=0.0001, maxit=100, mv_eps=1e-06, mv_maxit=100, kickrank=2)

Common interface for the construction of the approximation.

Parameters: eps (float) – [default == 1e-10] For method==’svd’: precision with which to approximate the input tensor. For method==’ttcross’: TT-rounding tolerance for rank-check. method (string) – ‘svd’ use singular value decomposition to construct the TT representation , ‘ttcross’ use low rank skeleton approximation to construct the TT representation , ‘ttdmrg’ uses Tensor Train Renormalization Cross to construct the TT representation , ‘ttdmrgcross’ uses ‘ttdmrg’ with ‘ttcross’ approximation of supercores rs (list) – list of integer ranks of different cores. If None then the incremental TTcross approach will be used. (method==’ttcross’) fix_rank (bool) – determines whether the rank is allowed to be increased (method==’ttcross’) Jinit (list) – list of list of integers containing the r starting columns in the lowrankapprox routine for each core. If None then pick them randomly. (method==’ttcross’) delta (float) – accuracy parameter in the TT-cross routine (method==’ttcross’). It is the relative error in Frobenious norm between two successive iterations. maxit (int) – maximum number of iterations in the lowrankapprox routine (method==’ttcross’) mv_eps (float) – accuracy parameter for each usage of the maxvol algorithm (method==’ttcross’) mv_maxit (int) – maximum number of iterations in the maxvol routine (method==’ttcross’) fix_rank – Whether the rank is allowed to increase kickrank (int) – rank overshooting for ‘ttdmrg’