Previous topic

Tensor Train Matrices

Next topic

Quantics Tensor Train Matrices

Quantics Tensor Train Vectors¶

class TensorToolbox.core.QTTvec(A, global_shape=None, base=2, store_location='', store_object=None, store_freq=1, store_overwrite=False, multidim_point=None)

Constructor of multidimensional tensor in Quantics Tensor Train format [1][2].

Parameters: A (ndarray,TensorWrapper,TT) – Available input formats are full tensor in numpy.ndarray, Tensor Wrapper, Tensor Train structure (list of cores) global_shape (list) – Argument to be provided if A is the list of cores of a TT format. base (int) – base selected to do the folding
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=None)

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 [3], ‘ttcross’ use low rank skeleton approximation to construct the TT representation [4], ‘ttdmrg’ uses Tensor Train Renormalization Cross to construct the TT representation [5][6], ‘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’
get_data_F_norm()

Used to get the Frobeniuos norm of the underlying data.

get_folded_shape()

Return the shape of the folded tensor (list of lists)

get_global_ndim()

Return the ndim of the original tensor

get_global_shape()

Return the shape of the original tensor

get_q_shape()

Return the shape of the base “base” shape of the tensor

get_ttdmrg_real_subtensor(C, idxs)

Used to get the Frobeniuos norm of a subtensor of the underlying data.

Parameters: Return np.ndarray Creal: C (np.ndarray) – Extracted 4-d tensor with shape len(l_idx) x n x m x len(r_idx) idxs (list) – List of tuples of the form (l_idx, slice, slice, r_idx) 1-d array containing the filtered values belonging to the real tensor
interpolate(Ms=None, eps=1e-08, is_sparse=None)

Interpolates the values of the QTTvec at arbitrary points, using the interpolation matrices Ms.

Parameters: Ms (list) – list of interpolation matrices for each dimension. Ms[i].shape[1] == self.shape()[i] eps (float) – tolerance with which to perform the rounding after interpolation is_sparse (list) – is_sparse[i] is a bool indicating whether Ms[i] is sparse or not. If ‘None’ all matrices are non sparse [sparsity is not exploited] QTTvec interpolation QTTvec
>>> from DABISpectralToolbox import DABISpectral1D as S1D
>>> Ms = [ S1D.LinearInterpolationMatrix(X[i],XI[i]) for i in range(d) ]
>>> is_sparse = [True]*d
>>> TTapproxI = TTapprox.interpolate(Ms,eps=1e-8,is_sparse=is_sparse)

project(Vs=None, Ws=None, eps=1e-08, is_sparse=None)

Project the QTTvec onto a set of basis provided, using the Generalized Vandermonde matrices Vs and weights Ws.

Parameters: Vs (list) – list of generalized Vandermonde matrices for each dimension. Ms[i].shape[1] == self.shape()[i] Ws (list) – list of weights for each dimension. Ws[i].shape[0] == self.shape()[i] eps (float) – tolerance with which to perform the rounding after interpolation is_sparse (list) – is_sparse[i] is a bool indicating whether Ms[i] is sparse or not. If ‘None’ all matrices are non sparse [sparsity is not exploited] TTvec containting the Fourier coefficients TTvec
>>> from DABISpectralToolbox import DABISpectral1D as S1D
>>> P = S1D.Poly1D(S1D.JACOBI,(0,0))