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

precond_rankOne

PURPOSE ^

TTeMPS Toolbox.

SYNOPSIS ^

function [eta] = precond_rankOne( A, xi, xL, xR )

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 function [eta] = precond_rankOne( A, xi, xL, xR  )
0007 % A is a parameterdependent operator
0008 
0009 r = xL.rank;
0010 n = xL.size;
0011 d = xL.order;
0012 
0013 
0014 eta = xi;
0015 xi = tangent_to_TTeMPS( xi );
0016 % % 1. STEP: Project right hand side
0017 % below is hard-coded version of
0018 % for ii=1:d
0019 %     eta_partial_ii = TTeMPS_partial_project_overlap( xL, xR, xi, ii);
0020 %     Y{ii} = eta_partial_ii.dU{ii};
0021 % end
0022 
0023 % TODO, it seems that the left and right cell arrays consist of a lot of
0024 % identities and zeros.
0025 Y = cell(1,d);
0026 % precompute inner products
0027 left = innerprod( xL, xi, 'LR', d-1, true );
0028 right = innerprod( xR, xi, 'RL', 2, true );
0029 
0030 % contract to first core
0031 Y{1} = tensorprod_ttemps( xi.U{1}, right{2}, 3 );
0032 % contract to first core
0033 for idx = 2:d-1
0034     res = tensorprod_ttemps( xi.U{idx}, left{idx-1}, 1 );
0035     Y{idx} = tensorprod_ttemps( res, right{idx+1}, 3 );
0036 end
0037 % contract to last core
0038 Y{d} = tensorprod_ttemps( xi.U{d}, left{d-1}, 1 );
0039 
0040 
0041 tmp = (19.4*A.A{1}) \ unfold( Y{1}, 'left' );
0042 eta.dU{1} = reshape( tmp, [r(1), n(1), r(2)]);
0043  
0044 x1 = matricize( xL.U{1}, 2);
0045 y = xL;
0046 y.U{1} = tensorize( (19.4*A.A{1})*x1, 2, [r(1), n(1), r(2)] );
0047 B1 = innerprod( xL, y, 'LR', d-1, true);
0048 for i=2:d
0049     tmp = B1{i-1} \ unfold(Y{i}, 'right');
0050     eta.dU{i} = reshape( tmp, [r(i), n(i), r(i+1)] );
0051 end
0052 
0053 eta = TTeMPS_tangent_orth( xL, xR, eta ); 
0054 
0055 end
0056

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