📄 matrix.h
字号:
/*
* @(#)matrix.h generated by: makeheader Fri Apr 25 00:51:35 1997
*
* built from: copyright.h
* ../../src/include/mathwork.hh
* ../../src/include/mxassert.h
* ../../src/matrix/array.c
* ../../src/matrix/array2.c
* ../../src/matrix/ieee_wrap.c
* ../../src/matrix/mxapiv4.c
* ../../src/matrix/mxdbg.h
*/
#ifndef matrix_h
#define matrix_h
/* $Revision: 1.2 $ */
/*
* Copyright (c) 1984-1997 by The MathWorks, Inc.
* All Rights Reserved.
*/
#ifdef __cplusplus
extern "C" {
#endif
#if !defined(__cplusplus) || defined(NO_BUILT_IN_SUPPORT_FOR_BOOL)
typedef int bool;
#if !defined(false)
#define false (0)
#endif
#if !defined(true)
#define true (1)
#endif
#endif /* !defined(__cplusplus) || defined(NO_BUILT_IN_SUPPORT_FOR_BOOL) */
typedef struct mxArray_tag mxArray;
/* $Revision: 1.4 $ */
/*
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 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
#include "tmwtypes.h"
#define mxMAXNAM 32 /* maximum name length */
#ifdef V4_COMPAT
typedef double Real; /* mimic MATLAB 4's matrix.h */
#endif
typedef uint16_T mxChar;
typedef enum {
mxCELL_CLASS = 1,
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 */
mxUNKNOWN_CLASS = -1
} mxClassID;
typedef enum {
mxREAL,
mxCOMPLEX
} mxComplexity;
#if defined(ARRAY_ACCESS_INLINING)
/*
* 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.
*/
struct mxArray_tag {
char name[mxMAXNAM];
int reserved1[2];
void *reserved2;
int number_of_dims;
int nelements_allocated;
int reserved3[3];
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 */
);
/*
* 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 */
);
/*
* Set pointer to data
*/
extern void mxSetData(
mxArray *pa, /* pointer to array */
void *pd /* pointer to data */
);
/*
* Get real data pointer for numeric array
*/
extern double *mxGetPr(
const mxArray *pa /* pointer to array */
);
/*
* Set real data pointer for numeric array
*/
extern void mxSetPr(
mxArray *pa, /* pointer to array */
double *pr /* real data array pointer */
);
/*
* Get imaginary data pointer for numeric array
*/
extern void *mxGetImagData(
const mxArray *pa /* pointer to array */
);
/*
* Set imaginary data pointer for numeric array
*/
extern void mxSetImagData(
mxArray *pa, /* pointer to array */
void *pi /* imaginary data array pointer */
);
/*
* Get imaginary data pointer for numeric array
*/
extern double *mxGetPi(
const mxArray *pa /* pointer to array */
);
/*
* Set imaginary data pointer for numeric array
*/
extern void mxSetPi(
mxArray *pa, /* pointer to array */
double *pi /* imaginary 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 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);
#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 */
);
/*
* Get row dimension
*/
extern int mxGetM(
const mxArray *pa /* pointer to array */
);
/*
* Set row dimension
*/
extern void mxSetM(
mxArray *pa, /* pointer to array */
int m /* row dimension */
);
/*
* Get column dimension
*/
extern int mxGetN(
const mxArray *pa /* pointer to array */
);
/*
* Get pointer to dimension array
*/
extern const int *mxGetDimensions(
const mxArray *pa /* pointer to array */
);
/*
* Is array empty
*/
extern bool mxIsEmpty(
const mxArray *pa /* pointer to array */
);
/*
* Get row data pointer for sparse numeric array
*/
extern int *mxGetIr(
const mxArray *pa /* pointer to array */
);
/*
* Set row data pointer for numeric array
*/
extern void mxSetIr(
mxArray *pa, /* pointer to array */
int *ir /* row data array pointer */
);
/*
* Get column data pointer for sparse numeric array
*/
extern int *mxGetJc(
const mxArray *pa /* pointer to array */
);
/*
* Set column data pointer for numeric array
*/
extern void mxSetJc(
mxArray *pa, /* pointer to array */
int *jc /* column data array pointer */
);
/*
* Get maximum nonzero elements for sparse numeric array
*/
extern int mxGetNzmax(
const mxArray *pa /* pointer to array */
);
/*
* Set maximum nonzero elements for numeric array
*/
extern void mxSetNzmax(
mxArray *pa, /* pointer to array */
int nzmax /* maximum nonzero elements */
);
/*
* Get number of elements in array
*/
extern int mxGetNumberOfElements(
const mxArray *pa /* pointer to array */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -