📄 nndef.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 "nndef.h"
#include "mwservices.h"
#include "libmatlbm.h"
#include "nntobsf.h"
static mxChar _array1_[7] = { 't', 'r', 'a', 'i', 'n', 'w', 'b' };
static mxArray * _mxarray0_;
static mxChar _array3_[33] = { 'U', 's', 'e', ' ', 'T', 'R', 'A', 'I', 'N',
'B', ' ', 't', 'o', ' ', 't', 'r', 'a', 'i',
'n', ' ', 'y', 'o', 'u', 'r', ' ', 'n', 'e',
't', 'w', 'o', 'r', 'k', '.' };
static mxArray * _mxarray2_;
static mxArray * _mxarray4_;
void InitializeModule_nndef(void) {
_mxarray0_ = mclInitializeString(7, _array1_);
_mxarray2_ = mclInitializeString(33, _array3_);
_mxarray4_ = mclInitializeDouble(1.0);
}
void TerminateModule_nndef(void) {
mxDestroyArray(_mxarray4_);
mxDestroyArray(_mxarray2_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mnndef(int nargout_, mxArray * x, mxArray * d);
_mexLocalFunctionTable _local_function_table_nndef
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfNndef" contains the normal interface for the "nndef"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\nndef.m" (lines
* 1-26). This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
mxArray * mlfNndef(mxArray * x, mxArray * d) {
int nargout = 1;
mxArray * y = NULL;
mlfEnterNewContext(0, 2, x, d);
y = Mnndef(nargout, x, d);
mlfRestorePreviousContext(0, 2, x, d);
return mlfReturnValue(y);
}
/*
* The function "mlxNndef" contains the feval interface for the "nndef"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\nndef.m" (lines
* 1-26). The feval function calls the implementation version of nndef through
* this function. This function processes any input arguments and passes them
* to the implementation version of the function, appearing above.
*/
void mlxNndef(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: nndef Line: 1 Column: 1 The function \"nndef"
"\" was called with more than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 2) {
mlfError(
mxCreateString(
"Run-time Error: File: nndef Line: 1 Column: 1 The function \"nndef"
"\" was called with more 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] = Mnndef(nlhs, mprhs[0], mprhs[1]);
mlfRestorePreviousContext(0, 2, mprhs[0], mprhs[1]);
plhs[0] = mplhs[0];
}
/*
* The function "Mnndef" is the implementation version of the "nndef"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\nndef.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 y=nndef(x,d)
*/
static mxArray * Mnndef(int nargout_, mxArray * x, mxArray * d) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_nndef);
mxArray * y = NULL;
mxArray * i = NULL;
mxArray * ans = NULL;
mclCopyArray(&x);
mclCopyArray(&d);
/*
* %NNDEF Replace missing and NaN values with defaults.
* %
* % This function is obselete.
*
* nntobsf('trainwb','Use TRAINB to train your network.')
*/
mlfNntobsf(_mxarray0_, _mxarray2_, NULL);
/*
*
*
* % NNDEF(X,D)
* % X - Row vector of proposed values.
* % D - Row vector of default values.
* % Returns X with all non-finite and missing values with
* % the corresponding values in D.
* %
* % EXAMPLE: x = [1 2 NaN 4 5];
* % d = [10 20 30 40 50 60];
* % y = nndef(x,d)
*
* % Mark Beale, 12-15-93
* % Copyright 1992-2002 The MathWorks, Inc.
* % $Revision: 1.14 $ $Date: 2002/03/25 16:54:01 $
*
* y = d;
*/
mlfAssign(&y, mclVa(d, "d"));
/*
* i = find(finite(x(1:min(length(x),length(y)))));
*/
mlfAssign(
&i,
mlfFind(
NULL,
NULL,
mlfFinite(
mclArrayRef1(
mclVa(x, "x"),
mlfColon(
_mxarray4_,
mlfScalar(
svDoubleScalarMin(
(double) mclLengthInt(mclVa(x, "x")),
(double) mclLengthInt(mclVv(y, "y")))),
NULL)))));
/*
* y(i) = x(i);
*/
mclArrayAssign1(
&y, mclArrayRef1(mclVa(x, "x"), mclVv(i, "i")), mclVv(i, "i"));
mclValidateOutput(y, 1, nargout_, "y", "nndef");
mxDestroyArray(ans);
mxDestroyArray(i);
mxDestroyArray(d);
mxDestroyArray(x);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return y;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -