📄 optim_private_display1.c
字号:
/*
* MATLAB Compiler: 2.0.1
* Date: Tue May 08 21:28:22 2001
* Arguments: "-B" "sgl" "-m" "-W" "mainhg" "-L" "C" "asufit.m" "absfun.m"
* "absfunfree.m" "absfunshift.m" "absfunwidth.m" "dispfit.m" "dispfitdisp.m"
* "dispfitfree.m" "dispfitwidth.m" "seqmodfree.m" "spcfun.m" "spcfun1.m"
* "atamult.m" "aprecon.m"
*/
#include "optim_private_display1.h"
#include "optim_private_xtrack.h"
static double __Array0_r[4] = { .1, .45, .8, .5 };
static double __Array1_r[4] = { .74, .04, .17, .22 };
static double __Array2_r[4] = { .75, .15, .15, .1 };
static double __Array3_r[4] = { .75, .05, .15, .1 };
static double __Array4_r[4] = { 0.1, 0.05, 0.36, 0.30 };
static double __Array5_r[4] = { .25, .05, .5, .21 };
static double __Array6_r[4] = { .26, .16, .48, .1 };
static double __Array7_r[4] = { .26, .06, .48, .1 };
static double __Array8_r[4] = { 0.0, 0.3, 1.0, .7 };
static double __Array9_r[3] = { .0, .0, .0 };
static double __Array10_r[3] = { 1.0, 1.0, 1.0 };
static void Mdisplay1_displayProgress(mxArray * it,
mxArray * csnrm,
mxArray * val,
mxArray * pcgit,
mxArray * npcg,
mxArray * degen,
mxArray * bndfeas,
mxArray * showstat,
mxArray * nbnds,
mxArray * x,
mxArray * g,
mxArray * l,
mxArray * u,
mxArray * figtr,
mxArray * posdef,
mxArray * linfeas);
static void mlfDisplay1_displayProgress(mxArray * it,
mxArray * csnrm,
mxArray * val,
mxArray * pcgit,
mxArray * npcg,
mxArray * degen,
mxArray * bndfeas,
mxArray * showstat,
mxArray * nbnds,
mxArray * x,
mxArray * g,
mxArray * l,
mxArray * u,
mxArray * figtr,
mxArray * posdef,
mxArray * linfeas);
static void mlxDisplay1_displayProgress(int nlhs,
mxArray * plhs[],
int nrhs,
mxArray * prhs[]);
static mxArray * Mdisplay1_displayInit(int nargout_,
mxArray * itbnd,
mxArray * tol,
mxArray * showstat,
mxArray * nbnds,
mxArray * x,
mxArray * g,
mxArray * l,
mxArray * u);
static mxArray * mlfDisplay1_displayInit(mxArray * itbnd,
mxArray * tol,
mxArray * showstat,
mxArray * nbnds,
mxArray * x,
mxArray * g,
mxArray * l,
mxArray * u);
static void mlxDisplay1_displayInit(int nlhs,
mxArray * plhs[],
int nrhs,
mxArray * prhs[]);
static void Mdisplay1_displayFinal(mxArray * figtr, mxArray * figps);
static void mlfDisplay1_displayFinal(mxArray * figtr, mxArray * figps);
static void mlxDisplay1_displayFinal(int nlhs,
mxArray * plhs[],
int nrhs,
mxArray * prhs[]);
/*
* The function "Moptim_private_display1" is the implementation version of the
* "optim/private/display1" M-function from file
* "C:\MATLABR11\toolbox\optim\private\display1.m" (lines 1-27). It contains
* the actual compiled code for that M-function. It is a static function and
* must only be called from one of the interface functions, appearing below.
*/
/*
* function varargout = display1(flag,varargin)
*/
static mxArray * Moptim_private_display1(mxArray * flag, mxArray * varargin) {
mxArray * varargout = mclGetUninitializedArray();
mclValidateInputs("optim/private/display1", 1, &flag);
/*
* % DISPLAY1 displays progress information during optimization.
* % FIGTR = DISPLAY1('init',itbnd,tol,showstat,nbnds,x,g,l,u)
* % does the initialization of the windows.
* %
* % DISPLAY1('progress',it,csnrm,val,pcgit,npcg,degen,bndfeas,...
* % showstat,nbnds,x,g,l,u,figtr,posdef,linfeas)
* % displays the current values.
* %
* % DISPLAY1('final',figtr,figps) displays end of optimization messages.
*
* % Copyright (c) 1990-98 by The MathWorks, Inc.
* % $Revision: 1.7 $ $Date: 1998/07/09 16:30:13 $
*
* switch flag
* case 'progress'
*/
if (mclSwitchCompare(flag, mxCreateString("progress"))) {
/*
* displayProgress(varargin{:});
*/
mlfFeval(
mclAnsVarargout(),
mlxDisplay1_displayProgress,
mlfIndexRef(varargin, "{?}", mlfCreateColonIndex()),
NULL);
/*
* case 'init'
*/
} else if (mclSwitchCompare(flag, mxCreateString("init"))) {
/*
* varargout{1} = displayInit(varargin{:});
*/
mlfIndexAssign(
&varargout,
"{?}",
mlfScalar(1.0),
mlfFeval(
mclValueVarargout(),
mlxDisplay1_displayInit,
mlfIndexRef(varargin, "{?}", mlfCreateColonIndex()),
NULL));
/*
* case 'final'
*/
} else if (mclSwitchCompare(flag, mxCreateString("final"))) {
/*
* displayFinal(varargin{:});
*/
mlfFeval(
mclAnsVarargout(),
mlxDisplay1_displayFinal,
mlfIndexRef(varargin, "{?}", mlfCreateColonIndex()),
NULL);
/*
* otherwise
*/
} else {
/*
* error('Invalid string used for FLAG argument to DISPLAY1');
*/
mlfError(
mxCreateString("Invalid string used for FLAG argument to DISPLAY1"));
/*
* end
*/
}
/*
*
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
* function displayProgress(it,csnrm,val,pcgit,npcg,degen,bndfeas,...
* showstat,nbnds,x,g,l,u,figtr,posdef,linfeas)
* %DISPLAYPROGRESS displays current values of several parameters.
* %
* % DISPLAYPROGRESS(it,csnrm,val,pcgit,npcg,degen,bndfeas,...
* % showstat,nbnds,x,g,l,u,figtr,posdef,linfeas)
* % displays current values of several parameters after the Progress
* % information window has already been created.
* %
*
*
* %
* if nargin < 6, degen = -1; end
* if nargin < 7, bndfeas = inf; end
* if isempty(bndfeas), bndfeas = inf; end
* if nargin < 15, posdef = []; end
* if nargin < 16, linfeas = -1; end
* if isempty(linfeas), linfeas = -1; end
* lastParam = [] ;
* if degen >= 0
* lastParam = str2mat(lastParam, ...
* sprintf(' Degeneracy measure = %-6.2e',degen));
* end
* if bndfeas < inf
* lastParam = str2mat(lastParam, ...
* sprintf(' Feasibility wrt bounds = %-6.2e',bndfeas));
* end
* if posdef > 0
* lastParam = str2mat(lastParam, ...
* sprintf(' Curvature: Positive')) ;
* elseif posdef <= 0
* lastParam = str2mat(lastParam, ...
* sprintf(' Curvature: Negative')) ;
* end ;
* if linfeas >= 0
* lastParam = str2mat(lastParam, ...
* sprintf(' Feasibility wrt linear equalities = %-6.2e',linfeas));
* end ;
* if ~isempty(lastParam)
* lastParam(1,:) = [] ;
* end
* figure(figtr) ;
* ParamTitl = str2mat('', ...
* sprintf(' Iteration = %-4.0f',it), ...
* sprintf(' First-order optimality accuracy = %-6.2e',csnrm), ...
* sprintf(' Objective function value = %-12.10e',val), ...
* sprintf(' CG iterations = %-5.0f',pcgit), ...
* sprintf(' Total CG iterations to date = %-7.0f',npcg), ...
* lastParam) ;
* ParamTitlHndl = findobj(figtr,'type','uicontrol',...
* 'Userdata','Report Progress') ;
* set(ParamTitlHndl,'String',ParamTitl) ;
* drawnow
*
* % Write the same thing to the log file
* % temporarily disable this feature
* if 0
* logfile = fopen('lsot.log','at') ;
* fprintf(logfile,'\n\n***********************************************************\n') ;
* fprintf(logfile,[ParamTitl';10*ones(1,size(ParamTitl,1))]) ;
* fclose(logfile) ;
* end
*
* if (showstat >=3 & nbnds)
* figure(figtr) ;
* xtrack(x,g,l,u);
* end
*
*
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
return varargout;
}
/*
* The function "mlfOptim_private_display1" contains the normal interface for
* the "optim/private/display1" M-function from file
* "C:\MATLABR11\toolbox\optim\private\display1.m" (lines 1-27). This function
* processes any input arguments and passes them to the implementation version
* of the function, appearing above.
*/
mxArray * mlfOptim_private_display1(mlfVarargoutList * varargout,
mxArray * flag,
...) {
mxArray * varargin = mclUnassigned();
mlfVarargin(&varargin, flag, 0);
mlfEnterNewContext(0, -2, flag, varargin);
*mlfGetVarargoutCellPtr(varargout)
= Moptim_private_display1(flag, varargin);
mlfRestorePreviousContext(0, 1, flag);
mxDestroyArray(varargin);
return mlfAssignOutputs(varargout);
}
/*
* The function "mlxOptim_private_display1" contains the feval interface for
* the "optim/private/display1" M-function from file
* "C:\MATLABR11\toolbox\optim\private\display1.m" (lines 1-27). The feval
* function calls the implementation version of optim/private/display1 through
* this function. This function processes any input arguments and passes them
* to the implementation version of the function, appearing above.
*/
void mlxOptim_private_display1(int nlhs,
mxArray * plhs[],
int nrhs,
mxArray * prhs[]) {
mxArray * mprhs[2];
mxArray * mplhs[1];
int i;
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 1 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 1; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 1, mprhs[0]);
mprhs[1] = NULL;
mlfAssign(&mprhs[1], mclCreateVararginCell(nrhs - 1, prhs + 1));
mplhs[0] = Moptim_private_display1(mprhs[0], mprhs[1]);
mclAssignVarargoutCell(nlhs, plhs, mplhs[0]);
mlfRestorePreviousContext(0, 1, mprhs[0]);
mxDestroyArray(mprhs[1]);
}
/*
* The function "Mdisplay1_displayProgress" is the implementation version of
* the "display1/displayProgress" M-function from file
* "C:\MATLABR11\toolbox\optim\private\display1.m" (lines 27-98). It contains
* the actual compiled code for that M-function. It is a static function and
* must only be called from one of the interface functions, appearing below.
*/
/*
* function displayProgress(it,csnrm,val,pcgit,npcg,degen,bndfeas,...
*/
static void Mdisplay1_displayProgress(mxArray * it,
mxArray * csnrm,
mxArray * val,
mxArray * pcgit,
mxArray * npcg,
mxArray * degen,
mxArray * bndfeas,
mxArray * showstat,
mxArray * nbnds,
mxArray * x,
mxArray * g,
mxArray * l,
mxArray * u,
mxArray * figtr,
mxArray * posdef,
mxArray * linfeas) {
mxArray * ParamTitl = mclGetUninitializedArray();
mxArray * ParamTitlHndl = mclGetUninitializedArray();
mxArray * ans = mclInitializeAns();
mxArray * lastParam = mclGetUninitializedArray();
mxArray * logfile = mclGetUninitializedArray();
mxArray * nargin_ = mclGetUninitializedArray();
mlfAssign(
&nargin_,
mlfNargin(
0,
it,
csnrm,
val,
pcgit,
npcg,
degen,
bndfeas,
showstat,
nbnds,
x,
g,
l,
u,
figtr,
posdef,
linfeas,
NULL));
mclValidateInputs(
"display1/displayProgress",
16,
&it,
&csnrm,
&val,
&pcgit,
&npcg,
°en,
&bndfeas,
&showstat,
&nbnds,
&x,
&g,
&l,
&u,
&figtr,
&posdef,
&linfeas);
mclCopyArray(°en);
mclCopyArray(&bndfeas);
mclCopyArray(&posdef);
mclCopyArray(&linfeas);
/*
* showstat,nbnds,x,g,l,u,figtr,posdef,linfeas)
* %DISPLAYPROGRESS displays current values of several parameters.
* %
* % DISPLAYPROGRESS(it,csnrm,val,pcgit,npcg,degen,bndfeas,...
* % showstat,nbnds,x,g,l,u,figtr,posdef,linfeas)
* % displays current values of several parameters after the Progress
* % information window has already been created.
* %
*
*
* %
* if nargin < 6, degen = -1; end
*/
if (mlfTobool(mlfLt(nargin_, mlfScalar(6.0)))) {
mlfAssign(°en, mlfScalar(-1.0));
}
/*
* if nargin < 7, bndfeas = inf; end
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -