Home > manopt > manifolds > ttfixedrank > TTeMPS_1.1 > @TTeMPS > TTeMPS_to_TT.m

TTeMPS_to_TT

PURPOSE ^

TTeMPS_to_TT Convert to TT Toolbox format.

SYNOPSIS ^

function TT = TTeMPS_to_TT( x )

DESCRIPTION ^

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.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

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

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