📄 nncpyd.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 "nncpyd.h"
#include "libmatlbm.h"
#include "nntobsf.h"
static mxChar _array1_[6] = { 'n', 'n', 'c', 'p', 'y', 'd' };
static mxArray * _mxarray0_;
static mxArray * _mxarray2_;
static mxArray * _mxarray3_;
static mxArray * _mxarray4_;
void InitializeModule_nncpyd(void) {
_mxarray0_ = mclInitializeString(6, _array1_);
_mxarray2_ = mclInitializeCharVector(0, 0, (mxChar *)NULL);
_mxarray3_ = mclInitializeDouble(1.0);
_mxarray4_ = mclInitializeDouble(0.0);
}
void TerminateModule_nncpyd(void) {
mxDestroyArray(_mxarray4_);
mxDestroyArray(_mxarray3_);
mxDestroyArray(_mxarray2_);
mxDestroyArray(_mxarray0_);
}
static mxArray * Mnncpyd(int nargout_, mxArray * x);
_mexLocalFunctionTable _local_function_table_nncpyd
= { 0, (mexFunctionTableEntry *)NULL };
/*
* The function "mlfNncpyd" contains the normal interface for the "nncpyd"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\nncpyd.m" (lines
* 1-33). This function processes any input arguments and passes them to the
* implementation version of the function, appearing above.
*/
mxArray * mlfNncpyd(mxArray * x) {
int nargout = 1;
mxArray * y = NULL;
mlfEnterNewContext(0, 1, x);
y = Mnncpyd(nargout, x);
mlfRestorePreviousContext(0, 1, x);
return mlfReturnValue(y);
}
/*
* The function "mlxNncpyd" contains the feval interface for the "nncpyd"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\nncpyd.m" (lines
* 1-33). The feval function calls the implementation version of nncpyd through
* this function. This function processes any input arguments and passes them
* to the implementation version of the function, appearing above.
*/
void mlxNncpyd(int nlhs, mxArray * plhs[], int nrhs, mxArray * prhs[]) {
mxArray * mprhs[1];
mxArray * mplhs[1];
int i;
if (nlhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: nncpyd Line: 1 Column: "
"1 The function \"nncpyd\" was called with mor"
"e than the declared number of outputs (1)."),
NULL);
}
if (nrhs > 1) {
mlfError(
mxCreateString(
"Run-time Error: File: nncpyd Line: 1 Column: "
"1 The function \"nncpyd\" was called with mor"
"e than the declared number of inputs (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]);
mplhs[0] = Mnncpyd(nlhs, mprhs[0]);
mlfRestorePreviousContext(0, 1, mprhs[0]);
plhs[0] = mplhs[0];
}
/*
* The function "Mnncpyd" is the implementation version of the "nncpyd"
* M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\nncpyd.m" (lines
* 1-33). 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 = nncpyd(x)
*/
static mxArray * Mnncpyd(int nargout_, mxArray * x) {
mexLocalFunctionTable save_local_function_table_
= mclSetCurrentLocalFunctionTable(&_local_function_table_nncpyd);
mxArray * y = NULL;
mxArray * j = NULL;
mxArray * i = NULL;
mxArray * xc = NULL;
mxArray * xr = NULL;
mxArray * ans = NULL;
mclCopyArray(&x);
/*
* %NNCPYD Copy vectors in a matrix onto diagonals.
* %
* % This function is obselete.
*
* nntobsf('nncpyd','')
*/
mlfNntobsf(_mxarray0_, _mxarray2_, NULL);
/*
*
* % *WARNING*: This function is undocumented as it may be altered
* % at any time in the future without warning.
*
* % NNCPYD(X)
* % X - NxM Matrix of column vectors.
* % Returns Nx(N*M) matrix of M NxN diagonal matrices
* % with the columns of X on each diagonal.
* %
* % EXAMPLE: X = [1 2; 3 4; 5 6];
* % Y = nncpyd(X)
* %
* % SEE ALSO: nncpy, nncpyi
*
* % Mark Beale, 12-15-93
* % Copyright 1992-2002 The MathWorks, Inc.
* % $Revision: 1.11 $ $Date: 2002/03/25 16:53:59 $
*
* [xr,xc] = size(x);
*/
mlfSize(mlfVarargout(&xr, &xc, NULL), mclVa(x, "x"), NULL);
/*
*
* y = zeros(xr,xr*xc);
*/
mlfAssign(
&y,
mlfZeros(
mclVv(xr, "xr"), mclMtimes(mclVv(xr, "xr"), mclVv(xc, "xc")), NULL));
/*
*
* i = 1:xr;
*/
mlfAssign(&i, mlfColon(_mxarray3_, mclVv(xr, "xr"), NULL));
/*
* for j=0:xr:((xc-1)*xr)
*/
{
mclForLoopIterator viter__;
for (mclForStart(
&viter__,
_mxarray4_,
mclVv(xr, "xr"),
mclMtimes(
mclMinus(mclVv(xc, "xc"), _mxarray3_), mclVv(xr, "xr")));
mclForNext(&viter__, &j);
) {
/*
* y(i+(i+j-1)*xr) = x(i+j);
*/
mclArrayAssign1(
&y,
mclArrayRef1(
mclVa(x, "x"), mclPlus(mclVv(i, "i"), mclVv(j, "j"))),
mclPlus(
mclVv(i, "i"),
mclMtimes(
mclMinus(mclPlus(mclVv(i, "i"), mclVv(j, "j")), _mxarray3_),
mclVv(xr, "xr"))));
/*
* end
*/
}
mclDestroyForLoopIterator(viter__);
}
mclValidateOutput(y, 1, nargout_, "y", "nncpyd");
mxDestroyArray(ans);
mxDestroyArray(xr);
mxDestroyArray(xc);
mxDestroyArray(i);
mxDestroyArray(j);
mxDestroyArray(x);
mclSetCurrentLocalFunctionTable(save_local_function_table_);
return y;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -