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

round

PURPOSE ^

ROUND Approximate TTeMPS operator within a prescribed tolerance.

SYNOPSIS ^

function A = round(A, tol )

DESCRIPTION ^

ROUND Approximate TTeMPS operator within a prescribed tolerance.
   X = ROUND( A, tol ) truncates the given TTeMPS operator A 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 A = round(A, tol )
0002     %ROUND Approximate TTeMPS operator within a prescribed tolerance.
0003     %   X = ROUND( A, tol ) truncates the given TTeMPS operator A 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
0009     %   BSD 2-clause license, see LICENSE.txt
0010 
0011     C = cell(1, A.order);
0012     for i = 1:A.order
0013         C{i} = reshape(A.U{i}, [A.rank(i), A.size_col(i)*A.size_row(i), A.rank(i+1)]);
0014     end
0015     X = TTeMPS( C );
0016     X = round(X, tol);
0017     for i = 1:A.order
0018         A.U{i} = reshape(X.U{i}, [X.rank(i), A.size_col(i), A.size_row(i), X.rank(i+1)]);
0019     end
0020 
0021     A = update_properties(A);
0022 
0023 end

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