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

📄 rndcheck.c

📁 好东西
💻 C
📖 第 1 页 / 共 5 页
字号:
/*
 * MATLAB Compiler: 3.0
 * Date: Fri Mar 24 11:31:37 2006
 * Arguments: "-B" "macro_default" "-O" "all" "-O" "fold_scalar_mxarrays:on"
 * "-O" "fold_non_scalar_mxarrays:on" "-O" "optimize_integer_for_loops:on" "-O"
 * "array_indexing:on" "-O" "optimize_conditionals:on" "-m" "-W" "main" "-L"
 * "C" "-t" "-T" "link:exe" "-h" "libmmfile.mlib"
 * "adptive_bitpow_allocate_systems" 
 */
#include "rndcheck.h"
#include "libmatlbm.h"
static mxArray * _mxarray0_;
static mxArray * _mxarray1_;
static mxArray * _mxarray2_;
static mxArray * _mxarray3_;
static mxArray * _mxarray4_;
static mxArray * _mxarray5_;

void InitializeModule_rndcheck(void) {
    _mxarray0_ = mclInitializeDouble(0.0);
    _mxarray1_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
    _mxarray2_ = mclInitializeDouble(1.0);
    _mxarray3_ = mclInitializeDouble(2.0);
    _mxarray4_ = mclInitializeDouble(3.0);
    _mxarray5_ = mclInitializeDouble(4.0);
}

void TerminateModule_rndcheck(void) {
    mxDestroyArray(_mxarray5_);
    mxDestroyArray(_mxarray4_);
    mxDestroyArray(_mxarray3_);
    mxDestroyArray(_mxarray2_);
    mxDestroyArray(_mxarray1_);
    mxDestroyArray(_mxarray0_);
}

static mxArray * Mrndcheck(mxArray * * rows,
                           mxArray * * columns,
                           int nargout_,
                           mxArray * nargs,
                           mxArray * nparms,
                           mxArray * arg1,
                           mxArray * arg2,
                           mxArray * arg3,
                           mxArray * arg4,
                           mxArray * arg5);

_mexLocalFunctionTable _local_function_table_rndcheck
  = { 0, (mexFunctionTableEntry *)NULL };

/*
 * The function "mlfRndcheck" contains the normal interface for the "rndcheck"
 * M-function from file "c:\matlab6p5\toolbox\stats\rndcheck.m" (lines 1-284).
 * This function processes any input arguments and passes them to the
 * implementation version of the function, appearing above.
 */
mxArray * mlfRndcheck(mxArray * * rows,
                      mxArray * * columns,
                      mxArray * nargs,
                      mxArray * nparms,
                      mxArray * arg1,
                      mxArray * arg2,
                      mxArray * arg3,
                      mxArray * arg4,
                      mxArray * arg5) {
    int nargout = 1;
    mxArray * errorcode = NULL;
    mxArray * rows__ = NULL;
    mxArray * columns__ = NULL;
    mlfEnterNewContext(
      2, 7, rows, columns, nargs, nparms, arg1, arg2, arg3, arg4, arg5);
    if (rows != NULL) {
        ++nargout;
    }
    if (columns != NULL) {
        ++nargout;
    }
    errorcode
      = Mrndcheck(
          &rows__,
          &columns__,
          nargout,
          nargs,
          nparms,
          arg1,
          arg2,
          arg3,
          arg4,
          arg5);
    mlfRestorePreviousContext(
      2, 7, rows, columns, nargs, nparms, arg1, arg2, arg3, arg4, arg5);
    if (rows != NULL) {
        mclCopyOutputArg(rows, rows__);
    } else {
        mxDestroyArray(rows__);
    }
    if (columns != NULL) {
        mclCopyOutputArg(columns, columns__);
    } else {
        mxDestroyArray(columns__);
    }
    return mlfReturnValue(errorcode);
}

/*
 * The function "mlxRndcheck" contains the feval interface for the "rndcheck"
 * M-function from file "c:\matlab6p5\toolbox\stats\rndcheck.m" (lines 1-284).
 * The feval function calls the implementation version of rndcheck through this
 * function. This function processes any input arguments and passes them to the
 * implementation version of the function, appearing above.
 */
void mlxRndcheck(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    mxArray * mprhs[7];
    mxArray * mplhs[3];
    int i;
    if (nlhs > 3) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: rndcheck Line: 1 Column:"
            " 1 The function \"rndcheck\" was called with m"
            "ore than the declared number of outputs (3)."),
          NULL);
    }
    if (nrhs > 7) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: rndcheck Line: 1 Column:"
            " 1 The function \"rndcheck\" was called with m"
            "ore than the declared number of inputs (7)."),
          NULL);
    }
    for (i = 0; i < 3; ++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]
      = Mrndcheck(
          &mplhs[1],
          &mplhs[2],
          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];
    for (i = 1; i < 3 && i < nlhs; ++i) {
        plhs[i] = mplhs[i];
    }
    for (; i < 3; ++i) {
        mxDestroyArray(mplhs[i]);
    }
}

/*
 * The function "Mrndcheck" is the implementation version of the "rndcheck"
 * M-function from file "c:\matlab6p5\toolbox\stats\rndcheck.m" (lines 1-284).
 * 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 [errorcode, rows, columns] = rndcheck(nargs,nparms,arg1,arg2,arg3,arg4,arg5)
 */
static mxArray * Mrndcheck(mxArray * * rows,
                           mxArray * * columns,
                           int nargout_,
                           mxArray * nargs,
                           mxArray * nparms,
                           mxArray * arg1,
                           mxArray * arg2,
                           mxArray * arg3,
                           mxArray * arg4,
                           mxArray * arg5) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_rndcheck);
    mxArray * errorcode = NULL;
    mxArray * scalararg3 = NULL;
    mxArray * c3 = NULL;
    mxArray * r3 = NULL;
    mxArray * c2 = NULL;
    mxArray * r2 = NULL;
    mxArray * c1 = NULL;
    mxArray * r1 = NULL;
    mxArray * scalararg2 = NULL;
    mxArray * scalararg1 = NULL;
    mxArray * sizeinfo = NULL;
    mclCopyArray(&nargs);
    mclCopyArray(&nparms);
    mclCopyArray(&arg1);
    mclCopyArray(&arg2);
    mclCopyArray(&arg3);
    mclCopyArray(&arg4);
    mclCopyArray(&arg5);
    /*
     * %RNDCHECK error checks the argument list for the random number generators.
     * 
     * %   Copyright 1993-2002 The MathWorks, Inc. 
     * %   $Revision: 2.10 $  $Date: 2002/03/31 22:26:57 $
     * 
     * sizeinfo = nargs - nparms;
     */
    mlfAssign(
      &sizeinfo, mclMinus(mclVa(nargs, "nargs"), mclVa(nparms, "nparms")));
    /*
     * errorcode = 0;
     */
    mlfAssign(&errorcode, _mxarray0_);
    /*
     * rows = [];
     */
    mlfAssign(rows, _mxarray1_);
    /*
     * columns = [];
     */
    mlfAssign(columns, _mxarray1_);
    /*
     * 
     * if sizeinfo == 0        
     */
    if (mclEqBool(mclVv(sizeinfo, "sizeinfo"), _mxarray0_)) {
        /*
         * if nparms == 1
         */
        if (mclEqBool(mclVa(nparms, "nparms"), _mxarray2_)) {
            /*
             * [rows columns] = size(arg1);
             */
            mlfSize(
              mlfVarargout(rows, columns, NULL), mclVa(arg1, "arg1"), NULL);
        /*
         * elseif nparms == 2
         */
        } else if (mclEqBool(mclVa(nparms, "nparms"), _mxarray3_)) {
            /*
             * scalararg1 = (prod(size(arg1)) == 1);
             */
            mlfAssign(
              &scalararg1,
              mclEq(
                mlfProd(
                  mlfSize(mclValueVarargout(), mclVa(arg1, "arg1"), NULL),
                  NULL),
                _mxarray2_));
            /*
             * scalararg2 = (prod(size(arg2)) == 1);
             */
            mlfAssign(
              &scalararg2,
              mclEq(
                mlfProd(
                  mlfSize(mclValueVarargout(), mclVa(arg2, "arg2"), NULL),
                  NULL),
                _mxarray2_));
            /*
             * if ~scalararg1 & ~scalararg2
             */
            {
                mxArray * a_
                  = mclInitialize(mclNot(mclVv(scalararg1, "scalararg1")));
                if (mlfTobool(a_)
                    && mlfTobool(
                         mclAnd(
                           a_, mclNot(mclVv(scalararg2, "scalararg2"))))) {
                    mxDestroyArray(a_);
                    /*
                     * [r1 c1] = size(arg1);
                     */
                    mlfSize(
                      mlfVarargout(&r1, &c1, NULL), mclVa(arg1, "arg1"), NULL);
                    /*
                     * [r2 c2] = size(arg2);
                     */
                    mlfSize(
                      mlfVarargout(&r2, &c2, NULL), mclVa(arg2, "arg2"), NULL);
                    /*
                     * if r1 ~= r2 | c1 ~= c2
                     */
                    {
                        mxArray * a_0
                          = mclInitialize(
                              mclNe(mclVv(r1, "r1"), mclVv(r2, "r2")));
                        if (mlfTobool(a_0)
                            || mlfTobool(
                                 mclOr(
                                   a_0,
                                   mclNe(mclVv(c1, "c1"), mclVv(c2, "c2"))))) {
                            mxDestroyArray(a_0);
                            /*
                             * errorcode = 1;
                             */
                            mlfAssign(&errorcode, _mxarray2_);
                            /*
                             * return;         
                             */
                            goto return_;
                        } else {
                            mxDestroyArray(a_0);
                        }
                    /*
                     * end
                     */
                    }
                } else {
                    mxDestroyArray(a_);
                }
            /*
             * end
             */
            }
            /*
             * if ~scalararg1
             */
            if (mclNotBool(mclVv(scalararg1, "scalararg1"))) {
                /*
                 * [rows columns] = size(arg1);
                 */
                mlfSize(
                  mlfVarargout(rows, columns, NULL), mclVa(arg1, "arg1"), NULL);
            /*
             * elseif ~scalararg2
             */
            } else if (mclNotBool(mclVv(scalararg2, "scalararg2"))) {
                /*
                 * [rows columns] = size(arg2);
                 */
                mlfSize(
                  mlfVarargout(rows, columns, NULL), mclVa(arg2, "arg2"), NULL);
            /*
             * else
             */
            } else {
                /*
                 * [rows columns] = size(arg1);
                 */
                mlfSize(
                  mlfVarargout(rows, columns, NULL), mclVa(arg1, "arg1"), NULL);
            /*
             * end
             */
            }
        /*
         * elseif nparms == 3
         */
        } else if (mclEqBool(mclVa(nparms, "nparms"), _mxarray4_)) {
            /*
             * [r1 c1] = size(arg1);
             */
            mlfSize(mlfVarargout(&r1, &c1, NULL), mclVa(arg1, "arg1"), NULL);
            /*
             * [r2 c2] = size(arg2);
             */
            mlfSize(mlfVarargout(&r2, &c2, NULL), mclVa(arg2, "arg2"), NULL);
            /*
             * [r3 c3] = size(arg3);
             */

⌨️ 快捷键说明

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