📄 matrix.h
字号:
/*
* @(#)matrix.h generated by: makeheader 3.10 Tue Jun 18 00:53:14 2002
*
* built from: ../include/copyright.h
* ../include/mxassert.h
* alloccbk.c
* alloclst.c
* array.c
* array2.c
* arraycbk.c
* arraycpy.c
* assignmt.c
* bytestr.c
* catenate.c
* cellindex.c
* checkdim.c
* conversions.c
* end.c
* errmsg.c
* error.cpp
* fcnreg.c
* fmxapi.c
* funhdl.c
* ieee_wrap.c
* indexcpy.c
* iocbk.c
* marshal.c
* mcat.c
* mxapiv4.c
* mxapiv5.c
* mxequal.c
* mxutil.c
* nameindex.c
* nargchk.c
* numconv.c
* opaque.c
* permute.c
* populate.c
* referenc.c
* resize.c
* rndcolon.c
* scopemgr.c
* spassex.c
* sprefex.c
* strconv.c
* transpose.cpp
* txtcmp.c
* undoc.c
* warning.c
* modver/modver.c
* mxdbg.h
* PUB_HEADER_LIST
* ../../src/include/copyright.h
*/
#ifndef matrix_h
#define matrix_h
/* $Revision: 1.4 $ */
/*
* Copyright (c) 1984-2001 The MathWorks, Inc.
* All Rights Reserved.
*/
/* $Revision: 1.5 $ */
/*
mxAssert(int expression, char *error_message)
---------------------------------------------
Similar to ANSI C's assert() macro, the mxAssert macro checks the
value of an assertion, continuing execution only if the assertion
holds. If 'expression' evaluates to be true, then the mxAssert does
nothing. If, however, 'expression' is false, then mxAssert prints an
error message to the MATLAB Command Window, consisting of the failed
assertion's expression, the file name and line number where the failed
assertion occurred, and the string 'error_message'. 'error_message'
allows the user to specify a more understandable description of why
the assertion failed. (Use an empty string if no extra description
should follow the failed assertion message.) After a failed
assertion, control returns to the MATLAB command line.
mxAssertS, (the S for Simple), takes the same inputs as mxAssert. It
does not print the text of the failed assertion, only the file and
line where the assertion failed, and the explanatory error_message.
Note that script MEX will turn off these assertions when building
optimized MEX-functions, so they should be used for debugging
purposes only.
*/
#ifdef __cplusplus
extern "C" {
#endif
#ifdef MATLAB_MEX_FILE
# ifndef NDEBUG
extern void mexPrintAssertion(
const char *test,
const char *fname,
int linenum,
const char *message);
# define mxAssert(test, message) ( (test) ? (void) 0 : mexPrintAssertion(": " #test ",", __FILE__, __LINE__, message))
# define mxAssertS(test, message) ( (test) ? (void) 0 : mexPrintAssertion("", __FILE__, __LINE__, message))
# else
# define mxAssert(test, message) ((void) 0)
# define mxAssertS(test, message) ((void) 0)
# endif
#else
# include <assert.h>
# define mxAssert(test, message) assert(test)
# define mxAssertS(test, message) assert(test)
#endif
#ifdef __cplusplus
} /* extern "C" */
#endif
#ifdef __cplusplus
extern "C" {
#endif
#include <stddef.h> /* size_t */
/*
* allocate memory, notifying registered listener
*/
extern void *mxMalloc(
size_t n /* number of bytes */
);
/*
* allocate cleared memory, notifying registered listener.
*/
extern void *mxCalloc(
size_t n, /* number of objects */
size_t size /* size of objects */
);
/*
* free memory, notifying registered listener.
*/
extern void mxFree(void *ptr); /* pointer to memory to be freed */
/*
* reallocate memory, notifying registered listener.
*/
extern void *mxRealloc(void *ptr, size_t size);
#if !defined(mxArray_DEFINED)
/*
* Incomplete definition of mxArray
*/
typedef struct mxArray_tag mxArray;
#define mxArray_DEFINED
#endif /* !defined(mxArray_DEFINED) */
#include "tmwtypes.h"
typedef void(*mxFunctionPtr)(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]);
#define mxMAXNAM TMW_NAME_LENGTH_MAX /* maximum name length */
#if !defined(__APPLE__)
typedef bool mxLogical;
#else
typedef unsigned char mxLogical;
#endif
typedef uint16_T mxChar;
/*
* Flipped the position of mxLOGICAL_CLASS and mxOBJECT_CLASS
* to make sure that mxOBJECT_CLASS is last in the list.
*/
typedef enum {
mxUNKNOWN_CLASS = 0,
mxCELL_CLASS,
mxSTRUCT_CLASS,
mxLOGICAL_CLASS,
mxCHAR_CLASS,
mxSPARSE_CLASS, /* OBSOLETE! DO NOT USE */
mxDOUBLE_CLASS,
mxSINGLE_CLASS,
mxINT8_CLASS,
mxUINT8_CLASS,
mxINT16_CLASS,
mxUINT16_CLASS,
mxINT32_CLASS,
mxUINT32_CLASS,
mxINT64_CLASS, /* place holder - future enhancements */
mxUINT64_CLASS, /* place holder - future enhancements */
mxFUNCTION_CLASS,
mxOPAQUE_CLASS,
mxOBJECT_CLASS
} mxClassID;
typedef enum {
mxREAL,
mxCOMPLEX
} mxComplexity;
#if defined(ARRAY_ACCESS_INLINING) && !defined(MATLAB_COMPILER_GENERATED_CODE)
/*
* This modified version of the mxArray structure is needed to support
* the ARRAY_ACCESS_INLINING macros. NOTE: The elements in this structure
* should not be accessed directly. Inlined MEX-files are NOT guaranteed
* to be portable from one release of MATLAB to another.
*/
struct mxArray_tag {
void *reserved;
int reserved1[2];
void *reserved2;
int number_of_dims;
unsigned int reserved3;
struct {
unsigned int scalar_flag : 1;
unsigned int flag1 : 1;
unsigned int flag2 : 1;
unsigned int flag3 : 1;
unsigned int flag4 : 1;
unsigned int flag5 : 1;
unsigned int flag6 : 1;
unsigned int flag7 : 1;
unsigned int private_data_flag : 1;
unsigned int flag8 : 1;
unsigned int flag9 : 1;
unsigned int flag10 : 1;
unsigned int flag11 : 4;
unsigned int flag12 : 8;
unsigned int flag13 : 8;
} flags;
unsigned int reserved4[2];
union {
struct {
void *pdata;
void *pimag_data;
void *reserved5;
int reserved6[3];
} number_array;
} data;
};
#endif /* ARRAY_ACCESS_INLINING */
/*
* Return the class (catergory) of data that the array holds.
*/
extern mxClassID mxGetClassID(const mxArray *pa);
/*
* Get pointer to data
*/
extern void *mxGetData(
const mxArray *pa /* pointer to array */
);
#if defined(ARRAY_ACCESS_INLINING)
#define mxGetData(pa) ((pa)->data.number_array.pdata)
#endif /* defined(ARRAY_ACCESS_INLINING) */
/*
* Set pointer to data
*/
extern void mxSetData(
mxArray *pa, /* pointer to array */
void *newdata /* pointer to data */
);
/*
* Determine whether the specified array contains numeric (as opposed
* to cell or struct) data.
*/
extern bool mxIsNumeric(const mxArray *pa);
/*
* Determine whether the given array is a cell array.
*/
extern bool mxIsCell(const mxArray *pa);
/*
* Determine whether the given array's logical flag is on.
*/
extern bool mxIsLogical(const mxArray *pa);
/*
* Determine whether the given array contains character data.
*/
extern bool mxIsChar(const mxArray *pa);
/*
* Determine whether the given array is a structure array.
*/
extern bool mxIsStruct(const mxArray *pa);
/*
* Determine whether the given array is an opaque array.
*/
extern bool mxIsOpaque(const mxArray *pa);
/*
* Returns true if specified array is a function object.
*/
extern bool mxIsFunctionHandle(const mxArray *pa);
/*
* Is array user defined object
*/
extern bool mxIsObject(
const mxArray *pa /* pointer to array */
);
/*
* Get imaginary data pointer for numeric array
*/
extern void *mxGetImagData(
const mxArray *pa /* pointer to array */
);
#if defined(ARRAY_ACCESS_INLINING)
#define mxGetImagData(pa) ((pa)->data.number_array.pimag_data)
#endif /* defined(ARRAY_ACCESS_INLINING) */
/*
* Set imaginary data pointer for numeric array
*/
extern void mxSetImagData(
mxArray *pa, /* pointer to array */
void *newdata /* imaginary data array pointer */
);
/*
* Determine whether the given array contains complex data.
*/
extern bool mxIsComplex(const mxArray *pa);
/*
* Determine whether the given array is a sparse (as opposed to full).
*/
extern bool mxIsSparse(const mxArray *pa);
/*
* Determine whether the specified array represents its data as
* double-precision floating-point numbers.
*/
extern bool mxIsDouble(const mxArray *pa);
/*
* Determine whether the specified array represents its data as
* single-precision floating-point numbers.
*/
extern bool mxIsSingle(const mxArray *pa);
/*
* Determine whether the specified array represents its data as
* signed 8-bit integers.
*/
extern bool mxIsInt8(const mxArray *pa);
/*
* Determine whether the specified array represents its data as
* unsigned 8-bit integers.
*/
extern bool mxIsUint8(const mxArray *pa);
/*
* Determine whether the specified array represents its data as
* signed 16-bit integers.
*/
extern bool mxIsInt16(const mxArray *pa);
/*
* Determine whether the specified array represents its data as
* unsigned 16-bit integers.
*/
extern bool mxIsUint16(const mxArray *pa);
/*
* Determine whether the specified array represents its data as
* signed 32-bit integers.
*/
extern bool mxIsInt32(const mxArray *pa);
/*
* Determine whether the specified array represents its data as
* unsigned 32-bit integers.
*/
extern bool mxIsUint32(const mxArray *pa);
/*
* Determine whether the specified array represents its data as
* signed 64-bit integers.
*/
extern bool mxIsInt64(const mxArray *pa);
/*
* Determine whether the specified array represents its data as
* unsigned 64-bit integers.
*/
extern bool mxIsUint64(const mxArray *pa);
/*
* Get real data pointer for numeric array
*/
extern double *mxGetPr(
const mxArray *pa /* pointer to array */
);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -