📄 deltatan.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 "deltatan.h"
#include "libmatlbm.h"
#include "nntobsf.h"
static mxChar _array1_[8] = { 'd', 'e', 'l', 't', 'a', 't', 'a', 'n' };
static mxArray * _mxarray0_;
static mxChar _array3_[45] = { 'U', 's', 'e', ' ', 'D', 'T', 'A', 'N', 'S',
'I', 'G', ' ', 't', 'o', ' ', 'c', 'a', 'l',
'c', 'u', 'l', 'a', 't', 'e', 's', ' ', 'T',
'A', 'N', 'S', 'I', 'G', ' ', 'd', 'e', 'r',
'i', 'v', 'a', 't', 'i', 'v', 'e', 's', '.' };
static mxArray * _mxarray2_;
static mxChar _array5_[26] = { 'N', 'o', 't', ' ', 'e', 'n', 'o', 'u', 'g',
'h', ' ', 'i', 'n', 'p', 'u', 't', ' ', 'a',
'r', 'g', 'u', 'm', 'e', 'n', 't', 's' };
static mxArray * _mxarray4_;
static mxArray * _mxarray6_;
static mxArray * _mxarray7_;
void InitializeModule_deltatan(void) {
_mxarray0_ = mclInitializeString(8, _array1_);
_mxarray2_ = mclInitializeString(45, _array3_);
_mxarray4_ = mclInitializeString(26, _array5_);
_mxarray6_ = mclInitializeDouble(1.0);
_mxarray7_ = mclInitializeDouble(6.0);
}
void TerminateModule_deltatan(void) {
mxDestroyArray(_mxarray7_);
mxDestroyArray(_mxarray6_);
mxDestroyArray(_mxarray4_);
mxDestroyArray(_mxarray2_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mdeltatan(int nargout_,
mxArray * a,
mxArray * d_in,
mxArray * w);
_mexLocalFunctionTable _local_function_table_deltatan
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfDeltatan" contains the normal interface for the "deltatan"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\deltatan.m"
* (lines 1-39). This function processes any input arguments and passes them to
* the implementation version of the function, appearing above.
*/
mxArray * mlfDeltatan(mxArray * a, mxArray * d_in, mxArray * w) {
int nargout = 1;
mxArray * d = NULL;
mlfEnterNewContext(0, 3, a, d_in, w);
d = Mdeltatan(nargout, a, d_in, w);
mlfRestorePreviousContext(0, 3, a, d_in, w);
return mlfReturnValue(d);
}
/*
* The function "mlxDeltatan" contains the feval interface for the "deltatan"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\deltatan.m"
* (lines 1-39). The feval function calls the implementation version of
* deltatan through this function. This function processes any input arguments
* and passes them to the implementation version of the function, appearing
* above.
*/
void mlxDeltatan(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: deltatan Line: 1 Column:"
" 1 The function \"deltatan\" was called with m"
"ore than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 3) {
mlfError(
mxCreateString(
"Run-time Error: File: deltatan Line: 1 Column:"
" 1 The function \"deltatan\" 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] = Mdeltatan(nlhs, mprhs[0], mprhs[1], mprhs[2]);
mlfRestorePreviousContext(0, 3, mprhs[0], mprhs[1], mprhs[2]);
plhs[0] = mplhs[0];
}
/*
* The function "Mdeltatan" is the implementation version of the "deltatan"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\deltatan.m"
* (lines 1-39). 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 = deltatan(a,d,w)
*/
static mxArray * Mdeltatan(int nargout_,
mxArray * a,
mxArray * d_in,
mxArray * w) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_deltatan);
int nargin_ = mclNargin(3, a, d_in, w, NULL);
mxArray * d = NULL;
mxArray * ans = NULL;
mclCopyArray(&a);
mclCopyInputArg(&d, d_in);
mclCopyArray(&w);
/*
* %DELTATAN Delta function for TANSIG neurons.
* %
* % This function is obselete.
* % Use DTANSIG to calculates TANSIG derivatives.
*
* nntobsf('deltatan','Use DTANSIG to calculates TANSIG derivatives.')
*/
mlfNntobsf(_mxarray0_, _mxarray2_, NULL);
/*
*
* %
* % DELTATAN(A,E)
* % A - S1xQ matrix of output vectors
* % E - S1xQ matrix of associated errors
* % Returns an SxQ matrix of output layer derivatives.
* %
* % DELTATAN(A,D,W)
* % D - S2xQ matrix of next layer delta vectors
* % W - S2xS1 weight matrix between layers.
* % Returns an SxQ matrix of hidden layer derivatives.
* %
* % DELTATAN(A)
* % Returns derivatives of outputs A (not error) for TRAINLM.
* %
* % See also NNTRANS, BACKPROP, TANSIG, DELTALOG, DELTALIN.
*
* % 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:47 $
*
* if nargin < 1,error('Not enough input arguments'),end
*/
if (nargin_ < 1) {
mlfError(_mxarray4_, NULL);
}
/*
*
* if nargin == 1
*/
if (nargin_ == 1) {
/*
* d = 1-(a.*a);
*/
mlfAssign(
&d, mclMinus(_mxarray6_, mclTimes(mclVa(a, "a"), mclVa(a, "a"))));
/*
* elseif nargin == 2
*/
} else if (nargin_ == 2) {
/*
* d = (1-(a.*a)).*d;
*/
mlfAssign(
&d,
mclTimes(
mclMinus(_mxarray6_, mclTimes(mclVa(a, "a"), mclVa(a, "a"))),
mclVa(d, "d")));
/*
* else
*/
} else {
/*
* d = (1-(a.*a)).*(w'*d);
*/
mlfAssign(
&d,
mclTimes(
mclMinus(_mxarray6_, mclTimes(mclVa(a, "a"), mclVa(a, "a"))),
mlf_times_transpose(mclVa(w, "w"), mclVa(d, "d"), _mxarray7_)));
/*
* end
*/
}
mclValidateOutput(d, 1, nargout_, "d", "deltatan");
mxDestroyArray(ans);
mxDestroyArray(w);
mxDestroyArray(a);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return d;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -