📄 cliptr.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 "cliptr.h"
#include "libmatlbm.h"
static mxArray * _mxarray0_;
static mxArray * _mxarray1_;
static mxChar _array3_[3] = { 't', 'r', '.' };
static mxArray * _mxarray2_;
static mxChar _array5_[6] = { ' ', '=', ' ', 't', 'r', '.' };
static mxArray * _mxarray4_;
static mxChar _array7_[12] = { '(', ':', ',', 'i', 'n', 'd',
'i', 'c', 'e', 's', ')', ';' };
static mxArray * _mxarray6_;
void InitializeModule_cliptr(void) {
_mxarray0_ = mclInitializeDouble(1.0);
_mxarray1_ = mclInitializeDoubleVector(0, 0, (double *)NULL);
_mxarray2_ = mclInitializeString(3, _array3_);
_mxarray4_ = mclInitializeString(6, _array5_);
_mxarray6_ = mclInitializeString(12, _array7_);
}
void TerminateModule_cliptr(void) {
mxDestroyArray(_mxarray6_);
mxDestroyArray(_mxarray4_);
mxDestroyArray(_mxarray2_);
mxDestroyArray(_mxarray1_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mcliptr(int nargout_, mxArray * tr_in, mxArray * epochs);
_mexLocalFunctionTable _local_function_table_cliptr
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfCliptr" contains the normal interface for the "cliptr"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnutils\cliptr.m" (lines
* 1-24). This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
mxArray * mlfCliptr(mxArray * tr_in, mxArray * epochs) {
int nargout = 1;
mxArray * tr = NULL;
mlfEnterNewContext(0, 2, tr_in, epochs);
tr = Mcliptr(nargout, tr_in, epochs);
mlfRestorePreviousContext(0, 2, tr_in, epochs);
return mlfReturnValue(tr);
}
/*
* The function "mlxCliptr" contains the feval interface for the "cliptr"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnutils\cliptr.m" (lines
* 1-24). The feval function calls the implementation version of cliptr through
* this function. This function processes any input arguments and passes them
* to the implementation version of the function, appearing above.
*/
void mlxCliptr(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: cliptr Line: 1 Column: "
"1 The function \"cliptr\" was called with mor"
"e than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 2) {
mlfError(
mxCreateString(
"Run-time Error: File: cliptr Line: 1 Column: "
"1 The function \"cliptr\" was called with mor"
"e 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] = Mcliptr(nlhs, mprhs[0], mprhs[1]);
mlfRestorePreviousContext(0, 2, mprhs[0], mprhs[1]);
plhs[0] = mplhs[0];
}
/*
* The function "Mcliptr" is the implementation version of the "cliptr"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnutils\cliptr.m" (lines
* 1-24). 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=cliptr(tr,epochs)
*/
static mxArray * Mcliptr(int nargout_, mxArray * tr_in, mxArray * epochs) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_cliptr);
mxArray * tr = NULL;
mxArray * ans = NULL;
mxArray * name = NULL;
mxArray * i = NULL;
mxArray * names = NULL;
mxArray * indices = NULL;
mclCopyInputArg(&tr, tr_in);
mclCopyArray(&epochs);
/*
* %CLIPTR Clip training record to the final number of epochs.
* %
* % Syntax
* %
* % tr = cliptr(tr,epochs)
* %
* % 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.7 $
*
* indices = 1:(epochs+1);
*/
mlfAssign(
&indices,
mlfColon(_mxarray0_, mclPlus(mclVa(epochs, "epochs"), _mxarray0_), NULL));
/*
* names = fieldnames(tr);
*/
mlfAssign(&names, mlfFieldnames(mclVa(tr, "tr")));
/*
* for i=1:length(names)
*/
{
int v_ = mclForIntStart(1);
int e_ = mclLengthInt(mclVv(names, "names"));
if (v_ > e_) {
mlfAssign(&i, _mxarray1_);
} else {
/*
* name = names{i};
* eval(['tr.' name ' = tr.' name '(:,indices);']);
* end
*/
for (; ; ) {
mlfAssign(
&name,
mlfIndexRef(mclVv(names, "names"), "{?}", mlfScalar(v_)));
mclAssignAns(
&ans,
mlfEval(
mclAnsVarargout(),
mlfHorzcat(
_mxarray2_,
mclVv(name, "name"),
_mxarray4_,
mclVv(name, "name"),
_mxarray6_,
NULL),
NULL));
if (v_ == e_) {
break;
}
++v_;
}
mlfAssign(&i, mlfScalar(v_));
}
}
mclValidateOutput(tr, 1, nargout_, "tr", "cliptr");
mxDestroyArray(indices);
mxDestroyArray(names);
mxDestroyArray(i);
mxDestroyArray(name);
mxDestroyArray(ans);
mxDestroyArray(epochs);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return tr;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -