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

📄 tansig.c

📁 nnToolKit 神经网络工具包是基于 MATLAB 神经网络工具箱自行开发的一组神经网络算法函数库
💻 C
📖 第 1 页 / 共 2 页
字号:
/*
 * 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 "tansig.h"
#include "libmatlbm.h"
#include "nntobsu.h"

static mxChar _array1_[21] = { 'N', 'o', 't', ' ', 'e', 'n', 'o',
                               'u', 'g', 'h', ' ', 'a', 'r', 'g',
                               'u', 'm', 'e', 'n', 't', 's', '.' };
static mxArray * _mxarray0_;

static mxChar _array3_[5] = { 'd', 'e', 'r', 'i', 'v' };
static mxArray * _mxarray2_;

static mxChar _array5_[7] = { 'd', 't', 'a', 'n', 's', 'i', 'g' };
static mxArray * _mxarray4_;

static mxChar _array7_[4] = { 'n', 'a', 'm', 'e' };
static mxArray * _mxarray6_;

static mxChar _array9_[11] = { 'T', 'a', 'n', ' ', 'S', 'i',
                               'g', 'm', 'o', 'i', 'd' };
static mxArray * _mxarray8_;

static mxChar _array11_[6] = { 'o', 'u', 't', 'p', 'u', 't' };
static mxArray * _mxarray10_;

static double _array13_[2] = { -1.0, 1.0 };
static mxArray * _mxarray12_;

static mxChar _array15_[6] = { 'a', 'c', 't', 'i', 'v', 'e' };
static mxArray * _mxarray14_;

static double _array17_[2] = { -2.0, 2.0 };
static mxArray * _mxarray16_;

static mxChar _array19_[4] = { 't', 'y', 'p', 'e' };
static mxArray * _mxarray18_;
static mxArray * _mxarray20_;

static mxChar _array22_[5] = { 'd', 'e', 'l', 't', 'a' };
static mxArray * _mxarray21_;

static mxChar _array24_[8] = { 'd', 'e', 'l', 't', 'a', 't', 'a', 'n' };
static mxArray * _mxarray23_;

static mxChar _array26_[6] = { 't', 'a', 'n', 's', 'i', 'g' };
static mxArray * _mxarray25_;

static mxChar _array28_[47] = { 'U', 's', 'e', ' ', 'T', 'A', 'N', 'S',
                                'I', 'G', '(', 0x0027, 'd', 'e', 'r', 'i',
                                'v', 0x0027, ')', ' ', 'i', 'n', 's', 't',
                                'e', 'a', 'd', ' ', 'o', 'f', ' ', 'T',
                                'A', 'N', 'S', 'I', 'G', '(', 0x0027, 'd',
                                'e', 'l', 't', 'a', 0x0027, ')', '.' };
static mxArray * _mxarray27_;

static mxChar _array30_[4] = { 'i', 'n', 'i', 't' };
static mxArray * _mxarray29_;

static mxChar _array32_[5] = { 'n', 'w', 't', 'a', 'n' };
static mxArray * _mxarray31_;

static mxChar _array34_[53] = { 'U', 's', 'e', ' ', 'n', 'e', 't', 'w', 'o',
                                'r', 'k', ' ', 'p', 'r', 'o', 'p', 'r', 'e',
                                't', 'i', 'e', 's', ' ', 't', 'o', ' ', 'o',
                                'b', 't', 'a', 'i', 'n', ' ', 'i', 'n', 'i',
                                't', 'i', 'a', 'l', 'i', 'z', 'a', 't', 'i',
                                'o', 'n', ' ', 'i', 'n', 'f', 'o', '.' };
static mxArray * _mxarray33_;

static mxChar _array36_[18] = { 'U', 'n', 'r', 'e', 'c', 'o', 'g', 'n', 'i',
                                'z', 'e', 'd', ' ', 'c', 'o', 'd', 'e', '.' };
static mxArray * _mxarray35_;

static mxChar _array38_[47] = { 'U', 's', 'e', ' ', 'T', 'A', 'N', 'S',
                                'I', 'G', '(', 'N', 'E', 'T', 'S', 'U',
                                'M', '(', 'Z', ',', 'B', ')', ')', ' ',
                                'i', 'n', 's', 't', 'e', 'a', 'd', ' ',
                                'o', 'f', ' ', 'T', 'A', 'N', 'S', 'I',
                                'G', '(', 'Z', ',', 'B', ')', '.' };
static mxArray * _mxarray37_;
static mxArray * _mxarray39_;
static mxArray * _mxarray40_;

void InitializeModule_tansig(void) {
    _mxarray0_ = mclInitializeString(21, _array1_);
    _mxarray2_ = mclInitializeString(5, _array3_);
    _mxarray4_ = mclInitializeString(7, _array5_);
    _mxarray6_ = mclInitializeString(4, _array7_);
    _mxarray8_ = mclInitializeString(11, _array9_);
    _mxarray10_ = mclInitializeString(6, _array11_);
    _mxarray12_ = mclInitializeDoubleVector(1, 2, _array13_);
    _mxarray14_ = mclInitializeString(6, _array15_);
    _mxarray16_ = mclInitializeDoubleVector(1, 2, _array17_);
    _mxarray18_ = mclInitializeString(4, _array19_);
    _mxarray20_ = mclInitializeDouble(1.0);
    _mxarray21_ = mclInitializeString(5, _array22_);
    _mxarray23_ = mclInitializeString(8, _array24_);
    _mxarray25_ = mclInitializeString(6, _array26_);
    _mxarray27_ = mclInitializeString(47, _array28_);
    _mxarray29_ = mclInitializeString(4, _array30_);
    _mxarray31_ = mclInitializeString(5, _array32_);
    _mxarray33_ = mclInitializeString(53, _array34_);
    _mxarray35_ = mclInitializeString(18, _array36_);
    _mxarray37_ = mclInitializeString(47, _array38_);
    _mxarray39_ = mclInitializeDouble(2.0);
    _mxarray40_ = mclInitializeDouble(-2.0);
}

void TerminateModule_tansig(void) {
    mxDestroyArray(_mxarray40_);
    mxDestroyArray(_mxarray39_);
    mxDestroyArray(_mxarray37_);
    mxDestroyArray(_mxarray35_);
    mxDestroyArray(_mxarray33_);
    mxDestroyArray(_mxarray31_);
    mxDestroyArray(_mxarray29_);
    mxDestroyArray(_mxarray27_);
    mxDestroyArray(_mxarray25_);
    mxDestroyArray(_mxarray23_);
    mxDestroyArray(_mxarray21_);
    mxDestroyArray(_mxarray20_);
    mxDestroyArray(_mxarray18_);
    mxDestroyArray(_mxarray16_);
    mxDestroyArray(_mxarray14_);
    mxDestroyArray(_mxarray12_);
    mxDestroyArray(_mxarray10_);
    mxDestroyArray(_mxarray8_);
    mxDestroyArray(_mxarray6_);
    mxDestroyArray(_mxarray4_);
    mxDestroyArray(_mxarray2_);
    mxDestroyArray(_mxarray0_);
}

static mxArray * Mtansig(int nargout_, mxArray * n, mxArray * b);

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

/*
 * The function "mlfTansig" contains the normal interface for the "tansig"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnet\tansig.m" (lines
 * 1-107). This function processes any input arguments and passes them to the
 * implementation version of the function, appearing above.
 */
mxArray * mlfTansig(mxArray * n, mxArray * b) {
    int nargout = 1;
    mxArray * a = NULL;
    mlfEnterNewContext(0, 2, n, b);
    a = Mtansig(nargout, n, b);
    mlfRestorePreviousContext(0, 2, n, b);
    return mlfReturnValue(a);
}

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

/*
 * The function "Mtansig" is the implementation version of the "tansig"
 * M-function from file "d:\matlab6p5\toolbox\nnet\nnet\tansig.m" (lines
 * 1-107). 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 a = tansig(n,b)
 */
static mxArray * Mtansig(int nargout_, mxArray * n, mxArray * b) {
    mexLocalFunctionTable save_local_function_table_
      = mclSetCurrentLocalFunctionTable(&_local_function_table_tansig);
    int nargin_ = mclNargin(2, n, b, NULL);
    mxArray * a = NULL;
    mxArray * i = NULL;
    mxArray * ans = NULL;

⌨️ 快捷键说明

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