📄 learnlm.c
字号:
/*
* 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 "learnlm.h"
#include "libmatlbm.h"
#include "nncpy.h"
#include "nncpyi.h"
#include "nntobsf.h"
static mxChar _array1_[7] = { 'l', 'e', 'a', 'r', 'n', 'l', 'm' };
static mxArray * _mxarray0_;
static mxChar _array3_[54] = { 'U', 's', 'e', ' ', 'N', 'N', 'T', '2', 'F',
'F', ' ', 'a', 'n', 'd', ' ', 'T', 'R', 'A',
'I', 'N', ' ', 't', 'o', ' ', 'u', 'p', 'd',
'a', 't', 'e', ' ', 'a', 'n', 'd', ' ', 't',
'r', 'a', 'i', 'n', ' ', 'y', 'o', 'u', 'r',
' ', 'n', 'e', 't', 'w', 'o', 'r', 'k', '.' };
static mxArray * _mxarray2_;
static mxChar _array5_[26] = { 'W', 'r', 'o', 'n', 'g', ' ', 'n', 'u', 'm',
'b', 'e', 'r', ' ', 'o', 'f', ' ', 'a', 'r',
'g', 'u', 'm', 'e', 'n', 't', 's', '.' };
static mxArray * _mxarray4_;
void InitializeModule_learnlm(void) {
_mxarray0_ = mclInitializeString(7, _array1_);
_mxarray2_ = mclInitializeString(54, _array3_);
_mxarray4_ = mclInitializeString(26, _array5_);
}
void TerminateModule_learnlm(void) {
mxDestroyArray(_mxarray4_);
mxDestroyArray(_mxarray2_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mlearnlm(int nargout_, mxArray * p, mxArray * d);
_mexLocalFunctionTable _local_function_table_learnlm
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfLearnlm" contains the normal interface for the "learnlm"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\learnlm.m" (lines
* 1-26). This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
mxArray * mlfLearnlm(mxArray * p, mxArray * d) {
int nargout = 1;
mxArray * j = NULL;
mlfEnterNewContext(0, 2, p, d);
j = Mlearnlm(nargout, p, d);
mlfRestorePreviousContext(0, 2, p, d);
return mlfReturnValue(j);
}
/*
* The function "mlxLearnlm" contains the feval interface for the "learnlm"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\learnlm.m" (lines
* 1-26). The feval function calls the implementation version of learnlm
* through this function. This function processes any input arguments and
* passes them to the implementation version of the function, appearing above.
*/
void mlxLearnlm(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[2];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: learnlm Line: 1 Column: "
"1 The function \"learnlm\" was called with mor"
"e than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 2) {
mlfError(
mxCreateString(
"Run-time Error: File: learnlm Line: 1 Column:"
" 1 The function \"learnlm\" was called with m"
"ore than the declared number of inputs (2)."),
NULL);
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 2 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 2; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 2, mprhs[0], mprhs[1]);
mplhs[0] = Mlearnlm(nlhs, mprhs[0], mprhs[1]);
mlfRestorePreviousContext(0, 2, mprhs[0], mprhs[1]);
plhs[0] = mplhs[0];
}
/*
* The function "Mlearnlm" is the implementation version of the "learnlm"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\learnlm.m" (lines
* 1-26). 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 j = learnlm(p,d)
*/
static mxArray * Mlearnlm(int nargout_, mxArray * p, mxArray * d) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_learnlm);
int nargin_ = mclNargin(2, p, d, NULL);
mxArray * j = NULL;
mxArray * S = NULL;
mxArray * Q = NULL;
mxArray * R = NULL;
mxArray * ans = NULL;
mclCopyArray(&p);
mclCopyArray(&d);
/*
* %LEARNLM Levenberg-Marquardt learning rule.
* %
* % This function is obselete.
* % Use NNT2FF and TRAIN to update and train your network.
*
* nntobsf('learnlm','Use NNT2FF and TRAIN to update and train your network.')
*/
mlfNntobsf(_mxarray0_, _mxarray2_, NULL);
/*
*
* % LEARNLM(P,D)
* % P - RxQ matrix of input (column) vectors.
* % D - SxQ matrix of delta (column) vectors.
* % Returns:
* % Partial jacobian matrix.
* %
* % See also NNLEARN, BACKPROP, INITFF, SIMFF, TRAINLM.
*
* % Mark Beale, 12-15-93
* % Copyright 1992-2002 The MathWorks, Inc.
* % $Revision: 1.11 $ $Date: 2002/03/25 16:53:55 $
*
* if nargin < 2, error('Wrong number of arguments.'),end
*/
if (nargin_ < 2) {
mlfError(_mxarray4_, NULL);
}
/*
*
* [R,Q]=size(p);
*/
mlfSize(mlfVarargout(&R, &Q, NULL), mclVa(p, "p"), NULL);
/*
* [S,Q]=size(d);
*/
mlfSize(mlfVarargout(&S, &Q, NULL), mclVa(d, "d"), NULL);
/*
* j = nncpy(d',R) .* nncpyi(p',S);
*/
mlfAssign(
&j,
mclTimes(
mlfNncpy(mlfCtranspose(mclVa(d, "d")), mclVv(R, "R")),
mlfNncpyi(mlfCtranspose(mclVa(p, "p")), mclVv(S, "S"))));
mclValidateOutput(j, 1, nargout_, "j", "learnlm");
mxDestroyArray(ans);
mxDestroyArray(R);
mxDestroyArray(Q);
mxDestroyArray(S);
mxDestroyArray(d);
mxDestroyArray(p);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return j;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -