📄 matrix.h
字号:
/*
* @(#)matrix.h generated by: makeheader Sun Sep 10 10:14:07 2000
*
* built from: ../include/copyright.h
* ../include/mxassert.h
* alloccbk.c
* alloclst.c
* array.c
* array2.c
* arraycbk.c
* arraycpy.c
* assignmt.c
* catenate.c
* cellindex.c
* checkdim.c
* conversions.c
* end.c
* errmsg.c
* error.c
* errtable.c
* fmxapi.c
* funhdl.c
* ieee_wrap.c
* indexcpy.c
* iocbk.c
* mcat.c
* mxapiv4.c
* mxequal.c
* mxutil.c
* nargchk.c
* numconv.c
* opaque.c
* permute.c
* populate.c
* referenc.c
* resize.c
* rndcolon.c
* scopemgr.c
* strconv.c
* transpose.c
* txtcmp.c
* undoc.c
* warning.c
* wrnstate.c
* modver/modver.c
* mxdbg.h
*/
#ifndef matrix_h
#define matrix_h
/* $Revision: 1.3 $ */
/*
* Copyright (c) 1984-2000 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);
typedef struct mxArray_tag mxArray;
#include "tmwtypes.h"
/*typedef struct mxArray_tag mxArray;*/
typedef void(*mxFunctionPtr)(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]);
#define mxMAXNAM 32 /* maximum name length */
typedef uint16_T mxChar;
typedef enum {
mxUNKNOWN_CLASS = 0,
mxCELL_CLASS,
mxSTRUCT_CLASS,
mxOBJECT_CLASS,
mxCHAR_CLASS,
mxSPARSE_CLASS,
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
} 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 {
char name[mxMAXNAM];
int reserved1[2];
void *reserved2;
int number_of_dims;
int reserved3[4];
union {
struct {
void *pdata;
void *pimag_data;
void *reserved4;
int reserved5[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 array name.
*/
extern const char *mxGetName(
const mxArray *pa /* pointer to array */
);
#if defined(ARRAY_ACCESS_INLINING)
#define mxGetName(pa) ((const char *)((pa)->name))
#endif /* defined(ARRAY_ACCESS_INLINING) */
/*
* Set array name. This routine copies the string pointed to by s
* into the mxMAXNAM length character name field.
*/
extern void mxSetName(
mxArray *pa, /* pointer to array */
const char *s /* string to copy into name */
);
/*
* 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 */
);
/*
* Get real data pointer for numeric array
*/
extern double *mxGetPr(
const mxArray *pa /* pointer to array */
);
#if defined(ARRAY_ACCESS_INLINING)
#define mxGetPr(pa) ((double *)mxGetData(pa))
#endif /* defined(ARRAY_ACCESS_INLINING) */
/*
* Set real data pointer for numeric array
*/
extern void mxSetPr(
mxArray *pa, /* pointer to array */
double *pr /* real data array pointer */
);
/*
* 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 contains character data.
*/
extern bool mxIsChar(const mxArray *pa);
/*
* Determine whether the given array is a sparse (as opposed to full).
*/
extern bool mxIsSparse(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 */
);
/*
* Get imaginary data pointer for numeric array
*/
extern double *mxGetPi(
const mxArray *pa /* pointer to array */
);
#if defined(ARRAY_ACCESS_INLINING)
#define mxGetPi(pa) ((double *)mxGetImagData(pa))
#endif /* defined(ARRAY_ACCESS_INLINING) */
/*
* Set imaginary data pointer for numeric array
*/
extern void mxSetPi(
mxArray *pa, /* pointer to array */
double *pi /* imaginary data array pointer */
);
/*
* Determine whether the given array contains complex data.
*/
extern bool mxIsComplex(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 given array's logical flag is on.
*/
extern bool mxIsLogical(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 8 bits of user data stored in the mxArray header. NOTE: This state
* of these bits are not guaranteed to be preserved after API function
* calls.
*/
extern int mxGetUserBits(
const mxArray *pa /* pointer to array */
);
/*
* Set 8 bits of user data stored in the mxArray header. NOTE: This state
* of these bits are not guaranteed to be preserved after API function
* calls.
*/
extern void mxSetUserBits(
mxArray *pa, /* pointer to array */
int value
);
#ifdef __WATCOMC__
#ifndef __cplusplus
#pragma aux mxGetScalar value [8087];
#endif
#endif
/*
* Get the real component of the specified array's first data element.
*/
extern double mxGetScalar(const mxArray *pa);
/*
* Specify that the data in an array is to be treated as Boolean data.
*/
extern void mxSetLogical(mxArray *pa);
/*
* Specify that the data in an array is to be treated as numerical
* (as opposed to Boolean) data.
*/
extern void mxClearLogical(mxArray *pa);
/*
* Is the isFromGlobalWorkspace bit set?
*/
extern bool mxIsFromGlobalWS(const mxArray *pa);
/*
* Set the isFromGlobalWorkspace bit.
*/
extern void mxSetFromGlobalWS(mxArray *pa, bool global);
/*
* Get number of dimensions in array
*/
extern int mxGetNumberOfDimensions(
const mxArray *pa /* pointer to array */
);
#if defined(ARRAY_ACCESS_INLINING)
#define mxGetNumberOfDimensions(pa) ((pa)->number_of_dims)
#endif /* defined(ARRAY_ACCESS_INLINING) */
/*
* Get pointer to dimension array
*/
extern const int *mxGetDimensions(
const mxArray *pa /* pointer to array */
);
/*
* Get row dimension
*/
extern int mxGetM(
const mxArray *pa /* pointer to array */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -