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

TT_to_TTeMPS

PURPOSE ^

TT_to_TTeMPS Convert from TT Toolbox format.

SYNOPSIS ^

function x = TT_to_TTeMPS( tt )

DESCRIPTION ^

TT_to_TTeMPS Convert from TT Toolbox format. 
   A = TT_to_TTeMPS( tt ) takes the tt_tensor object tt created using the 
   TT Toolbox 2.x from Oseledets et al. and converts it into a TTeMPS tensor. 
   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 x = TT_to_TTeMPS( tt )
0002     %TT_to_TTeMPS Convert from TT Toolbox format.
0003     %   A = TT_to_TTeMPS( tt ) takes the tt_tensor object tt created using the
0004     %   TT Toolbox 2.x from Oseledets et al. and converts it into a TTeMPS tensor.
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     cores = {};
0015     ps = tt.ps;
0016     for i = 1:tt.d
0017         cores{i} = reshape( tt.core( ps(i):ps(i+1)-1 ), ...
0018                                 [tt.r(i), tt.n(i), tt.r(i+1)] ); 
0019     end
0020     
0021     x = TTeMPS( cores );
0022     
0023 end

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