📄 matrix.h
字号:
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#if defined(ARRAY_ACCESS_INLINING)
#define mxGetPr(pa) ((double *)mxGetData(pa))
#endif /* defined(ARRAY_ACCESS_INLINING) */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set real data pointer for numeric array
*/
extern void mxSetPr(
mxArray *pa, /* pointer to array */
double *pr /* real data array pointer */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get imaginary data pointer for numeric array
*/
extern double *mxGetPi(
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#if defined(ARRAY_ACCESS_INLINING)
#define mxGetPi(pa) ((double *)mxGetImagData(pa))
#endif /* defined(ARRAY_ACCESS_INLINING) */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set imaginary data pointer for numeric array
*/
extern void mxSetPi(
mxArray *pa, /* pointer to array */
double *pi /* imaginary data array pointer */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get string array data
*/
extern mxChar *mxGetChars(
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#if defined(ARRAY_ACCESS_INLINING)
#define mxGetChars(pa) ((mxChar *)mxGetData(pa))
#endif /* defined(ARRAY_ACCESS_INLINING) */
#ifdef __cplusplus
extern "C" {
#endif
/*
* 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 */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* 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 __cplusplus
}
#endif
#ifdef __WATCOMC__
#ifndef __cplusplus
#pragma aux mxGetScalar value [8087];
#endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get the real component of the specified array's first data element.
*/
extern double mxGetScalar(const mxArray *pa);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Is the isFromGlobalWorkspace bit set?
*/
extern bool mxIsFromGlobalWS(const mxArray *pa);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set the isFromGlobalWorkspace bit.
*/
extern void mxSetFromGlobalWS(mxArray *pa, bool global);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get row dimension
*/
extern int mxGetM(
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set row dimension
*/
extern void mxSetM(
mxArray *pa, /* pointer to array */
int m /* row dimension */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get column dimension
*/
extern int mxGetN(
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Is array empty
*/
extern bool mxIsEmpty(
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get row data pointer for sparse numeric array
*/
extern int *mxGetIr(
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set row data pointer for numeric array
*/
extern void mxSetIr(
mxArray *pa, /* pointer to array */
int *newir /* row data array pointer */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get column data pointer for sparse numeric array
*/
extern int *mxGetJc(
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set column data pointer for numeric array
*/
extern void mxSetJc(
mxArray *pa, /* pointer to array */
int *newjc /* column data array pointer */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get maximum nonzero elements for sparse numeric array
*/
extern int mxGetNzmax(
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set maximum nonzero elements for numeric array
*/
extern void mxSetNzmax(
mxArray *pa, /* pointer to array */
int nzmax /* maximum nonzero elements */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get array data element size
*/
extern int mxGetElementSize(const mxArray *pa);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Return the offset (in number of elements) from the beginning of
* the array to a given subscript.
*/
extern int mxCalcSingleSubscript(const mxArray *pa, int nsubs, const int *subs);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get number of structure fields in array
*/
extern int mxGetNumberOfFields(
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get a pointer to the specified cell element.
*/
extern mxArray *mxGetCell(const mxArray *pa, int i);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set an element in a cell array to the specified value.
*/
extern void mxSetCell(mxArray *pa, int i, mxArray *value);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Return pointer to the nth field name
*/
extern const char *mxGetFieldNameByNumber(const mxArray *pa, int n);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Get the index to the named field.
*/
extern int mxGetFieldNumber(const mxArray *pa, const char *name);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Return a pointer to the contents of the named field for
* the ith element (zero based).
*/
extern mxArray *mxGetFieldByNumber(const mxArray *pa, int i, int fieldnum);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set pa[i][fieldnum] = value
*/
extern void mxSetFieldByNumber(mxArray *pa, int i, int fieldnum, mxArray *value);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Return a pointer to the contents of the named field for the ith
* element (zero based). Returns NULL on no such field or if the
* field itself is NULL
*/
extern mxArray *mxGetField(const mxArray *pa, int i, const char *fieldname);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set pa[i]->fieldname = value
*/
extern void mxSetField(mxArray *pa, int i, const char *fieldname, mxArray *value);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Return the name of an array's class.
*/
extern const char *mxGetClassName(const mxArray *pa);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Determine whether an array is a member of the specified class.
*/
extern bool mxIsClass(const mxArray *pa, const char *name);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set scalar double flag
*/
extern void mxSetScalarDoubleFlag(
mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#if defined(ARRAY_ACCESS_INLINING)
#define mxSetScalarDoubleFlag(pa) ((pa)->flags.scalar_flag = true)
#endif /* defined(ARRAY_ACCESS_INLINING) */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Clear scalar double flag
*/
extern void mxClearScalarDoubleFlag(
mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#if defined(ARRAY_ACCESS_INLINING)
#define mxClearScalarDoubleFlag(pa) ((pa)->flags.scalar_flag = false)
#endif /* defined(ARRAY_ACCESS_INLINING) */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Is scalar double flag set
*/
extern bool mxIsScalarDoubleFlagSet(
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#if defined(ARRAY_ACCESS_INLINING)
#define mxIsScalarDoubleFlagSet(pa) ((pa)->flags.scalar_flag == 1)
#endif /* defined(ARRAY_ACCESS_INLINING) */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set scalar flag if appropiate (double scalar)
*/
extern void mxSetScalarDoubleFlagIfAppropiate(
mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Mark data as unshareable
*/
extern void mxSetDataPrivateFlag(
mxArray *pa, /* pointer to array */
bool val
);
#ifdef __cplusplus
}
#endif
#if defined(ARRAY_ACCESS_INLINING)
#define mxSetDataPrivateFlag(pa, val) ((pa)->flags.private_data_flag = (int)(val))
#endif /* defined(ARRAY_ACCESS_INLINING) */
#ifdef __cplusplus
extern "C" {
#endif
/*
* Is data unshareable?
*/
extern bool mxIsDataPrivate(
const mxArray *pa /* pointer to array */
);
#ifdef __cplusplus
}
#endif
#if defined(ARRAY_ACCESS_INLINING)
#define mxIsDataPrivate(pa) (((pa)->flags.private_data_flag==1) ? true : false)
#endif /* defined(ARRAY_ACCESS_INLINING) */
#include <stdlib.h>
#define MX_DYNAMIC_STRUCT_REF_ERROR "Argument to dynamic structure reference must evaluate to a valid field name"
#ifdef __cplusplus
extern "C" {
#endif
/*
* Create a numeric matrix and initialize all its data elements to 0.
*/
extern mxArray *mxCreateNumericMatrix(
int m,
int n,
mxClassID classid,
int cmplx_flag
);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set column dimension
*/
extern void mxSetN(mxArray *pa, int n);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Set dimension array and number of dimensions. Returns 0 on success and 1
* if there was not enough memory available to reallocate the dimensions array.
*/
extern int mxSetDimensions(mxArray *pa, const int *size, int ndims);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* mxArray destructor
*/
extern void mxDestroyArray(mxArray *pa);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
* Create a numeric array and initialize all its data elements to 0.
*
* Similar to mxCreateNumericMatrix, in a standalone application,
* out-of-memory will mean a NULL pointer is returned.
*/
extern mxArray *mxCreateNumericArray(int ndim, const int *dims, mxClassID classid, mxComplexity flag);
#ifdef __cplusplus
}
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -