#### Previous topic

Spectral Tensor Train

#### Next topic

Canonical Decomposition

# Multi-linear algebra¶

TensorToolbox.multilinalg.mul(A, B)
• If A,B are TTvec/TTmat -> Hadamard product of two TT tensors
• If A TTvec/TTmat and B scalar -> multiplication by scalar
TensorToolbox.multilinalg.kron(A, B)

Kron product between two tensors in TT format. Complexity: O(1)

TensorToolbox.multilinalg.contraction(A, U)

Multidimensional contraction of tensor A with vectors in list U. Complexity: O(dnr^2)

Syntax:
W = contraction(A,U)
Parameters: A – Tensor in some form U – list of vectors of dimensions n_k for performing the contraction
TensorToolbox.multilinalg.norm(A, ord='fro', round_eps=1e-10, eps=0.0001, maxit=1000, pow_guess=None, info=False)

Compute the norm of tensor A.

Syntax:
w = norm(A,[ord])
Parameters: A – Tensor in some form ord – Specifies the type of norm that needs to be computed. Available norms are: the Frobenius norm: ‘fro’. If the input tensor is a WeightedTensorTrainVec, then this takes the Frobenious norm of the weighted TT, i.e. the continuos norm defined by the weights.
TensorToolbox.multilinalg.sd(A, b, x0=None, eps=1e-08, maxit=1000, eps_round=1e-10, ext_info=False)

Solves the system $$Ax=b$$ using the Steepest Descent method in Tensor Train format.

Parameters: A (TTmat) – Tensor train matrix b (TTvec/ndarray) – Right hand side x0 (TTvec/ndarray) – [default == TensorToolbox.core.zerosvec()] initial guess of solution x eps (float) – [default == 1e-8] stop criteria maxit (int) – [default == 1000] maximum number of iterations eps_round (float) – [default == 1e-10] accuracy for Tensor Train rounding operations ext_info (bool) – [default == False] whehter of not to have additional info returned tuple (x,conv,info) x (TTvec): solution of the linear system if converged or last iterate if not converged conv (bool): True -> converged, False -> Not converged / Zero Inner Product exeception info (dict): iter -> total number of iterations; r -> last residual in TT format; res -> residual history
TensorToolbox.multilinalg.cg(A, b, x0=None, eps=1e-08, maxit=1000, eps_round=1e-10, ext_info=False)

Solves the system $$Ax=b$$ using the Conjugate Gradient method in Tensor Train format.

Parameters: A (TTmat) – Tensor train matrix b (TTvec/ndarray) – Right hand side x0 (TTvec/ndarray) – [default == TensorToolbox.core.zerosvec()] initial guess of solution x eps (float) – [default == 1e-8] stop criteria for Bi-CGSTAB iterations maxit (int) – [default == 1000] maximum number of iterations for Bi-CGSTAB eps_round (float) – [default == 1e-10] accuracy for Tensor Train rounding operations ext_info (bool) – [default == False] whehter of not to have additional info returned tuple (x,conv,info) x (TTvec): solution of the linear system if converged or last iterate if not converged conv (bool): True -> converged, False -> Not converged / Zero Inner Product exeception info (dict): iter -> total number of iterations; r -> last residual in TT format; res -> residual history
TensorToolbox.multilinalg.bicgstab(A, b, x0=None, eps=1e-08, maxit=1000, eps_round=1e-10, ext_info=False)

Solves the system $$Ax=b$$ using the Bi-Conjugate Gradient Stabilized method using Tensor Train format.

Parameters: A (TTmat) – Tensor train matrix b (TTvec) – Right hand side x0 (TTvec) – [default == TensorToolbox.core.zerosvec()] initial guess of solution x eps (float) – [default == 1e-8] stop criteria for Bi-CGSTAB iterations maxit (int) – [default == 1000] maximum number of iterations for Bi-CGSTAB eps_round (float) – [default == 1e-10] accuracy for Tensor Train rounding operations ext_info (bool) – [default == False] whehter of not to have additional info returned tuple (x,conv,info) x (TTvec): solution of the linear system if converged or last iterate if not converged conv (bool): True -> converged, False -> Not converged / Zero Inner Product exeception info (dict): iter -> total number of iterations; r -> last residual in TT format; rho -> last value of dot(r0,r) must be bigger than np.spacing(1); r0v -> last value of dot(r0,v) must be bigger than np.spacing(1)
TensorToolbox.multilinalg.gmres(A, b, x0=None, eps=1e-08, maxit=1000, restart=1000, eps_round=1e-10, ext_info=False)

Solves the system $$Ax=b$$ using the Generalized Minimum Residual method with Modified Gram-Schmidt iterations using Tensor Train format.

Parameters: A (TTmat) – Tensor train matrix b (TTvec) – Right hand side x0 (TTvec) – [default == TensorToolbox.core.zerosvec()] initial guess of solution x eps (float) – [default == 1e-8] stop criteria for GMRES iterations maxit (int) – [default == 1000] maximum number of iterations for GMRES restart (int) – [default == 1000] restart constant for GMRES (nothing is implemented to retain information, i.e. Hessemberg and Krylov space are reset) eps_round (float) – [default == 1e-10] accuracy for Tensor Train rounding operations ext_info (bool) – [default == False] whehter of not to have additional info returned tuple (x,conv,info) x (TTvec): solution of the linear system if converged or last iterate if not converged conv (bool): True -> converged, False -> Not converged / Zero Inner Product exeception info (dict): iter -> total number of iterations; TT_r -> last residual in TT format; res -> norm of last residual; err -> residual history per iteration not optimized for symmetric A