Home > manopt > manifolds > ttfixedrank > TTeMPS_1.1 > @TTeMPS_block > mtimes.m

# mtimes

## PURPOSE

MINUS Multiplication of TT/MPS block tensor by scalar or vector

## SYNOPSIS

function x = mtimes( a, x )

## DESCRIPTION

```MINUS Multiplication of TT/MPS block tensor by scalar or vector
X = MTIMES(A, X) multiplies the TT/MPS tensor X by A.
If A is a scalar, all blocks are multiplied by the x.order-th root of A.
if A is a vector of size X.p, all X.p slices of the supercore X.U{x.mu} are multiplied
by the corresponding entry in A.

## CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:

## SOURCE CODE

```0001 function x = mtimes( a, x )
0002     %MINUS Multiplication of TT/MPS block tensor by scalar or vector
0003     %   X = MTIMES(A, X) multiplies the TT/MPS tensor X by A.
0004     %       If A is a scalar, all blocks are multiplied by the x.order-th root of A.
0005     %       if A is a vector of size X.p, all X.p slices of the supercore X.U{x.mu} are multiplied
0006     %       by the corresponding entry in A.
0007     %
0009
0010     %   TTeMPS Toolbox.
0011     %   Michael Steinlechner, 2013-2016
0012     %   Questions and contact: michael.steinlechner@epfl.ch
0014
0015     %x.U{1} = a*x.U{1};
0016
0017     if length(a) == 1
0018         c = a^(1/x.order);
0019         for i = 1:x.order
0020             x.U{i} = c*x.U{i};
0021         end
0022     elseif length(a) == x.p
0023         for i = 1:x.p
0024             x.U{x.mu}(:,:,:,i) = a(i) * x.U{x.mu}(:,:,:,i);
0025         end
0026     else
0027         error('Dimension mismatch! Can only multiply block tensor X by scalar (whole tensor) or by a vector of length X.p')
0028     end
0029 end```

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