Home > manopt > manifolds > ttfixedrank > TTeMPS_1.1 > examples > example.m

example

PURPOSE ^

TTeMPS Toolbox.

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

   TTeMPS Toolbox. 
   Michael Steinlechner, 2013-2016
   Questions and contact: michael.steinlechner@epfl.ch
   BSD 2-clause license, see LICENSE.txt

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %   TTeMPS Toolbox.
0002 %   Michael Steinlechner, 2013-2016
0003 %   Questions and contact: michael.steinlechner@epfl.ch
0004 %   BSD 2-clause license, see LICENSE.txt
0005 
0006 rng(11);
0007 
0008 disp('Number of dimensions:')
0009 d = 5
0010 
0011 disp('Define tensor size:')
0012 n = [7 8 9 10 11]
0013 
0014 disp('Define rank vector (note that in the TT/MPS format, both the first and last rank are 1):')
0015 r = [1 4 5 6 7 1]
0016 
0017 disp('Create two random TT/MPS tensors:')
0018 X = TTeMPS_rand( r, n )
0019 Y = TTeMPS_rand( r, n )
0020 
0021 disp('Calculate inner product between them:')
0022 ip = innerprod( X, Y )
0023 
0024 disp('Left-orthogonalize X:')
0025 X = orthogonalize( X, 1 )
0026 
0027 disp('Right-orthogonalize Y:')
0028 Y = orthogonalize( Y, Y.order )
0029 
0030 disp('Add X and Y')
0031 Z = X + Y
0032 
0033 disp('Truncate Z back to rank r:')
0034 Z_trunc = truncate(Z, r)
0035 
0036 disp('Note that we also have the round() operations,')
0037 disp('where you specify a desired accuracy instead of prescribed rank')
0038 Z_round = round(Z, 1e-2)

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