FULL Convert TTeMPS tensor to full array X = FULL(X) converts the TTeMPS tensor X to a (X.order)-dimensional full array of size X.size(1) x X.size(2) x ... x X.size(X.order) Use with care! Result can easily exceed available memory. See also SUBSREF.
0001 function y = full( x ) 0002 %FULL Convert TTeMPS tensor to full array 0003 % X = FULL(X) converts the TTeMPS tensor X to a (X.order)-dimensional full array of size 0004 % X.size(1) x X.size(2) x ... x X.size(X.order) 0005 % 0006 % Use with care! Result can easily exceed available memory. 0007 % 0008 % See also SUBSREF. 0009 0010 % TTeMPS Toolbox. 0011 % Michael Steinlechner, 2013-2016 0012 % Questions and contact: michael.steinlechner@epfl.ch 0013 % BSD 2-clause license, see LICENSE.txt 0014 0015 0016 y = x.U{1}; 0017 y = reshape( y, [ x.size(1), x.rank(2) ]); 0018 for i = 2:x.order 0019 U_temp = unfold( x.U{i}, 'right'); 0020 y = y * U_temp; 0021 y = reshape( y, [ prod(x.size(1:i)), x.rank(i+1) ]); 0022 end 0023 y = reshape( y, x.size ); 0024 end