matrix.h 40.4 KB
Newer Older
Maxime Perrotin's avatar
Maxime Perrotin committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
 * @(#)matrix.h    generated by: makeheader 5.1.5  Mon Jun 29 15:46:30 2009
 *
 *		built from:	../../src/include/copyright.h
 *				../../src/include/pragma_interface.h
 *				include/published_version.h
 *				include/symver.h
 *				include/matrix/mxarray_pub_fwd.h
 *				include/matrix/matrix_pub_fwd.h
 *				include/matrix/vague_mxarray.hpp
 *				alloccbk.cpp
 *				alloclst.cpp
 *				array.cpp
 *				array2.cpp
 *				arraycbk.cpp
 *				arraycpy.cpp
 *				assignmt.cpp
 *				bytestr.cpp
 *				catenate.cpp
 *				cellindex.cpp
 *				checkdim.cpp
 *				compat32.cpp
 *				conversions.cpp
 *				end.cpp
 *				errmsg.cpp
 *				error.cpp
 *				fmxapi.cpp
 *				fmxapi_700.cpp
 *				fmxapi_730.cpp
 *				fmxapi_stdcall.cpp
 *				funhdl.cpp
 *				ieee_wrap.cpp
 *				indexcpy.cpp
 *				iocbk.cpp
 *				marshal.cpp
 *				mcat.cpp
 *				mxarray_alloc.cpp
 *				mxassert.cpp
 *				mxequal.cpp
 *				mxuint128.cpp
 *				mxutil.cpp
 *				nameindex.cpp
 *				nargchk.cpp
 *				numconv.cpp
 *				opaque.cpp
 *				permute.cpp
 *				populate.cpp
 *				protected.cpp
 *				referenc.cpp
 *				resize.cpp
 *				rndcolon.cpp
 *				scopemgr.cpp
 *				spassex.cpp
 *				sprefex.cpp
 *				strconv.cpp
 *				subserror.cpp
 *				transpose.cpp
 *				txtcmp.cpp
 *				undoc.cpp
 *				warning.cpp
 *				zbuffer.cpp
 *				mxdbg.h
 *				include/compat_pub.h
 */

#if defined(_MSC_VER)
# pragma once
#endif
#if defined(__GNUC__) && (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3))
# pragma once
#endif

#ifndef matrix_h
#define matrix_h


/*
 * Copyright 1984-2003 The MathWorks, Inc.
 * All Rights Reserved.
 */



/* Copyright 2003-2006 The MathWorks, Inc. */

/* Only define EXTERN_C if it hasn't been defined already. This allows
 * individual modules to have more control over managing their exports.
 */
#ifndef EXTERN_C

#ifdef __cplusplus
  #define EXTERN_C extern "C"
#else
  #define EXTERN_C extern
#endif

#endif


/* Version 7.4.0 */
#define MX_API_VER 0x07040000



#ifndef matrix_symver_h

/*
 * PUBLISHED APIs with changes in MATLAB 7.3
 */

#if !defined(MX_COMPAT_32) || defined(MX_INTERNAL_730)

/*
 * Include this uniformly on non-Linux platforms (no .symver)
 * Include it only internal to the matrix library on Linux
 */
#if !defined(__linux__) || defined(MX_INTERNAL_730)

#ifndef mxSetProperty
# define mxSetProperty mxSetProperty_730
#endif

#ifndef mxGetProperty
# define mxGetProperty mxGetProperty_730
#endif

#ifndef mxSetField
# define mxSetField mxSetField_730
#endif

#ifndef mxSetFieldByNumber
# define mxSetFieldByNumber mxSetFieldByNumber_730
#endif

#ifndef mxGetFieldByNumber
# define mxGetFieldByNumber mxGetFieldByNumber_730
#endif

#ifndef mxGetField
# define mxGetField mxGetField_730
#endif

#ifndef mxCreateStructMatrix
# define mxCreateStructMatrix mxCreateStructMatrix_730
#endif

#ifndef mxCreateCellMatrix
# define mxCreateCellMatrix mxCreateCellMatrix_730
#endif

#ifndef mxCreateCharMatrixFromStrings
# define mxCreateCharMatrixFromStrings mxCreateCharMatrixFromStrings_730
#endif

#ifndef mxGetString
# define mxGetString mxGetString_730
#endif

#ifndef mxGetNumberOfDimensions
# define mxGetNumberOfDimensions mxGetNumberOfDimensions_730
#endif

#ifndef mxGetDimensions
# define mxGetDimensions mxGetDimensions_730
#endif

#ifndef mxSetDimensions
# define mxSetDimensions mxSetDimensions_730
#endif

#ifndef mxSetIr
# define mxSetIr mxSetIr_730
#endif

#ifndef mxGetIr
# define mxGetIr mxGetIr_730
#endif

#ifndef mxSetJc
# define mxSetJc mxSetJc_730
#endif

#ifndef mxGetJc
# define mxGetJc mxGetJc_730
#endif

#ifndef mxCreateStructArray
# define mxCreateStructArray mxCreateStructArray_730
#endif

#ifndef mxCreateCharArray
# define mxCreateCharArray mxCreateCharArray_730
#endif

#ifndef mxCreateNumericArray
# define mxCreateNumericArray mxCreateNumericArray_730
#endif

#ifndef mxCreateCellArray
# define mxCreateCellArray mxCreateCellArray_730
#endif

#ifndef mxCreateLogicalArray
# define mxCreateLogicalArray mxCreateLogicalArray_730
#endif

#ifndef mxGetCell
# define mxGetCell mxGetCell_730
#endif

#ifndef mxSetCell
# define mxSetCell mxSetCell_730
#endif

#ifndef mxSetNzmax
# define mxSetNzmax mxSetNzmax_730
#endif

#ifndef mxSetN
# define mxSetN mxSetN_730
#endif

#ifndef mxSetM
# define mxSetM mxSetM_730
#endif

#ifndef mxGetNzmax
# define mxGetNzmax mxGetNzmax_730
#endif

#ifndef mxCreateDoubleMatrix
# define mxCreateDoubleMatrix mxCreateDoubleMatrix_730
#endif

#ifndef mxCreateNumericMatrix
# define mxCreateNumericMatrix mxCreateNumericMatrix_730
#endif

#ifndef mxCreateLogicalMatrix
# define mxCreateLogicalMatrix mxCreateLogicalMatrix_730
#endif

#ifndef mxCreateSparse
# define mxCreateSparse mxCreateSparse_730
#endif

#ifndef mxCreateSparseLogicalMatrix
# define mxCreateSparseLogicalMatrix mxCreateSparseLogicalMatrix_730
#endif

#ifndef mxGetNChars
# define mxGetNChars mxGetNChars_730
#endif

#ifndef mxCreateStringFromNChars
# define mxCreateStringFromNChars mxCreateStringFromNChars_730
#endif

#ifndef mxCalcSingleSubscript
# define mxCalcSingleSubscript mxCalcSingleSubscript_730
#endif

#ifndef mxGetDimensions_fcn
# define mxGetDimensions_fcn mxGetDimensions_730
#endif

#else

#ifndef mxGetDimensions_fcn
# define mxGetDimensions_fcn mxGetDimensions
#endif

#endif /* !__linux__ || MX_INTERNAL_730 */

#else

#ifndef mxGetDimensions_fcn
# define mxGetDimensions_fcn mxGetDimensions_700
#endif

#endif /* !MX_COMPAT_32 || MX_INTERNAL_730 */

#endif /* matrix_symver_h */



#ifndef MATHWORKS_MATRIX_MXARRAY_PUB_FWD_H
#define MATHWORKS_MATRIX_MXARRAY_PUB_FWD_H

/* Copyright 2008 The MathWorks, Inc. */

/**
 * Published incomplete definition of mxArray
 */
typedef struct mxArray_tag mxArray;

#endif /* MATHWORKS_MATRIX_MXARRAY_PUB_FWD_H */


#ifndef MATHWORKS_MATRIX_MATRIX_PUB_FWD_H
#define MATHWORKS_MATRIX_MATRIX_PUB_FWD_H

/* Copyright 2008 The MathWorks, Inc. */
#include <stddef.h>
#include <tmwtypes.h>

/**
 * Type representing the signature for MEX functions.
 */
typedef void (*mxFunctionPtr) (int nlhs, mxArray *plhs[], int nrhs, mxArray *prhs[]);

/**
 * Maximum mxArray name length
 */
#define mxMAXNAM TMW_NAME_LENGTH_MAX

/**
 * Logical type
 */
typedef bool mxLogical;

/**
 * UTF-16 character type
 */
#ifndef __STDC_UTF_16__
#    ifndef CHAR16_T
#        if defined(_WIN32) && defined(_MSC_VER)
#            define CHAR16_T wchar_t
#        else
#            define CHAR16_T UINT16_T
#        endif
         typedef CHAR16_T char16_t;
#    endif
#endif

/**
 * Typedef required for Unicode support in MATLAB
 */
typedef char16_t mxChar;

/**
 * Enumeration corresponding to all the valid mxArray types.
 */
typedef enum
{
    mxUNKNOWN_CLASS = 0,
    mxCELL_CLASS,
    mxSTRUCT_CLASS,
    mxLOGICAL_CLASS,
    mxCHAR_CLASS,
    mxVOID_CLASS,
    mxDOUBLE_CLASS,
    mxSINGLE_CLASS,
    mxINT8_CLASS,
    mxUINT8_CLASS,
    mxINT16_CLASS,
    mxUINT16_CLASS,
    mxINT32_CLASS,
    mxUINT32_CLASS,
    mxINT64_CLASS,
    mxUINT64_CLASS,
    mxFUNCTION_CLASS,
    mxOPAQUE_CLASS,
    mxOBJECT_CLASS, /* keep the last real item in the list */
#if defined(_LP64) || defined(_WIN64)
    mxINDEX_CLASS = mxUINT64_CLASS,
#else
    mxINDEX_CLASS = mxUINT32_CLASS,
#endif
    /* TEMPORARY AND NASTY HACK UNTIL mxSPARSE_CLASS IS COMPLETELY ELIMINATED */
    mxSPARSE_CLASS = mxVOID_CLASS /* OBSOLETE! DO NOT USE */
}
mxClassID;

/**
 * Indicates whether floating-point mxArrays are real or complex.
 */
typedef enum
{
    mxREAL,
    mxCOMPLEX
}
mxComplexity;

#endif /* MATHWORKS_MATRIX_MATRIX_PUB_FWD_H */


#ifndef MATHWORKS_MATRIX_VAGUE_MXARRAY_HPP
#define MATHWORKS_MATRIX_VAGUE_MXARRAY_HPP

/* Copyright 2008 The MathWorks, Inc. */

#if defined(ARRAY_ACCESS_INLINING)

#include <stddef.h>

/*
 * This modified version of the mxArray structure is needed to support
 * the ARRAY_ACCESS_INLINING macros.  NOTE: The elements in this structure
 * should not be accessed directly.  Inlined MEX-files are NOT guaranteed
 * to be portable from one release of MATLAB to another.
 */

struct mxArray_tag {
    void    *reserved;
    int      reserved1[2];
    void    *reserved2;
    size_t  number_of_dims;
    unsigned int reserved3;
    struct {
        unsigned int    flag0 : 1;
        unsigned int    flag1 : 1; 
        unsigned int    flag2 : 1;
        unsigned int    flag3 : 1;
        unsigned int    flag4 : 1;
        unsigned int    flag5 : 1;
        unsigned int    flag6 : 1;
        unsigned int    flag7 : 1;
        unsigned int    flag7a: 1;
        unsigned int    flag8 : 1;
        unsigned int    flag9 : 1;
        unsigned int    flag10 : 1;
        unsigned int    flag11 : 4;
        unsigned int    flag12 : 8;
        unsigned int    flag13 : 8;
    }   flags;
    size_t reserved4[2];
    union {
        struct {
            void  *pdata;
            void  *pimag_data;
            void  *reserved5;
            size_t reserved6[3];
        }   number_array;
    }   data;
};
#endif /* ARRAY_ACCESS_INLINING */

#endif /* MATHWORKS_MATRIX_VAGUE_MXARRAY_HPP */


#include <stddef.h>	/* size_t */


/*
 * allocate memory, notifying registered listener
 */
EXTERN_C void *mxMalloc(
    size_t	n		/* number of bytes */
    );


/*
 * allocate cleared memory, notifying registered listener.
 */
EXTERN_C void *mxCalloc(
    size_t	n,	/* number of objects */
    size_t	size	/* size of objects */
    );


/*
 * free memory, notifying registered listener.
 */
EXTERN_C void mxFree(void *ptr)	/* pointer to memory to be freed */;


/*
 * reallocate memory, notifying registered listener.
 */
EXTERN_C void *mxRealloc(void *ptr, size_t size);

 
/*
 * Return the class (catergory) of data that the array holds.
 */
EXTERN_C mxClassID mxGetClassID(const mxArray *pa);


/*
 * Get pointer to data
 */
EXTERN_C void *mxGetData(
    const mxArray *pa		/* pointer to array */
    );


#if defined(ARRAY_ACCESS_INLINING)
#define mxGetData(pa)           ((pa)->data.number_array.pdata)
#endif /* defined(ARRAY_ACCESS_INLINING) */


/*
 * Set pointer to data
 */
EXTERN_C void mxSetData(
    mxArray *pa,		/* pointer to array */
    void  *newdata		/* pointer to data */
    );


/* 
 * Determine whether the specified array contains numeric (as opposed 
 * to cell or struct) data.
 */
EXTERN_C bool mxIsNumeric(const mxArray *pa);


/* 
 * Determine whether the given array is a cell array.
 */
EXTERN_C bool mxIsCell(const mxArray *pa);


/*
 * Determine whether the given array's logical flag is on.
 */ 
EXTERN_C bool mxIsLogical(const mxArray *pa);


/*  
 * Determine whether the given array contains character data. 
 */
EXTERN_C bool mxIsChar(const mxArray *pa);


/*
 * Determine whether the given array is a structure array.
 */
EXTERN_C bool mxIsStruct(const mxArray *pa);


/*
 * Determine whether the given array is an opaque array.
 */
EXTERN_C bool mxIsOpaque(const mxArray *pa);


/*
 * Returns true if specified array is a function object.
 */
EXTERN_C bool mxIsFunctionHandle(const mxArray *pa);


/*
 * This function is deprecated and is preserved only for backward compatibility.
 * DO NOT USE if possible.
 * Is array user defined MATLAB v5 object
 */
EXTERN_C bool mxIsObject(
    const mxArray *pa		/* pointer to array */
    );


/*
 * Get imaginary data pointer for numeric array
 */
EXTERN_C void *mxGetImagData(
    const mxArray *pa		/* pointer to array */
    );


#if defined(ARRAY_ACCESS_INLINING)
#define mxGetImagData(pa)       ((pa)->data.number_array.pimag_data)
#endif /* defined(ARRAY_ACCESS_INLINING) */


/*
 * Set imaginary data pointer for numeric array
 */
EXTERN_C void mxSetImagData(
    mxArray *pa,		/* pointer to array */
    void    *newdata		/* imaginary data array pointer */
    );


/*
 * Determine whether the given array contains complex data.
 */
EXTERN_C bool mxIsComplex(const mxArray *pa);


/*
 * Determine whether the given array is a sparse (as opposed to full). 
 */
EXTERN_C bool mxIsSparse(const mxArray *pa);


/*
 * Determine whether the specified array represents its data as 
 * double-precision floating-point numbers.
 */
EXTERN_C bool mxIsDouble(const mxArray *pa);


/*
 * Determine whether the specified array represents its data as 
 * single-precision floating-point numbers.
 */
EXTERN_C bool mxIsSingle(const mxArray *pa);


/*
 * Determine whether the specified array represents its data as 
 * signed 8-bit integers.
 */
EXTERN_C bool mxIsInt8(const mxArray *pa);


/*
 * Determine whether the specified array represents its data as 
 * unsigned 8-bit integers.
 */
EXTERN_C bool mxIsUint8(const mxArray *pa);


/*
 * Determine whether the specified array represents its data as 
 * signed 16-bit integers.
 */
EXTERN_C bool mxIsInt16(const mxArray *pa);


/*
 * Determine whether the specified array represents its data as 
 * unsigned 16-bit integers.
 */
EXTERN_C bool mxIsUint16(const mxArray *pa);


/*
 * Determine whether the specified array represents its data as 
 * signed 32-bit integers.
 */
EXTERN_C bool mxIsInt32(const mxArray *pa);


/*
 * Determine whether the specified array represents its data as 
 * unsigned 32-bit integers.
 */
EXTERN_C bool mxIsUint32(const mxArray *pa);


/*
 * Determine whether the specified array represents its data as 
 * signed 64-bit integers.
 */
EXTERN_C bool mxIsInt64(const mxArray *pa);


/*
 * Determine whether the specified array represents its data as 
 * unsigned 64-bit integers.
 */
EXTERN_C bool mxIsUint64(const mxArray *pa);


/*
 * Get number of dimensions in array
 */
EXTERN_C mwSize mxGetNumberOfDimensions(const mxArray *pa);


#if defined(ARRAY_ACCESS_INLINING)
#undef mxGetNumberOfDimensions
#define mxGetNumberOfDimensions(pa) (mwSize)((pa)->number_of_dims)
#endif /* defined(ARRAY_ACCESS_INLINING) */


/*
 * Get pointer to dimension array
 */
EXTERN_C const mwSize *mxGetDimensions(const mxArray *pa);


/* 
 * Get number of elements in array
 */
EXTERN_C size_t mxGetNumberOfElements(	
    const mxArray *pa		/* pointer to array */
    );


/*
 * Get real data pointer for numeric array
 */
EXTERN_C double *mxGetPr(
    const mxArray *pa		/* pointer to array */
    );


#if defined(ARRAY_ACCESS_INLINING)
#define mxGetPr(pa)             ((double *)mxGetData(pa))
#endif /* defined(ARRAY_ACCESS_INLINING) */


/*
 * Set real data pointer for numeric array
 */
EXTERN_C void mxSetPr(
    mxArray *pa,		/* pointer to array */
    double  *pr			/* real data array pointer */
    );


/*
 * Get imaginary data pointer for numeric array
 */
EXTERN_C double *mxGetPi(
    const mxArray *pa		/* pointer to array */
    );


#if defined(ARRAY_ACCESS_INLINING)
#define mxGetPi(pa)             ((double *)mxGetImagData(pa))
#endif /* defined(ARRAY_ACCESS_INLINING) */


/*
 * Set imaginary data pointer for numeric array
 */
EXTERN_C void mxSetPi(
    mxArray *pa,		/* pointer to array */
    double  *pi			/* imaginary data array pointer */
    );


/*
 * Get string array data
 */
EXTERN_C mxChar *mxGetChars(
    const mxArray *pa		/* pointer to array */
    );


#if defined(ARRAY_ACCESS_INLINING)
#define mxGetChars(pa)          ((mxChar *)mxGetData(pa))
#endif /* defined(ARRAY_ACCESS_INLINING) */


/*
 * Get 8 bits of user data stored in the mxArray header.  NOTE: This state
 * of these bits are not guaranteed to be preserved after API function
 * calls.
 */
EXTERN_C int mxGetUserBits(
    const mxArray	*pa		/* pointer to array */
    );


/*
 * Set 8 bits of user data stored in the mxArray header. NOTE: This state
 * of these bits are not guaranteed to be preserved after API function
 * calls.
 */ 
EXTERN_C void mxSetUserBits(
	mxArray	*pa,		/* pointer to array */
	int	value
    );


#ifdef __WATCOMC__
#ifndef __cplusplus
#pragma aux mxGetScalar value [8087];
#endif
#endif


/*
 * Get the real component of the specified array's first data element.
 */
EXTERN_C double mxGetScalar(const mxArray *pa);


/*
 * Is the isFromGlobalWorkspace bit set?
 */
EXTERN_C bool mxIsFromGlobalWS(const mxArray *pa);


/*
 * Set the isFromGlobalWorkspace bit.
 */
EXTERN_C void mxSetFromGlobalWS(mxArray *pa, bool global);


/* 
 * Get row dimension
 */
EXTERN_C size_t mxGetM(const mxArray *pa);


/* 
 * Set row dimension
 */
EXTERN_C void mxSetM(mxArray *pa, mwSize m);


/* 
 * Get column dimension
 */
EXTERN_C size_t mxGetN(const mxArray *pa);


/*
 * Is array empty
 */
EXTERN_C bool mxIsEmpty(
    const mxArray *pa		/* pointer to array */
    );


/*
 * Get row data pointer for sparse numeric array
 */
EXTERN_C mwIndex *mxGetIr(const mxArray *pa);


/*
 * Set row data pointer for numeric array
 */
EXTERN_C void mxSetIr(mxArray *pa, mwIndex *newir);


/*
 * Get column data pointer for sparse numeric array
 */
EXTERN_C mwIndex *mxGetJc(const mxArray *pa);


/*
 * Set column data pointer for numeric array
 */
EXTERN_C void mxSetJc(mxArray *pa, mwIndex *newjc);


/*
 * Get maximum nonzero elements for sparse numeric array
 */
EXTERN_C mwSize mxGetNzmax(const mxArray *pa);


/*
 * Set maximum nonzero elements for numeric array
 */
EXTERN_C void mxSetNzmax(mxArray *pa, mwSize nzmax);


/*
 * Get array data element size
 */
EXTERN_C size_t mxGetElementSize(const mxArray *pa);


/* 
 * Return the offset (in number of elements) from the beginning of 
 * the array to a given subscript.  
 */
EXTERN_C mwIndex mxCalcSingleSubscript(const mxArray *pa, mwSize nsubs, const mwIndex *subs);


/*
 * Get number of structure fields in array
 */
EXTERN_C int mxGetNumberOfFields(
    const mxArray *pa		/* pointer to array */
    );


/*
 * Get a pointer to the specified cell element. 
 */ 
EXTERN_C mxArray *mxGetCell(const mxArray *pa, mwIndex i);


/*
 * Set an element in a cell array to the specified value.
 */
EXTERN_C void mxSetCell(mxArray *pa, mwIndex i, mxArray *value);


/*
 * Return pointer to the nth field name
 */
EXTERN_C const char *mxGetFieldNameByNumber(const mxArray *pa, int n);


/*
 * Get the index to the named field.
 */ 
EXTERN_C int mxGetFieldNumber(const mxArray *pa, const char *name);


/*
 * Return a pointer to the contents of the named field for 
 * the ith element (zero based).
 */ 
EXTERN_C mxArray *mxGetFieldByNumber(const mxArray *pa, mwIndex i, int fieldnum);


/*
 * Set pa[i][fieldnum] = value 
 */
EXTERN_C void mxSetFieldByNumber(mxArray *pa, mwIndex i, int fieldnum, mxArray *value);


/*
 * Return a pointer to the contents of the named field for the ith 
 * element (zero based).  Returns NULL on no such field or if the
 * field itself is NULL
 */
EXTERN_C mxArray *mxGetField(const mxArray *pa, mwIndex i, const char *fieldname);


/*
 * Sets the contents of the named field for the ith element (zero based).  
 * The input 'value' is stored in the input array 'pa' - no copy is made.
 */
EXTERN_C void mxSetField(mxArray *pa, mwIndex i, const char *fieldname, mxArray *value);

 
/*
 * mxGetProperty returns the value of a property for a given object and index.
 * The property must be public.
 *
 * If the given property name doesn't exist, isn't public, or the object isn't
 * the right type, then mxGetProperty returns NULL.
 */
EXTERN_C mxArray *mxGetProperty(const mxArray *pa, mwIndex i, const char *propname);

 
/*
 * mxSetProperty sets the value of a property for a given object and index.
 * The property must be public.
 *
 */
EXTERN_C void mxSetProperty(mxArray *pa, mwIndex i, const char *propname, const mxArray *value);

 
/* 
 * Return the name of an array's class.  
 */
EXTERN_C const char *mxGetClassName(const mxArray *pa);


/*
 * Determine whether an array is a member of the specified class. 
 */
EXTERN_C bool mxIsClass(const mxArray *pa, const char *name);


#include <stdlib.h>


#if !defined(MX_COMPAT_32) || defined(MX_INTERNAL_730)


/*
 * Create a numeric matrix and initialize all its data elements to 0.
 */
EXTERN_C mxArray *mxCreateNumericMatrix(mwSize m, mwSize n, mxClassID classid, mxComplexity flag);


#endif

 
/* 
 * Set column dimension
 */
EXTERN_C void mxSetN(mxArray *pa, mwSize n);


/*
 * Set dimension array and number of dimensions.  Returns 0 on success and 1
 * if there was not enough memory available to reallocate the dimensions array.
 */
EXTERN_C int mxSetDimensions(mxArray *pa, const mwSize *size, mwSize ndims);


/*
 * mxArray destructor
 */
EXTERN_C void mxDestroyArray(mxArray *pa);


/*
 * Create a numeric array and initialize all its data elements to 0.
 *
 * Similar to mxCreateNumericMatrix, in a standalone application, 
 * out-of-memory will mean a NULL pointer is returned.
 */
EXTERN_C mxArray *mxCreateNumericArray(mwSize ndim, const mwSize *dims, mxClassID classid, mxComplexity flag);


/*
 * Create an N-Dimensional array to hold string data;
 * initialize all elements to 0.
 */
EXTERN_C mxArray *mxCreateCharArray(mwSize ndim, const mwSize *dims);
For faster browsing, not all history is shown. View entire blame