⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nnmaxr.c

📁 nnToolKit 神经网络工具包是基于 MATLAB 神经网络工具箱自行开发的一组神经网络算法函数库
💻 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 "nnmaxr.h"
#include "libmatlbm.h"
#include "nntobsf.h"

static mxChar _array1_[6] = { 'n', 'n', 'm', 'a', 'x', 'r' };
static mxArray * _mxarray0_;

static mxChar _array3_[16] = { 'U', 's', 'e', ' ', 'M', 'A', 'X', '(',
                               'M', ',', '[', ']', ',', '1', ')', '.' };
static mxArray * _mxarray2_;
static mxArray * _mxarray4_;

void InitializeModule_nnmaxr(void) {
    _mxarray0_ = mclInitializeString(6, _array1_);
    _mxarray2_ = mclInitializeString(16, _array3_);
    _mxarray4_ = mclInitializeDouble(1.0);
}

void TerminateModule_nnmaxr(void) {
    mxDestroyArray(_mxarray4_);
    mxDestroyArray(_mxarray2_);
    mxDestroyArray(_mxarray0_);
}

static mxArray * Mnnmaxr(int nargout_, mxArray * m_in);

_mexLocalFunctionTable _local_function_table_nnmaxr
  = { 0, (mexFunctionTableEntry *)NULL };

/*
 * The function "mlfNnmaxr" contains the normal interface for the "nnmaxr"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\nnmaxr.m" (lines
 * 1-31). This function processes any input arguments and passes them to the
 * implementation version of the function, appearing above.
 */
mxArray * mlfNnmaxr(mxArray * m_in) {
    int nargout = 1;
    mxArray * m = NULL;
    mlfEnterNewContext(0, 1, m_in);
    m = Mnnmaxr(nargout, m_in);
    mlfRestorePreviousContext(0, 1, m_in);
    return mlfReturnValue(m);
}

/*
 * The function "mlxNnmaxr" contains the feval interface for the "nnmaxr"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\nnmaxr.m" (lines
 * 1-31). The feval function calls the implementation version of nnmaxr through
 * this function. This function processes any input arguments and passes them
 * to the implementation version of the function, appearing above.
 */
void mlxNnmaxr(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: nnmaxr Line: 1 Column: "
            "1 The function \"nnmaxr\" was called with mor"
            "e than the declared number of outputs (1)."),
          NULL);
    }
    if (nrhs > 1) {
        mlfError(
          mxCreateString(
            "Run-time Error: File: nnmaxr Line: 1 Column: "
            "1 The function \"nnmaxr\" 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] = Mnnmaxr(nlhs, mprhs[0]);
    mlfRestorePreviousContext(0, 1, mprhs[0]);
    plhs[0] = mplhs[0];
}

/*
 * The function "Mnnmaxr" is the implementation version of the "nnmaxr"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnobsolete\nnmaxr.m" (lines
 * 1-31). 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 m = nnmaxr(m)
 */
static mxArray * Mnnmaxr(int nargout_, mxArray * m_in) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_nnmaxr);
    mxArray * m = NULL;
    mxArray * M = NULL;
    mxArray * N = NULL;
    mxArray * ans = NULL;
    mclCopyInputArg(&m, m_in);
    /*
     * %NNMAXR Find maximum of each row.
     * %  
     * %  This function is obselete.
     * %  Use MAX(M,[],1).
     * 
     * nntobsf('nnmaxr','Use MAX(M,[],1).')
     */
    mlfNntobsf(_mxarray0_, _mxarray2_, NULL);
    /*
     * 
     * %  
     * %  *WARNING*: This function is undocumented as it may be altered
     * %  at any time in the future without warning.
     * 
     * % NNMAXR(M)
     * %   M - Matrix.
     * % Returns column of maximum row values.
     * %
     * % EXAMPLE: M = [1 2 3; 4 5 2]
     * %          maxrow(M)
     * %
     * % SEE ALSO: nnmaxr
     * 
     * % Mark Beale, 12-15-93
     * % Copyright 1992-2002 The MathWorks, Inc.
     * % $Revision: 1.11 $  $Date: 2002/03/25 16:54:01 $
     * 
     * [N,M] = size(m);
     */
    mlfSize(mlfVarargout(&N, &M, NULL), mclVa(m, "m"), NULL);
    /*
     * 
     * if M > 1
     */
    if (mclGtBool(mclVv(M, "M"), _mxarray4_)) {
        /*
         * m = max(m')';
         */
        mlfAssign(
          &m,
          mlfCtranspose(
            mlfMax(NULL, mlfCtranspose(mclVa(m, "m")), NULL, NULL)));
    /*
     * end
     */
    }
    mclValidateOutput(m, 1, nargout_, "m", "nnmaxr");
    mxDestroyArray(ans);
    mxDestroyArray(N);
    mxDestroyArray(M);
    mclSetCurrentLocalFunctionTable(save_local_function_table_);
    return m;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -