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

round

PURPOSE

ROUND Approximate TTeMPS tensor within a prescribed tolerance.

SYNOPSIS

function x = round( x, tol )

DESCRIPTION

```ROUND Approximate TTeMPS tensor within a prescribed tolerance.
X = ROUND( X, tol ) truncates the given TTeMPS tensor X to a
lower rank such that the error is in order of tol.```

CROSS-REFERENCE INFORMATION

This function calls:
This function is called by:

SOURCE CODE

```0001 function x = round( x, tol )
0002     %ROUND Approximate TTeMPS tensor within a prescribed tolerance.
0003     %   X = ROUND( X, tol ) truncates the given TTeMPS tensor X to a
0004     %   lower rank such that the error is in order of tol.
0005
0006     %   TTeMPS Toolbox.
0007     %   Michael Steinlechner, 2013-2016
0008     %   Questions and contact: michael.steinlechner@epfl.ch
0010
0011     sz = x.size;
0012     d = x.order;
0013
0014     % Left-right procedure
0015     x = x.orthogonalize( d );
0016
0017     right_rank = 1;
0018     for i = d:-1:2
0019         [U,S,V] = svd( unfold( x.U{i}, 'right'), 'econ' );
0020         r = trunc_singular( diag(S), tol, true );
0021         U = U(:,1:r);
0022         V = V(:,1:r);
0023         S = S(1:r,1:r);
0024         x.U{i} = reshape( V', [r, sz(i), right_rank] );
0025         x.U{i-1} = tensorprod_ttemps( x.U{i-1}, (U*S).', 3 );
0026         right_rank = r;
0027     end
0028
0029 end```

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