matlab define ifdef,matlib.h 源代码在线查看 - 介绍如何在VC中调用matcom编译后的函数; 如在调试过程中遇到困难请详见VC知识库文章 - 浅析VC与Matlab联合...

MATCOM header file 提供了高级数学操作的支持,包括矩阵运算、算术函数、线性代数等。定义了多种操作符和类,如Mm、Mr用于处理复杂的数学表达式,适合于Matlab-like环境。本文档涵盖了MATCOM的主要结构和用法,适用于Windows、Windows 386、Windows NT等平台。
摘要由CSDN通过智能技术生成

#ifndef matlibH#define matlibH/* * MATLIB header file * * Copyright (c) MathTools Ltd. 1994-1999. All rights reserved. */#define MATCOM_VERSION 4501#define MATCOM_BUILD 1031#if defined(__WINDOWS_386__) || defined(WIN32) || defined(_WIN32) || defined(__NT__)||defined(_MSC_VER)#ifndef __WIN32__#define __WIN32__ 1#endif#endif#if !defined(_Windows) && (defined(_WINDOWS) || defined(__WIN32__))#define _Windows 1#endif#if !defined(BIT16) && (defined(__BORLANDC__) && !defined(__WIN32__))#define BIT16 1#define HELPER#else#define HELPER template#endif#if !defined(__OS2__) && defined(__TOS_OS2__)#define __OS2__ 1#endif#if defined (_MSC_VER) || defined(__MINGW32__) #if defined (MLIBDLL) #define DLLI __declspec(dllexport) #else #define DLLI __declspec(dllimport) #endif #define DLLX __declspec(dllexport) #define DLLW#elif defined (__BORLANDC__) && defined(__WIN32__) #if defined (MLIBDLL) #define DLLI __export #else #define DLLI __import #endif #define DLLX __export #define DLLW#elif defined (__WATCOMC__) && defined(__WIN32__) #if defined (MLIBDLL) #define DLLI __export #define DLLW #else #define DLLI #define DLLW __declspec(dllimport) #endif #define DLLX __export#else #define DLLI #define DLLX #define DLLW#endif#ifdef _MSC_VER #define PPDLLI DLLI ** #define PDLLI DLLI * #define RDLLI DLLI & #define PDLLX DLLX * #define RDLLX DLLX else #define PPDLLI ** DLLI #define PDLLI * DLLI #define RDLLI & DLLI #define PDLLX * DLLX #define RDLLX & DLLX#endif#ifdef __BORLANDC__#define __MFC_COMPAT__#if __BORLANDC__#define __MINMAX_DEFINED#define _WINNETWK_#endif#endif#ifdef _MSC_VER#if _MSC_VER#define NO_BUILT_IN_SUPPORT_FOR_BOOL#endif#endif#ifdef __WATCOMC__#if __WATCOMC__#define NO_BUILT_IN_SUPPORT_FOR_BOOL#endif#pragma warning 379 9#endiftypedef unsigned charuint8;typedef floatsingle;#define max_ndims 4#define mt_stack_max_depth 513#define m_type double#include #include #include #include #undef TMP_MAX#undef abs#undef acos#undef and#undef asin#undef atan#undef atan2#undef bitand#undef bitor#undef clear#undef cos#undef exp#undef fabs#undef feof#undef ferror#undef finite#undef isinf#undef islower#undef isnan#undef isspace#undef isupper#undef log#undef log10#undef log2#undef max#undef min#undef not#undef or#undef sin#undef sin#undef sqrt#undef strcmp#undef strcmpi#undef strncmp#undef strncmpi#undef tan#undef xor#ifndef mH#define mHenum op_t { OP_DIFF, OP_DEL2, OP_GRADIENT, OP_ALL, OP_ANY, OP_CUMPROD, OP_CUMSUM, OP_MAX_1, OP_MEDIAN, OP_MIN_1, OP_PROD, OP_SUM, OP_UNWRAP, OP_ABS, OP_ACOS, OP_ACOSH, OP_ACOT, OP_ACOTH, OP_ACSC, OP_ACSCH, OP_AND, OP_ANGLE, OP_ASEC, OP_ASECH, OP_ASIN, OP_ASINH, OP_ATAN, OP_ATAN2, OP_ATANH, OP_BETA, OP_BETALN, OP_BITAND, OP_BITCMP, OP_BITGET, OP_BITOR, OP_BITRESET, OP_BITSET, OP_BITSHIFT, OP_BITXOR, OP_CEIL, OP_CONJ, OP_COS, OP_COSH, OP_COT, OP_COTH, OP_CSC, OP_CSCH, OP_EQ, OP_ERFC, OP_ERFCX, OP_ERFINV, OP_ERF, OP_EXP, OP_EXPINT, OP_FIX, OP_FLOOR, OP_GAMMA, OP_GAMMAINC, OP_GAMMALN, OP_GE, OP_GT, OP_IMAG, OP_ISFINITE, OP_ISINF, OP_ISNAN, OP_LDIVIDE, OP_LE, OP_LOG, OP_LOG10, OP_LOG2, OP_LT, OP_MAX_2, OP_MINUS, OP_MIN_2, OP_MOD, OP_MTIMES, OP_NE, OP_NOT, OP_OR, OP_PLUS, OP_POW2_1, OP_POW2_2, OP_POWER, OP_RDIVIDE, OP_REM, OP_ROUND, OP_SEC, OP_SECH, OP_SIGN, OP_SIN, OP_SINC, OP_SINH, OP_SQRT, OP_TAN, OP_TANH, OP_TIMES, OP_UMINUS, OP_UPLUS, OP_XOR};#undef TMP_MAX#undef abs#undef acos#undef and#undef asin#undef atan#undef atan2#undef bitand#undef bitor#undef clear#undef cos#undef exp#undef fabs#undef feof#undef ferror#undef finite#undef isinf#undef islower#undef isnan#undef isspace#undef isupper#undef log#undef log10#undef log2#undef max#undef min#undef not#undef or#undef sin#undef sin#undef sqrt#undef strcmp#undef strcmpi#undef strncmp#undef strncmpi#undef tan#undef xorclass Mm;typedef const Mm& cMm;class Mr;typedef const Mr& cMr;#define dMm(x) Mm x(i_o,#x,0)#define M_VECTOR(x,v) x=zeros(1,int(sizeof(v)/sizeof(v[0]))); \ copy_data(x.addr(),v,int(sizeof(v)/sizeof(v[0])));#define mswitch(x)switchdepth++; switchvar.br(switchdepth)=switchinit(x); do#define beginmswitchif (switchfalse)#define mcase(x)else if (isequal(x,switchvar.br(switchdepth)))#define otherwiseelse#define endmswitchwhile (0);switchdepth--struct i_o_t { int i; int o;};#define Mcinitsz 16class Mc { friend class Mm; const Mm* initd[Mcinitsz]; int initdyn[Mcinitsz]; const Mm** d; int* dyn; int siz; int last; int cl; void DLLI operator =(const Mc&);public: DLLI Mc(); DLLI Mc(const Mc& x); DLLI Mc(int new_cl, int new_dyn, cMm x); DLLI ~Mc(); const Mm* br(int idx) const { return d[idx-1]; } int size() const { return last+1; } Mc RDLLI operator ,(cMm x); Mc RDLLI operator ,(const char* x); Mc RDLLI operator ,(double x);};enum Mr_idx { Mr_idxx=-1, Mr_idx0=0, Mr_idx1=1, Mr_idx2=2, Mr_idx3=3, Mr_idx4=4};enum Mr_idx_type { Mr_idx_paren='(', Mr_idx_br='{', Mr_idx_struct='.', Mr_idx_error='?'};class Mr {public: friend class Mm; Mr_idx indexed; Mr_idx_type how; const char* field; int isr; Mm* data; Mr* datar; int idx_free[max_ndims]; Mm* idx[max_ndims]; DLLI Mr(); DLLI Mr(cMm src); DLLI Mr(cMr src); DLLI Mr(cMm src, const char* f); DLLI Mr(cMr src, const char* f); DLLI Mr(Mr_idx_type new_how, cMm src, cMm i0); DLLI Mr(Mr_idx_type new_how, cMm src, cMm i0, cMm i1); DLLI Mr(Mr_idx_type new_how, cMm src, cMm i0, cMm i1, cMm i2); DLLI Mr(Mr_idx_type new_how, cMm src, cMm i0, cMm i1, cMm i2, cMm i3); DLLI Mr(Mr_idx_type new_how, cMr src, cMm i0); DLLI Mr(Mr_idx_type new_how, cMr src, cMm i0, cMm i1); DLLI Mr(Mr_idx_type new_how, cMr src, cMm i0, cMm i1, cMm i2); DLLI Mr(Mr_idx_type new_how, cMr src, cMm i0, cMm i1, cMm i2, cMm i3); DLLI ~Mr(); int DLLI size() const; Mr DLLI member(const char* field_name) const { return Mr(*this, field_name); } Mr DLLI operator ()(cMm i0) const { return Mr(Mr_idx_paren, *this, i0); } Mr DLLI operator ()(cMm i0, cMm i1) const { return Mr(Mr_idx_paren, *this, i0, i1); } Mr DLLI operator ()(cMm i0, cMm i1, cMm i2) const { return Mr(Mr_idx_paren, *this, i0, i1, i2); } Mr DLLI operator ()(cMm i0, cMm i1, cMm i2, cMm i3) const { return Mr(Mr_idx_paren, *this, i0, i1, i2, i3); } Mr DLLI br(cMm i0) const { return Mr(Mr_idx_br,*this, i0); } Mr DLLI br(cMm i0, cMm i1) const { return Mr(Mr_idx_br,*this, i0, i1); } Mr DLLI br(cMm i0, cMm i1, cMm i2) const { return Mr(Mr_idx_br,*this, i0, i1, i2); } Mr DLLI br(cMm i0, cMm i1, cMm i2, cMm i3) const { return Mr(Mr_idx_br,*this, i0, i1, i2, i3); } void DLLI operator =(cMm src); void DLLI operator =(cMr src); int find_index_sizes(int sub_index_sizes[max_ndims]) const; int advance_linear_index(int sub_index_sizes[max_ndims], int sub_index[max_ndims], int sub_indexed[max_ndims],int find_limits, int index_limits[max_ndims], int err) const;}; // Mr/* TODOtemplate class Sr { friend class M; int indexed; M& data; int idx[max_ndims];public: DLLI Sr(); DLLI Sr(const Sr& src); DLLI Sr(const M& src); DLLI Sr(const M& src, m_type i0); DLLI Sr(const M& src, m_type i0, m_type i1); DLLI Sr(const M& src, m_type i0, m_type i1, m_type i2); DLLI Sr(const M& src, m_type i0, m_type i1, m_type i2, m_type i3); DLLI ~Sr(); void DLLI operator =(const M& src); void DLLI operator =(const Sr& src);}; // Sr*/enum mt_matrix_types { mt_uninit_matrix=0, mt_double_matrix, mt_uint8_matrix, mt_matrix_matrix

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值