Home > manopt > manifolds > ttfixedrank > TTeMPS_1.1 > algorithms > linearsystem > solvePrecond.m

solvePrecond

PURPOSE ^

TTeMPS Toolbox.

SYNOPSIS ^

function xi = solvePrecond(L, P, rhs, xL, xR, opts )

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:

SUBFUNCTIONS ^

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 function xi = solvePrecond(L, P, rhs, xL, xR, opts  )
0007 
0008 if nargin==5
0009     opts.precond_tol = 1e-5;   % 1e-8 has the same performace, just to be sure...
0010     opts.precond_maxit = 5;
0011 end
0012 
0013 P_rhs = precond_laplace( P, rhs );
0014 
0015 
0016             
0017     function y = fun_A(x)        
0018         % x is a vectorized tangent
0019         x_tangent = fill_with_vectorized( dummy, x );        
0020         x_ttemps = tangent_to_TTeMPS( x_tangent );
0021         y_ttemps = apply(L, x_ttemps);
0022         y_tangent = TTeMPS_tangent_orth( xL, xR, y_ttemps );
0023         y = vectorize_tangent( y_tangent );
0024     end
0025 
0026     function y = fun_P(x)        
0027         x_tangent = fill_with_vectorized( dummy, x );        
0028         eta = precond_laplace( P, x_tangent );
0029         y = vectorize_tangent( eta );
0030     end
0031 
0032 if opts.precond_maxit > 1
0033     dummy = rhs;
0034         
0035     tol = opts.precond_tol;
0036     maxit = opts.precond_maxit-1;  % minus one !!
0037 
0038     [xi_vec,flag,relres,iter] = pcg(@fun_A, vectorize_tangent(rhs), tol, maxit, @fun_P, [], vectorize_tangent(P_rhs) );
0039     iter
0040     xi = fill_with_vectorized( dummy, xi_vec );
0041 else
0042     xi = P_rhs;
0043 end
0044 
0045 end

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