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 r = x.rank; 0015 n = x.size; 0016 0017 y = x.U{1}; 0018 y = reshape( y, [n(1), r(2) ]); 0019 for i = 2:x.order 0020 U_temp = unfold( x.U{i}, 'right'); 0021 y = y * U_temp; 0022 y = reshape( y, [ prod(n(1:i)), r(i+1) ]); 0023 end 0024 y = reshape( y, n ); 0025 end