Home > manopt > manifolds > ttfixedrank > TTeMPS_1.1 > algorithms > completion > completion_rankincrease.m

# completion_rankincrease

## SYNOPSIS

function [X,cost,test,stats] = completion_rankincrease_adaptive_new2( method, A_Omega, Omega, A_Omega_C, Omega_C, A_Gamma, Gamma, X0, opts )

## CROSS-REFERENCE INFORMATION

This function calls:
• disp DISP Display TT/MPS tensor.
• norm NORM Norm of a TT/MPS tensor.
• orthogonalize ORTHOGONALIZE Orthogonalize tensor.
• disp DISP Display TT/MPS block-mu tensor.
• norm NORM Norm of a TT/MPS block-mu tensor.
• orthogonalize ORTHOGONALIZE Orthogonalize TT/MPS Block-mu tensor.
• disp DISP Display TT/MPS operator.
• disp DISP Display TT/MPS operator.
• completion Completion for Tensor train but without individual orthogonalization
• completion_als ALS Completion
• completion_orth RTTC: Riemannian Tensor Train Completion
• increaseRank Helper routine to artificially increase the rank of the current iterate.
• orthogonalize Orthonormalizes a basis of tangent vectors in the Manopt framework.
This function is called by:

## SOURCE CODE

```0001 function [X,cost,test,stats] = completion_rankincrease_adaptive_new2( method, A_Omega, Omega, A_Omega_C, Omega_C, A_Gamma, Gamma, X0, opts )
0002
0003     if ~isfield( opts, 'maxrank');      opts.maxrank = 4  ;         end
0004     if ~isfield( opts, 'cg');           opts.cg = true;             end
0005     if ~isfield( opts, 'tol');          opts.tol = 1e-6;            end
0006     if ~isfield( opts, 'reltol');       opts.reltol = 1e-8;         end
0007     if ~isfield( opts, 'reltol_final'); opts.reltol_final = eps;    end
0008     if ~isfield( opts, 'maxiter');      opts.maxiter = 10;          end
0009     if ~isfield( opts, 'maxiter_final');opts.maxiter_final = 20;    end
0010     if ~isfield( opts, 'locked_tol');   opts.locked_tol = 1;        end
0011     if ~isfield( opts, 'epsilon');      opts.epsilon = 1e-8;        end
0012     if ~isfield( opts, 'verbose');      opts.verbose = false;       end
0013
0014     if strcmpi( method, 'GeomCG' )
0015         completion = @( A_Omega, Omega, A_Gamma, Gamma, X0, opts ) ...
0016                             completion_orth( A_Omega, Omega, A_Gamma, Gamma, X0, opts )
0017     elseif strcmpi( method, 'ALS' )
0018         completion = @( A_Omega, Omega, A_Gamma, Gamma, X0, opts ) ...
0019                             completion_als( A_Omega, Omega, A_Gamma, Gamma, X0, opts )
0020     end
0021     d = X0.order;
0022
0023     test = [];
0024     control_old = inf;
0025
0026     % ===========================================
0027     disp('____________________________________________________________________');
0028     disp(['Completion with with starting rank r = [ ' num2str(X0.rank) ' ] ...']);
0029     [X,cost,control,stats] = completion( A_Omega, Omega, A_Gamma, Gamma, X0, opts);
0030
0031     stats.rankidx = [length(cost)];
0032
0033     disp('____________________________________________________________________');
0034     disp(['Increasing rank ... ']);
0035
0036     locked = zeros(1,d+1);
0037
0038     for k = 2:opts.maxrank
0039         for i = 2:d
0040
0041             disp(['Locked cores:' num2str(locked) ])
0042             if locked(i)
0043                 disp(['Rank r(' num2str(i) ') is locked. Skipping.']);
0044             else
0045                 r = X.rank;
0046                 disp(['Trying to increase rank r(' num2str(i) ') from ' num2str(r(i)) ' to ' num2str(r(i)+1) ':']);
0047                 Xnew = increaseRank(X, 1, i, opts.epsilon);
0048                 Xnew = orthogonalize(Xnew, d);
0049                 if i==d && k == opts.maxrank
0050                     opts.maxiter = opts.maxiter_final;
0051                 end
0052                 [Xnew,cost_tmp,control_tmp,stats_tmp] = completion( A_Omega, Omega, A_Omega_C, Omega_C, Xnew, opts);
0053                 stats.rankidx = [stats.rankidx, length(cost_tmp)];
0054                 disp( ['Current cost function:            ', num2str(cost_tmp(end)) ]);
0055
0056                 progress = (control_tmp(end) - control_old )/control_old;
0057                 disp( ['Current rel. progress on control: ' num2str(progress)]);
0058
0059                 if  progress > opts.locked_tol
0060                     disp(['     ... failed. Reverting.']);
0061                 else
0062                    disp(['     ... accepted.']);
0063                    X = Xnew;
0064                    control_old = control_tmp(end)
0065                    test_current = norm(X(Gamma) - A_Gamma)/ norm(A_Gamma)
0066                    disp( ['Current error on test set Gamma:  ', num2str(test_current) ]);
0067                    test = [test, test_current];
0068                 end
0069
0070                 if ~isempty(stats.time)
0071                     stats_tmp.time = stats_tmp.time + stats.time(end);
0072                 end
0073
0074                 cost = [cost; cost_tmp];
0075                 control = [control; control_tmp];
0076                 stats.time = [stats.time, stats_tmp.time];
0077
0078             end
0079
0080         end
0081     end
0082
0083 end```

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