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

TTeMPS_randn

PURPOSE ^

TTEMPS_RANDN Create random TTeMPS tensor

SYNOPSIS ^

function x = TTeMPS_randn(r, n)

DESCRIPTION ^

 TTEMPS_RANDN Create random TTeMPS tensor
   X = TTEMPS_RANDN(R, N) creates a length(N)-dimensional TTeMPS tensor
   of size N(1)*N(2)*...N(end) with ranks R by filling the cores with
   iid standard Gaussian random numbers.
   Note that the first and last entry of the rank vector must be 1.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function x = TTeMPS_randn(r, n)
0002 % TTEMPS_RANDN Create random TTeMPS tensor
0003 %   X = TTEMPS_RANDN(R, N) creates a length(N)-dimensional TTeMPS tensor
0004 %   of size N(1)*N(2)*...N(end) with ranks R by filling the cores with
0005 %   iid standard Gaussian random numbers.
0006 %   Note that the first and last entry of the rank vector must be 1.
0007 %
0008 
0009 %   This is a trivial modification of TTeMPS_rand, part of TTeMPS.
0010 %
0011 %   See also TTeMPS_rand
0012     
0013     if length(r) ~= length(n)+1
0014         error('Size mismatch in arguments')
0015     end
0016 
0017     U = cell(1, length(n));
0018     for i = 1:length(n)
0019         U{i} = randn(r(i), n(i), r(i+1));
0020     end
0021     x = TTeMPS(U);
0022 end

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