📄 newtr.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 "newtr.h"
#include "libmatlbm.h"
static mxChar _array1_[27] = { '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 * _mxarray0_;
static mxArray * _mxarray2_;
static mxArray * _mxarray3_;
static double _ieee_nan_;
static mxArray * _mxarray4_;
static mxArray * _mxarray5_;
static mxChar _array7_[3] = { 't', 'r', '.' };
static mxArray * _mxarray6_;
static mxChar _array9_[7] = { '=', 'b', 'l', 'a', 'n', 'k', ';' };
static mxArray * _mxarray8_;
void InitializeModule_newtr(void) {
_mxarray0_ = mclInitializeString(27, _array1_);
_mxarray2_ = mclInitializeDouble(0.0);
_mxarray3_ = mclInitializeDouble(1.0);
_ieee_nan_ = mclGetNaN();
_mxarray4_ = mclInitializeDouble(_ieee_nan_);
_mxarray5_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
_mxarray6_ = mclInitializeString(3, _array7_);
_mxarray8_ = mclInitializeString(7, _array9_);
}
void TerminateModule_newtr(void) {
mxDestroyArray(_mxarray8_);
mxDestroyArray(_mxarray6_);
mxDestroyArray(_mxarray5_);
mxDestroyArray(_mxarray4_);
mxDestroyArray(_mxarray3_);
mxDestroyArray(_mxarray2_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mnewtr(int nargout_, mxArray * epochs, mxArray * varargin);
_mexLocalFunctionTable _local_function_table_newtr
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfNewtr" contains the normal interface for the "newtr"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnutils\newtr.m" (lines
* 1-27). This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
mxArray * mlfNewtr(mxArray * epochs, ...) {
mxArray * varargin = NULL;
int nargout = 1;
mxArray * tr = NULL;
mlfVarargin(&varargin, epochs, 0);
mlfEnterNewContext(0, -2, epochs, varargin);
tr = Mnewtr(nargout, epochs, varargin);
mlfRestorePreviousContext(0, 1, epochs);
mxDestroyArray(varargin);
return mlfReturnValue(tr);
}
/*
* The function "mlxNewtr" contains the feval interface for the "newtr"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnutils\newtr.m" (lines
* 1-27). The feval function calls the implementation version of newtr through
* this function. This function processes any input arguments and passes them
* to the implementation version of the function, appearing above.
*/
void mlxNewtr(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: newtr Line: 1 Column: 1 The function \"newtr"
"\" was called with more than the declared number of outputs (1)."),
NULL);
}
for (i = 0; i < 1; ++i) {
mplhs[i] = NULL;
}
for (i = 0; i < 1 && i < nrhs; ++i) {
mprhs[i] = prhs[i];
}
for (; i < 1; ++i) {
mprhs[i] = NULL;
}
mlfEnterNewContext(0, 1, mprhs[0]);
mprhs[1] = NULL;
mlfAssign(&mprhs[1], mclCreateVararginCell(nrhs - 1, prhs + 1));
mplhs[0] = Mnewtr(nlhs, mprhs[0], mprhs[1]);
mlfRestorePreviousContext(0, 1, mprhs[0]);
plhs[0] = mplhs[0];
mxDestroyArray(mprhs[1]);
}
/*
* The function "Mnewtr" is the implementation version of the "newtr"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnutils\newtr.m" (lines
* 1-27). 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 tr=newtr(epochs,varargin)
*/
static mxArray * Mnewtr(int nargout_, mxArray * epochs, mxArray * varargin) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_newtr);
int nargin_ = mclNargin(-2, epochs, varargin, NULL);
mxArray * tr = NULL;
mxArray * i = NULL;
mxArray * blank = NULL;
mxArray * names = NULL;
mxArray * ans = NULL;
mclCopyArray(&epochs);
mclCopyArray(&varargin);
/*
* %NEWTR New training record with any number of optional fields.
* %
* % Syntax
* %
* % tr = newtr(epochs,'fieldname1','fieldname2',...)
* % tr = newtr([firstEpoch epochs],'fieldname1','fieldname2',...)
* %
* % Warning!!
* %
* % This function may be altered or removed in future
* % releases of the Neural Network Toolbox. We recommend
* % you do not write code which calls this function.
*
* % Mark Beale, 11-31-97
* % Copyright 1992-2002 The MathWorks, Inc.
* % $Revision: 1.9 $ $Date: 2002/03/25 16:55:00 $
*
* if nargin < 1,error('Not enough input arguments.'),end
*/
if (nargin_ < 1) {
mlfError(_mxarray0_, NULL);
}
/*
*
* names = varargin;
*/
mlfAssign(&names, mclVa(varargin, "varargin"));
/*
* tr.epoch = 0:epochs;
*/
mlfIndexAssign(
&tr, ".epoch", mlfColon(_mxarray2_, mclVa(epochs, "epochs"), NULL));
/*
* blank = zeros(1,epochs+1)+NaN;
*/
mlfAssign(
&blank,
mclPlus(
mlfZeros(
_mxarray3_, mclPlus(mclVa(epochs, "epochs"), _mxarray3_), NULL),
_mxarray4_));
/*
* for i=1:length(names)
*/
{
int v_ = mclForIntStart(1);
int e_ = mclLengthInt(mclVv(names, "names"));
if (v_ > e_) {
mlfAssign(&i, _mxarray5_);
} else {
/*
* eval(['tr.' names{i} '=blank;']);
* end
*/
for (; ; ) {
mclAssignAns(
&ans,
mlfEval(
mclAnsVarargout(),
mlfHorzcat(
_mxarray6_,
mlfIndexRef(mclVv(names, "names"), "{?}", mlfScalar(v_)),
_mxarray8_,
NULL),
NULL));
if (v_ == e_) {
break;
}
++v_;
}
mlfAssign(&i, mlfScalar(v_));
}
}
mclValidateOutput(tr, 1, nargout_, "tr", "newtr");
mxDestroyArray(ans);
mxDestroyArray(names);
mxDestroyArray(blank);
mxDestroyArray(i);
mxDestroyArray(varargin);
mxDestroyArray(epochs);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return tr;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -