simuff.c

来自「nnToolKit 神经网络工具包是基于 MATLAB 神经网络工具箱自行开发的」· C语言 代码 · 共 469 行 · 第 1/2 页

C
469
字号
/*
 * MATLAB Compiler: 3.0
 * Date: Sun May 13 16:47:40 2007
 * 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" "-silentsetup" "-d"
 * "d:/MATLAB6p5/work/nnToolKit/src" "-B" "csglcom:nnToolKit,nnToolKit,2.0"
 * "-B" "sgl" "-m" "-W" "main" "-L" "C" "-t" "-T" "link:exe" "-h"
 * "libmmfile.mlib" "-W" "mainhg" "libmwsglm.mlib" "-t" "-W"
 * "comhg:nnToolKit,nnToolKit,2.0" "-T" "link:lib" "-h" "libmmfile.mlib" "-i"
 * "-i" "D:/MATLAB6p5/work/nnToolKit/lmnet/LmSimu.m"
 * "D:/MATLAB6p5/work/nnToolKit/lmnet/LmTrain.m"
 * "D:/MATLAB6p5/work/nnToolKit/sofm/SofmSimu.m"
 * "D:/MATLAB6p5/work/nnToolKit/sofm/SofmTrain.m" 
 */
#include "simuff.h"
#include "libmatlbm.h"
#include "nntobsf.h"

static mxChar _array1_[6] = { 's', 'i', 'm', 'u', 'f', 'f' };
static mxArray * _mxarray0_;

static mxChar _array3_[55] = { 'U', 's', 'e', ' ', 'N', 'N', 'T', '2', 'F', 'F',
                               ' ', 'a', 'n', 'd', ' ', 'S', 'I', 'M', ' ', 't',
                               'o', ' ', 'u', 'p', 'd', 'a', 't', 'e', ' ', 'a',
                               'n', 'd', ' ', 's', 'i', 'm', 'u', 'l', 'a', 't',
                               'e', ' ', 'y', 'o', 'u', 'r', ' ', 'n', 'e', 't',
                               'w', 'o', 'r', 'k', '.' };
static mxArray * _mxarray2_;

static double _array5_[3] = { 4.0, 7.0, 10.0 };
static mxArray * _mxarray4_;

static mxChar _array7_[31] = { 'W', 'r', 'o', 'n', 'g', ' ', 'n', 'u',
                               'm', 'b', 'e', 'r', ' ', 'o', 'f', ' ',
                               'i', 'n', 'p', 'u', 't', ' ', 'a', 'r',
                               'g', 'u', 'm', 'e', 'n', 't', 's' };
static mxArray * _mxarray6_;

void InitializeModule_simuff(void) {
    _mxarray0_ = mclInitializeString(6, _array1_);
    _mxarray2_ = mclInitializeString(55, _array3_);
    _mxarray4_ = mclInitializeDoubleVector(1, 3, _array5_);
    _mxarray6_ = mclInitializeString(31, _array7_);
}

void TerminateModule_simuff(void) {
    mxDestroyArray(_mxarray6_);
    mxDestroyArray(_mxarray4_);
    mxDestroyArray(_mxarray2_);
    mxDestroyArray(_mxarray0_);
}

static mxArray * Msimuff(mxArray * * a2,
                         mxArray * * a3,
                         int nargout_,
                         mxArray * p,
                         mxArray * w1,
                         mxArray * b1,
                         mxArray * f1,
                         mxArray * w2,
                         mxArray * b2,
                         mxArray * f2,
                         mxArray * w3,
                         mxArray * b3,
                         mxArray * f3);

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

/*
 * The function "mlfNSimuff" contains the nargout interface for the "simuff"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\simuff.m" (lines
 * 1-48). This interface is only produced if the M-function uses the special
 * variable "nargout". The nargout interface allows the number of requested
 * outputs to be specified via the nargout argument, as opposed to the normal
 * interface which dynamically calculates the number of outputs based on the
 * number of non-NULL inputs it receives. This function processes any input
 * arguments and passes them to the implementation version of the function,
 * appearing above.
 */
mxArray * mlfNSimuff(int nargout,
                     mxArray * * a2,
                     mxArray * * a3,
                     mxArray * p,
                     mxArray * w1,
                     mxArray * b1,
                     mxArray * f1,
                     mxArray * w2,
                     mxArray * b2,
                     mxArray * f2,
                     mxArray * w3,
                     mxArray * b3,
                     mxArray * f3) {
    mxArray * a1 = NULL;
    mxArray * a2__ = NULL;
    mxArray * a3__ = NULL;
    mlfEnterNewContext(2, 10, a2, a3, p, w1, b1, f1, w2, b2, f2, w3, b3, f3);
    a1 = Msimuff(&a2__, &a3__, nargout, p, w1, b1, f1, w2, b2, f2, w3, b3, f3);
    mlfRestorePreviousContext(
      2, 10, a2, a3, p, w1, b1, f1, w2, b2, f2, w3, b3, f3);
    if (a2 != NULL) {
        mclCopyOutputArg(a2, a2__);
    } else {
        mxDestroyArray(a2__);
    }
    if (a3 != NULL) {
        mclCopyOutputArg(a3, a3__);
    } else {
        mxDestroyArray(a3__);
    }
    return mlfReturnValue(a1);
}

/*
 * The function "mlfSimuff" contains the normal interface for the "simuff"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\simuff.m" (lines
 * 1-48). This function processes any input arguments and passes them to the
 * implementation version of the function, appearing above.
 */
mxArray * mlfSimuff(mxArray * * a2,
                    mxArray * * a3,
                    mxArray * p,
                    mxArray * w1,
                    mxArray * b1,
                    mxArray * f1,
                    mxArray * w2,
                    mxArray * b2,
                    mxArray * f2,
                    mxArray * w3,
                    mxArray * b3,
                    mxArray * f3) {
    int nargout = 1;
    mxArray * a1 = NULL;
    mxArray * a2__ = NULL;
    mxArray * a3__ = NULL;
    mlfEnterNewContext(2, 10, a2, a3, p, w1, b1, f1, w2, b2, f2, w3, b3, f3);
    if (a2 != NULL) {
        ++nargout;
    }
    if (a3 != NULL) {
        ++nargout;
    }
    a1 = Msimuff(&a2__, &a3__, nargout, p, w1, b1, f1, w2, b2, f2, w3, b3, f3);
    mlfRestorePreviousContext(
      2, 10, a2, a3, p, w1, b1, f1, w2, b2, f2, w3, b3, f3);
    if (a2 != NULL) {
        mclCopyOutputArg(a2, a2__);
    } else {
        mxDestroyArray(a2__);
    }
    if (a3 != NULL) {
        mclCopyOutputArg(a3, a3__);
    } else {
        mxDestroyArray(a3__);
    }
    return mlfReturnValue(a1);
}

/*
 * The function "mlfVSimuff" contains the void interface for the "simuff"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\simuff.m" (lines
 * 1-48). The void interface is only produced if the M-function uses the
 * special variable "nargout", and has at least one output. The void interface
 * function specifies zero output arguments to the implementation version of
 * the function, and in the event that the implementation version still returns
 * an output (which, in MATLAB, would be assigned to the "ans" variable), it
 * deallocates the output. This function processes any input arguments and
 * passes them to the implementation version of the function, appearing above.
 */
void mlfVSimuff(mxArray * p,
                mxArray * w1,
                mxArray * b1,
                mxArray * f1,
                mxArray * w2,
                mxArray * b2,
                mxArray * f2,
                mxArray * w3,
                mxArray * b3,
                mxArray * f3) {
    mxArray * a1 = NULL;
    mxArray * a2 = NULL;
    mxArray * a3 = NULL;
    mlfEnterNewContext(0, 10, p, w1, b1, f1, w2, b2, f2, w3, b3, f3);
    a1 = Msimuff(&a2, &a3, 0, p, w1, b1, f1, w2, b2, f2, w3, b3, f3);
    mlfRestorePreviousContext(0, 10, p, w1, b1, f1, w2, b2, f2, w3, b3, f3);
    mxDestroyArray(a1);
    mxDestroyArray(a2);
    mxDestroyArray(a3);
}

/*
 * The function "mlxSimuff" contains the feval interface for the "simuff"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\simuff.m" (lines
 * 1-48). The feval function calls the implementation version of simuff through
 * this function. This function processes any input arguments and passes them
 * to the implementation version of the function, appearing above.
 */
void mlxSimuff(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
    mxArray * mprhs[10];
    mxArray * mplhs[3];
    int i;
    if (nlhs > 3) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: simuff Line: 1 Column: "
            "1 The function \"simuff\" was called with mor"
            "e than the declared number of outputs (3)."),
          NULL);
    }
    if (nrhs > 10) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: simuff Line: 1 Column: "
            "1 The function \"simuff\" was called with mor"
            "e than the declared number of inputs (10)."),
          NULL);
    }
    for (i = 0; i < 3; ++i) {
        mplhs[i] = NULL;
    }
    for (i = 0; i < 10 && i < nrhs; ++i) {
        mprhs[i] = prhs[i];
    }
    for (; i < 10; ++i) {
        mprhs[i] = NULL;
    }
    mlfEnterNewContext(
      0,
      10,
      mprhs[0],
      mprhs[1],
      mprhs[2],
      mprhs[3],
      mprhs[4],

⌨️ 快捷键说明

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