Home > solver > TEBD_Check_StopCrit.m

TEBD_Check_StopCrit

PURPOSE ^

Check stopping criterion : checks if the stopping criterion is satisfied

SYNOPSIS ^

function [stopstatus,printstatus,statusstr,runhist] = TEBD_Check_StopCrit(par,residuals,runhist,iter,stopstatus)

DESCRIPTION ^

Check stopping criterion : checks if the stopping criterion is satisfied
at a given iteration
%
% [stopstatus,printstatus,statusstr,runhist] = TEBD_Check_StopCrit(par,residuals,runhist,iter,stopstatus)
%
% input:
%        - par                : (struct) parameters of the algorithm
%        - resduals           : (struct) contains the specific residuals of the problem at the current iteration 
%        - runhist            : (struct) contains the accumulated running history
%        - iter               : current  iteration
%        - stopstatus         : flag that defines which stopping criteria are going to be considered 
%        
% output:
%        - stopstatus         : flag that defines which stopping criteria are going to be considered 
%        - printstatus        : is 1 if a stopping criterion is satisfied 0 otherwise 
%        - statusstr          : if printstatus = 1 a string of the stopping 
%                             criterion status at the current iterations (iter) 
%        - runhist            : (struct) contains the accumulated running 
%                             history, including the final norm of the 
%                             residuals and the number of the iterations 
%                             of the stopping criterion satisfied.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% 2EBD-HPE:
% Modified by C.Ortiz
% Last Modified: 6/15/2012

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 %Check stopping criterion : checks if the stopping criterion is satisfied
0002 %at a given iteration
0003 %%
0004 %% [stopstatus,printstatus,statusstr,runhist] = TEBD_Check_StopCrit(par,residuals,runhist,iter,stopstatus)
0005 %%
0006 %% input:
0007 %%        - par                : (struct) parameters of the algorithm
0008 %%        - resduals           : (struct) contains the specific residuals of the problem at the current iteration
0009 %%        - runhist            : (struct) contains the accumulated running history
0010 %%        - iter               : current  iteration
0011 %%        - stopstatus         : flag that defines which stopping criteria are going to be considered
0012 %%
0013 %% output:
0014 %%        - stopstatus         : flag that defines which stopping criteria are going to be considered
0015 %%        - printstatus        : is 1 if a stopping criterion is satisfied 0 otherwise
0016 %%        - statusstr          : if printstatus = 1 a string of the stopping
0017 %%                             criterion status at the current iterations (iter)
0018 %%        - runhist            : (struct) contains the accumulated running
0019 %%                             history, including the final norm of the
0020 %%                             residuals and the number of the iterations
0021 %%                             of the stopping criterion satisfied.
0022 %%
0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0024 %% 2EBD-HPE:
0025 %% Modified by C.Ortiz
0026 %% Last Modified: 6/15/2012
0027 function   [stopstatus,printstatus,statusstr,runhist] = TEBD_Check_StopCrit(par,residuals,runhist,iter,stopstatus)
0028 statusstr = '';
0029 printstatus = 0;
0030 if stopstatus >= 3 && residuals.resnorm3 < par.tol
0031     statusstr = [statusstr ,'****************Stop Criterion 3 satisfied**************************\n'];
0032     stopstatus = 2;
0033     printstatus = 1;
0034     runhist.finalresnorm3 = residuals.resnorm3;
0035     runhist.numiterations3 = iter;
0036 end
0037 if stopstatus >= 2 && residuals.resnorm2 < par.tol
0038     statusstr = [statusstr ,'****************Stop Criterion 2 satisfied**************************\n'];
0039     stopstatus = 1;
0040     printstatus = 1;
0041     runhist.finalresnorm2 = residuals.resnorm2;
0042     runhist.numiterations2 = iter;
0043 end
0044 if stopstatus >= 1 && residuals.resnorm < par.tol
0045     statusstr = [statusstr ,'****************Stop Criterion satisfied**************************\n'];
0046     stopstatus = 0;
0047     printstatus = 0;
0048 end
0049 
0050 
0051

Generated on Tue 06-Aug-2013 17:07:59 by m2html © 2005