⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 optim_private_display1.c

📁 ASUFIT-Matlab-全局拟合程序
💻 C
📖 第 1 页 / 共 5 页
字号:
    if (mlfTobool(mlfLt(nargin_, mlfScalar(7.0)))) {
        mlfAssign(&bndfeas, mlfInf());
    }
    /*
     * if isempty(bndfeas), bndfeas = inf; end
     */
    if (mlfTobool(mlfIsempty(bndfeas))) {
        mlfAssign(&bndfeas, mlfInf());
    }
    /*
     * if nargin < 15, posdef = []; end
     */
    if (mlfTobool(mlfLt(nargin_, mlfScalar(15.0)))) {
        mlfAssign(&posdef, mclCreateEmptyArray());
    }
    /*
     * if nargin < 16, linfeas = -1; end 
     */
    if (mlfTobool(mlfLt(nargin_, mlfScalar(16.0)))) {
        mlfAssign(&linfeas, mlfScalar(-1.0));
    }
    /*
     * if isempty(linfeas), linfeas = -1; end
     */
    if (mlfTobool(mlfIsempty(linfeas))) {
        mlfAssign(&linfeas, mlfScalar(-1.0));
    }
    /*
     * lastParam = [] ;
     */
    mlfAssign(&lastParam, mclCreateEmptyArray());
    /*
     * if degen >= 0
     */
    if (mlfTobool(mlfGe(degen, mlfScalar(0.0)))) {
        /*
         * lastParam = str2mat(lastParam, ...
         */
        mlfAssign(
          &lastParam,
          mlfStr2mat(
            lastParam,
            mlfSprintf(
              NULL,
              mxCreateString(" Degeneracy measure = %-6.2e"),
              degen,
              NULL),
            NULL));
    /*
     * sprintf(' Degeneracy measure = %-6.2e',degen)); 
     * end
     */
    }
    /*
     * if bndfeas < inf
     */
    if (mlfTobool(mlfLt(bndfeas, mlfInf()))) {
        /*
         * lastParam = str2mat(lastParam, ...
         */
        mlfAssign(
          &lastParam,
          mlfStr2mat(
            lastParam,
            mlfSprintf(
              NULL,
              mxCreateString(" Feasibility wrt bounds = %-6.2e"),
              bndfeas,
              NULL),
            NULL));
    /*
     * sprintf(' Feasibility wrt bounds = %-6.2e',bndfeas));
     * end
     */
    }
    /*
     * if posdef > 0
     */
    if (mlfTobool(mlfGt(posdef, mlfScalar(0.0)))) {
        /*
         * lastParam = str2mat(lastParam, ...
         */
        mlfAssign(
          &lastParam,
          mlfStr2mat(
            lastParam,
            mlfSprintf(NULL, mxCreateString(" Curvature: Positive"), NULL),
            NULL));
    /*
     * sprintf(' Curvature: Positive')) ;
     * elseif posdef <= 0
     */
    } else if (mlfTobool(mlfLe(posdef, mlfScalar(0.0)))) {
        /*
         * lastParam = str2mat(lastParam, ...
         */
        mlfAssign(
          &lastParam,
          mlfStr2mat(
            lastParam,
            mlfSprintf(NULL, mxCreateString(" Curvature: Negative"), NULL),
            NULL));
    /*
     * sprintf(' Curvature: Negative')) ;
     * end ;
     */
    }
    /*
     * if linfeas >= 0
     */
    if (mlfTobool(mlfGe(linfeas, mlfScalar(0.0)))) {
        /*
         * lastParam = str2mat(lastParam, ...
         */
        mlfAssign(
          &lastParam,
          mlfStr2mat(
            lastParam,
            mlfSprintf(
              NULL,
              mxCreateString(" Feasibility wrt linear equalities = %-6.2e"),
              linfeas,
              NULL),
            NULL));
    /*
     * sprintf(' Feasibility wrt linear equalities = %-6.2e',linfeas));
     * end ;
     */
    }
    /*
     * if ~isempty(lastParam)
     */
    if (mlfTobool(mlfNot(mlfIsempty(lastParam)))) {
        /*
         * lastParam(1,:) = [] ; 
         */
        mlfIndexDelete(
          &lastParam, "(?,?)", mlfScalar(1.0), mlfCreateColonIndex());
    /*
     * end 
     */
    }
    /*
     * figure(figtr) ;
     */
    mclAssignAns(&ans, mlfNFigure(0, figtr, NULL));
    /*
     * ParamTitl = str2mat('', ...
     */
    mlfAssign(
      &ParamTitl,
      mlfStr2mat(
        mxCreateString(""),
        mlfSprintf(NULL, mxCreateString(" Iteration =  %-4.0f"), it, NULL),
        mlfSprintf(
          NULL,
          mxCreateString(" First-order optimality accuracy = %-6.2e"),
          csnrm,
          NULL),
        mlfSprintf(
          NULL,
          mxCreateString(" Objective function value =   %-12.10e"),
          val,
          NULL),
        mlfSprintf(
          NULL, mxCreateString(" CG iterations  = %-5.0f"), pcgit, NULL),
        mlfSprintf(
          NULL,
          mxCreateString(" Total CG iterations to date = %-7.0f"),
          npcg,
          NULL),
        lastParam,
        NULL));
    /*
     * 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',...
     */
    mlfAssign(
      &ParamTitlHndl,
      mlfFindobj(
        figtr,
        mxCreateString("type"),
        mxCreateString("uicontrol"),
        mxCreateString("Userdata"),
        mxCreateString("Report Progress"),
        NULL));
    /*
     * 'Userdata','Report Progress') ;
     * set(ParamTitlHndl,'String',ParamTitl) ;
     */
    mclAssignAns(
      &ans,
      mlfNSet(0, ParamTitlHndl, mxCreateString("String"), ParamTitl, NULL));
    /*
     * drawnow 
     */
    mlfDrawnow(NULL);
    /*
     * 
     * % Write the same thing to the log file
     * % temporarily disable this feature
     * if 0
     */
    if (mlfTobool(mlfScalar(0.0))) {
        /*
         * logfile = fopen('lsot.log','at') ;
         */
        mlfAssign(
          &logfile,
          mlfFopen(
            NULL,
            NULL,
            mxCreateString("lsot.log"),
            mxCreateString("at"),
            NULL));
        /*
         * fprintf(logfile,'\n\n***********************************************************\n') ;
         */
        mclAssignAns(
          &ans,
          mlfFprintf(
            logfile,
            mxCreateString(
              "\\n\\n*****************************"
              "******************************\\n"),
            NULL));
        /*
         * fprintf(logfile,[ParamTitl';10*ones(1,size(ParamTitl,1))]) ;
         */
        mclAssignAns(
          &ans,
          mlfFprintf(
            logfile,
            mlfVertcat(
              mlfHorzcat(mlfCtranspose(ParamTitl), NULL),
              mlfHorzcat(
                mlfMtimes(
                  mlfScalar(10.0),
                  mlfOnes(
                    mlfScalar(1.0),
                    mlfSize(mclValueVarargout(), ParamTitl, mlfScalar(1.0)),
                    NULL)),
                NULL),
              NULL),
            NULL));
        /*
         * fclose(logfile) ;
         */
        mclAssignAns(&ans, mlfFclose(logfile));
    /*
     * end
     */
    }
    /*
     * 
     * if (showstat >=3 & nbnds)
     */
    {
        mxArray * a_ = mclInitialize(mlfGe(showstat, mlfScalar(3.0)));
        if (mlfTobool(a_) && mlfTobool(mlfAnd(a_, nbnds))) {
            mxDestroyArray(a_);
            /*
             * figure(figtr) ; 
             */
            mclAssignAns(&ans, mlfNFigure(0, figtr, NULL));
            /*
             * xtrack(x,g,l,u); 
             */
            mlfOptim_private_xtrack(x, g, l, u, NULL);
        } else {
            mxDestroyArray(a_);
        }
    /*
     * end
     */
    }
    mxDestroyArray(ParamTitl);
    mxDestroyArray(ParamTitlHndl);
    mxDestroyArray(ans);
    mxDestroyArray(bndfeas);
    mxDestroyArray(degen);
    mxDestroyArray(lastParam);
    mxDestroyArray(linfeas);
    mxDestroyArray(logfile);
    mxDestroyArray(nargin_);
    mxDestroyArray(posdef);
/*
 * 
 * 
 * %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 * 
 */
}

/*
 * The function "mlfDisplay1_displayProgress" contains the normal interface for
 * the "display1/displayProgress" M-function from file
 * "C:\MATLABR11\toolbox\optim\private\display1.m" (lines 27-98). This function
 * processes any input arguments and passes them to the implementation version
 * of the function, appearing above.
 */
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) {
    mlfEnterNewContext(
      0,
      16,
      it,
      csnrm,
      val,
      pcgit,
      npcg,
      degen,
      bndfeas,
      showstat,
      nbnds,
      x,
      g,
      l,
      u,
      figtr,
      posdef,
      linfeas);
    Mdisplay1_displayProgress(
      it,
      csnrm,
      val,
      pcgit,
      npcg,
      degen,
      bndfeas,
      showstat,
      nbnds,
      x,
      g,
      l,
      u,
      figtr,
      posdef,
      linfeas);
    mlfRestorePreviousContext(
      0,
      16,
      it,
      csnrm,
      val,
      pcgit,
      npcg,
      degen,
      bndfeas,
      showstat,
      nbnds,
      x,
      g,
      l,
      u,
      figtr,
      posdef,
      linfeas);
}

/*
 * The function "mlxDisplay1_displayProgress" contains the feval interface for
 * the "display1/displayProgress" M-function from file
 * "C:\MATLABR11\toolbox\optim\private\display1.m" (lines 27-98). The feval
 * function calls the implementation version of display1/displayProgress
 * through this function. This function processes any input arguments and
 * passes them to the implementation version of the function, appearing above.
 */
static void mlxDisplay1_displayProgress(int nlhs,
                                        mxArray * plhs[],
                                        int nrhs,
                                        mxArray * prhs[]) {
    mxArray * mprhs[16];
    int i;
    if (nlhs > 0) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: display1/displayProgress Line: 27 C"
            "olumn: 0 The function \"display1/displayProgress\" was ca"
            "lled with more than the declared number of outputs (0)"));
    }
    if (nrhs > 16) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: display1/displayProgress Line: 27 C"

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -