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

📄 deltalin.c

📁 nnToolKit 神经网络工具包是基于 MATLAB 神经网络工具箱自行开发的一组神经网络算法函数库
💻 C
字号:
/*
 * 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 "deltalin.h"
#include "libmatlbm.h"
#include "nntobsf.h"

static mxChar _array1_[8] = { 'd', 'e', 'l', 't', 'a', 'l', 'i', 'n' };
static mxArray * _mxarray0_;

static mxChar _array3_[47] = { 'U', 's', 'e', ' ', 'D', 'P', 'U', 'R', 'E', 'L',
                               'I', 'N', ' ', 't', 'o', ' ', 'c', 'a', 'l', 'c',
                               'u', 'l', 'a', 't', 'e', 's', ' ', 'P', 'U', 'R',
                               'E', 'L', 'I', 'N', ' ', 'd', 'e', 'r', 'i', 'v',
                               'a', 't', 'i', 'v', 'e', 's', '.' };
static mxArray * _mxarray2_;
static mxArray * _mxarray4_;

void InitializeModule_deltalin(void) {
    _mxarray0_ = mclInitializeString(8, _array1_);
    _mxarray2_ = mclInitializeString(47, _array3_);
    _mxarray4_ = mclInitializeDouble(6.0);
}

void TerminateModule_deltalin(void) {
    mxDestroyArray(_mxarray4_);
    mxDestroyArray(_mxarray2_);
    mxDestroyArray(_mxarray0_);
}

static mxArray * Mdeltalin(int nargout_,
                           mxArray * a,
                           mxArray * d_in,
                           mxArray * w);

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

/*
 * The function "mlfDeltalin" contains the normal interface for the "deltalin"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\deltalin.m"
 * (lines 1-38). This function processes any input arguments and passes them to
 * the implementation version of the function, appearing above.
 */
mxArray * mlfDeltalin(mxArray * a, mxArray * d_in, mxArray * w) {
    int nargout = 1;
    mxArray * d = NULL;
    mlfEnterNewContext(0, 3, a, d_in, w);
    d = Mdeltalin(nargout, a, d_in, w);
    mlfRestorePreviousContext(0, 3, a, d_in, w);
    return mlfReturnValue(d);
}

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

/*
 * The function "Mdeltalin" is the implementation version of the "deltalin"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\deltalin.m"
 * (lines 1-38). 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 d = deltalin(a,d,w)
 */
static mxArray * Mdeltalin(int nargout_,
                           mxArray * a,
                           mxArray * d_in,
                           mxArray * w) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_deltalin);
    int nargin_ = mclNargin(3, a, d_in, w, NULL);
    mxArray * d = NULL;
    mxArray * ans = NULL;
    mclCopyArray(&a);
    mclCopyInputArg(&d, d_in);
    mclCopyArray(&w);
    /*
     * %DELTALIN Delta function for PURELIN neurons.
     * %
     * %  This function is obselete.
     * %  Use DPURELIN to calculates PURELIN derivatives.
     * 
     * nntobsf('deltalin','Use DPURELIN to calculates PURELIN derivatives.')
     */
    mlfNntobsf(_mxarray0_, _mxarray2_, NULL);
    /*
     * 
     * %  
     * %  DELATLIN(A)
     * %    A - S1xQ matrix of output vectors.
     * %  Returns the S1xQ matrix of derivatives of the output vectors
     * %    with respect to the net input of the PURELIN transfer function.
     * %  
     * %  DELTALIN(A,E)
     * %    E - S1xQ matrix of associated errors
     * %  Returns an S1xQ matrix of derivatives of error for an output layer.
     * %  
     * %  DELTALIN(A,D,W)
     * %    D - S2xQ matrix of next layer delta vectors
     * %    W - S2xS1 weight matrix between layers.
     * %  Returns an S1xQ matrix of derivatives of error for a hidden layer.
     * %  
     * % See also NNTRANS, BACKPROP, PURELIN.
     * 
     * % Mark Beale, 1-31-92
     * % Revised 12-15-93, MB
     * % Copyright 1992-2002 The MathWorks, Inc.
     * % $Revision: 1.11 $  $Date: 2002/03/25 16:53:45 $
     * 
     * if nargin == 1
     */
    if (nargin_ == 1) {
        /*
         * d = ones(size(a));
         */
        mlfAssign(
          &d, mlfOnes(mlfSize(mclValueVarargout(), mclVa(a, "a"), NULL), NULL));
    /*
     * elseif nargin == 2
     */
    } else if (nargin_ == 2) {
        /*
         * d = d;
         */
        mlfAssign(&d, mclVa(d, "d"));
    /*
     * else
     */
    } else {
        /*
         * d = w'*d;
         */
        mlfAssign(
          &d, mlf_times_transpose(mclVa(w, "w"), mclVa(d, "d"), _mxarray4_));
    /*
     * end
     */
    }
    mclValidateOutput(d, 1, nargout_, "d", "deltalin");
    mxDestroyArray(ans);
    mxDestroyArray(w);
    mxDestroyArray(a);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
    return d;
}

⌨️ 快捷键说明

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