SPEIGS 1.0.0
matrix.h
1/*
2 * External header for the libmx library.
3 *
4 * Copyright 1984-2018 The MathWorks, Inc.
5 * All Rights Reserved.
6 */
7
8#ifdef MDA_ARRAY_HPP_
9#error Using MATLAB Data API with C Matrix API is not supported.
10#endif
11
12#if defined(_MSC_VER)
13#pragma once
14#endif
15#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3))
16#pragma once
17#endif
18
19#ifndef matrix_h
20#define matrix_h
21
22#include <stdlib.h>
23#include <stddef.h>
24#include "tmwtypes.h"
25
26#ifdef __cplusplus
27#define LIBMMWMATRIX_PUBLISHED_API_EXTERN_C extern "C"
28#else
29#define LIBMMWMATRIX_PUBLISHED_API_EXTERN_C extern
30#endif
31
32
33
34#define MW_FIRST_API_VERSION 700
35#define R2017b 700
36#define R2018a 800
37#define R2018b 800
38#define R2019a 800
39#define R2019b 800
40#define R201aa 800
41#define R201ab 800
42#define R201ba 800
43#define R201bb 800
44#define R201ca 800
45#define R201cb 800
46#define R201da 800
47#define R201db 800
48#define R201ea 800
49#define R201eb 800
50#define R201fa 800
51#define R201fb 800
52#define R2020a 800
53#define R2020b 800
54#define MW_LATEST_API_VERSION 800
55
56
57#define MW_REL2VER(A) A
58
59#if defined(MX_COMPAT_32) || defined(MEX_DOUBLE_HANDLE)
60
61#if defined(MATLAB_MEXCMD_RELEASE) || defined(MATLAB_MEXSRC_RELEASE)
62
63/* Errors! Legacy knobs cannot be used with release-based hard knobs */
64
65#if defined(MX_COMPAT_32) && defined(MATLAB_MEXCMD_RELEASE)
66#error "MEX command option -R20XXx is incompatible with MX_COMPAT_32"
67#endif
68
69#if defined(MEX_DOUBLE_HANDLE) && defined(MATLAB_MEXCMD_RELEASE)
70#error "MEX command option -R20XXx is incompatible with MEX_DOUBLE_HANDLE"
71#endif
72
73#if defined(MX_COMPAT_32) && defined(MATLAB_MEXSRC_RELEASE)
74#error "Source code macro MATLAB_MEXSRC_RELEASE is incompatible with MX_COMPAT_32"
75#endif
76
77#if defined(MEX_DOUBLE_HANDLE) && defined(MATLAB_MEXSRC_RELEASE)
78#error "Source code macro MATLAB_MEXSRC_RELEASE is incompatible with MEX_DOUBLE_HANDLE"
79#endif
80
81#else
82
83/* Legacy knobs are defined */
84
85#define MATLAB_TARGET_API_VERSION MW_FIRST_API_VERSION
86
87#endif
88
89#else /* defined(MX_COMPAT_32) || defined(MEX_DOUBLE_HANDLE) */
90
91/* No Legacy knobs. Check release-based tag */
92
93#if defined(MATLAB_MEXCMD_RELEASE)
94#define MW_MEXCMD_VERSION MW_REL2VER(MATLAB_MEXCMD_RELEASE)
95#if MW_MEXCMD_VERSION < MW_FIRST_API_VERSION
96#error invalid MATLAB_MEXCMD_RELEASE definition
97#endif
98#endif
99
100#if defined(MATLAB_MEXSRC_RELEASE)
101#define MW_MEXSRC_VERSION MW_REL2VER(MATLAB_MEXSRC_RELEASE)
102#if MW_MEXSRC_VERSION < MW_FIRST_API_VERSION
103#error invalid MATLAB_MEXSRC_RELEASE definition
104#endif
105#endif
106
107#if defined(MATLAB_DEFAULT_RELEASE)
108#define MW_DEFAULT_VERSION MW_REL2VER(MATLAB_DEFAULT_RELEASE)
109#if MW_DEFAULT_VERSION < MW_FIRST_API_VERSION
110#error invalid MATLAB_DEFAULT_RELEASE definition
111#endif
112#endif
113
114#if defined(MATLAB_MEXCMD_RELEASE) && defined(MATLAB_MEXSRC_RELEASE)
115#if MW_MEXCMD_VERSION != MW_MEXSRC_VERSION
116#error "MEX command option -R20XXx is incompatible with MATLAB_MEXSRC_RELEASE"
117#endif
118#endif
119
120#if defined(MATLAB_MEXCMD_RELEASE) || defined(MATLAB_MEXSRC_RELEASE)
121
122/* Check whether MEXCMD and MEXSRC release tags are compatible */
123
124#if defined(MATLAB_MEXCMD_RELEASE)
125#define MATLAB_TARGET_API_VERSION MW_MEXCMD_VERSION
126#else
127#define MATLAB_TARGET_API_VERSION MW_MEXSRC_VERSION
128#endif
129
130#else /* defined(MATLAB_MEXCMD_RELEASE) || defined(MATLAB_MEXSRC_RELEASE) */
131
132#if defined(MATLAB_DEFAULT_RELEASE)
133#define MATLAB_TARGET_API_VERSION MW_DEFAULT_VERSION
134#else
135
136/* None of the input macros are defined. Use LATEST */
137#define MATLAB_TARGET_API_VERSION MW_LATEST_API_VERSION
138
139#endif /* defined(MATLAB_DEFAULT_RELEASE) */
140
141#endif /* defined(MATLAB_MEXCMD_RELEASE) || defined(MATLAB_MEXSRC_RELEASE) */
142
143#endif /* defined(MX_COMPAT_32) || defined(MEX_DOUBLE_HANDLE) */
144
145#if defined(TARGET_API_VERSION)
146#if MATLAB_TARGET_API_VERSION != TARGET_API_VERSION
147#error MATLAB_TARGET_API_VERSION != TARGET_API_VERSION
148#endif
149#else
150#define TARGET_API_VERSION MATLAB_TARGET_API_VERSION
151#endif
152
153
154
158typedef struct mxArray_tag mxArray;
159
163typedef void (*mxFunctionPtr)(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]);
164
168#define mxMAXNAM TMW_NAME_LENGTH_MAX
169
173typedef bool mxLogical;
174
178typedef CHAR16_T mxChar;
179
183typedef enum {
184 mxUNKNOWN_CLASS = 0,
185 mxCELL_CLASS,
186 mxSTRUCT_CLASS,
187 mxLOGICAL_CLASS,
188 mxCHAR_CLASS,
189 mxVOID_CLASS,
190 mxDOUBLE_CLASS,
191 mxSINGLE_CLASS,
192 mxINT8_CLASS,
193 mxUINT8_CLASS,
194 mxINT16_CLASS,
195 mxUINT16_CLASS,
196 mxINT32_CLASS,
197 mxUINT32_CLASS,
198 mxINT64_CLASS,
199 mxUINT64_CLASS,
200 mxFUNCTION_CLASS,
201 mxOPAQUE_CLASS,
202 mxOBJECT_CLASS,
203#if defined(_LP64) || defined(_WIN64)
204 mxINDEX_CLASS = mxUINT64_CLASS
205#else
206 mxINDEX_CLASS = mxUINT32_CLASS
207#endif
208} mxClassID;
209
213typedef enum { mxREAL, mxCOMPLEX } mxComplexity;
214
215/*
216 * MATRIX numeric real data types
217 */
218typedef double mxDouble;
219typedef float mxSingle;
220typedef int8_T mxInt8;
221typedef uint8_T mxUint8;
222typedef int16_T mxInt16;
223typedef uint16_T mxUint16;
224typedef int32_T mxInt32;
225typedef uint32_T mxUint32;
226typedef int64_T mxInt64;
227typedef uint64_T mxUint64;
228
229#if TARGET_API_VERSION >= 800
230/*
231 * MATRIX numeric complex data types
232 */
233typedef struct { mxDouble real, imag; } mxComplexDouble;
234typedef struct { mxSingle real, imag; } mxComplexSingle;
235typedef struct { mxInt8 real, imag; } mxComplexInt8;
236typedef struct { mxUint8 real, imag; } mxComplexUint8;
237typedef struct { mxInt16 real, imag; } mxComplexInt16;
238typedef struct { mxUint16 real, imag; } mxComplexUint16;
239typedef struct { mxInt32 real, imag; } mxComplexInt32;
240typedef struct { mxUint32 real, imag; } mxComplexUint32;
241typedef struct { mxInt64 real, imag; } mxComplexInt64;
242typedef struct { mxUint64 real, imag; } mxComplexUint64;
243
244#endif /* TARGET_API_VERSION >= 800 */
245
246#if defined(TARGET_API_VERSION)
247#if !(TARGET_API_VERSION == 700 || TARGET_API_VERSION == 800)
248#error invalid TARGET_VERSION_API definition
249#elif defined(MEX_DOUBLE_HANDLE) && TARGET_API_VERSION != 700
250#error It is illegal to use MEX_DOUBLE_HANDLE with linear versioning
251#elif defined(MX_COMPAT_32) && TARGET_API_VERSION != 700
252#error It is illegal to use MX_COMPAT_32 with linear versioning
253#endif
254#endif
255
256
257#if !defined(TARGET_API_VERSION) || TARGET_API_VERSION == 700
258
259/*
260 * PUBLISHED APIs with changes in MATLAB 7.3
261 */
262
263#if !defined(MX_COMPAT_32)
264
265#define mxSetProperty mxSetProperty_730
266#define mxGetProperty mxGetProperty_730
267#define mxSetField mxSetField_730
268#define mxSetFieldByNumber mxSetFieldByNumber_730
269#define mxGetFieldByNumber mxGetFieldByNumber_730
270#define mxGetField mxGetField_730
271#define mxCreateStructMatrix mxCreateStructMatrix_730
272#define mxCreateCellMatrix mxCreateCellMatrix_730
273#define mxCreateCharMatrixFromStrings mxCreateCharMatrixFromStrings_730
274#define mxGetString mxGetString_730
275#define mxGetNumberOfDimensions mxGetNumberOfDimensions_730
276#define mxGetDimensions mxGetDimensions_730
277#define mxSetDimensions mxSetDimensions_730
278#define mxSetIr mxSetIr_730
279#define mxGetIr mxGetIr_730
280#define mxSetJc mxSetJc_730
281#define mxGetJc mxGetJc_730
282#define mxCreateStructArray mxCreateStructArray_730
283#define mxCreateCharArray mxCreateCharArray_730
284#define mxCreateNumericArray mxCreateNumericArray_730
285#define mxCreateCellArray mxCreateCellArray_730
286#define mxCreateLogicalArray mxCreateLogicalArray_730
287#define mxGetCell mxGetCell_730
288#define mxSetCell mxSetCell_730
289#define mxSetNzmax mxSetNzmax_730
290#define mxSetN mxSetN_730
291#define mxSetM mxSetM_730
292#define mxGetNzmax mxGetNzmax_730
293#define mxCreateDoubleMatrix mxCreateDoubleMatrix_730
294#define mxCreateNumericMatrix mxCreateNumericMatrix_730
295#define mxCreateLogicalMatrix mxCreateLogicalMatrix_730
296#define mxCreateSparse mxCreateSparse_730
297#define mxCreateSparseLogicalMatrix mxCreateSparseLogicalMatrix_730
298#define mxGetNChars mxGetNChars_730
299#define mxCreateStringFromNChars mxCreateStringFromNChars_730
300#define mxCalcSingleSubscript mxCalcSingleSubscript_730
301#define mxGetDimensions_fcn mxGetDimensions_730
302
303#else /* MX_COMPAT_32 */
304
305/*
306 * 32-bit compatibility APIs
307 */
308
309#define mxGetNumberOfDimensions mxGetNumberOfDimensions_700
310#define mxGetDimensions mxGetDimensions_700
311#define mxGetDimensions_fcn mxGetDimensions_700
312#define mxGetIr mxGetIr_700
313#define mxGetJc mxGetJc_700
314#define mxGetCell mxGetCell_700
315#define mxGetNzmax mxGetNzmax_700
316#define mxSetNzmax mxSetNzmax_700
317#define mxGetFieldByNumber mxGetFieldByNumber_700
318#define mxSetProperty mxSetProperty_700
319#define mxGetProperty mxGetProperty_700
320#define mxSetField mxSetField_700
321#define mxSetFieldByNumber mxSetFieldByNumber_700
322#define mxGetField mxGetField_700
323#define mxCreateStructMatrix mxCreateStructMatrix_700
324#define mxCreateCellMatrix mxCreateCellMatrix_700
325#define mxCreateCharMatrixFromStrings mxCreateCharMatrixFromStrings_700
326#define mxGetString mxGetString_700
327#define mxSetDimensions mxSetDimensions_700
328#define mxSetIr mxSetIr_700
329#define mxSetJc mxSetJc_700
330#define mxCreateStructArray mxCreateStructArray_700
331#define mxCreateCharArray mxCreateCharArray_700
332#define mxCreateNumericArray mxCreateNumericArray_700
333#define mxCreateCellArray mxCreateCellArray_700
334#define mxCreateLogicalArray mxCreateLogicalArray_700
335#define mxSetCell mxSetCell_700
336#define mxSetN mxSetN_700
337#define mxSetM mxSetM_700
338#define mxCreateDoubleMatrix mxCreateDoubleMatrix_700
339#define mxCreateNumericMatrix mxCreateNumericMatrix_700
340#define mxCreateLogicalMatrix mxCreateLogicalMatrix_700
341#define mxCreateSparse mxCreateSparse_700
342#define mxCreateSparseLogicalMatrix mxCreateSparseLogicalMatrix_700
343#define mxGetNChars mxGetNChars_700
344#define mxCreateStringFromNChars mxCreateStringFromNChars_700
345#define mxCalcSingleSubscript mxCalcSingleSubscript_700
346
347#endif /* #ifdef MX_COMPAT_32 */
348
349
350#elif TARGET_API_VERSION == 800
351
352#define mxMalloc mxMalloc_800
353#define mxCalloc mxCalloc_800
354#define mxRealloc mxRealloc_800
355#define mxGetM mxGetM_800
356#define mxGetN mxGetN_800
357#define mxGetNumberOfElements mxGetNumberOfElements_800
358#define mxFree mxFree_800
359#define mxGetEps mxGetEps_800
360#define mxGetInf mxGetInf_800
361#define mxGetFieldNameByNumber mxGetFieldNameByNumber_800
362#define mxGetClassID mxGetClassID_800
363#define mxIsNumeric mxIsNumeric_800
364#define mxIsCell mxIsCell_800
365#define mxIsLogical mxIsLogical_800
366#define mxIsChar mxIsChar_800
367#define mxIsStruct mxIsStruct_800
368#define mxIsSparse mxIsSparse_800
369#define mxIsDouble mxIsDouble_800
370#define mxIsSingle mxIsSingle_800
371#define mxIsInt8 mxIsInt8_800
372#define mxIsUint8 mxIsUint8_800
373#define mxIsInt16 mxIsInt16_800
374#define mxIsUint16 mxIsUint16_800
375#define mxIsInt32 mxIsInt32_800
376#define mxIsUint32 mxIsUint32_800
377#define mxIsInt64 mxIsInt64_800
378#define mxIsUint64 mxIsUint64_800
379#define mxIsFromGlobalWS mxIsFromGlobalWS_800
380#define mxIsEmpty mxIsEmpty_800
381#define mxGetFieldNumber mxGetFieldNumber_800
382#define mxGetNumberOfFields mxGetNumberOfFields_800
383#define mxGetClassName mxGetClassName_800
384#define mxIsClass mxIsClass_800
385#define mxDestroyArray mxDestroyArray_800
386#define mxCreateDoubleScalar mxCreateDoubleScalar_800
387#define mxCreateString mxCreateString_800
388#define mxAddField mxAddField_800
389#define mxRemoveField mxRemoveField_800
390#define mxGetNaN mxGetNaN_800
391#define mxIsFinite mxIsFinite_800
392#define mxIsInf mxIsInf_800
393#define mxIsNaN mxIsNaN_800
394#define mxIsScalar mxIsScalar_800
395#define mxIsOpaque mxIsOpaque_800
396#define mxIsFunctionHandle mxIsFunctionHandle_800
397#define mxIsObject mxIsObject_800
398#define mxGetChars mxGetChars_800
399#define mxGetUserBits mxGetUserBits_800
400#define mxSetUserBits mxSetUserBits_800
401#define mxSetFromGlobalWS mxSetFromGlobalWS_800
402#define mxCreateUninitNumericMatrix mxCreateUninitNumericMatrix_800
403#define mxCreateUninitNumericArray mxCreateUninitNumericArray_800
404#define mxGetLogicals mxGetLogicals_800
405#define mxCreateLogicalScalar mxCreateLogicalScalar_800
406#define mxIsLogicalScalar mxIsLogicalScalar_800
407#define mxIsLogicalScalarTrue mxIsLogicalScalarTrue_800
408#define mxArrayToString mxArrayToString_800
409#define mxArrayToUTF8String mxArrayToUTF8String_800
410#define mxSetClassName mxSetClassName_800
411#define mxGetNumberOfDimensions mxGetNumberOfDimensions_800
412#define mxGetDimensions mxGetDimensions_800
413#define mxGetIr mxGetIr_800
414#define mxGetJc mxGetJc_800
415#define mxGetNzmax mxGetNzmax_800
416#define mxGetFieldByNumber mxGetFieldByNumber_800
417#define mxGetCell mxGetCell_800
418#define mxSetIr mxSetIr_800
419#define mxSetJc mxSetJc_800
420#define mxCalcSingleSubscript mxCalcSingleSubscript_800
421#define mxSetCell mxSetCell_800
422#define mxSetFieldByNumber mxSetFieldByNumber_800
423#define mxGetField mxGetField_800
424#define mxSetField mxSetField_800
425#define mxGetProperty mxGetProperty_800
426#define mxSetProperty mxSetProperty_800
427#define mxCreateNumericMatrix mxCreateNumericMatrix_800
428#define mxCreateNumericArray mxCreateNumericArray_800
429#define mxCreateCharArray mxCreateCharArray_800
430#define mxCreateDoubleMatrix mxCreateDoubleMatrix_800
431#define mxCreateSparse mxCreateSparse_800
432#define mxGetString mxGetString_800
433#define mxCreateCharMatrixFromStrings mxCreateCharMatrixFromStrings_800
434#define mxCreateCellMatrix mxCreateCellMatrix_800
435#define mxCreateCellArray mxCreateCellArray_800
436#define mxCreateStructMatrix mxCreateStructMatrix_800
437#define mxCreateStructArray mxCreateStructArray_800
438#define mxCreateLogicalArray mxCreateLogicalArray_800
439#define mxCreateLogicalMatrix mxCreateLogicalMatrix_800
440#define mxCreateSparseLogicalMatrix mxCreateSparseLogicalMatrix_800
441#define mxCreateStringFromNChars mxCreateStringFromNChars_800
442#define mxGetNChars mxGetNChars_800
443#define mxSetM mxSetM_800
444#define mxSetN mxSetN_800
445#define mxSetDimensions mxSetDimensions_800
446#define mxSetNzmax mxSetNzmax_800
447#define mxGetData mxGetData_800
448#define mxSetData mxSetData_800
449#define mxIsComplex mxIsComplex_800
450#define mxGetScalar mxGetScalar_800
451#define mxGetPr mxGetPr_800
452#define mxSetPr mxSetPr_800
453#define mxGetElementSize mxGetElementSize_800
454#define mxDuplicateArray mxDuplicateArray_800
455#define mxGetDoubles mxGetDoubles_800
456#define mxSetDoubles mxSetDoubles_800
457#define mxGetComplexDoubles mxGetComplexDoubles_800
458#define mxSetComplexDoubles mxSetComplexDoubles_800
459#define mxGetSingles mxGetSingles_800
460#define mxSetSingles mxSetSingles_800
461#define mxGetComplexSingles mxGetComplexSingles_800
462#define mxSetComplexSingles mxSetComplexSingles_800
463#define mxGetInt8s mxGetInt8s_800
464#define mxSetInt8s mxSetInt8s_800
465#define mxGetComplexInt8s mxGetComplexInt8s_800
466#define mxSetComplexInt8s mxSetComplexInt8s_800
467#define mxGetUint8s mxGetUint8s_800
468#define mxSetUint8s mxSetUint8s_800
469#define mxGetComplexUint8s mxGetComplexUint8s_800
470#define mxSetComplexUint8s mxSetComplexUint8s_800
471#define mxGetInt16s mxGetInt16s_800
472#define mxSetInt16s mxSetInt16s_800
473#define mxGetComplexInt16s mxGetComplexInt16s_800
474#define mxSetComplexInt16s mxSetComplexInt16s_800
475#define mxGetUint16s mxGetUint16s_800
476#define mxSetUint16s mxSetUint16s_800
477#define mxGetComplexUint16s mxGetComplexUint16s_800
478#define mxSetComplexUint16s mxSetComplexUint16s_800
479#define mxGetInt32s mxGetInt32s_800
480#define mxSetInt32s mxSetInt32s_800
481#define mxGetComplexInt32s mxGetComplexInt32s_800
482#define mxSetComplexInt32s mxSetComplexInt32s_800
483#define mxGetUint32s mxGetUint32s_800
484#define mxSetUint32s mxSetUint32s_800
485#define mxGetComplexUint32s mxGetComplexUint32s_800
486#define mxSetComplexUint32s mxSetComplexUint32s_800
487#define mxGetInt64s mxGetInt64s_800
488#define mxSetInt64s mxSetInt64s_800
489#define mxGetComplexInt64s mxGetComplexInt64s_800
490#define mxSetComplexInt64s mxSetComplexInt64s_800
491#define mxGetUint64s mxGetUint64s_800
492#define mxSetUint64s mxSetUint64s_800
493#define mxGetComplexUint64s mxGetComplexUint64s_800
494#define mxSetComplexUint64s mxSetComplexUint64s_800
495#define mxMakeArrayReal mxMakeArrayReal_800
496#define mxMakeArrayComplex mxMakeArrayComplex_800
497#define mxGetPi mxGetPiIsDeprecated
498#define mxGetImagData mxGetImagDataIsDeprecated
499#define mxSetImagData mxSetImagDataIsDeprecated
500#define mxSetPi mxSetPiIsDeprecated
501#define mxCreateSharedDataCopy mxCreateSharedDataCopyIsDeprecated
502#define mxCreateUninitDoubleMatrix mxCreateUninitDoubleMatrixIsDeprecated
503#define mxFastZeros mxFastZerosIsDeprecated
504#define mxUnreference mxUnreferenceIsDeprecated
505#define mxUnshareArray mxUnshareArrayIsDeprecated
506#define mxGetPropertyShared mxGetPropertySharedIsDeprecated
507#define mxSetPropertyShared mxSetPropertySharedIsDeprecated
508
509#endif /* TARGET_API_VERSION */
510
511/*
512 * allocate memory, notifying registered listener
513 */
514LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void *mxMalloc(size_t n /* number of bytes */
515 );
516
517/*
518 * allocate cleared memory, notifying registered listener.
519 */
520LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void *mxCalloc(size_t n, /* number of objects */
521 size_t size /* size of objects */
522 );
523
524/*
525 * free memory, notifying registered listener.
526 */
527LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxFree(void *ptr) /* pointer to memory to be freed */;
528
529/*
530 * reallocate memory, notifying registered listener.
531 */
532LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void *mxRealloc(void *ptr, size_t size);
533
534/*
535 * Get number of dimensions in array
536 */
537LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mwSize mxGetNumberOfDimensions(const mxArray *pa);
538
539/*
540 * Get pointer to dimension array
541 */
542LIBMMWMATRIX_PUBLISHED_API_EXTERN_C const mwSize *mxGetDimensions(const mxArray *pa);
543
544/*
545 * Get row dimension
546 */
547LIBMMWMATRIX_PUBLISHED_API_EXTERN_C size_t mxGetM(const mxArray *pa);
548
549/*
550 * Get row data pointer for sparse numeric array
551 */
552LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mwIndex *mxGetIr(const mxArray *pa);
553
554/*
555 * Get column data pointer for sparse numeric array
556 */
557LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mwIndex *mxGetJc(const mxArray *pa);
558
559/*
560 * Get maximum nonzero elements for sparse numeric array
561 */
562LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mwSize mxGetNzmax(const mxArray *pa);
563
564/*
565 * Set maximum nonzero elements for numeric array
566 */
567LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetNzmax(mxArray *pa, mwSize nzmax);
568
569/*
570 * Return pointer to the nth field name
571 */
572LIBMMWMATRIX_PUBLISHED_API_EXTERN_C const char *mxGetFieldNameByNumber(const mxArray *pa, int n);
573
574
575/*
576 * Return a pointer to the contents of the named field for
577 * the ith element (zero based).
578 */
579LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
580mxGetFieldByNumber(const mxArray *pa, mwIndex i, int fieldnum);
581
582/*
583 * Get a pointer to the specified cell element.
584 */
585LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxGetCell(const mxArray *pa, mwIndex i);
586
587/*
588 * Return the class (category) of data that the array holds.
589 */
590LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxClassID mxGetClassID(const mxArray *pa);
591
592/*
593 * Get pointer to data
594 */
595LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void *mxGetData(const mxArray *pa /* pointer to array */
596 );
597
598/*
599 * Set pointer to data
600 */
601LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetData(mxArray *pa, /* pointer to array */
602 void *newdata /* pointer to data */
603 );
604
605/*
606 * Determine whether the specified array contains numeric (as opposed
607 * to cell or struct) data.
608 */
609LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsNumeric(const mxArray *pa);
610
611/*
612 * Determine whether the given array is a cell array.
613 */
614LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsCell(const mxArray *pa);
615
616/*
617 * Determine whether the given array's logical flag is on.
618 */
619LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsLogical(const mxArray *pa);
620
621/*
622 * Determine whether the given array's scalar flag is on.
623 */
624LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsScalar(const mxArray *pa);
625
626/*
627 * Determine whether the given array contains character data.
628 */
629LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsChar(const mxArray *pa);
630
631/*
632 * Determine whether the given array is a structure array.
633 */
634LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsStruct(const mxArray *pa);
635
636/*
637 * Determine whether the given array is an opaque array.
638 */
639LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsOpaque(const mxArray *pa);
640
641/*
642 * Returns true if specified array is a function object.
643 */
644LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsFunctionHandle(const mxArray *pa);
645
646/*
647 * This function is deprecated and is preserved only for backward compatibility.
648 * DO NOT USE if possible.
649 * Is array user defined MATLAB v5 object
650 */
651LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsObject(const mxArray *pa /* pointer to array */
652 );
653#if !defined(TARGET_API_VERSION) || (TARGET_API_VERSION == 700)
654/*
655 * Get imaginary data pointer for numeric array
656 */
657LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void *mxGetImagData(const mxArray *pa /* pointer to array */
658 );
659
660/*
661 * Set imaginary data pointer for numeric array
662 */
663LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void
664mxSetImagData(mxArray *pa, /* pointer to array */
665 void *newdata /* imaginary data array pointer */
666 );
667#endif
668
669/*
670 * Determine whether the given array contains complex data.
671 */
672LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsComplex(const mxArray *pa);
673
674/*
675 * Determine whether the given array is a sparse (as opposed to full).
676 */
677LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsSparse(const mxArray *pa);
678
679/*
680 * Determine whether the specified array represents its data as
681 * double-precision floating-point numbers.
682 */
683LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsDouble(const mxArray *pa);
684
685/*
686 * Determine whether the specified array represents its data as
687 * single-precision floating-point numbers.
688 */
689LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsSingle(const mxArray *pa);
690
691/*
692 * Determine whether the specified array represents its data as
693 * signed 8-bit integers.
694 */
695LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsInt8(const mxArray *pa);
696
697/*
698 * Determine whether the specified array represents its data as
699 * unsigned 8-bit integers.
700 */
701LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsUint8(const mxArray *pa);
702
703/*
704 * Determine whether the specified array represents its data as
705 * signed 16-bit integers.
706 */
707LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsInt16(const mxArray *pa);
708
709/*
710 * Determine whether the specified array represents its data as
711 * unsigned 16-bit integers.
712 */
713LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsUint16(const mxArray *pa);
714
715/*
716 * Determine whether the specified array represents its data as
717 * signed 32-bit integers.
718 */
719LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsInt32(const mxArray *pa);
720
721/*
722 * Determine whether the specified array represents its data as
723 * unsigned 32-bit integers.
724 */
725LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsUint32(const mxArray *pa);
726
727/*
728 * Determine whether the specified array represents its data as
729 * signed 64-bit integers.
730 */
731LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsInt64(const mxArray *pa);
732
733/*
734 * Determine whether the specified array represents its data as
735 * unsigned 64-bit integers.
736 */
737LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsUint64(const mxArray *pa);
738
739/*
740 * Get number of elements in array
741 */
742LIBMMWMATRIX_PUBLISHED_API_EXTERN_C size_t mxGetNumberOfElements(
743 const mxArray *pa /* pointer to array */
744 );
745
746#if !defined(TARGET_API_VERSION) || (TARGET_API_VERSION == 700)
747/*
748 * Get imaginary data pointer for numeric array
749 */
750LIBMMWMATRIX_PUBLISHED_API_EXTERN_C double *mxGetPi(const mxArray *pa /* pointer to array */
751 );
752
753/*
754 * Set imaginary data pointer for numeric array
755 */
756LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetPi(mxArray *pa, /* pointer to array */
757 double *pi /* imaginary data array pointer */
758 );
759#endif
760
761/*
762 * Get string array data
763 */
764LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxChar *mxGetChars(const mxArray *pa /* pointer to array */
765 );
766
767/*
768 * Get 8 bits of user data stored in the mxArray header. NOTE: The state
769 * of these bits is not guaranteed to be preserved after API function
770 * calls.
771 */
772LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int mxGetUserBits(const mxArray *pa /* pointer to array */
773 );
774
775/*
776 * Set 8 bits of user data stored in the mxArray header. NOTE: The state
777 * of these bits is not guaranteed to be preserved after API function
778 * calls.
779 */
780LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetUserBits(mxArray *pa, /* pointer to array */
781 int value);
782
783/*
784 * Get the real component of the specified array's first data element.
785 */
786LIBMMWMATRIX_PUBLISHED_API_EXTERN_C double mxGetScalar(const mxArray *pa);
787
788/*
789 * Inform Watcom compilers that scalar double return values
790 * will be in the FPU register.
791 */
792#ifdef __WATCOMC__
793#pragma aux mxGetScalar value[8087];
794#endif
795
796/*
797 * Is the isFromGlobalWorkspace bit set?
798 */
799LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsFromGlobalWS(const mxArray *pa);
800
801/*
802 * Set the isFromGlobalWorkspace bit.
803 */
804LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetFromGlobalWS(mxArray *pa, bool global);
805
806/*
807 * Set row dimension
808 */
809LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetM(mxArray *pa, mwSize m);
810
811/*
812 * Get column dimension
813 */
814LIBMMWMATRIX_PUBLISHED_API_EXTERN_C size_t mxGetN(const mxArray *pa);
815
816/*
817 * Is array empty
818 */
819LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsEmpty(const mxArray *pa /* pointer to array */
820 );
821/*
822 * Get the index to the named field.
823 */
824LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int mxGetFieldNumber(const mxArray *pa, const char *name);
825
826/*
827 * Set row data pointer for sparse numeric array
828 */
829LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetIr(mxArray *pa, mwIndex *newir);
830
831/*
832 * Set column data pointer for sparse numeric array
833 */
834LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetJc(mxArray *pa, mwIndex *newjc);
835
836LIBMMWMATRIX_PUBLISHED_API_EXTERN_C double *mxGetPr(const mxArray *pa);
837LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetPr(mxArray *pa, double *newdata);
838LIBMMWMATRIX_PUBLISHED_API_EXTERN_C size_t mxGetElementSize(const mxArray *pa);
839
840/*
841 * Return the offset (in number of elements) from the beginning of
842 * the array to a given subscript.
843 */
844LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mwIndex mxCalcSingleSubscript(const mxArray *pa,
845 mwSize nsubs,
846 const mwIndex *subs);
847
848/*
849 * Get number of structure fields in array
850 * Returns 0 if mxArray is non-struct.
851 */
852LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int mxGetNumberOfFields(const mxArray *pa /* pointer to array */
853 );
854
855/*
856 * Set an element in a cell array to the specified value.
857 */
858LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetCell(mxArray *pa, mwIndex i, mxArray *value);
859
860/*
861 * Set pa[i][fieldnum] = value
862 */
863LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void
864mxSetFieldByNumber(mxArray *pa, mwIndex i, int fieldnum, mxArray *value);
865
866/*
867 * Return a pointer to the contents of the named field for the ith
868 * element (zero based). Returns NULL on no such field or if the
869 * field itself is NULL
870 */
871LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
872mxGetField(const mxArray *pa, mwIndex i, const char *fieldname);
873
874/*
875 * Sets the contents of the named field for the ith element (zero based).
876 * The input 'value' is stored in the input array 'pa' - no copy is made.
877 */
878LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void
879mxSetField(mxArray *pa, mwIndex i, const char *fieldname, mxArray *value);
880
881/*
882 * mxGetProperty returns the value of a property for a given object and index.
883 * The property must be public.
884 *
885 * If the given property name doesn't exist, or isn't public, or the object isn't
886 * the right type, then mxGetProperty returns NULL.
887 */
888LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
889mxGetProperty(const mxArray *pa, const mwIndex i, const char *propname);
890
891/*
892 * mxSetProperty sets the value of a property for a given object and index.
893 * The property must be public.
894 *
895 */
896LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void
897mxSetProperty(mxArray *pa, mwIndex i, const char *propname, const mxArray *value);
898
899/*
900 * Return the name of an array's class.
901 */
902LIBMMWMATRIX_PUBLISHED_API_EXTERN_C const char *mxGetClassName(const mxArray *pa);
903
904/*
905 * Determine whether an array is a member of the specified class.
906 */
907LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsClass(const mxArray *pa, const char *name);
908
909/*
910 * Create a numeric matrix and initialize all its data elements to 0.
911 * In standalone mode, out-of-memory will mean a NULL pointer is returned.
912 */
913LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
914mxCreateNumericMatrix(mwSize m, mwSize n, mxClassID classid, mxComplexity flag);
915
916/*
917 * Create an uninitialized numeric matrix.
918 * The resulting array must be freed with mxDestroyArray.
919 */
920LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
921mxCreateUninitNumericMatrix(size_t m, size_t n, mxClassID classid, mxComplexity flag);
922
923/*
924 * Create an uninitialized numeric array.
925 * The resulting array must be freed with mxDestroyArray.
926 */
927LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
928mxCreateUninitNumericArray(size_t ndim, size_t *dims, mxClassID classid, mxComplexity flag);
929
930/*
931 * Set column dimension
932 */
933LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetN(mxArray *pa, mwSize n);
934
935/*
936 * Set dimension array and number of dimensions. Returns 0 on success and 1
937 * if there was not enough memory available to reallocate the dimensions array.
938 */
939LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int
940mxSetDimensions(mxArray *pa, const mwSize *pdims, mwSize ndims);
941
942/*
943 * mxArray destructor
944 */
945LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxDestroyArray(mxArray *pa);
946
947/*
948 * Create a numeric array and initialize all its data elements to 0.
949 *
950 * As with mxCreateNumericMatrix, in a standalone application,
951 * out-of-memory will mean a NULL pointer is returned.
952 */
953LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
954mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity flag);
955
956/*
957 * Create an N-Dimensional array to hold string data;
958 * initialize all elements to 0.
959 */
960LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateCharArray(mwSize ndim, const mwSize *dims);
961
962/*
963 * Create a two-dimensional array to hold double-precision
964 * floating-point data; initialize each data element to 0.
965 */
966LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
967mxCreateDoubleMatrix(mwSize m, mwSize n, mxComplexity flag);
968
969/*
970 * Get a properly typed pointer to the elements of a logical array.
971 */
972LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxLogical *mxGetLogicals(const mxArray *pa);
973
974/*
975 * Create a logical array and initialize its data elements to false.
976 */
977LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateLogicalArray(mwSize ndim, const mwSize *dims);
978
979/*
980 * Create a two-dimensional array to hold logical data and
981 * initialize each data element to false.
982 */
983LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateLogicalMatrix(mwSize m, mwSize n);
984
985/*
986 * Create a logical scalar mxArray having the specified value.
987 */
988LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateLogicalScalar(bool value);
989
990/*
991 * Returns true if we have a valid logical scalar mxArray.
992 */
993LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsLogicalScalar(const mxArray *pa);
994
995/*
996 * Returns true if the logical scalar value is true.
997 */
998LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsLogicalScalarTrue(const mxArray *pa);
999
1000/*
1001 * Create a double-precision scalar mxArray initialized to the
1002 * value specified
1003 */
1004LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateDoubleScalar(double value);
1005
1006/*
1007 * Create a 2-Dimensional sparse array.
1008 *
1009 * Z = mxCreateSparse(m,n,nzmax,cmplx_flag);
1010 * An m-by-n, real or complex, sparse matrix with room for nzmax nonzeros.
1011 * Use this to allocate storage for a sparse matrix.
1012 * It allocates the structure, allocates the pr, pi, ir and jc arrays,
1013 * and sets all the fields, which may be changed later.
1014 * Avoids the question of malloc(0) by replacing nzmax = 0 with nzmax = 1.
1015 * Also sets Z->pr[0] = 0.0 so that the scalar sparse(0.0) acts like 0.0.
1016 *
1017 * Notice that the value of m is almost irrelevant. It is only stored in
1018 * the mxSetM field of the matrix structure. It does not affect the amount
1019 * of storage required by sparse matrices, or the amount of time required
1020 * by sparse algorithms. Consequently, m can be "infinite". The result
1021 * is a semi-infinite matrix with a finite number of columns and a finite,
1022 * but unspecified, number of nonzero rows.
1023 */
1024LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
1025mxCreateSparse(mwSize m, mwSize n, mwSize nzmax, mxComplexity flag);
1026
1027/*
1028 * Create a 2-D sparse logical array
1029 */
1030LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
1031mxCreateSparseLogicalMatrix(mwSize m, mwSize n, mwSize nzmax);
1032
1033/*
1034 * Copies characters from a MATLAB array to a char array
1035 * This function will attempt to perform null termination if it is possible.
1036 * nChars is the number of bytes in the output buffer
1037 */
1038LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void
1039mxGetNChars(const mxArray *pa, char *buf, mwSize nChars);
1040
1041/*
1042 * Converts a string array to a C-style string. The C-style string is in the
1043 * local codepage encoding. If the conversion for the entire Unicode string
1044 * cannot fit into the supplied character buffer, then the conversion includes
1045 * the last whole codepoint that will fit into the buffer. The string is thus
1046 * truncated at the greatest possible whole codepoint and does not split code-
1047 * points.
1048 */
1049LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int
1050mxGetString(const mxArray *pa, char *buf, mwSize buflen);
1051
1052/*
1053 * Create a NULL terminated C string from an mxArray of type mxCHAR_CLASS
1054 * Supports multibyte character sets. The resulting string must be freed
1055 * with mxFree. Returns NULL on out of memory or non-character arrays.
1056 */
1057LIBMMWMATRIX_PUBLISHED_API_EXTERN_C char *mxArrayToString(const mxArray *pa);
1058
1059/*
1060 * Create a NULL terminated C string from an mxArray of type mxCHAR_CLASS
1061 * The C style string is in UTF-8 encoding. The resulting
1062 * string must be freed with mxFree. Returns NULL on out of memory or
1063 * non-character arrays.
1064 */
1065LIBMMWMATRIX_PUBLISHED_API_EXTERN_C char *mxArrayToUTF8String(mxArray const *pa);
1066
1072LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateStringFromNChars(const char *str, mwSize n);
1073
1074/*
1075 * Create a character vector initialized from null-terminated string str. The
1076 * supplied string can use either UTF-8 encoding or the local codepage encoding.
1077 * The character data format in the mxArray will be UTF-16.
1078 */
1079LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateString(const char *str);
1080
1081/*
1082 * Create a string array initialized to the strings in str.
1083 */
1084LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateCharMatrixFromStrings(mwSize m, const char **str);
1085
1086/*
1087 * Create a 2-Dimensional cell array, with each cell initialized
1088 * to NULL.
1089 */
1090LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateCellMatrix(mwSize m, mwSize n);
1091
1092/*
1093 * Create an N-Dimensional cell array, with each cell initialized
1094 * to NULL.
1095 */
1096LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateCellArray(mwSize ndim, const mwSize *dims);
1097
1098/*
1099 * Create a 2-Dimensional structure array having the specified fields;
1100 * initialize all values to NULL.
1101 */
1102LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
1103mxCreateStructMatrix(mwSize m, mwSize n, int nfields, const char **fieldnames);
1104
1105/*
1106 * Create an N-Dimensional structure array having the specified fields;
1107 * initialize all values to NULL.
1108 */
1109LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *
1110mxCreateStructArray(mwSize ndim, const mwSize *dims, int nfields, const char **fieldnames);
1111
1112/*
1113 * Make a deep copy of an array, return a pointer to the copy.
1114 */
1115LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxDuplicateArray(const mxArray *in);
1116
1117/*
1118 * Set classname of an unvalidated object array. It is illegal to
1119 * call this function on a previously validated object array.
1120 * Return 0 for success, 1 for failure.
1121 */
1122LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int mxSetClassName(mxArray *pa, const char *classname);
1123
1124/*
1125 * Add a field to a structure array. Returns field number on success or -1
1126 * if inputs are invalid or an out of memory condition occurs.
1127 */
1128LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int mxAddField(mxArray *pa, const char *fieldname);
1129
1130/*
1131 * Remove a field from a structure array. Does nothing if no such field exists.
1132 * Does not destroy the field itself.
1133*/
1134LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxRemoveField(mxArray *pa, int field);
1135
1136/*
1137 * Function for obtaining MATLAB's concept of EPS
1138 */
1139LIBMMWMATRIX_PUBLISHED_API_EXTERN_C double mxGetEps(void);
1140
1141/*
1142 * Function for obtaining MATLAB's concept of INF (Used in MEX-File callback).
1143 */
1144LIBMMWMATRIX_PUBLISHED_API_EXTERN_C double mxGetInf(void);
1145
1146/*
1147 * Function for obtaining MATLAB's concept of NaN (Used in MEX-File callback).
1148 */
1149LIBMMWMATRIX_PUBLISHED_API_EXTERN_C double mxGetNaN(void);
1150
1151/*
1152 * test for finiteness in a machine-independent manner
1153 */
1154LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsFinite(double x /* value to test */
1155 );
1156
1157/*
1158 * test for infinity in a machine-independent manner
1159 */
1160LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsInf(double x /* value to test */
1161 );
1162/*
1163 * test for NaN in a machine-independent manner
1164 */
1165LIBMMWMATRIX_PUBLISHED_API_EXTERN_C bool mxIsNaN(double x /* value to test */
1166 );
1167#if !defined(TARGET_API_VERSION) || (TARGET_API_VERSION == 700)
1168/*
1169 * Undocumented. Removed in later APIs.
1170 */
1171LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateSharedDataCopy(const mxArray *pa);
1172LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxCreateUninitDoubleMatrix(int cmplx_flag, size_t m, size_t n);
1173LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxFastZeros(int cmplx_flag, int m, int n);
1174LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxUnreference(mxArray *pa);
1175LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int mxUnshareArray(mxArray *pa, int level);
1176LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mxArray *mxGetPropertyShared(const mxArray *pa, size_t i, const char *propname);
1177LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void mxSetPropertyShared(mxArray *pa, size_t i, const char *propname, const mxArray *value);
1178#endif
1179
1180
1181#if TARGET_API_VERSION >= 800
1182
1183/*
1184 * Typed data access for numeric arrays
1185 */
1186#define MX_DECLARE_DATA_ACCESSORS(Name) \
1187 LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mx##Name *mxGet##Name##s(mxArray const *); \
1188 LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int mxSet##Name##s(mxArray *, mx##Name *); \
1189 LIBMMWMATRIX_PUBLISHED_API_EXTERN_C mx##Complex##Name *mxGet##Complex##Name##s(mxArray const *); \
1190 LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int mxSet##Complex##Name##s(mxArray *, mx##Complex##Name *)
1191
1192MX_DECLARE_DATA_ACCESSORS(Double); /* mxDoubles*, mxComplexDoubles* in mx[SG]etDoubles, mx[SG]etComplexDoubles */
1193MX_DECLARE_DATA_ACCESSORS(Single); /* mxSingles*, mxComplexSingles* in mx[SG]etSingles, mx[SG]etComplexSingles */
1194MX_DECLARE_DATA_ACCESSORS(Int8); /* mxInt8s*, mxComplexInt8s* in mx[SG]etInt8s, mx[SG]etComplexInt8s */
1195MX_DECLARE_DATA_ACCESSORS(Uint8); /* mxUint8s*, mxComplexUint8s* in mx[SG]etUint8s, mx[SG]etComplexUint8s */
1196MX_DECLARE_DATA_ACCESSORS(Int16); /* mxInt16s*, mxComplexInt16s* in mx[SG]etInt16s, mx[SG]etComplexInt16s */
1197MX_DECLARE_DATA_ACCESSORS(Uint16); /* mxUint16s*, mxComplexUint16s* in mx[SG]etUint16s, mx[SG]etComplexUint16s */
1198MX_DECLARE_DATA_ACCESSORS(Int32); /* mxInt32s*, mxComplexInt32s* in mx[SG]etInt32s, mx[SG]etComplexInt32s */
1199MX_DECLARE_DATA_ACCESSORS(Uint32); /* mxUint32s*, mxComplexUint32s* in mx[SG]etUint32s, mx[SG]etComplexUint32s */
1200MX_DECLARE_DATA_ACCESSORS(Int64); /* mxInt64s*, mxComplexInt64s* in mx[SG]etInt64s, mx[SG]etComplexInt64s */
1201MX_DECLARE_DATA_ACCESSORS(Uint64); /* mxUint64s*, mxComplexUint64s* in mx[SG]etUint64s, mx[SG]etComplexUint64s */
1202
1203LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int mxMakeArrayReal(mxArray *);
1204LIBMMWMATRIX_PUBLISHED_API_EXTERN_C int mxMakeArrayComplex(mxArray *);
1205
1206#endif /* TARGET_API_VERSION >= 800 */
1207
1208/*
1209mxAssert(int expression, char *error_message)
1210---------------------------------------------
1211
1212 Similar to ANSI C's assert() macro, the mxAssert macro checks the
1213 value of an assertion, continuing execution only if the assertion
1214 holds. If 'expression' evaluates to be true, then the mxAssert does
1215 nothing. If, however, 'expression' is false, then mxAssert prints an
1216 error message to the MATLAB Command Window, consisting of the failed
1217 assertion's expression, the file name and line number where the failed
1218 assertion occurred, and the string 'error_message'. 'error_message'
1219 allows the user to specify a more understandable description of why
1220 the assertion failed. (Use an empty string if no extra description
1221 should follow the failed assertion message.) After a failed
1222 assertion, control returns to the MATLAB command line.
1223
1224 mxAssertS, (the S for Simple), takes the same inputs as mxAssert. It
1225 does not print the text of the failed assertion, only the file and
1226 line where the assertion failed, and the explanatory error_message.
1227
1228 Note that script MEX will turn off these assertions when building
1229 optimized MEX-functions, so they should be used for debugging
1230 purposes only.
1231*/
1232
1233#ifdef MATLAB_MEX_FILE
1234#ifndef NDEBUG
1235
1236LIBMMWMATRIX_PUBLISHED_API_EXTERN_C void
1237mexPrintAssertion(const char *test, const char *fname, int linenum, const char *message);
1238
1239#define mxAssert(test, message) \
1240 ((test) ? (void)0 : mexPrintAssertion(#test, __FILE__, __LINE__, message))
1241#define mxAssertS(test, message) \
1242 ((test) ? (void)0 : mexPrintAssertion("", __FILE__, __LINE__, message))
1243#else
1244#define mxAssert(test, message) ((void)0)
1245#define mxAssertS(test, message) ((void)0)
1246#endif
1247#else
1248#include <assert.h>
1249#define mxAssert(test, message) assert(test)
1250#define mxAssertS(test, message) assert(test)
1251#endif
1252
1253/* Current MATRIX published API version */
1254#define MX_CURRENT_API_VER 0x08000000
1255
1256/* Backward compatible current MATRIX published API version */
1257#define MX_API_VER MX_CURRENT_API_VER
1258
1259/* Backward compatible MATRIX published API versions */
1260#define MX_LAST_32BIT_VER 0x07000000
1261#define MX_LAST_SEPARATE_COMPLEX_VER 0x07300000
1262
1263/* Required MEX-file MATRIX published API version */
1264#if TARGET_API_VERSION == 700
1265#if defined(MX_COMPAT_32)
1266#define MX_TARGET_API_VER MX_LAST_32BIT_VER
1267#else
1268#define MX_TARGET_API_VER MX_LAST_SEPARATE_COMPLEX_VER
1269#endif
1270#else
1271#define MX_TARGET_API_VER MX_CURRENT_API_VER
1272#endif
1273
1274/*
1275 * The following macros enable conditional compilation based on the
1276 * target published API. The macros can be used in a single source file
1277 * that is intended to be built against multiple matrix API versions.
1278 *
1279 * MX_HAS_64BIT_ARRAY_DIMS evaluates to a non-zero value if array
1280 * dimensions are 64 bits wide.
1281 *
1282 * MX_HAS_INTERLEAVED_COMPLEX evaluates to a non-zero value if complex
1283 * array data is interleaved.
1284 *
1285 */
1286#define MX_HAS_64BIT_ARRAY_DIMS MX_TARGET_API_VER > MX_LAST_32BIT_VER
1287#define MX_HAS_INTERLEAVED_COMPLEX MX_TARGET_API_VER > MX_LAST_SEPARATE_COMPLEX_VER
1288
1289/*
1290 * Inform Watcom compilers that scalar double return values
1291 * will be in the FPU register.
1292 */
1293#ifdef __WATCOMC__
1294#pragma aux mxGetEps value[8087];
1295#pragma aux mxGetInf value[8087];
1296#pragma aux mxGetNaN value[8087];
1297#endif
1298
1299#endif /* matrix_h */
Definition: matrix.h:233
Definition: matrix.h:237
Definition: matrix.h:239
Definition: matrix.h:241
Definition: matrix.h:235
Definition: matrix.h:234
Definition: matrix.h:238
Definition: matrix.h:240
Definition: matrix.h:242
Definition: matrix.h:236