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

📄 optim_private_xplot.c

📁 ASUFIT-Matlab-全局拟合程序
💻 C
📖 第 1 页 / 共 2 页
字号:
     */
    }
    /*
     * vpos(vpos ==0)= -ones(length(vpos(vpos==0)),1);
     */
    mlfIndexAssign(
      &vpos,
      "(?)",
      mlfEq(vpos, mlfScalar(0.0)),
      mlfUminus(
        mlfOnes(
          mlfLength(mlfIndexRef(vpos, "(?)", mlfEq(vpos, mlfScalar(0.0)))),
          mlfScalar(1.0),
          NULL)));
    /*
     * currsubplot=subplot(2,2,3); 
     */
    mlfAssign(
      &currsubplot,
      mlfNSubplot(1, mlfScalar(2.0), mlfScalar(2.0), mlfScalar(3.0)));
    /*
     * plot(itv(vpos==1),vpos(vpos==1),'xr');
     */
    mclAssignAns(
      &ans,
      mlfNPlot(
        0,
        mlfIndexRef(itv, "(?)", mlfEq(vpos, mlfScalar(1.0))),
        mlfIndexRef(vpos, "(?)", mlfEq(vpos, mlfScalar(1.0))),
        mxCreateString("xr"),
        NULL));
    /*
     * axis([0 it -2 2]);
     */
    mclAssignAns(
      &ans,
      mlfNAxis(
        0,
        NULL,
        NULL,
        mlfHorzcat(mlfScalar(0.0), it, mlfScalar(-2.0), mlfScalar(2.0), NULL),
        NULL));
    /*
     * 
     * hold on
     */
    mlfHold(mxCreateString("on"));
    /*
     * currsubplot = subplot(2,2,3);
     */
    mlfAssign(
      &currsubplot,
      mlfNSubplot(1, mlfScalar(2.0), mlfScalar(2.0), mlfScalar(3.0)));
    /*
     * plot(itv(vpos==-1),vpos(vpos==-1),'ob');
     */
    mclAssignAns(
      &ans,
      mlfNPlot(
        0,
        mlfIndexRef(itv, "(?)", mlfEq(vpos, mlfScalar(-1.0))),
        mlfIndexRef(vpos, "(?)", mlfEq(vpos, mlfScalar(-1.0))),
        mxCreateString("ob"),
        NULL));
    /*
     * set(currsubplot,'YTick',[-1 1]);
     */
    mclAssignAns(
      &ans,
      mlfNSet(
        0,
        currsubplot,
        mxCreateString("YTick"),
        mlfDoubleMatrix(1, 2, __Array0_r, NULL),
        NULL));
    /*
     * set(currsubplot,'YTickLabel',{'negative';'positive'});
     */
    mclAssignAns(
      &ans,
      mlfNSet(
        0,
        currsubplot,
        mxCreateString("YTickLabel"),
        mlfVertcat(
          mlfCellhcat(mxCreateString("negative"), NULL),
          mlfCellhcat(mxCreateString("positive"), NULL),
          NULL),
        NULL));
    /*
     * title('Curvature of current direction');
     */
    mclAssignAns(
      &ans,
      mlfNTitle(0, mxCreateString("Curvature of current direction"), NULL));
    /*
     * xlabel('iteration');
     */
    mclAssignAns(&ans, mlfNXlabel(0, mxCreateString("iteration"), NULL));
    /*
     * hold off
     */
    mlfHold(mxCreateString("off"));
    /*
     * %
     * if isempty(vdeg)
     */
    if (mlfTobool(mlfIsempty(vdeg))) {
        /*
         * vdeg = ones(it,1);
         */
        mlfAssign(&vdeg, mlfOnes(it, mlfScalar(1.0), NULL));
    /*
     * end
     */
    }
    /*
     * len = length(vdeg); 
     */
    mlfAssign(&len, mlfLength(vdeg));
    /*
     * itv = 1:1:len; 
     */
    mlfAssign(&itv, mlfColon(mlfScalar(1.0), mlfScalar(1.0), len));
    /*
     * itv = itv';
     */
    mlfAssign(&itv, mlfCtranspose(itv));
    /*
     * one = ones(len,1);
     */
    mlfAssign(&one, mlfOnes(len, mlfScalar(1.0), NULL));
    /*
     * subplot(2,2,4)
     */
    mclPrintAns(
      &ans, mlfNSubplot(0, mlfScalar(2.0), mlfScalar(2.0), mlfScalar(4.0)));
    /*
     * %plot(itv,log10(vdeg),'-',itv,log10(vdeg),'go');
     * semilogy(itv,vdeg,'-',itv,vdeg,'go');
     */
    mclAssignAns(
      &ans,
      mlfNSemilogy(
        0,
        itv,
        vdeg,
        mxCreateString("-"),
        itv,
        vdeg,
        mxCreateString("go"),
        NULL));
    /*
     * title('Constraint degeneracy')
     */
    mclPrintAns(
      &ans, mlfNTitle(0, mxCreateString("Constraint degeneracy"), NULL));
    /*
     * xlabel('iteration')
     */
    mclPrintAns(&ans, mlfNXlabel(0, mxCreateString("iteration"), NULL));
    /*
     * 
     * if ~isempty(figtr) 
     */
    if (mlfTobool(mlfNot(mlfIsempty(figtr)))) {
        /*
         * set(closebtn,'Enable','on') ; 
         */
        mclAssignAns(
          &ans,
          mlfNSet(
            0, closebtn, mxCreateString("Enable"), mxCreateString("on"), NULL));
    /*
     * end
     */
    }
    /*
     * 
     * 
     */
    return_:
    mclValidateOutputs("optim/private/xplot", 1, nargout_, &figps);
    mxDestroyArray(ans);
    mxDestroyArray(closebtn);
    mxDestroyArray(currsubplot);
    mxDestroyArray(figtr);
    mxDestroyArray(itv);
    mxDestroyArray(len);
    mxDestroyArray(one);
    mxDestroyArray(screensize);
    mxDestroyArray(vdeg);
    mxDestroyArray(vpos);
    mxDestroyArray(ypos);
    return figps;
}

/*
 * The function "mlfOptim_private_xplot" contains the normal interface for the
 * "optim/private/xplot" M-function from file
 * "C:\MATLABR11\toolbox\optim\private\xplot.m" (lines 1-87). This function
 * processes any input arguments and passes them to the implementation version
 * of the function, appearing above.
 */
mxArray * mlfOptim_private_xplot(mxArray * it,
                                 mxArray * vval,
                                 mxArray * vfnrm,
                                 mxArray * vflops,
                                 mxArray * vpos,
                                 mxArray * vdeg,
                                 mxArray * vpcg) {
    int nargout = 1;
    mxArray * figps = mclGetUninitializedArray();
    mlfEnterNewContext(0, 7, it, vval, vfnrm, vflops, vpos, vdeg, vpcg);
    figps
      = Moptim_private_xplot(
          nargout, it, vval, vfnrm, vflops, vpos, vdeg, vpcg);
    mlfRestorePreviousContext(0, 7, it, vval, vfnrm, vflops, vpos, vdeg, vpcg);
    return mlfReturnValue(figps);
}

/*
 * The function "mlxOptim_private_xplot" contains the feval interface for the
 * "optim/private/xplot" M-function from file
 * "C:\MATLABR11\toolbox\optim\private\xplot.m" (lines 1-87). The feval
 * function calls the implementation version of optim/private/xplot through
 * this function. This function processes any input arguments and passes them
 * to the implementation version of the function, appearing above.
 */
void mlxOptim_private_xplot(int nlhs,
                            mxArray * plhs[],
                            int nrhs,
                            mxArray * prhs[]) {
    mxArray * mprhs[7];
    mxArray * mplhs[1];
    int i;
    if (nlhs > 1) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: optim/private/xplot Line: 1 Colu"
            "mn: 0 The function \"optim/private/xplot\" was called "
            "with more than the declared number of outputs (1)"));
    }
    if (nrhs > 7) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: optim/private/xplot Line: 1 Col"
            "umn: 0 The function \"optim/private/xplot\" was calle"
            "d with more than the declared number of inputs (7)"));
    }
    for (i = 0; i < 1; ++i) {
        mplhs[i] = NULL;
    }
    for (i = 0; i < 7 && i < nrhs; ++i) {
        mprhs[i] = prhs[i];
    }
    for (; i < 7; ++i) {
        mprhs[i] = NULL;
    }
    mlfEnterNewContext(
      0,
      7,
      mprhs[0],
      mprhs[1],
      mprhs[2],
      mprhs[3],
      mprhs[4],
      mprhs[5],
      mprhs[6]);
    mplhs[0]
      = Moptim_private_xplot(
          nlhs,
          mprhs[0],
          mprhs[1],
          mprhs[2],
          mprhs[3],
          mprhs[4],
          mprhs[5],
          mprhs[6]);
    mlfRestorePreviousContext(
      0,
      7,
      mprhs[0],
      mprhs[1],
      mprhs[2],
      mprhs[3],
      mprhs[4],
      mprhs[5],
      mprhs[6]);
    plhs[0] = mplhs[0];
}

⌨️ 快捷键说明

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