| 1 | /* |
|---|
| 2 | * @(#)matrix.h generated by: makeheader 4.21 Tue Jul 26 18:26:13 2005 |
|---|
| 3 | * |
|---|
| 4 | * built from: ../../src/include/copyright.h |
|---|
| 5 | * ../../src/include/pragma_interface.h |
|---|
| 6 | * ./alloccbk.cpp |
|---|
| 7 | * ./alloclst.cpp |
|---|
| 8 | * ./array.cpp |
|---|
| 9 | * ./array2.cpp |
|---|
| 10 | * ./arraycbk.cpp |
|---|
| 11 | * ./arraycpy.cpp |
|---|
| 12 | * ./assignmt.cpp |
|---|
| 13 | * ./bytestr.cpp |
|---|
| 14 | * ./catenate.cpp |
|---|
| 15 | * ./cellindex.cpp |
|---|
| 16 | * ./checkdim.cpp |
|---|
| 17 | * ./conversions.cpp |
|---|
| 18 | * ./end.cpp |
|---|
| 19 | * ./errmsg.cpp |
|---|
| 20 | * ./error.cpp |
|---|
| 21 | * ./fmxapi.cpp |
|---|
| 22 | * ./fmxapiv5.cpp |
|---|
| 23 | * ./funhdl.cpp |
|---|
| 24 | * ./ieee_wrap.cpp |
|---|
| 25 | * ./indexcpy.cpp |
|---|
| 26 | * ./iocbk.cpp |
|---|
| 27 | * ./marshal.cpp |
|---|
| 28 | * ./mcat.cpp |
|---|
| 29 | * ./mxapiv4.cpp |
|---|
| 30 | * ./mxapiv5.cpp |
|---|
| 31 | * ./mxassert.cpp |
|---|
| 32 | * ./mxequal.cpp |
|---|
| 33 | * ./mxutil.cpp |
|---|
| 34 | * ./nameindex.cpp |
|---|
| 35 | * ./nargchk.cpp |
|---|
| 36 | * ./numconv.cpp |
|---|
| 37 | * ./opaque.cpp |
|---|
| 38 | * ./permute.cpp |
|---|
| 39 | * ./populate.cpp |
|---|
| 40 | * ./referenc.cpp |
|---|
| 41 | * ./resize.cpp |
|---|
| 42 | * ./rndcolon.cpp |
|---|
| 43 | * ./scopemgr.cpp |
|---|
| 44 | * ./spassex.cpp |
|---|
| 45 | * ./sprefex.cpp |
|---|
| 46 | * ./strconv.cpp |
|---|
| 47 | * ./subserror.cpp |
|---|
| 48 | * ./transpose.cpp |
|---|
| 49 | * ./txtcmp.cpp |
|---|
| 50 | * ./undoc.cpp |
|---|
| 51 | * ./warning.cpp |
|---|
| 52 | * ./zbuffer.cpp |
|---|
| 53 | * mxdbg.h |
|---|
| 54 | */ |
|---|
| 55 | |
|---|
| 56 | #ifndef matrix_h |
|---|
| 57 | #define matrix_h |
|---|
| 58 | |
|---|
| 59 | |
|---|
| 60 | /* |
|---|
| 61 | * Copyright 1984-2003 The MathWorks, Inc. |
|---|
| 62 | * All Rights Reserved. |
|---|
| 63 | */ |
|---|
| 64 | |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | /* Copyright 2003-2004 The MathWorks, Inc. */ |
|---|
| 68 | |
|---|
| 69 | /* |
|---|
| 70 | * Prevent g++ from making copies of vtable and typeinfo data |
|---|
| 71 | * in every compilation unit. By allowing for only one, we can |
|---|
| 72 | * save space and prevent some situations where the linker fails |
|---|
| 73 | * to coalesce them properly into a single entry. |
|---|
| 74 | * |
|---|
| 75 | * References: |
|---|
| 76 | * http://gcc.gnu.org/onlinedocs/gcc/Vague-Linkage.html#Vague%20Linkage |
|---|
| 77 | * http://gcc.gnu.org/onlinedocs/gcc/C---Interface.html |
|---|
| 78 | */ |
|---|
| 79 | |
|---|
| 80 | #ifdef __cplusplus |
|---|
| 81 | # ifdef __linux__ |
|---|
| 82 | # pragma interface |
|---|
| 83 | # endif |
|---|
| 84 | #endif |
|---|
| 85 | |
|---|
| 86 | |
|---|
| 87 | |
|---|
| 88 | #include <stddef.h> /* size_t */ |
|---|
| 89 | |
|---|
| 90 | #ifdef __cplusplus |
|---|
| 91 | extern "C" { |
|---|
| 92 | #endif |
|---|
| 93 | /* |
|---|
| 94 | * allocate memory, notifying registered listener |
|---|
| 95 | */ |
|---|
| 96 | extern void *mxMalloc( |
|---|
| 97 | size_t n /* number of bytes */ |
|---|
| 98 | ); |
|---|
| 99 | #ifdef __cplusplus |
|---|
| 100 | } |
|---|
| 101 | #endif |
|---|
| 102 | |
|---|
| 103 | #ifdef __cplusplus |
|---|
| 104 | extern "C" { |
|---|
| 105 | #endif |
|---|
| 106 | /* |
|---|
| 107 | * allocate cleared memory, notifying registered listener. |
|---|
| 108 | */ |
|---|
| 109 | extern void *mxCalloc( |
|---|
| 110 | size_t n, /* number of objects */ |
|---|
| 111 | size_t size /* size of objects */ |
|---|
| 112 | ); |
|---|
| 113 | #ifdef __cplusplus |
|---|
| 114 | } |
|---|
| 115 | #endif |
|---|
| 116 | |
|---|
| 117 | #ifdef __cplusplus |
|---|
| 118 | extern "C" { |
|---|
| 119 | #endif |
|---|
| 120 | /* |
|---|
| 121 | * free memory, notifying registered listener. |
|---|
| 122 | */ |
|---|
| 123 | extern void mxFree(void *ptr); /* pointer to memory to be freed */ |
|---|
| 124 | #ifdef __cplusplus |
|---|
| 125 | } |
|---|
| 126 | #endif |
|---|
| 127 | |
|---|
| 128 | #ifdef __cplusplus |
|---|
| 129 | extern "C" { |
|---|
| 130 | #endif |
|---|
| 131 | /* |
|---|
| 132 | * reallocate memory, notifying registered listener. |
|---|
| 133 | */ |
|---|
| 134 | extern void *mxRealloc(void *ptr, size_t size); |
|---|
| 135 | #ifdef __cplusplus |
|---|
| 136 | } |
|---|
| 137 | #endif |
|---|
| 138 | |
|---|
| 139 | |
|---|
| 140 | #if !defined(mxArray_DEFINED) |
|---|
| 141 | /* |
|---|
| 142 | * Incomplete definition of mxArray |
|---|
| 143 | */ |
|---|
| 144 | typedef struct mxArray_tag mxArray; |
|---|
| 145 | #define mxArray_DEFINED |
|---|
| 146 | #endif /* !defined(mxArray_DEFINED) */ |
|---|
| 147 | |
|---|
| 148 | |
|---|
| 149 | #include "tmwtypes.h" |
|---|
| 150 | |
|---|
| 151 | typedef void(*mxFunctionPtr)(int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]); |
|---|
| 152 | |
|---|
| 153 | #define mxMAXNAM TMW_NAME_LENGTH_MAX /* maximum name length */ |
|---|
| 154 | |
|---|
| 155 | #if !defined(__APPLE__) |
|---|
| 156 | typedef bool mxLogical; |
|---|
| 157 | #else |
|---|
| 158 | typedef unsigned char mxLogical; |
|---|
| 159 | #endif |
|---|
| 160 | |
|---|
| 161 | #ifdef __ENABLE_UNICODE_DATA_REPRESENTATION__ |
|---|
| 162 | /* Default is UTF-16 when Unicode rep is enabled. */ |
|---|
| 163 | typedef char16_t mxChar; |
|---|
| 164 | #else |
|---|
| 165 | /* Default is schizophrenic rep when Unicode is NOT enabled. */ |
|---|
| 166 | typedef uint16_T mxChar; |
|---|
| 167 | #endif |
|---|
| 168 | |
|---|
| 169 | /* |
|---|
| 170 | * Flipped the position of mxLOGICAL_CLASS and mxOBJECT_CLASS |
|---|
| 171 | * to make sure that mxOBJECT_CLASS is last in the list. |
|---|
| 172 | */ |
|---|
| 173 | typedef enum { |
|---|
| 174 | mxUNKNOWN_CLASS = 0, |
|---|
| 175 | mxCELL_CLASS, |
|---|
| 176 | mxSTRUCT_CLASS, |
|---|
| 177 | mxLOGICAL_CLASS, |
|---|
| 178 | mxCHAR_CLASS, |
|---|
| 179 | mxVOID_CLASS, |
|---|
| 180 | mxDOUBLE_CLASS, |
|---|
| 181 | mxSINGLE_CLASS, |
|---|
| 182 | mxINT8_CLASS, |
|---|
| 183 | mxUINT8_CLASS, |
|---|
| 184 | mxINT16_CLASS, |
|---|
| 185 | mxUINT16_CLASS, |
|---|
| 186 | mxINT32_CLASS, |
|---|
| 187 | mxUINT32_CLASS, |
|---|
| 188 | mxINT64_CLASS, |
|---|
| 189 | mxUINT64_CLASS, |
|---|
| 190 | mxFUNCTION_CLASS, |
|---|
| 191 | mxOPAQUE_CLASS, |
|---|
| 192 | mxOBJECT_CLASS |
|---|
| 193 | } mxClassID; |
|---|
| 194 | |
|---|
| 195 | /* VERY TEMPORARY AND NASTY HACK TILL mxSPARSE_CLASS IS COMPLETELY ELIMINATED */ |
|---|
| 196 | #define mxSPARSE_CLASS mxVOID_CLASS /* OBSOLETE! DO NOT USE */ |
|---|
| 197 | |
|---|
| 198 | typedef enum { |
|---|
| 199 | mxREAL, |
|---|
| 200 | mxCOMPLEX |
|---|
| 201 | } mxComplexity; |
|---|
| 202 | |
|---|
| 203 | |
|---|
| 204 | #if defined(ARRAY_ACCESS_INLINING) && !defined(MATLAB_COMPILER_GENERATED_CODE) |
|---|
| 205 | /* |
|---|
| 206 | * This modified version of the mxArray structure is needed to support |
|---|
| 207 | * the ARRAY_ACCESS_INLINING macros. NOTE: The elements in this structure |
|---|
| 208 | * should not be accessed directly. Inlined MEX-files are NOT guaranteed |
|---|
| 209 | * to be portable from one release of MATLAB to another. |
|---|
| 210 | */ |
|---|
| 211 | |
|---|
| 212 | struct mxArray_tag { |
|---|
| 213 | void *reserved; |
|---|
| 214 | int reserved1[2]; |
|---|
| 215 | void *reserved2; |
|---|
| 216 | int number_of_dims; |
|---|
| 217 | unsigned int reserved3; |
|---|
| 218 | struct { |
|---|
| 219 | unsigned int scalar_flag : 1; |
|---|
| 220 | unsigned int flag1 : 1; |
|---|
| 221 | unsigned int flag2 : 1; |
|---|
| 222 | unsigned int flag3 : 1; |
|---|
| 223 | unsigned int flag4 : 1; |
|---|
| 224 | unsigned int flag5 : 1; |
|---|
| 225 | unsigned int flag6 : 1; |
|---|
| 226 | unsigned int flag7 : 1; |
|---|
| 227 | unsigned int private_data_flag : 1; |
|---|
| 228 | unsigned int flag8 : 1; |
|---|
| 229 | unsigned int flag9 : 1; |
|---|
| 230 | unsigned int flag10 : 1; |
|---|
| 231 | unsigned int flag11 : 4; |
|---|
| 232 | unsigned int flag12 : 8; |
|---|
| 233 | unsigned int flag13 : 8; |
|---|
| 234 | } flags; |
|---|
| 235 | unsigned int reserved4[2]; |
|---|
| 236 | union { |
|---|
| 237 | struct { |
|---|
| 238 | void *pdata; |
|---|
| 239 | void *pimag_data; |
|---|
| 240 | void *reserved5; |
|---|
| 241 | int reserved6[3]; |
|---|
| 242 | } number_array; |
|---|
| 243 | } data; |
|---|
| 244 | }; |
|---|
| 245 | #endif /* ARRAY_ACCESS_INLINING */ |
|---|
| 246 | |
|---|
| 247 | #ifdef __cplusplus |
|---|
| 248 | extern "C" { |
|---|
| 249 | #endif |
|---|
| 250 | /* |
|---|
| 251 | * Return the class (catergory) of data that the array holds. |
|---|
| 252 | */ |
|---|
| 253 | extern mxClassID mxGetClassID(const mxArray *pa); |
|---|
| 254 | #ifdef __cplusplus |
|---|
| 255 | } |
|---|
| 256 | #endif |
|---|
| 257 | |
|---|
| 258 | #ifdef __cplusplus |
|---|
| 259 | extern "C" { |
|---|
| 260 | #endif |
|---|
| 261 | /* |
|---|
| 262 | * Get pointer to data |
|---|
| 263 | */ |
|---|
| 264 | extern void *mxGetData( |
|---|
| 265 | const mxArray *pa /* pointer to array */ |
|---|
| 266 | ); |
|---|
| 267 | #ifdef __cplusplus |
|---|
| 268 | } |
|---|
| 269 | #endif |
|---|
| 270 | |
|---|
| 271 | |
|---|
| 272 | #if defined(ARRAY_ACCESS_INLINING) |
|---|
| 273 | #define mxGetData(pa) ((pa)->data.number_array.pdata) |
|---|
| 274 | #endif /* defined(ARRAY_ACCESS_INLINING) */ |
|---|
| 275 | |
|---|
| 276 | #ifdef __cplusplus |
|---|
| 277 | extern "C" { |
|---|
| 278 | #endif |
|---|
| 279 | /* |
|---|
| 280 | * Set pointer to data |
|---|
| 281 | */ |
|---|
| 282 | extern void mxSetData( |
|---|
| 283 | mxArray *pa, /* pointer to array */ |
|---|
| 284 | void *newdata /* pointer to data */ |
|---|
| 285 | ); |
|---|
| 286 | #ifdef __cplusplus |
|---|
| 287 | } |
|---|
| 288 | #endif |
|---|
| 289 | |
|---|
| 290 | #ifdef __cplusplus |
|---|
| 291 | extern "C" { |
|---|
| 292 | #endif |
|---|
| 293 | /* |
|---|
| 294 | * Determine whether the specified array contains numeric (as opposed |
|---|
| 295 | * to cell or struct) data. |
|---|
| 296 | */ |
|---|
| 297 | extern bool mxIsNumeric(const mxArray *pa); |
|---|
| 298 | #ifdef __cplusplus |
|---|
| 299 | } |
|---|
| 300 | #endif |
|---|
| 301 | |
|---|
| 302 | #ifdef __cplusplus |
|---|
| 303 | extern "C" { |
|---|
| 304 | #endif |
|---|
| 305 | /* |
|---|
| 306 | * Determine whether the given array is a cell array. |
|---|
| 307 | */ |
|---|
| 308 | extern bool mxIsCell(const mxArray *pa); |
|---|
| 309 | #ifdef __cplusplus |
|---|
| 310 | } |
|---|
| 311 | #endif |
|---|
| 312 | |
|---|
| 313 | #ifdef __cplusplus |
|---|
| 314 | extern "C" { |
|---|
| 315 | #endif |
|---|
| 316 | /* |
|---|
| 317 | * Determine whether the given array's logical flag is on. |
|---|
| 318 | */ |
|---|
| 319 | extern bool mxIsLogical(const mxArray *pa); |
|---|
| 320 | #ifdef __cplusplus |
|---|
| 321 | } |
|---|
| 322 | #endif |
|---|
| 323 | |
|---|
| 324 | #ifdef __cplusplus |
|---|
| 325 | extern "C" { |
|---|
| 326 | #endif |
|---|
| 327 | /* |
|---|
| 328 | * Determine whether the given array contains character data. |
|---|
| 329 | */ |
|---|
| 330 | extern bool mxIsChar(const mxArray *pa); |
|---|
| 331 | #ifdef __cplusplus |
|---|
| 332 | } |
|---|
| 333 | #endif |
|---|
| 334 | |
|---|
| 335 | #ifdef __cplusplus |
|---|
| 336 | extern "C" { |
|---|
| 337 | #endif |
|---|
| 338 | /* |
|---|
| 339 | * Determine whether the given array is a structure array. |
|---|
| 340 | */ |
|---|
| 341 | extern bool mxIsStruct(const mxArray *pa); |
|---|
| 342 | #ifdef __cplusplus |
|---|
| 343 | } |
|---|
| 344 | #endif |
|---|
| 345 | |
|---|
| 346 | #ifdef __cplusplus |
|---|
| 347 | extern "C" { |
|---|
| 348 | #endif |
|---|
| 349 | /* |
|---|
| 350 | * Determine whether the given array is an opaque array. |
|---|
| 351 | */ |
|---|
| 352 | extern bool mxIsOpaque(const mxArray *pa); |
|---|
| 353 | #ifdef __cplusplus |
|---|
| 354 | } |
|---|
| 355 | #endif |
|---|
| 356 | |
|---|
| 357 | #ifdef __cplusplus |
|---|
| 358 | extern "C" { |
|---|
| 359 | #endif |
|---|
| 360 | /* |
|---|
| 361 | * Returns true if specified array is a function object. |
|---|
| 362 | */ |
|---|
| 363 | extern bool mxIsFunctionHandle(const mxArray *pa); |
|---|
| 364 | #ifdef __cplusplus |
|---|
| 365 | } |
|---|
| 366 | #endif |
|---|
| 367 | |
|---|
| 368 | #ifdef __cplusplus |
|---|
| 369 | extern "C" { |
|---|
| 370 | #endif |
|---|
| 371 | /* |
|---|
| 372 | * Is array user defined object |
|---|
| 373 | */ |
|---|
| 374 | extern bool mxIsObject( |
|---|
| 375 | const mxArray *pa /* pointer to array */ |
|---|
| 376 | ); |
|---|
| 377 | #ifdef __cplusplus |
|---|
| 378 | } |
|---|
| 379 | #endif |
|---|
| 380 | |
|---|
| 381 | #ifdef __cplusplus |
|---|
| 382 | extern "C" { |
|---|
| 383 | #endif |
|---|
| 384 | /* |
|---|
| 385 | * Get imaginary data pointer for numeric array |
|---|
| 386 | */ |
|---|
| 387 | extern void *mxGetImagData( |
|---|
| 388 | const mxArray *pa /* pointer to array */ |
|---|
| 389 | ); |
|---|
| 390 | #ifdef __cplusplus |
|---|
| 391 | } |
|---|
| 392 | #endif |
|---|
| 393 | |
|---|
| 394 | |
|---|
| 395 | #if defined(ARRAY_ACCESS_INLINING) |
|---|
| 396 | #define mxGetImagData(pa) ((pa)->data.number_array.pimag_data) |
|---|
| 397 | #endif /* defined(ARRAY_ACCESS_INLINING) */ |
|---|
| 398 | |
|---|
| 399 | #ifdef __cplusplus |
|---|
| 400 | extern "C" { |
|---|
| 401 | #endif |
|---|
| 402 | /* |
|---|
| 403 | * Set imaginary data pointer for numeric array |
|---|
| 404 | */ |
|---|
| 405 | extern void mxSetImagData( |
|---|
| 406 | mxArray *pa, /* pointer to array */ |
|---|
| 407 | void *newdata /* imaginary data array pointer */ |
|---|
| 408 | ); |
|---|
| 409 | #ifdef __cplusplus |
|---|
| 410 | } |
|---|
| 411 | #endif |
|---|
| 412 | |
|---|
| 413 | #ifdef __cplusplus |
|---|
| 414 | extern "C" { |
|---|
| 415 | #endif |
|---|
| 416 | /* |
|---|
| 417 | * Determine whether the given array contains complex data. |
|---|
| 418 | */ |
|---|
| 419 | extern bool mxIsComplex(const mxArray *pa); |
|---|
| 420 | #ifdef __cplusplus |
|---|
| 421 | } |
|---|
| 422 | #endif |
|---|
| 423 | |
|---|
| 424 | #ifdef __cplusplus |
|---|
| 425 | extern "C" { |
|---|
| 426 | #endif |
|---|
| 427 | /* |
|---|
| 428 | * Determine whether the given array is a sparse (as opposed to full). |
|---|
| 429 | */ |
|---|
| 430 | extern bool mxIsSparse(const mxArray *pa); |
|---|
| 431 | #ifdef __cplusplus |
|---|
| 432 | } |
|---|
| 433 | #endif |
|---|
| 434 | |
|---|
| 435 | #ifdef __cplusplus |
|---|
| 436 | extern "C" { |
|---|
| 437 | #endif |
|---|
| 438 | /* |
|---|
| 439 | * Determine whether the specified array represents its data as |
|---|
| 440 | * double-precision floating-point numbers. |
|---|
| 441 | */ |
|---|
| 442 | extern bool mxIsDouble(const mxArray *pa); |
|---|
| 443 | #ifdef __cplusplus |
|---|
| 444 | } |
|---|
| 445 | #endif |
|---|
| 446 | |
|---|
| 447 | #ifdef __cplusplus |
|---|
| 448 | extern "C" { |
|---|
| 449 | #endif |
|---|
| 450 | /* |
|---|
| 451 | * Determine whether the specified array represents its data as |
|---|
| 452 | * single-precision floating-point numbers. |
|---|
| 453 | */ |
|---|
| 454 | extern bool mxIsSingle(const mxArray *pa); |
|---|
| 455 | #ifdef __cplusplus |
|---|
| 456 | } |
|---|
| 457 | #endif |
|---|
| 458 | |
|---|
| 459 | #ifdef __cplusplus |
|---|
| 460 | extern "C" { |
|---|
| 461 | #endif |
|---|
| 462 | /* |
|---|
| 463 | * Determine whether the specified array represents its data as |
|---|
| 464 | * signed 8-bit integers. |
|---|
| 465 | */ |
|---|
| 466 | extern bool mxIsInt8(const mxArray *pa); |
|---|
| 467 | #ifdef __cplusplus |
|---|
| 468 | } |
|---|
| 469 | #endif |
|---|
| 470 | |
|---|
| 471 | #ifdef __cplusplus |
|---|
| 472 | extern "C" { |
|---|
| 473 | #endif |
|---|
| 474 | /* |
|---|
| 475 | * Determine whether the specified array represents its data as |
|---|
| 476 | * unsigned 8-bit integers. |
|---|
| 477 | */ |
|---|
| 478 | extern bool mxIsUint8(const mxArray *pa); |
|---|
| 479 | #ifdef __cplusplus |
|---|
| 480 | } |
|---|
| 481 | #endif |
|---|
| 482 | |
|---|
| 483 | #ifdef __cplusplus |
|---|
| 484 | extern "C" { |
|---|
| 485 | #endif |
|---|
| 486 | /* |
|---|
| 487 | * Determine whether the specified array represents its data as |
|---|
| 488 | * signed 16-bit integers. |
|---|
| 489 | */ |
|---|
| 490 | extern bool mxIsInt16(const mxArray *pa); |
|---|
| 491 | #ifdef __cplusplus |
|---|
| 492 | } |
|---|
| 493 | #endif |
|---|
| 494 | |
|---|
| 495 | #ifdef __cplusplus |
|---|
| 496 | extern "C" { |
|---|
| 497 | #endif |
|---|
| 498 | /* |
|---|
| 499 | * Determine whether the specified array represents its data as |
|---|
| 500 | * unsigned 16-bit integers. |
|---|
| 501 | */ |
|---|
| 502 | extern bool mxIsUint16(const mxArray *pa); |
|---|
| 503 | #ifdef __cplusplus |
|---|
| 504 | } |
|---|
| 505 | #endif |
|---|
| 506 | |
|---|
| 507 | #ifdef __cplusplus |
|---|
| 508 | extern "C" { |
|---|
| 509 | #endif |
|---|
| 510 | /* |
|---|
| 511 | * Determine whether the specified array represents its data as |
|---|
| 512 | * signed 32-bit integers. |
|---|
| 513 | */ |
|---|
| 514 | extern bool mxIsInt32(const mxArray *pa); |
|---|
| 515 | #ifdef __cplusplus |
|---|
| 516 | } |
|---|
| 517 | #endif |
|---|
| 518 | |
|---|
| 519 | #ifdef __cplusplus |
|---|
| 520 | extern "C" { |
|---|
| 521 | #endif |
|---|
| 522 | /* |
|---|
| 523 | * Determine whether the specified array represents its data as |
|---|
| 524 | * unsigned 32-bit integers. |
|---|
| 525 | */ |
|---|
| 526 | extern bool mxIsUint32(const mxArray *pa); |
|---|
| 527 | #ifdef __cplusplus |
|---|
| 528 | } |
|---|
| 529 | #endif |
|---|
| 530 | |
|---|
| 531 | #ifdef __cplusplus |
|---|
| 532 | extern "C" { |
|---|
| 533 | #endif |
|---|
| 534 | /* |
|---|
| 535 | * Determine whether the specified array represents its data as |
|---|
| 536 | * signed 64-bit integers. |
|---|
| 537 | */ |
|---|
| 538 | extern bool mxIsInt64(const mxArray *pa); |
|---|
| 539 | #ifdef __cplusplus |
|---|
| 540 | } |
|---|
| 541 | #endif |
|---|
| 542 | |
|---|
| 543 | #ifdef __cplusplus |
|---|
| 544 | extern "C" { |
|---|
| 545 | #endif |
|---|
| 546 | /* |
|---|
| 547 | * Determine whether the specified array represents its data as |
|---|
| 548 | * unsigned 64-bit integers. |
|---|
| 549 | */ |
|---|
| 550 | extern bool mxIsUint64(const mxArray *pa); |
|---|
| 551 | #ifdef __cplusplus |
|---|
| 552 | } |
|---|
| 553 | #endif |
|---|
| 554 | |
|---|
| 555 | #ifdef __cplusplus |
|---|
| 556 | extern "C" { |
|---|
| 557 | #endif |
|---|
| 558 | /* |
|---|
| 559 | * Get number of dimensions in array |
|---|
| 560 | */ |
|---|
| 561 | extern int mxGetNumberOfDimensions( |
|---|
| 562 | const mxArray *pa /* pointer to array */ |
|---|
| 563 | ); |
|---|
| 564 | #ifdef __cplusplus |
|---|
| 565 | } |
|---|
| 566 | #endif |
|---|
| 567 | |
|---|
| 568 | |
|---|
| 569 | #if defined(ARRAY_ACCESS_INLINING) |
|---|
| 570 | #define mxGetNumberOfDimensions(pa) ((pa)->number_of_dims) |
|---|
| 571 | #endif /* defined(ARRAY_ACCESS_INLINING) */ |
|---|
| 572 | |
|---|
| 573 | #ifdef __cplusplus |
|---|
| 574 | extern "C" { |
|---|
| 575 | #endif |
|---|
| 576 | /* |
|---|
| 577 | * Get pointer to dimension array |
|---|
| 578 | */ |
|---|
| 579 | extern const int *mxGetDimensions( |
|---|
| 580 | const mxArray *pa /* pointer to array */ |
|---|
| 581 | ); |
|---|
| 582 | #ifdef __cplusplus |
|---|
| 583 | } |
|---|
| 584 | #endif |
|---|
| 585 | |
|---|
| 586 | #ifdef __cplusplus |
|---|
| 587 | extern "C" { |
|---|
| 588 | #endif |
|---|
| 589 | /* |
|---|
| 590 | * Get number of elements in array |
|---|
| 591 | */ |
|---|
| 592 | extern int mxGetNumberOfElements( |
|---|
| 593 | const mxArray *pa /* pointer to array */ |
|---|
| 594 | ); |
|---|
| 595 | #ifdef __cplusplus |
|---|
| 596 | } |
|---|
| 597 | #endif |
|---|
| 598 | |
|---|
| 599 | #ifdef __cplusplus |
|---|
| 600 | extern "C" { |
|---|
| 601 | #endif |
|---|
| 602 | /* |
|---|
| 603 | * Get real data pointer for numeric array |
|---|
| 604 | */ |
|---|
| 605 | extern double *mxGetPr( |
|---|
| 606 | const mxArray *pa /* pointer to array */ |
|---|
| 607 | ); |
|---|
| 608 | #ifdef __cplusplus |
|---|
| 609 | } |
|---|
| 610 | #endif |
|---|
| 611 | |
|---|
| 612 | |
|---|
| 613 | #if defined(ARRAY_ACCESS_INLINING) |
|---|
| 614 | #define mxGetPr(pa) ((double *)mxGetData(pa)) |
|---|
| 615 | #endif /* defined(ARRAY_ACCESS_INLINING) */ |
|---|
| 616 | |
|---|
| 617 | #ifdef __cplusplus |
|---|
| 618 | extern "C" { |
|---|
| 619 | #endif |
|---|
| 620 | /* |
|---|
| 621 | * Set real data pointer for numeric array |
|---|
| 622 | */ |
|---|
| 623 | extern void mxSetPr( |
|---|
| 624 | mxArray *pa, /* pointer to array */ |
|---|
| 625 | double *pr /* real data array pointer */ |
|---|
| 626 | ); |
|---|
| 627 | #ifdef __cplusplus |
|---|
| 628 | } |
|---|
| 629 | #endif |
|---|
| 630 | |
|---|
| 631 | #ifdef __cplusplus |
|---|
| 632 | extern "C" { |
|---|
| 633 | #endif |
|---|
| 634 | /* |
|---|
| 635 | * Get imaginary data pointer for numeric array |
|---|
| 636 | */ |
|---|
| 637 | extern double *mxGetPi( |
|---|
| 638 | const mxArray *pa /* pointer to array */ |
|---|
| 639 | ); |
|---|
| 640 | #ifdef __cplusplus |
|---|
| 641 | } |
|---|
| 642 | #endif |
|---|
| 643 | |
|---|
| 644 | |
|---|
| 645 | #if defined(ARRAY_ACCESS_INLINING) |
|---|
| 646 | #define mxGetPi(pa) ((double *)mxGetImagData(pa)) |
|---|
| 647 | #endif /* defined(ARRAY_ACCESS_INLINING) */ |
|---|
| 648 | |
|---|
| 649 | #ifdef __cplusplus |
|---|
| 650 | extern "C" { |
|---|
| 651 | #endif |
|---|
| 652 | /* |
|---|
| 653 | * Set imaginary data pointer for numeric array |
|---|
| 654 | */ |
|---|
| 655 | extern void mxSetPi( |
|---|
| 656 | mxArray *pa, /* pointer to array */ |
|---|
| 657 | double *pi /* imaginary data array pointer */ |
|---|
| 658 | ); |
|---|
| 659 | #ifdef __cplusplus |
|---|
| 660 | } |
|---|
| 661 | #endif |
|---|
| 662 | |
|---|
| 663 | #ifdef __cplusplus |
|---|
| 664 | extern "C" { |
|---|
| 665 | #endif |
|---|
| 666 | /* |
|---|
| 667 | * Get string array data |
|---|
| 668 | */ |
|---|
| 669 | extern mxChar *mxGetChars( |
|---|
| 670 | const mxArray *pa /* pointer to array */ |
|---|
| 671 | ); |
|---|
| 672 | #ifdef __cplusplus |
|---|
| 673 | } |
|---|
| 674 | #endif |
|---|
| 675 | |
|---|
| 676 | |
|---|
| 677 | #if defined(ARRAY_ACCESS_INLINING) |
|---|
| 678 | #define mxGetChars(pa) ((mxChar *)mxGetData(pa)) |
|---|
| 679 | #endif /* defined(ARRAY_ACCESS_INLINING) */ |
|---|
| 680 | |
|---|
| 681 | #ifdef __cplusplus |
|---|
| 682 | extern "C" { |
|---|
| 683 | #endif |
|---|
| 684 | /* |
|---|
| 685 | * Get 8 bits of user data stored in the mxArray header. NOTE: This state |
|---|
| 686 | * of these bits are not guaranteed to be preserved after API function |
|---|
| 687 | * calls. |
|---|
| 688 | */ |
|---|
| 689 | extern int mxGetUserBits( |
|---|
| 690 | const mxArray *pa /* pointer to array */ |
|---|
| 691 | ); |
|---|
| 692 | #ifdef __cplusplus |
|---|
| 693 | } |
|---|
| 694 | #endif |
|---|
| 695 | |
|---|
| 696 | #ifdef __cplusplus |
|---|
| 697 | extern "C" { |
|---|
| 698 | #endif |
|---|
| 699 | /* |
|---|
| 700 | * Set 8 bits of user data stored in the mxArray header. NOTE: This state |
|---|
| 701 | * of these bits are not guaranteed to be preserved after API function |
|---|
| 702 | * calls. |
|---|
| 703 | */ |
|---|
| 704 | extern void mxSetUserBits( |
|---|
| 705 | mxArray *pa, /* pointer to array */ |
|---|
| 706 | int value |
|---|
| 707 | ); |
|---|
| 708 | #ifdef __cplusplus |
|---|
| 709 | } |
|---|
| 710 | #endif |
|---|
| 711 | |
|---|
| 712 | |
|---|
| 713 | #ifdef __WATCOMC__ |
|---|
| 714 | #ifndef __cplusplus |
|---|
| 715 | #pragma aux mxGetScalar value [8087]; |
|---|
| 716 | #endif |
|---|
| 717 | #endif |
|---|
| 718 | |
|---|
| 719 | #ifdef __cplusplus |
|---|
| 720 | extern "C" { |
|---|
| 721 | #endif |
|---|
| 722 | /* |
|---|
| 723 | * Get the real component of the specified array's first data element. |
|---|
| 724 | */ |
|---|
| 725 | extern double mxGetScalar(const mxArray *pa); |
|---|
| 726 | #ifdef __cplusplus |
|---|
| 727 | } |
|---|
| 728 | #endif |
|---|
| 729 | |
|---|
| 730 | #ifdef __cplusplus |
|---|
| 731 | extern "C" { |
|---|
| 732 | #endif |
|---|
| 733 | /* |
|---|
| 734 | * Is the isFromGlobalWorkspace bit set? |
|---|
| 735 | */ |
|---|
| 736 | extern bool mxIsFromGlobalWS(const mxArray *pa); |
|---|
| 737 | #ifdef __cplusplus |
|---|
| 738 | } |
|---|
| 739 | #endif |
|---|
| 740 | |
|---|
| 741 | #ifdef __cplusplus |
|---|
| 742 | extern "C" { |
|---|
| 743 | #endif |
|---|
| 744 | /* |
|---|
| 745 | * Set the isFromGlobalWorkspace bit. |
|---|
| 746 | */ |
|---|
| 747 | extern void mxSetFromGlobalWS(mxArray *pa, bool global); |
|---|
| 748 | #ifdef __cplusplus |
|---|
| 749 | } |
|---|
| 750 | #endif |
|---|
| 751 | |
|---|
| 752 | #ifdef __cplusplus |
|---|
| 753 | extern "C" { |
|---|
| 754 | #endif |
|---|
| 755 | /* |
|---|
| 756 | * Get row dimension |
|---|
| 757 | */ |
|---|
| 758 | extern int mxGetM( |
|---|
| 759 | const mxArray *pa /* pointer to array */ |
|---|
| 760 | ); |
|---|
| 761 | #ifdef __cplusplus |
|---|
| 762 | } |
|---|
| 763 | #endif |
|---|
| 764 | |
|---|
| 765 | #ifdef __cplusplus |
|---|
| 766 | extern "C" { |
|---|
| 767 | #endif |
|---|
| 768 | /* |
|---|
| 769 | * Set row dimension |
|---|
| 770 | */ |
|---|
| 771 | extern void mxSetM( |
|---|
| 772 | mxArray *pa, /* pointer to array */ |
|---|
| 773 | int m /* row dimension */ |
|---|
| 774 | ); |
|---|
| 775 | #ifdef __cplusplus |
|---|
| 776 | } |
|---|
| 777 | #endif |
|---|
| 778 | |
|---|
| 779 | #ifdef __cplusplus |
|---|
| 780 | extern "C" { |
|---|
| 781 | #endif |
|---|
| 782 | /* |
|---|
| 783 | * Get column dimension |
|---|
| 784 | */ |
|---|
| 785 | extern int mxGetN( |
|---|
| 786 | const mxArray *pa /* pointer to array */ |
|---|
| 787 | ); |
|---|
| 788 | #ifdef __cplusplus |
|---|
| 789 | } |
|---|
| 790 | #endif |
|---|
| 791 | |
|---|
| 792 | #ifdef __cplusplus |
|---|
| 793 | extern "C" { |
|---|
| 794 | #endif |
|---|
| 795 | /* |
|---|
| 796 | * Is array empty |
|---|
| 797 | */ |
|---|
| 798 | extern bool mxIsEmpty( |
|---|
| 799 | const mxArray *pa /* pointer to array */ |
|---|
| 800 | ); |
|---|
| 801 | #ifdef __cplusplus |
|---|
| 802 | } |
|---|
| 803 | #endif |
|---|
| 804 | |
|---|
| 805 | #ifdef __cplusplus |
|---|
| 806 | extern "C" { |
|---|
| 807 | #endif |
|---|
| 808 | /* |
|---|
| 809 | * Get row data pointer for sparse numeric array |
|---|
| 810 | */ |
|---|
| 811 | extern int *mxGetIr( |
|---|
| 812 | const mxArray *pa /* pointer to array */ |
|---|
| 813 | ); |
|---|
| 814 | #ifdef __cplusplus |
|---|
| 815 | } |
|---|
| 816 | #endif |
|---|
| 817 | |
|---|
| 818 | #ifdef __cplusplus |
|---|
| 819 | extern "C" { |
|---|
| 820 | #endif |
|---|
| 821 | /* |
|---|
| 822 | * Set row data pointer for numeric array |
|---|
| 823 | */ |
|---|
| 824 | extern void mxSetIr( |
|---|
| 825 | mxArray *pa, /* pointer to array */ |
|---|
| 826 | int *newir /* row data array pointer */ |
|---|
| 827 | ); |
|---|
| 828 | #ifdef __cplusplus |
|---|
| 829 | } |
|---|
| 830 | #endif |
|---|
| 831 | |
|---|
| 832 | #ifdef __cplusplus |
|---|
| 833 | extern "C" { |
|---|
| 834 | #endif |
|---|
| 835 | /* |
|---|
| 836 | * Get column data pointer for sparse numeric array |
|---|
| 837 | */ |
|---|
| 838 | extern int *mxGetJc( |
|---|
| 839 | const mxArray *pa /* pointer to array */ |
|---|
| 840 | ); |
|---|
| 841 | #ifdef __cplusplus |
|---|
| 842 | } |
|---|
| 843 | #endif |
|---|
| 844 | |
|---|
| 845 | #ifdef __cplusplus |
|---|
| 846 | extern "C" { |
|---|
| 847 | #endif |
|---|
| 848 | /* |
|---|
| 849 | * Set column data pointer for numeric array |
|---|
| 850 | */ |
|---|
| 851 | extern void mxSetJc( |
|---|
| 852 | mxArray *pa, /* pointer to array */ |
|---|
| 853 | int *newjc /* column data array pointer */ |
|---|
| 854 | ); |
|---|
| 855 | #ifdef __cplusplus |
|---|
| 856 | } |
|---|
| 857 | #endif |
|---|
| 858 | |
|---|
| 859 | #ifdef __cplusplus |
|---|
| 860 | extern "C" { |
|---|
| 861 | #endif |
|---|
| 862 | /* |
|---|
| 863 | * Get maximum nonzero elements for sparse numeric array |
|---|
| 864 | */ |
|---|
| 865 | extern int mxGetNzmax( |
|---|
| 866 | const mxArray *pa /* pointer to array */ |
|---|
| 867 | ); |
|---|
| 868 | #ifdef __cplusplus |
|---|
| 869 | } |
|---|
| 870 | #endif |
|---|
| 871 | |
|---|
| 872 | #ifdef __cplusplus |
|---|
| 873 | extern "C" { |
|---|
| 874 | #endif |
|---|
| 875 | /* |
|---|
| 876 | * Set maximum nonzero elements for numeric array |
|---|
| 877 | */ |
|---|
| 878 | extern void mxSetNzmax( |
|---|
| 879 | mxArray *pa, /* pointer to array */ |
|---|
| 880 | int nzmax /* maximum nonzero elements */ |
|---|
| 881 | ); |
|---|
| 882 | #ifdef __cplusplus |
|---|
| 883 | } |
|---|
| 884 | #endif |
|---|
| 885 | |
|---|
| 886 | #ifdef __cplusplus |
|---|
| 887 | extern "C" { |
|---|
| 888 | #endif |
|---|
| 889 | /* |
|---|
| 890 | * Get array data element size |
|---|
| 891 | */ |
|---|
| 892 | extern int mxGetElementSize(const mxArray *pa); |
|---|
| 893 | #ifdef __cplusplus |
|---|
| 894 | } |
|---|
| 895 | #endif |
|---|
| 896 | |
|---|
| 897 | #ifdef __cplusplus |
|---|
| 898 | extern "C" { |
|---|
| 899 | #endif |
|---|
| 900 | /* |
|---|
| 901 | * Return the offset (in number of elements) from the beginning of |
|---|
| 902 | * the array to a given subscript. |
|---|
| 903 | */ |
|---|
| 904 | extern int mxCalcSingleSubscript(const mxArray *pa, int nsubs, const int *subs); |
|---|
| 905 | #ifdef __cplusplus |
|---|
| 906 | } |
|---|
| 907 | #endif |
|---|
| 908 | |
|---|
| 909 | #ifdef __cplusplus |
|---|
| 910 | extern "C" { |
|---|
| 911 | #endif |
|---|
| 912 | /* |
|---|
| 913 | * Get number of structure fields in array |
|---|
| 914 | */ |
|---|
| 915 | extern int mxGetNumberOfFields( |
|---|
| 916 | const mxArray *pa /* pointer to array */ |
|---|
| 917 | ); |
|---|
| 918 | #ifdef __cplusplus |
|---|
| 919 | } |
|---|
| 920 | #endif |
|---|
| 921 | |
|---|
| 922 | #ifdef __cplusplus |
|---|
| 923 | extern "C" { |
|---|
| 924 | #endif |
|---|
| 925 | /* |
|---|
| 926 | * Get a pointer to the specified cell element. |
|---|
| 927 | */ |
|---|
| 928 | extern mxArray *mxGetCell(const mxArray *pa, int i); |
|---|
| 929 | #ifdef __cplusplus |
|---|
| 930 | } |
|---|
| 931 | #endif |
|---|
| 932 | |
|---|
| 933 | #ifdef __cplusplus |
|---|
| 934 | extern "C" { |
|---|
| 935 | #endif |
|---|
| 936 | /* |
|---|
| 937 | * Set an element in a cell array to the specified value. |
|---|
| 938 | */ |
|---|
| 939 | extern void mxSetCell(mxArray *pa, int i, mxArray *value); |
|---|
| 940 | #ifdef __cplusplus |
|---|
| 941 | } |
|---|
| 942 | #endif |
|---|
| 943 | |
|---|
| 944 | #ifdef __cplusplus |
|---|
| 945 | extern "C" { |
|---|
| 946 | #endif |
|---|
| 947 | /* |
|---|
| 948 | * Return pointer to the nth field name |
|---|
| 949 | */ |
|---|
| 950 | extern const char *mxGetFieldNameByNumber(const mxArray *pa, int n); |
|---|
| 951 | #ifdef __cplusplus |
|---|
| 952 | } |
|---|
| 953 | #endif |
|---|
| 954 | |
|---|
| 955 | #ifdef __cplusplus |
|---|
| 956 | extern "C" { |
|---|
| 957 | #endif |
|---|
| 958 | /* |
|---|
| 959 | * Get the index to the named field. |
|---|
| 960 | */ |
|---|
| 961 | extern int mxGetFieldNumber(const mxArray *pa, const char *name); |
|---|
| 962 | #ifdef __cplusplus |
|---|
| 963 | } |
|---|
| 964 | #endif |
|---|
| 965 | |
|---|
| 966 | #ifdef __cplusplus |
|---|
| 967 | extern "C" { |
|---|
| 968 | #endif |
|---|
| 969 | /* |
|---|
| 970 | * Return a pointer to the contents of the named field for |
|---|
| 971 | * the ith element (zero based). |
|---|
| 972 | */ |
|---|
| 973 | extern mxArray *mxGetFieldByNumber(const mxArray *pa, int i, int fieldnum); |
|---|
| 974 | #ifdef __cplusplus |
|---|
| 975 | } |
|---|
| 976 | #endif |
|---|
| 977 | |
|---|
| 978 | #ifdef __cplusplus |
|---|
| 979 | extern "C" { |
|---|
| 980 | #endif |
|---|
| 981 | /* |
|---|
| 982 | * Set pa[i][fieldnum] = value |
|---|
| 983 | */ |
|---|
| 984 | extern void mxSetFieldByNumber(mxArray *pa, int i, int fieldnum, mxArray *value); |
|---|
| 985 | #ifdef __cplusplus |
|---|
| 986 | } |
|---|
| 987 | #endif |
|---|
| 988 | |
|---|
| 989 | #ifdef __cplusplus |
|---|
| 990 | extern "C" { |
|---|
| 991 | #endif |
|---|
| 992 | /* |
|---|
| 993 | * Return a pointer to the contents of the named field for the ith |
|---|
| 994 | * element (zero based). Returns NULL on no such field or if the |
|---|
| 995 | * field itself is NULL |
|---|
| 996 | */ |
|---|
| 997 | extern mxArray *mxGetField(const mxArray *pa, int i, const char *fieldname); |
|---|
| 998 | #ifdef __cplusplus |
|---|
| 999 | } |
|---|
| 1000 | #endif |
|---|
| 1001 | |
|---|
| 1002 | #ifdef __cplusplus |
|---|
| 1003 | extern "C" { |
|---|
| 1004 | #endif |
|---|
| 1005 | /* |
|---|
| 1006 | * Set pa[i]->fieldname = value |
|---|
| 1007 | */ |
|---|
| 1008 | extern void mxSetField(mxArray *pa, int i, const char *fieldname, mxArray *value); |
|---|
| 1009 | #ifdef __cplusplus |
|---|
| 1010 | } |
|---|
| 1011 | #endif |
|---|
| 1012 | |
|---|
| 1013 | #ifdef __cplusplus |
|---|
| 1014 | extern "C" { |
|---|
| 1015 | #endif |
|---|
| 1016 | /* |
|---|
| 1017 | * Return the name of an array's class. |
|---|
| 1018 | */ |
|---|
| 1019 | extern const char *mxGetClassName(const mxArray *pa); |
|---|
| 1020 | #ifdef __cplusplus |
|---|
| 1021 | } |
|---|
| 1022 | #endif |
|---|
| 1023 | |
|---|
| 1024 | #ifdef __cplusplus |
|---|
| 1025 | extern "C" { |
|---|
| 1026 | #endif |
|---|
| 1027 | /* |
|---|
| 1028 | * Determine whether an array is a member of the specified class. |
|---|
| 1029 | */ |
|---|
| 1030 | extern bool mxIsClass(const mxArray *pa, const char *name); |
|---|
| 1031 | #ifdef __cplusplus |
|---|
| 1032 | } |
|---|
| 1033 | #endif |
|---|
| 1034 | |
|---|
| 1035 | #ifdef __cplusplus |
|---|
| 1036 | extern "C" { |
|---|
| 1037 | #endif |
|---|
| 1038 | /* |
|---|
| 1039 | * Set scalar double flag |
|---|
| 1040 | */ |
|---|
| 1041 | extern void mxSetScalarDoubleFlag( |
|---|
| 1042 | mxArray *pa /* pointer to array */ |
|---|
| 1043 | ); |
|---|
| 1044 | #ifdef __cplusplus |
|---|
| 1045 | } |
|---|
| 1046 | #endif |
|---|
| 1047 | |
|---|
| 1048 | |
|---|
| 1049 | #if defined(ARRAY_ACCESS_INLINING) |
|---|
| 1050 | #define mxSetScalarDoubleFlag(pa) ((pa)->flags.scalar_flag = true) |
|---|
| 1051 | #endif /* defined(ARRAY_ACCESS_INLINING) */ |
|---|
| 1052 | |
|---|
| 1053 | #ifdef __cplusplus |
|---|
| 1054 | extern "C" { |
|---|
| 1055 | #endif |
|---|
| 1056 | /* |
|---|
| 1057 | * Clear scalar double flag |
|---|
| 1058 | */ |
|---|
| 1059 | extern void mxClearScalarDoubleFlag( |
|---|
| 1060 | mxArray *pa /* pointer to array */ |
|---|
| 1061 | ); |
|---|
| 1062 | #ifdef __cplusplus |
|---|
| 1063 | } |
|---|
| 1064 | #endif |
|---|
| 1065 | |
|---|
| 1066 | |
|---|
| 1067 | #if defined(ARRAY_ACCESS_INLINING) |
|---|
| 1068 | #define mxClearScalarDoubleFlag(pa) ((pa)->flags.scalar_flag = false) |
|---|
| 1069 | #endif /* defined(ARRAY_ACCESS_INLINING) */ |
|---|
| 1070 | |
|---|
| 1071 | #ifdef __cplusplus |
|---|
| 1072 | extern "C" { |
|---|
| 1073 | #endif |
|---|
| 1074 | /* |
|---|
| 1075 | * Is scalar double flag set |
|---|
| 1076 | */ |
|---|
| 1077 | extern bool mxIsScalarDoubleFlagSet( |
|---|
| 1078 | const mxArray *pa /* pointer to array */ |
|---|
| 1079 | ); |
|---|
| 1080 | #ifdef __cplusplus |
|---|
| 1081 | } |
|---|
| 1082 | #endif |
|---|
| 1083 | |
|---|
| 1084 | |
|---|
| 1085 | #if defined(ARRAY_ACCESS_INLINING) |
|---|
| 1086 | #define mxIsScalarDoubleFlagSet(pa) ((pa)->flags.scalar_flag == 1) |
|---|
| 1087 | #endif /* defined(ARRAY_ACCESS_INLINING) */ |
|---|
| 1088 | |
|---|
| 1089 | #ifdef __cplusplus |
|---|
| 1090 | extern "C" { |
|---|
| 1091 | #endif |
|---|
| 1092 | /* |
|---|
| 1093 | * Set scalar flag if appropiate (double scalar) |
|---|
| 1094 | */ |
|---|
| 1095 | extern void mxSetScalarDoubleFlagIfAppropiate( |
|---|
| 1096 | mxArray *pa /* pointer to array */ |
|---|
| 1097 | ); |
|---|
| 1098 | #ifdef __cplusplus |
|---|
| 1099 | } |
|---|
| 1100 | #endif |
|---|
| 1101 | |
|---|
| 1102 | #ifdef __cplusplus |
|---|
| 1103 | extern "C" { |
|---|
| 1104 | #endif |
|---|
| 1105 | /* |
|---|
| 1106 | * Mark data as unshareable |
|---|
| 1107 | */ |
|---|
| 1108 | extern void mxSetDataPrivateFlag( |
|---|
| 1109 | mxArray *pa, /* pointer to array */ |
|---|
| 1110 | bool val |
|---|
| 1111 | ); |
|---|
| 1112 | #ifdef __cplusplus |
|---|
| 1113 | } |
|---|
| 1114 | #endif |
|---|
| 1115 | |
|---|
| 1116 | |
|---|
| 1117 | #if defined(ARRAY_ACCESS_INLINING) |
|---|
| 1118 | #define mxSetDataPrivateFlag(pa, val) ((pa)->flags.private_data_flag = (int)(val)) |
|---|
| 1119 | #endif /* defined(ARRAY_ACCESS_INLINING) */ |
|---|
| 1120 | |
|---|
| 1121 | #ifdef __cplusplus |
|---|
| 1122 | extern "C" { |
|---|
| 1123 | #endif |
|---|
| 1124 | /* |
|---|
| 1125 | * Is data unshareable? |
|---|
| 1126 | */ |
|---|
| 1127 | extern bool mxIsDataPrivate( |
|---|
| 1128 | const mxArray *pa /* pointer to array */ |
|---|
| 1129 | ); |
|---|
| 1130 | #ifdef __cplusplus |
|---|
| 1131 | } |
|---|
| 1132 | #endif |
|---|
| 1133 | |
|---|
| 1134 | |
|---|
| 1135 | #if defined(ARRAY_ACCESS_INLINING) |
|---|
| 1136 | #define mxIsDataPrivate(pa) (((pa)->flags.private_data_flag==1) ? true : false) |
|---|
| 1137 | #endif /* defined(ARRAY_ACCESS_INLINING) */ |
|---|
| 1138 | |
|---|
| 1139 | |
|---|
| 1140 | #include <stdlib.h> |
|---|
| 1141 | #define MX_DYNAMIC_STRUCT_REF_ERROR "Argument to dynamic structure reference must evaluate to a valid field name" |
|---|
| 1142 | |
|---|
| 1143 | #ifdef __cplusplus |
|---|
| 1144 | extern "C" { |
|---|
| 1145 | #endif |
|---|
| 1146 | /* |
|---|
| 1147 | * Create a numeric matrix and initialize all its data elements to 0. |
|---|
| 1148 | */ |
|---|
| 1149 | extern mxArray *mxCreateNumericMatrix( |
|---|
| 1150 | int m, |
|---|
| 1151 | int n, |
|---|
| 1152 | mxClassID classid, |
|---|
| 1153 | int cmplx_flag |
|---|
| 1154 | ); |
|---|
| 1155 | #ifdef __cplusplus |
|---|
| 1156 | } |
|---|
| 1157 | #endif |
|---|
| 1158 | |
|---|
| 1159 | #ifdef __cplusplus |
|---|
| 1160 | extern "C" { |
|---|
| 1161 | #endif |
|---|
| 1162 | /* |
|---|
| 1163 | * Set column dimension |
|---|
| 1164 | */ |
|---|
| 1165 | extern void mxSetN(mxArray *pa, int n); |
|---|
| 1166 | #ifdef __cplusplus |
|---|
| 1167 | } |
|---|
| 1168 | #endif |
|---|
| 1169 | |
|---|
| 1170 | #ifdef __cplusplus |
|---|
| 1171 | extern "C" { |
|---|
| 1172 | #endif |
|---|
| 1173 | /* |
|---|
| 1174 | * Set dimension array and number of dimensions. Returns 0 on success and 1 |
|---|
| 1175 | * if there was not enough memory available to reallocate the dimensions array. |
|---|
| 1176 | */ |
|---|
| 1177 | extern int mxSetDimensions(mxArray *pa, const int *size, int ndims); |
|---|
| 1178 | #ifdef __cplusplus |
|---|
| 1179 | } |
|---|
| 1180 | #endif |
|---|
| 1181 | |
|---|
| 1182 | #ifdef __cplusplus |
|---|
| 1183 | extern "C" { |
|---|
| 1184 | #endif |
|---|
| 1185 | /* |
|---|
| 1186 | * mxArray destructor |
|---|
| 1187 | */ |
|---|
| 1188 | extern void mxDestroyArray(mxArray *pa); |
|---|
| 1189 | #ifdef __cplusplus |
|---|
| 1190 | } |
|---|
| 1191 | #endif |
|---|
| 1192 | |
|---|
| 1193 | #ifdef __cplusplus |
|---|
| 1194 | extern "C" { |
|---|
| 1195 | #endif |
|---|
| 1196 | /* |
|---|
| 1197 | * Create a numeric array and initialize all its data elements to 0. |
|---|
| 1198 | * |
|---|
| 1199 | * Similar to mxCreateNumericMatrix, in a standalone application, |
|---|
| 1200 | * out-of-memory will mean a NULL pointer is returned. |
|---|
| 1201 | */ |
|---|
| 1202 | extern mxArray *mxCreateNumericArray(int ndim, const int *dims, mxClassID classid, mxComplexity flag); |
|---|
| 1203 | #ifdef __cplusplus |
|---|
| 1204 | } |
|---|
| 1205 | #endif |
|---|
| 1206 | |
|---|
| 1207 | #ifdef __cplusplus |
|---|
| 1208 | extern "C" { |
|---|
| 1209 | #endif |
|---|
| 1210 | /* |
|---|
| 1211 | * Create an N-Dimensional array to hold string data; |
|---|
| 1212 | * initialize all elements to 0. |
|---|
| 1213 | */ |
|---|
| 1214 | extern mxArray *mxCreateCharArray(int ndim, const int *dims); |
|---|
| 1215 | #ifdef __cplusplus |
|---|
| 1216 | } |
|---|
| 1217 | #endif |
|---|
| 1218 | |
|---|
| 1219 | #ifdef __cplusplus |
|---|
| 1220 | extern "C" { |
|---|
| 1221 | #endif |
|---|
| 1222 | /* |
|---|
| 1223 | * Create a two-dimensional array to hold double-precision |
|---|
| 1224 | * floating-point data; initialize each data element to 0. |
|---|
| 1225 | */ |
|---|
| 1226 | extern mxArray *mxCreateDoubleMatrix(int m, int n, mxComplexity flag); |
|---|
| 1227 | #ifdef __cplusplus |
|---|
| 1228 | } |
|---|
| 1229 | #endif |
|---|
| 1230 | |
|---|
| 1231 | #ifdef __cplusplus |
|---|
| 1232 | extern "C" { |
|---|
| 1233 | #endif |
|---|
| 1234 | /* |
|---|
| 1235 | * Get a properly typed pointer to the elements of a logical array. |
|---|
| 1236 | */ |
|---|
| 1237 | extern mxLogical *mxGetLogicals(const mxArray *pa); |
|---|
| 1238 | #ifdef __cplusplus |
|---|
| 1239 | } |
|---|
| 1240 | #endif |
|---|
| 1241 | |
|---|
| 1242 | #ifdef __cplusplus |
|---|
| 1243 | extern "C" { |
|---|
| 1244 | #endif |
|---|
| 1245 | /* |
|---|
| 1246 | * Create a logical array and initialize its data elements to false. |
|---|
| 1247 | */ |
|---|
| 1248 | extern mxArray *mxCreateLogicalArray(int ndim, const int *dims); |
|---|
| 1249 | #ifdef __cplusplus |
|---|
| 1250 | } |
|---|
| 1251 | #endif |
|---|
| 1252 | |
|---|
| 1253 | #ifdef __cplusplus |
|---|
| 1254 | extern "C" { |
|---|
| 1255 | #endif |
|---|
| 1256 | /* |
|---|
| 1257 | * Create a two-dimensional array to hold logical data and |
|---|
| 1258 | * initializes each data element to false. |
|---|
| 1259 | */ |
|---|
| 1260 | extern mxArray *mxCreateLogicalMatrix(unsigned int m, unsigned int n); |
|---|
| 1261 | #ifdef __cplusplus |
|---|
| 1262 | } |
|---|
| 1263 | #endif |
|---|
| 1264 | |
|---|
| 1265 | #ifdef __cplusplus |
|---|
| 1266 | extern "C" { |
|---|
| 1267 | #endif |
|---|
| 1268 | /* |
|---|
| 1269 | * Create a logical scalar mxArray having the specified value. |
|---|
| 1270 | */ |
|---|
| 1271 | extern mxArray *mxCreateLogicalScalar(bool value); |
|---|
| 1272 | #ifdef __cplusplus |
|---|
| 1273 | } |
|---|
| 1274 | #endif |
|---|
| 1275 | |
|---|
| 1276 | #ifdef __cplusplus |
|---|
| 1277 | extern "C" { |
|---|
| 1278 | #endif |
|---|
| 1279 | /* |
|---|
| 1280 | * Returns true if the logical scalar value is true. |
|---|
| 1281 | */ |
|---|
| 1282 | extern bool mxIsLogicalScalarTrue(const mxArray *pa); |
|---|
| 1283 | #ifdef __cplusplus |
|---|
| 1284 | } |
|---|
| 1285 | #endif |
|---|
| 1286 | |
|---|
| 1287 | #ifdef __cplusplus |
|---|
| 1288 | extern "C" { |
|---|
| 1289 | #endif |
|---|
| 1290 | /* |
|---|
| 1291 | * Create a double-precision scalar mxArray initialized to the |
|---|
| 1292 | * value specified |
|---|
| 1293 | */ |
|---|
| 1294 | extern mxArray *mxCreateDoubleScalar(double value); |
|---|
| 1295 | #ifdef __cplusplus |
|---|
| 1296 | } |
|---|
| 1297 | #endif |
|---|
| 1298 | |
|---|
| 1299 | #ifdef __cplusplus |
|---|
| 1300 | extern "C" { |
|---|
| 1301 | #endif |
|---|
| 1302 | /* |
|---|
| 1303 | * Create a 2-Dimensional sparse array. |
|---|
| 1304 | */ |
|---|
| 1305 | extern mxArray *mxCreateSparse(int m, int n, int nzmax, mxComplexity flag); |
|---|
| 1306 | #ifdef __cplusplus |
|---|
| 1307 | } |
|---|
| 1308 | #endif |
|---|
| 1309 | |
|---|
| 1310 | #ifdef __cplusplus |
|---|
| 1311 | extern "C" { |
|---|
| 1312 | #endif |
|---|
| 1313 | /* |
|---|
| 1314 | * Create a 2-D sparse logical array |
|---|
| 1315 | */ |
|---|
| 1316 | extern mxArray *mxCreateSparseLogicalMatrix(int m, int n, int nzmax); |
|---|
| 1317 | #ifdef __cplusplus |
|---|
| 1318 | } |
|---|
| 1319 | #endif |
|---|
| 1320 | |
|---|
| 1321 | #ifdef __cplusplus |
|---|
| 1322 | extern "C" { |
|---|
| 1323 | #endif |
|---|
| 1324 | /* |
|---|
| 1325 | * Copies characters from a MATLAB array to a char array |
|---|
| 1326 | * This function will attempt to perform null termination if it is possible. |
|---|
| 1327 | * nChars is the number of bytes in the output buffer |
|---|
| 1328 | */ |
|---|
| 1329 | extern void mxGetNChars(const mxArray *pa, char *buf, int nChars); |
|---|
| 1330 | #ifdef __cplusplus |
|---|
| 1331 | } |
|---|
| 1332 | #endif |
|---|
| 1333 | |
|---|
| 1334 | #ifdef __cplusplus |
|---|
| 1335 | extern "C" { |
|---|
| 1336 | #endif |
|---|
| 1337 | /* |
|---|
| 1338 | * Converts a string array to a C-style string. The C-style string is in the |
|---|
| 1339 | * local codepage encoding. If the conversion for the entire Unicode string |
|---|
| 1340 | * cannot fit into the supplied character buffer, then the conversion includes |
|---|
| 1341 | * the last whole codepoint that will fit into the buffer. The string is thus |
|---|
| 1342 | * truncated at the greatest possible whole codepoint and does not split code- |
|---|
| 1343 | * points. |
|---|
| 1344 | */ |
|---|
| 1345 | extern int mxGetString(const mxArray *pa, char *buf, int buflen); |
|---|
| 1346 | #ifdef __cplusplus |
|---|
| 1347 | } |
|---|
| 1348 | #endif |
|---|
| 1349 | |
|---|
| 1350 | #ifdef __cplusplus |
|---|
| 1351 | extern "C" { |
|---|
| 1352 | #endif |
|---|
| 1353 | /* |
|---|
| 1354 | * Create a NULL terminated C string from an mxArray of type mxCHAR_CLASS |
|---|
| 1355 | * Supports multibyte character sets. The resulting string must be freed |
|---|
| 1356 | * with mxFree. Returns NULL on out of memory or non-character arrays. |
|---|
| 1357 | */ |
|---|
| 1358 | extern char *mxArrayToString(const mxArray *pa); |
|---|
| 1359 | #ifdef __cplusplus |
|---|
| 1360 | } |
|---|
| 1361 | #endif |
|---|
| 1362 | |
|---|
| 1363 | #ifdef __cplusplus |
|---|
| 1364 | extern "C" { |
|---|
| 1365 | #endif |
|---|
| 1366 | /* |
|---|
| 1367 | * Create a 1-by-n string array initialized to str. The supplied string is |
|---|
| 1368 | * presumed to be in the local codepage encoding. The character data format |
|---|
| 1369 | * in the mxArray will be UTF-16. |
|---|
| 1370 | */ |
|---|
| 1371 | extern mxArray *mxCreateStringFromNChars(const char *str, int n); |
|---|
| 1372 | #ifdef __cplusplus |
|---|
| 1373 | } |
|---|
| 1374 | #endif |
|---|
| 1375 | |
|---|
| 1376 | #ifdef __cplusplus |
|---|
| 1377 | extern "C" { |
|---|
| 1378 | #endif |
|---|
| 1379 | /* |
|---|
| 1380 | * Create a 1-by-n string array initialized to null terminated string |
|---|
| 1381 | * where n is the length of the string. |
|---|
| 1382 | */ |
|---|
| 1383 | extern mxArray *mxCreateString(const char *str); |
|---|
| 1384 | #ifdef __cplusplus |
|---|
| 1385 | } |
|---|
| 1386 | #endif |
|---|
| 1387 | |
|---|
| 1388 | #ifdef __cplusplus |
|---|
| 1389 | extern "C" { |
|---|
| 1390 | #endif |
|---|
| 1391 | /* |
|---|
| 1392 | * Create a string array initialized to the strings in str. |
|---|
| 1393 | */ |
|---|
| 1394 | extern mxArray *mxCreateCharMatrixFromStrings(int m, const char **str); |
|---|
| 1395 | #ifdef __cplusplus |
|---|
| 1396 | } |
|---|
| 1397 | #endif |
|---|
| 1398 | |
|---|
| 1399 | #ifdef __cplusplus |
|---|
| 1400 | extern "C" { |
|---|
| 1401 | #endif |
|---|
| 1402 | /* |
|---|
| 1403 | * Create a 2-Dimensional cell array, with each cell initialized |
|---|
| 1404 | * to NULL. |
|---|
| 1405 | */ |
|---|
| 1406 | extern mxArray *mxCreateCellMatrix(int m, int n); |
|---|
| 1407 | #ifdef __cplusplus |
|---|
| 1408 | } |
|---|
| 1409 | #endif |
|---|
| 1410 | |
|---|
| 1411 | #ifdef __cplusplus |
|---|
| 1412 | extern "C" { |
|---|
| 1413 | #endif |
|---|
| 1414 | /* |
|---|
| 1415 | * Create an N-Dimensional cell array, with each cell initialized |
|---|
| 1416 | * to NULL. |
|---|
| 1417 | */ |
|---|
| 1418 | extern mxArray *mxCreateCellArray(int ndim, const int *dims); |
|---|
| 1419 | #ifdef __cplusplus |
|---|
| 1420 | } |
|---|
| 1421 | #endif |
|---|
| 1422 | |
|---|
| 1423 | #ifdef __cplusplus |
|---|
| 1424 | extern "C" { |
|---|
| 1425 | #endif |
|---|
| 1426 | /* |
|---|
| 1427 | * Create a 2-Dimensional structure array having the specified fields; |
|---|
| 1428 | * initialize all values to NULL. |
|---|
| 1429 | */ |
|---|
| 1430 | extern mxArray *mxCreateStructMatrix(int m, int n, int nfields, const char **fieldnames); |
|---|
| 1431 | #ifdef __cplusplus |
|---|
| 1432 | } |
|---|
| 1433 | #endif |
|---|
| 1434 | |
|---|
| 1435 | #ifdef __cplusplus |
|---|
| 1436 | extern "C" { |
|---|
| 1437 | #endif |
|---|
| 1438 | /* |
|---|
| 1439 | * Create an N-Dimensional structure array having the specified fields; |
|---|
| 1440 | * initialize all values to NULL. |
|---|
| 1441 | */ |
|---|
| 1442 | extern mxArray *mxCreateStructArray(int ndim, const int *dims, int nfields, |
|---|
| 1443 | const char **fieldnames); |
|---|
| 1444 | #ifdef __cplusplus |
|---|
| 1445 | } |
|---|
| 1446 | #endif |
|---|
| 1447 | |
|---|
| 1448 | #ifdef __cplusplus |
|---|
| 1449 | extern "C" { |
|---|
| 1450 | #endif |
|---|
| 1451 | /* |
|---|
| 1452 | * Make a deep copy of an array, return a pointer to the copy. |
|---|
| 1453 | */ |
|---|
| 1454 | extern mxArray *mxDuplicateArray(const mxArray *in); |
|---|
| 1455 | #ifdef __cplusplus |
|---|
| 1456 | } |
|---|
| 1457 | #endif |
|---|
| 1458 | |
|---|
| 1459 | #ifdef __cplusplus |
|---|
| 1460 | extern "C" { |
|---|
| 1461 | #endif |
|---|
| 1462 | /* |
|---|
| 1463 | * Set classname of an unvalidated object array. It is illegal to |
|---|
| 1464 | * call this function on a previously validated object array. |
|---|
| 1465 | * Return 0 for success, 1 for failure. |
|---|
| 1466 | */ |
|---|
| 1467 | extern int mxSetClassName(mxArray *pa, const char *classname); |
|---|
| 1468 | #ifdef __cplusplus |
|---|
| 1469 | } |
|---|
| 1470 | #endif |
|---|
| 1471 | |
|---|
| 1472 | #ifdef __cplusplus |
|---|
| 1473 | extern "C" { |
|---|
| 1474 | #endif |
|---|
| 1475 | /* |
|---|
| 1476 | * Add a field to a structure array. Returns field number on success or -1 |
|---|
| 1477 | * if inputs are invalid or an out of memory condition occurs. |
|---|
| 1478 | */ |
|---|
| 1479 | extern int mxAddField(mxArray *pa, const char *fieldname); |
|---|
| 1480 | #ifdef __cplusplus |
|---|
| 1481 | } |
|---|
| 1482 | #endif |
|---|
| 1483 | |
|---|
| 1484 | #ifdef __cplusplus |
|---|
| 1485 | extern "C" { |
|---|
| 1486 | #endif |
|---|
| 1487 | /* |
|---|
| 1488 | * Remove a field from a structure array. Does nothing if no such field exists. |
|---|
| 1489 | * Does not destroy the field itself. |
|---|
| 1490 | */ |
|---|
| 1491 | extern void mxRemoveField(mxArray *pa, int field); |
|---|
| 1492 | #ifdef __cplusplus |
|---|
| 1493 | } |
|---|
| 1494 | #endif |
|---|
| 1495 | |
|---|
| 1496 | |
|---|
| 1497 | #ifdef __WATCOMC__ |
|---|
| 1498 | #ifndef __cplusplus |
|---|
| 1499 | #pragma aux mxGetEps value [8087]; |
|---|
| 1500 | #pragma aux mxGetInf value [8087]; |
|---|
| 1501 | #pragma aux mxGetNaN value [8087]; |
|---|
| 1502 | #endif |
|---|
| 1503 | #endif |
|---|
| 1504 | |
|---|
| 1505 | #ifdef __cplusplus |
|---|
| 1506 | extern "C" { |
|---|
| 1507 | #endif |
|---|
| 1508 | /* |
|---|
| 1509 | * Function for obtaining MATLAB's concept of EPS |
|---|
| 1510 | */ |
|---|
| 1511 | extern double mxGetEps(void); |
|---|
| 1512 | #ifdef __cplusplus |
|---|
| 1513 | } |
|---|
| 1514 | #endif |
|---|
| 1515 | |
|---|
| 1516 | #ifdef __cplusplus |
|---|
| 1517 | extern "C" { |
|---|
| 1518 | #endif |
|---|
| 1519 | /* |
|---|
| 1520 | * Function for obtaining MATLAB's concept of INF (Used in MEX-File callback). |
|---|
| 1521 | */ |
|---|
| 1522 | extern double mxGetInf(void); |
|---|
| 1523 | #ifdef __cplusplus |
|---|
| 1524 | } |
|---|
| 1525 | #endif |
|---|
| 1526 | |
|---|
| 1527 | #ifdef __cplusplus |
|---|
| 1528 | extern "C" { |
|---|
| 1529 | #endif |
|---|
| 1530 | /* |
|---|
| 1531 | * Function for obtaining MATLAB's concept of NaN (Used in MEX-File callback). |
|---|
| 1532 | */ |
|---|
| 1533 | extern double mxGetNaN(void); |
|---|
| 1534 | #ifdef __cplusplus |
|---|
| 1535 | } |
|---|
| 1536 | #endif |
|---|
| 1537 | |
|---|
| 1538 | #ifdef __cplusplus |
|---|
| 1539 | extern "C" { |
|---|
| 1540 | #endif |
|---|
| 1541 | /* |
|---|
| 1542 | * test for finiteness in a machine-independent manner |
|---|
| 1543 | */ |
|---|
| 1544 | extern bool mxIsFinite( |
|---|
| 1545 | double x /* value to test */ |
|---|
| 1546 | ); |
|---|
| 1547 | #ifdef __cplusplus |
|---|
| 1548 | } |
|---|
| 1549 | #endif |
|---|
| 1550 | |
|---|
| 1551 | #ifdef __cplusplus |
|---|
| 1552 | extern "C" { |
|---|
| 1553 | #endif |
|---|
| 1554 | /* |
|---|
| 1555 | * test for infinity in a machine-independent manner |
|---|
| 1556 | */ |
|---|
| 1557 | extern bool mxIsInf( |
|---|
| 1558 | double x /* value to test */ |
|---|
| 1559 | ); |
|---|
| 1560 | #ifdef __cplusplus |
|---|
| 1561 | } |
|---|
| 1562 | #endif |
|---|
| 1563 | |
|---|
| 1564 | #ifdef __cplusplus |
|---|
| 1565 | extern "C" { |
|---|
| 1566 | #endif |
|---|
| 1567 | /* |
|---|
| 1568 | * test for NaN in a machine-independent manner |
|---|
| 1569 | */ |
|---|
| 1570 | extern bool mxIsNaN( |
|---|
| 1571 | double x /* value to test */ |
|---|
| 1572 | ); |
|---|
| 1573 | #ifdef __cplusplus |
|---|
| 1574 | } |
|---|
| 1575 | #endif |
|---|
| 1576 | |
|---|
| 1577 | |
|---|
| 1578 | #define mxCreateFull() mxCreateFull_is_obsolete |
|---|
| 1579 | #define mxIsFull() mxIsFull_is_obsolete |
|---|
| 1580 | #define mxIsString() mxIsString_is_obsolete |
|---|
| 1581 | #define mxFreeMatrix() mxFreeMatrix_is_obsolete |
|---|
| 1582 | |
|---|
| 1583 | |
|---|
| 1584 | #define mxCreateScalarDouble(d) mxCreateDoubleScalar(d) |
|---|
| 1585 | |
|---|
| 1586 | #if defined(V5_COMPAT) |
|---|
| 1587 | |
|---|
| 1588 | #ifdef __cplusplus |
|---|
| 1589 | extern "C" { |
|---|
| 1590 | #endif |
|---|
| 1591 | /* |
|---|
| 1592 | * NOTE: This function is obsolete and should no longer be used. Please |
|---|
| 1593 | * use one of the following routines instead: |
|---|
| 1594 | * mxCreateLogicalScalar |
|---|
| 1595 | * mxCreateLogicalMatrix |
|---|
| 1596 | * mxCreateLogicalArray |
|---|
| 1597 | * |
|---|
| 1598 | * Specify that the data in an array is to be treated as Boolean data. |
|---|
| 1599 | */ |
|---|
| 1600 | extern void mxSetLogical(mxArray *pa); |
|---|
| 1601 | #ifdef __cplusplus |
|---|
| 1602 | } |
|---|
| 1603 | #endif |
|---|
| 1604 | |
|---|
| 1605 | #ifdef __cplusplus |
|---|
| 1606 | extern "C" { |
|---|
| 1607 | #endif |
|---|
| 1608 | /* |
|---|
| 1609 | * NOTE: This function is obsolete and should no longer be used. |
|---|
| 1610 | * |
|---|
| 1611 | * Specify that the data in an array is to be treated as numerical |
|---|
| 1612 | * (as opposed to Boolean) data. |
|---|
| 1613 | */ |
|---|
| 1614 | extern void mxClearLogical(mxArray *pa); |
|---|
| 1615 | #ifdef __cplusplus |
|---|
| 1616 | } |
|---|
| 1617 | #endif |
|---|
| 1618 | |
|---|
| 1619 | |
|---|
| 1620 | #else |
|---|
| 1621 | #define mxSetLogical() mxSetLogical_is_obsolete |
|---|
| 1622 | #define mxClearLogical() mxClearLogical_is_obsolete |
|---|
| 1623 | #endif /* defined(V5_COMPAT) */ |
|---|
| 1624 | |
|---|
| 1625 | |
|---|
| 1626 | #if defined(V5_COMPAT) |
|---|
| 1627 | |
|---|
| 1628 | #ifdef __cplusplus |
|---|
| 1629 | extern "C" { |
|---|
| 1630 | #endif |
|---|
| 1631 | /* |
|---|
| 1632 | * Get pointer to array name. |
|---|
| 1633 | */ |
|---|
| 1634 | extern const char *mxGetName( |
|---|
| 1635 | const mxArray *pa /* pointer to array */ |
|---|
| 1636 | ); |
|---|
| 1637 | #ifdef __cplusplus |
|---|
| 1638 | } |
|---|
| 1639 | #endif |
|---|
| 1640 | |
|---|
| 1641 | #ifdef __cplusplus |
|---|
| 1642 | extern "C" { |
|---|
| 1643 | #endif |
|---|
| 1644 | /* |
|---|
| 1645 | * Set array name. This routine copies the string pointed to by s |
|---|
| 1646 | * into the mxMAXNAM length character name field. |
|---|
| 1647 | */ |
|---|
| 1648 | extern void mxSetName( |
|---|
| 1649 | mxArray *pa, /* pointer to array */ |
|---|
| 1650 | const char *s /* string to copy into name */ |
|---|
| 1651 | ); |
|---|
| 1652 | #ifdef __cplusplus |
|---|
| 1653 | } |
|---|
| 1654 | #endif |
|---|
| 1655 | |
|---|
| 1656 | |
|---|
| 1657 | #else |
|---|
| 1658 | #define mxGetName() mxGetName_is_obsolete |
|---|
| 1659 | #define mxSetName() mxSetName_is_obsolete |
|---|
| 1660 | #endif /* defined(V5_COMPAT) */ |
|---|
| 1661 | |
|---|
| 1662 | |
|---|
| 1663 | |
|---|
| 1664 | /* |
|---|
| 1665 | mxAssert(int expression, char *error_message) |
|---|
| 1666 | --------------------------------------------- |
|---|
| 1667 | |
|---|
| 1668 | Similar to ANSI C's assert() macro, the mxAssert macro checks the |
|---|
| 1669 | value of an assertion, continuing execution only if the assertion |
|---|
| 1670 | holds. If 'expression' evaluates to be true, then the mxAssert does |
|---|
| 1671 | nothing. If, however, 'expression' is false, then mxAssert prints an |
|---|
| 1672 | error message to the MATLAB Command Window, consisting of the failed |
|---|
| 1673 | assertion's expression, the file name and line number where the failed |
|---|
| 1674 | assertion occurred, and the string 'error_message'. 'error_message' |
|---|
| 1675 | allows the user to specify a more understandable description of why |
|---|
| 1676 | the assertion failed. (Use an empty string if no extra description |
|---|
| 1677 | should follow the failed assertion message.) After a failed |
|---|
| 1678 | assertion, control returns to the MATLAB command line. |
|---|
| 1679 | |
|---|
| 1680 | mxAssertS, (the S for Simple), takes the same inputs as mxAssert. It |
|---|
| 1681 | does not print the text of the failed assertion, only the file and |
|---|
| 1682 | line where the assertion failed, and the explanatory error_message. |
|---|
| 1683 | |
|---|
| 1684 | Note that script MEX will turn off these assertions when building |
|---|
| 1685 | optimized MEX-functions, so they should be used for debugging |
|---|
| 1686 | purposes only. |
|---|
| 1687 | */ |
|---|
| 1688 | |
|---|
| 1689 | #ifdef MATLAB_MEX_FILE |
|---|
| 1690 | # ifndef NDEBUG |
|---|
| 1691 | extern |
|---|
| 1692 | # ifdef __cplusplus |
|---|
| 1693 | "C" |
|---|
| 1694 | # endif |
|---|
| 1695 | void mexPrintAssertion(const char *test, |
|---|
| 1696 | const char *fname, |
|---|
| 1697 | int linenum, |
|---|
| 1698 | const char *message); |
|---|
| 1699 | |
|---|
| 1700 | # define mxAssert(test, message) ( (test) ? (void) 0 : mexPrintAssertion(": " #test ",", __FILE__, __LINE__, message)) |
|---|
| 1701 | # define mxAssertS(test, message) ( (test) ? (void) 0 : mexPrintAssertion("", __FILE__, __LINE__, message)) |
|---|
| 1702 | # else |
|---|
| 1703 | # define mxAssert(test, message) ((void) 0) |
|---|
| 1704 | # define mxAssertS(test, message) ((void) 0) |
|---|
| 1705 | # endif |
|---|
| 1706 | #else |
|---|
| 1707 | # include <assert.h> |
|---|
| 1708 | # define mxAssert(test, message) assert(test) |
|---|
| 1709 | # define mxAssertS(test, message) assert(test) |
|---|
| 1710 | #endif |
|---|
| 1711 | |
|---|
| 1712 | |
|---|
| 1713 | |
|---|
| 1714 | #include <stdlib.h> |
|---|
| 1715 | |
|---|
| 1716 | |
|---|
| 1717 | /* $Revision: 1.14.4.1 $ */ |
|---|
| 1718 | #ifdef ARGCHECK |
|---|
| 1719 | |
|---|
| 1720 | #include "mwdebug.h" /* Prototype _d versions of API functions */ |
|---|
| 1721 | |
|---|
| 1722 | #define mxAddField(pa, fieldname) mxAddField_d(pa, fieldname, __FILE__, __LINE__) |
|---|
| 1723 | #define mxArrayToString(pa) mxArrayToString_d(pa, __FILE__, __LINE__) |
|---|
| 1724 | #define mxCalcSingleSubscript(pa, nsubs, subs) mxCalcSingleSubscript_d(pa, nsubs, subs, __FILE__, __LINE__) |
|---|
| 1725 | #define mxCalloc(nelems, size) mxCalloc_d(nelems, size, __FILE__, __LINE__) |
|---|
| 1726 | #define mxCreateCellArray(ndim, dims) mxCreateCellArray_d(ndim, dims, __FILE__, __LINE__) |
|---|
| 1727 | #define mxCreateCellMatrix(m, n) mxCreateCellMatrix_d(m, n, __FILE__, __LINE__) |
|---|
| 1728 | #define mxCreateCharArray(ndim, dims) mxCreateCharArray_d(ndim, dims, __FILE__, __LINE__) |
|---|
| 1729 | #define mxCreateCharMatrixFromStrings(m, strings) mxCreateCharMatrixFromStrings_d(m, strings, __FILE__, __LINE__) |
|---|
| 1730 | #define mxCreateDoubleMatrix(m, n, cplxflag) mxCreateDoubleMatrix_d(m, n, cplxflag, __FILE__, __LINE__) |
|---|
| 1731 | #define mxCreateDoubleScalar(value) mxCreateDoubleScalar_d(value, __FILE__, __LINE__) |
|---|
| 1732 | #define mxCreateLogicalArray(ndim, dims) mxCreateLogicalArray_d(ndim, dims, __FILE__, __LINE__) |
|---|
| 1733 | #define mxCreateLogicalMatrix(m, n) mxCreateLogicalMatrix_d(m, n, __FILE__, __LINE__) |
|---|
| 1734 | #define mxCreateLogicalScalar(value) mxCreateLogicalScalar_d(value, __FILE__, __LINE__) |
|---|
| 1735 | #define mxCreateNumericArray(ndim, dims, classname, cplxflag) mxCreateNumericArray_d(ndim, dims, classname, cplxflag, __FILE__, __LINE__) |
|---|
| 1736 | #define mxCreateNumericMatrix(m, n, classid, cmplx_flag) mxCreateNumericMatrix_d(m, n, classid, cmplx_flag, __FILE__, __LINE__) |
|---|
| 1737 | #define mxCreateSparse(m, n, nzmax, cplxflag) mxCreateSparse_d(m, n, nzmax, cplxflag, __FILE__, __LINE__) |
|---|
| 1738 | #define mxCreateSparseLogicalMatrix(m, n, nzmax) mxCreateSparseLogicalMatrix_d(m, n, nzmax, __FILE__, __LINE__) |
|---|
| 1739 | #define mxCreateString(string) mxCreateString_d(string, __FILE__, __LINE__) |
|---|
| 1740 | #define mxCreateStructArray(ndim, dims, nfields, fieldnames) mxCreateStructArray_d(ndim, dims, nfields, fieldnames, __FILE__, __LINE__) |
|---|
| 1741 | #define mxCreateStructMatrix(m, n, nfields, fieldnames) mxCreateStructMatrix_d(m, n, nfields, fieldnames, __FILE__, __LINE__) |
|---|
| 1742 | #define mxDestroyArray(pa) mxDestroyArray_d(pa, __FILE__, __LINE__) |
|---|
| 1743 | #define mxDuplicateArray(pa) mxDuplicateArray_d(pa, __FILE__, __LINE__) |
|---|
| 1744 | #define mxFree(pm) mxFree_d(pm, __FILE__, __LINE__) |
|---|
| 1745 | #define mxGetChars(pa) mxGetChars_d(pa, __FILE__, __LINE__) |
|---|
| 1746 | #define mxGetCell(pa, index) mxGetCell_d(pa, index, __FILE__, __LINE__) |
|---|
| 1747 | #define mxGetClassID(pa) mxGetClassID_d(pa, __FILE__, __LINE__) |
|---|
| 1748 | #define mxGetClassName(pa) mxGetClassName_d(pa, __FILE__, __LINE__) |
|---|
| 1749 | #define mxGetData(pa) mxGetData_d(pa, __FILE__, __LINE__) |
|---|
| 1750 | #define mxGetDimensions(pa) mxGetDimensions_d(pa, __FILE__, __LINE__) |
|---|
| 1751 | #define mxGetElementSize(pa) mxGetElementSize_d(pa, __FILE__, __LINE__) |
|---|
| 1752 | #define mxGetField(pa, index, fieldname) mxGetField_d(pa, index, fieldname, __FILE__, __LINE__) |
|---|
| 1753 | #define mxGetFieldByNumber(pa, index, fieldnum) mxGetFieldByNumber_d(pa, index, fieldnum, __FILE__, __LINE__) |
|---|
| 1754 | #define mxGetFieldNameByNumber(pa, fieldnum) mxGetFieldNameByNumber_d(pa, fieldnum, __FILE__, __LINE__) |
|---|
| 1755 | #define mxGetFieldNumber(pa, fieldname) mxGetFieldNumber_d(pa, fieldname, __FILE__, __LINE__) |
|---|
| 1756 | #define mxGetImagData(pa) mxGetImagData_d(pa, __FILE__, __LINE__) |
|---|
| 1757 | #define mxGetIr(pa) mxGetIr_d(pa, __FILE__, __LINE__) |
|---|
| 1758 | #define mxGetJc(pa) mxGetJc_d(pa, __FILE__, __LINE__) |
|---|
| 1759 | #define mxGetLogicals(pa) mxGetLogicals_d(pa, __FILE__, __LINE__) |
|---|
| 1760 | #define mxGetNumberOfDimensions(pa) mxGetNumberOfDimensions_d(pa, __FILE__, __LINE__) |
|---|
| 1761 | #define mxGetNumberOfElements(pa) mxGetNumberOfElements_d(pa, __FILE__, __LINE__) |
|---|
| 1762 | #define mxGetNumberOfFields(pa) mxGetNumberOfFields_d(pa, __FILE__, __LINE__) |
|---|
| 1763 | #define mxGetNzmax(pa) mxGetNzmax_d(pa, __FILE__, __LINE__) |
|---|
| 1764 | #define mxGetM(pa) mxGetM_d(pa, __FILE__, __LINE__) |
|---|
| 1765 | #define mxGetN(pa) mxGetN_d(pa, __FILE__, __LINE__) |
|---|
| 1766 | #define mxGetPi(pa) mxGetPi_d(pa, __FILE__, __LINE__) |
|---|
| 1767 | #define mxGetPr(pa) mxGetPr_d(pa, __FILE__, __LINE__) |
|---|
| 1768 | #define mxGetScalar(pa) mxGetScalar_d(pa, __FILE__, __LINE__) |
|---|
| 1769 | #define mxGetString(pa, buffer, buflen) mxGetString_d(pa, buffer, buflen, __FILE__, __LINE__) |
|---|
| 1770 | #define mxIsCell(pa) mxIsCell_d(pa, __FILE__, __LINE__) |
|---|
| 1771 | #define mxIsChar(pa) mxIsChar_d(pa, __FILE__, __LINE__) |
|---|
| 1772 | #define mxIsClass(pa, classname) mxIsClass_d(pa, classname, __FILE__, __LINE__) |
|---|
| 1773 | #define mxIsComplex(pa) mxIsComplex_d(pa, __FILE__, __LINE__) |
|---|
| 1774 | #define mxIsDouble(pa) mxIsDouble_d(pa, __FILE__, __LINE__) |
|---|
| 1775 | #define mxIsEmpty(pa) mxIsEmpty_d(pa, __FILE__, __LINE__) |
|---|
| 1776 | #define mxIsFromGlobalWS(pa) mxIsFromGlobalWS_d(pa, __FILE__, __LINE__) |
|---|
| 1777 | #define mxIsInt8(pa) mxIsInt8_d(pa, __FILE__, __LINE__) |
|---|
| 1778 | #define mxIsInt16(pa) mxIsInt16_d(pa, __FILE__, __LINE__) |
|---|
| 1779 | #define mxIsInt32(pa) mxIsInt32_d(pa, __FILE__, __LINE__) |
|---|
| 1780 | #define mxIsLogical(pa) mxIsLogical_d(pa, __FILE__, __LINE__) |
|---|
| 1781 | #define mxIsNumeric(pa) mxIsNumeric_d(pa, __FILE__, __LINE__) |
|---|
| 1782 | #define mxIsOpaque(pa) mxIsOpaque_d(pa, __FILE__, __LINE__) |
|---|
| 1783 | #define mxIsObject(pa) mxIsObject_d(pa, __FILE__, __LINE__) |
|---|
| 1784 | #define mxIsSingle(pa) mxIsSingle_d(pa, __FILE__, __LINE__) |
|---|
| 1785 | #define mxIsSparse(pa) mxIsSparse_d(pa, __FILE__, __LINE__) |
|---|
| 1786 | #define mxIsStruct(pa) mxIsStruct_d(pa, __FILE__, __LINE__) |
|---|
| 1787 | #define mxIsUint8(pa) mxIsUint8_d(pa, __FILE__, __LINE__) |
|---|
| 1788 | #define mxIsUint16(pa) mxIsUint16_d(pa, __FILE__, __LINE__) |
|---|
| 1789 | #define mxIsUint32(pa) mxIsUint32_d(pa, __FILE__, __LINE__) |
|---|
| 1790 | #define mxIsUint64(pa) mxIsUint64_d(pa, __FILE__, __LINE__) |
|---|
| 1791 | #define mxMalloc(n) mxMalloc_d(n, __FILE__, __LINE__) |
|---|
| 1792 | #define mxRealloc(pm, nelems) mxRealloc_d(pm, nelems, __FILE__, __LINE__) |
|---|
| 1793 | #define mxRemoveField(pa, field) mxRemoveField_d(pa, field, __FILE__, __LINE__) |
|---|
| 1794 | #if !defined(MATLAB_MEX_FILE) |
|---|
| 1795 | #define mxSetAllocFcns(callocptr, freeptr, reallocptr, mallocptr) mxSetAllocFcns_d(callocptr, freeptr, reallocptr, freeptr, __FILE__, __LINE__) |
|---|
| 1796 | #endif /* MATLAB_MEX_FILE */ |
|---|
| 1797 | #define mxSetCell(pa, index, value) mxSetCell_d(pa, index, value, __FILE__, __LINE__) |
|---|
| 1798 | #define mxSetClassName(pa, name) mxSetClassName_d(pa, name, __FILE__, __LINE__) |
|---|
| 1799 | #define mxSetData(pa, pd) mxSetData_d(pa, pd, __FILE__, __LINE__) |
|---|
| 1800 | #define mxSetDimensions(pa, size, ndims) mxSetDimensions_d(pa, size, ndims, __FILE__, __LINE__) |
|---|
| 1801 | #define mxSetField(pa, index, fieldname, value) mxSetField_d(pa, index, fieldname, value, __FILE__, __LINE__) |
|---|
| 1802 | #define mxSetFieldByNumber(pa, index, fieldnum, value) mxSetFieldByNumber_d(pa, index, fieldnum, value, __FILE__, __LINE__) |
|---|
| 1803 | #define mxSetImagData(pa, pid) mxSetImagData_d(pa, pid, __FILE__, __LINE__) |
|---|
| 1804 | #define mxSetIr(pa, ir) mxSetIr_d(pa, ir, __FILE__, __LINE__) |
|---|
| 1805 | #define mxSetJc(pa, jc) mxSetJc_d(pa, jc, __FILE__, __LINE__) |
|---|
| 1806 | #define mxSetM(pa, m) mxSetM_d(pa, m, __FILE__, __LINE__) |
|---|
| 1807 | #define mxSetN(pa, n) mxSetN_d(pa, n, __FILE__, __LINE__) |
|---|
| 1808 | #define mxSetNzmax(pa, nzmax) mxSetNzmax_d(pa, nzmax, __FILE__, __LINE__) |
|---|
| 1809 | #define mxSetPi(pa, pi) mxSetPi_d(pa, pi, __FILE__, __LINE__) |
|---|
| 1810 | #define mxSetPr(pa, pr) mxSetPr_d(pa, pr, __FILE__, __LINE__) |
|---|
| 1811 | #endif |
|---|
| 1812 | |
|---|
| 1813 | #endif /* matrix_h */ |
|---|