TTeMPS_to_TT Convert to TT Toolbox format. TT = TT_to_TTeMPS( A ) takes the TTeMPS tensor A and converts it into a tt_tensor object tt using the TT Toolbox 2.x from Oseledets et al. Toolbox needs to be installed, of course. See also TTeMPS_to_TT.
0001 function TT = TTeMPS_to_TT( x ) 0002 %TTeMPS_to_TT Convert to TT Toolbox format. 0003 % TT = TT_to_TTeMPS( A ) takes the TTeMPS tensor A and converts it into 0004 % a tt_tensor object tt using the TT Toolbox 2.x from Oseledets et al. 0005 % Toolbox needs to be installed, of course. 0006 % 0007 % See also TTeMPS_to_TT. 0008 0009 % TTeMPS Toolbox. 0010 % Michael Steinlechner, 2013-2016 0011 % Questions and contact: michael.steinlechner@epfl.ch 0012 % BSD 2-clause license, see LICENSE.txt 0013 0014 TT = tt_tensor; 0015 TT.d = x.order; 0016 TT.n = x.size'; 0017 TT.r = x.rank'; 0018 0019 % cellfun goodness! 0020 TT.core = cell2mat( cellfun(@(y) y(:).', x.U, 'UniformOutput', false) ).'; 0021 lengths = TT.r(1:end-1) .* TT.n .* TT.r(2:end); 0022 TT.ps = cumsum( [1; lengths] ); 0023 0024 end