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

📄 learnis.c

📁 nnToolKit 神经网络工具包是基于 MATLAB 神经网络工具箱自行开发的一组神经网络算法函数库
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
 * MATLAB Compiler: 3.0
 * Date: Sun May 13 16:47:41 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 "learnis.h"
#include "libmatlbm.h"
#include "nntobsu.h"

static mxChar _array1_[7] = { 'l', 'e', 'a', 'r', 'n', 'i', 's' };
static mxArray * _mxarray0_;

static mxChar _array3_[42] = { 'S', 'e', 'e', ' ', 'h', 'e', 'l', 'p', ' ',
                               'o', 'n', ' ', 'L', 'E', 'A', 'R', 'N', 'I',
                               'S', ' ', 'f', 'o', 'r', ' ', 'n', 'e', 'w',
                               ' ', 'a', 'r', 'g', 'u', 'm', 'e', 'n', 't',
                               ' ', 'l', 'i', 's', 't', '.' };
static mxArray * _mxarray2_;
static mxArray * _mxarray4_;

static mxChar _array6_[6] = { 'p', 'n', 'a', 'm', 'e', 's' };
static mxArray * _mxarray5_;

static mxChar _array9_[2] = { 'l', 'r' };
static mxArray * _mxarray8_;
static mxArray * _mxarray7_;

static mxChar _array11_[9] = { 'p', 'd', 'e', 'f', 'a', 'u', 'l', 't', 's' };
static mxArray * _mxarray10_;
static mxArray * _mxarray12_;

static mxChar _array14_[5] = { 'n', 'e', 'e', 'd', 'g' };
static mxArray * _mxarray13_;
static mxArray * _mxarray15_;

static mxChar _array17_[22] = { 'U', 'n', 'r', 'e', 'c', 'o', 'g', 'n',
                                'i', 'z', 'e', 'd', ' ', 'p', 'r', 'o',
                                'p', 'e', 'r', 't', 'y', '.' };
static mxArray * _mxarray16_;
static mxArray * _mxarray18_;
static mxArray * _mxarray19_;

void InitializeModule_learnis(void) {
    _mxarray0_ = mclInitializeString(7, _array1_);
    _mxarray2_ = mclInitializeString(42, _array3_);
    _mxarray4_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
    _mxarray5_ = mclInitializeString(6, _array6_);
    _mxarray8_ = mclInitializeString(2, _array9_);
    _mxarray7_ = mclInitializeCell(_mxarray8_);
    _mxarray10_ = mclInitializeString(9, _array11_);
    _mxarray12_ = mclInitializeDouble(.5);
    _mxarray13_ = mclInitializeString(5, _array14_);
    _mxarray15_ = mclInitializeDouble(0.0);
    _mxarray16_ = mclInitializeString(22, _array17_);
    _mxarray18_ = mclInitializeDouble(2.0);
    _mxarray19_ = mclInitializeDouble(1.0);
}

void TerminateModule_learnis(void) {
    mxDestroyArray(_mxarray19_);
    mxDestroyArray(_mxarray18_);
    mxDestroyArray(_mxarray16_);
    mxDestroyArray(_mxarray15_);
    mxDestroyArray(_mxarray13_);
    mxDestroyArray(_mxarray12_);
    mxDestroyArray(_mxarray10_);
    mxDestroyArray(_mxarray7_);
    mxDestroyArray(_mxarray8_);
    mxDestroyArray(_mxarray5_);
    mxDestroyArray(_mxarray4_);
    mxDestroyArray(_mxarray2_);
    mxDestroyArray(_mxarray0_);
}

static mxArray * Mlearnis(mxArray * * ls,
                          int nargout_,
                          mxArray * w,
                          mxArray * p,
                          mxArray * z,
                          mxArray * n,
                          mxArray * a,
                          mxArray * t,
                          mxArray * e,
                          mxArray * gW,
                          mxArray * gA,
                          mxArray * d,
                          mxArray * lp,
                          mxArray * ls_in);

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

/*
 * The function "mlfLearnis" contains the normal interface for the "learnis"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnet\learnis.m" (lines
 * 1-124). This function processes any input arguments and passes them to the
 * implementation version of the function, appearing above.
 */
mxArray * mlfLearnis(mxArray * * ls,
                     mxArray * w,
                     mxArray * p,
                     mxArray * z,
                     mxArray * n,
                     mxArray * a,
                     mxArray * t,
                     mxArray * e,
                     mxArray * gW,
                     mxArray * gA,
                     mxArray * d,
                     mxArray * lp,
                     mxArray * ls_in) {
    int nargout = 1;
    mxArray * dw = NULL;
    mxArray * ls__ = NULL;
    mlfEnterNewContext(1, 12, ls, w, p, z, n, a, t, e, gW, gA, d, lp, ls_in);
    if (ls != NULL) {
        ++nargout;
    }
    dw = Mlearnis(&ls__, nargout, w, p, z, n, a, t, e, gW, gA, d, lp, ls_in);
    mlfRestorePreviousContext(
      1, 12, ls, w, p, z, n, a, t, e, gW, gA, d, lp, ls_in);
    if (ls != NULL) {
        mclCopyOutputArg(ls, ls__);
    } else {
        mxDestroyArray(ls__);
    }
    return mlfReturnValue(dw);
}

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

/*
 * The function "Mlearnis" is the implementation version of the "learnis"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnet\learnis.m" (lines
 * 1-124). 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 [dw,ls] = learnis(w,p,z,n,a,t,e,gW,gA,d,lp,ls)
 */
static mxArray * Mlearnis(mxArray * * ls,
                          int nargout_,
                          mxArray * w,
                          mxArray * p,
                          mxArray * z,
                          mxArray * n,
                          mxArray * a,
                          mxArray * t,
                          mxArray * e,
                          mxArray * gW,
                          mxArray * gA,
                          mxArray * d,
                          mxArray * lp,
                          mxArray * ls_in) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_learnis);
    int nargin_
      = mclNargin(12, w, p, z, n, a, t, e, gW, gA, d, lp, ls_in, NULL);
    mxArray * dw = NULL;
    mxArray * q = NULL;
    mxArray * lr_a = NULL;
    mxArray * pt = NULL;
    mxArray * Q = NULL;
    mxArray * R = NULL;
    mxArray * S = NULL;
    mxArray * ans = NULL;
    mclCopyArray(&w);
    mclCopyArray(&p);
    mclCopyArray(&z);
    mclCopyArray(&n);
    mclCopyArray(&a);
    mclCopyArray(&t);
    mclCopyArray(&e);
    mclCopyArray(&gW);
    mclCopyArray(&gA);
    mclCopyArray(&d);
    mclCopyArray(&lp);
    mclCopyInputArg(ls, ls_in);
    /*
     * %LEARNIS Instar weight learning function.

⌨️ 快捷键说明

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