Home > manopt > manifolds > ttfixedrank > TTeMPS_1.1 > tensorprod_ttemps.m

tensorprod_ttemps

PURPOSE ^

TENSORPROD_TTEMPS Tensor-times-Matrix product.

SYNOPSIS ^

function res = tensorprod_ttemps( U, A, mode, apply_inv )

DESCRIPTION ^

TENSORPROD_TTEMPS Tensor-times-Matrix product. 
   A = TENSORPROD_TTEMPS(U, A, MODE) performs the mode-MODE product between the
   tensor U and matrix A. Higher dimensions than 3 are not supported.

   A = TENSORPROD_TTEMPS(U, A, MODE, TRUE) multiplies with A^{-1} instead of A.

   Renamed from tensorprod to tensorprod on April 20, 2022 to accomodate the new
   Matlab built-in function tensorprod in R2022a.

   See also MATRICIZE, TENSORIZE, UNFOLD.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function res = tensorprod_ttemps( U, A, mode, apply_inv )
0002     %TENSORPROD_TTEMPS Tensor-times-Matrix product.
0003     %   A = TENSORPROD_TTEMPS(U, A, MODE) performs the mode-MODE product between the
0004     %   tensor U and matrix A. Higher dimensions than 3 are not supported.
0005     %
0006     %   A = TENSORPROD_TTEMPS(U, A, MODE, TRUE) multiplies with A^{-1} instead of A.
0007     %
0008     %   Renamed from tensorprod to tensorprod on April 20, 2022 to accomodate the new
0009     %   Matlab built-in function tensorprod in R2022a.
0010     %
0011     %   See also MATRICIZE, TENSORIZE, UNFOLD.
0012     
0013     %   TTeMPS Toolbox.
0014     %   Michael Steinlechner, 2013-2016
0015     %   Questions and contact: michael.steinlechner@epfl.ch
0016     %   BSD 2-clause license, see LICENSE.txt
0017 
0018     if nargin==3
0019         apply_inv = false;
0020     end
0021     
0022     d = size(U);
0023     % pad with 1 for the last dim (annoying)
0024     if length(d) == 2
0025         d = [d, 1];
0026     end
0027     d(mode) = size(A,1);
0028     
0029     if apply_inv
0030         res = A \ matricize( U, mode );
0031         res = tensorize( res, mode, d );
0032     else
0033         res = A * matricize( U, mode );
0034         res = tensorize( res, mode, d );
0035     end
0036 
0037 end

Generated on Fri 30-Sep-2022 13:18:25 by m2html © 2005