home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / INCLUDE.DI$ / MX3MATRX.H < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-15  |  10.1 KB  |  507 lines

  1. /*
  2.  * @(#)matrix.h    generated by: makeheader    Fri Feb 12 12:06:46 1993
  3.  *
  4.  *        built from:    /rel/bld/matlab4/sun4/prod/sandbox4/src/include/mathwork.h
  5.  *                /rel/bld/matlab4/sun4/prod/sandbox4/src/cmex/cmxcbk.c
  6.  */
  7.  
  8. #ifndef matrix_h
  9. #define matrix_h
  10.  
  11. typedef double Real;
  12.  
  13.  
  14. #ifdef OLDSTYLE
  15. /*
  16.  * modified matrix definition for compatibility with pre v4 mex files
  17.  */
  18.  
  19. #ifdef THINK_C
  20. #define dummy   unsigned char dummy1,dummy2,type,dummy3; int dummy4
  21. #else
  22. #ifdef applec
  23. #define dummy   unsigned char dummy1,dummy2,type,dummy3; int dummy4
  24. #else
  25. #define dummy   int dummy1,dummy2,type,dummy3
  26. #endif /* applec */
  27. #endif /* THINK_C */
  28.  
  29. #define mxMAXNAM        20
  30. typedef struct matrix {
  31.         char    name[mxMAXNAM];         /* name is now an array */
  32.         dummy;                          /* type: 0 - matrix, 1 - string */
  33.         int     m;                      /* row dimension */
  34.         int     n;                      /* column dimension */
  35.         Real    *pr;                    /* pointer to real part */
  36.         Real    *pi;                    /* pointer to imag part */
  37.         int     dummy6,dummy7,dummy8;
  38. } Matrix;
  39.  
  40. #define TEXT    1                       /* mat.type indicating text */
  41. #define MATRIX  0                       /* mat.type indicating matrix */
  42. #define REAL    0
  43. #define COMPLEX 1
  44.  
  45. #else
  46. /*
  47.  * post v4 mex files use an incomplete matrix structure and access methods
  48.  */
  49. #ifdef __STDC__
  50. /*
  51.  * incomplete definition of Matrix
  52.  */
  53. typedef struct matrix   Matrix;
  54. #else
  55. #ifdef VMS
  56. typedef struct matrix Matrix;
  57. #else
  58. #ifdef MMACINTOSH
  59. typedef struct matrix Matrix;
  60. #else
  61. typedef char    Matrix;
  62. #endif /* MMACINTOSH */
  63. #endif /* VMS */
  64. #endif /* __STDC__ */
  65.  
  66. #define REAL    (0)
  67. #define COMPLEX (1)
  68. #endif /* OLD_STYLE */
  69.  
  70.  
  71.  
  72. #ifdef VMS
  73. #define sp2spam            Csp2spam
  74. #define spam2sp            Cspam2sp
  75. #define malloc            VAXCmalloc
  76. #define calloc            VAXCcalloc
  77. #define realloc            VAXCrealloc
  78. #define free            VAXCfree
  79. #define mxCreateFull        CmxCreateFull
  80. #define mxFreeMatrix        CmxFreeMatrix
  81. #define mxCalloc        CmxCalloc
  82. #define mxFree            CmxFree
  83. #define mxGetName        CmxGetName
  84. #define mxSetName        CmxSetName
  85. #define mxGetStruc        CmxGetStruc
  86. #define mxSetStruc        CmxSetStruc
  87. #define mxGetType        CmxGetType
  88. #define mxSetType        CmxSetType
  89. #define mxGetDispMode        CmxGetDispMode
  90. #define mxSetDispMode        CmxSetDispMode
  91. #define mxGetM            CmxGetM
  92. #define mxSetM            CmxSetM
  93. #define mxGetN            CmxGetN
  94. #define mxSetN            CmxSetN
  95. #define mxGetPr            CmxGetPr
  96. #define mxSetPr            CmxSetPr
  97. #define mxGetPi            CmxGetPi
  98. #define mxSetPi            CmxSetPi
  99. #define mxGetNzmax        CmxGetNzmax
  100. #define mxSetNzmax        CmxSetNzmax
  101. #define mxGetIr            CmxGetIr
  102. #define mxSetIr            CmxSetIr
  103. #define mxGetJc            CmxGetJc
  104. #define mxSetJc            CmxSetJc
  105. #define mxGetString        CmxGetString
  106. #define mxCreateString        CmxCreateString
  107. #define mxGetScalar        CmxGetScalar
  108. #define mxIsFull        CmxIsFull
  109. #define mxIsSparse        CmxIsSparse
  110. #define mxIsDouble        CmxIsDouble
  111. #define mxIsString        CmxIsString
  112. #define mxIsNumeric        CmxIsNumeric
  113. #define mxIsComplex        CmxIsComplex
  114. #define mxCreateSparse        CmxCreateSparse
  115. #define mxCreateNDArray        CmxCreateNDArray
  116. #define mxSetTag        CmxSetTag
  117. #define mxGetTag        CmxGetTag
  118. #define mxGetDim        CmxGetDim
  119. #define mxSetDim        CmxSetDim
  120. #define mxIsNDArray        CmxIsNDArray
  121. #define mxGetDimNum        CmxGetDimNum
  122. #define mxIsSpam        CmxIsSpam
  123. #define mxGetNumEl        CmxGetNumEl
  124. #define mxSizeofMatrix        CmxSizeofMatrix
  125. #define mxRemoveFromAllocList    CmxRemoveFromAllocList
  126. #define mxIsFlint        CmxIsFlint
  127. #endif /* VMS */
  128.  
  129.  
  130. /*
  131.  * create matrix 
  132.  */
  133. #ifdef __STDC__
  134. extern    Matrix    *mxCreateFull(
  135.     int        m,        /* number of rows in matrix */
  136.     int        n,        /* number of columns */
  137.     int        cmplx_flg    /* complex flag */
  138.     );
  139. #else
  140. extern    Matrix    *mxCreateFull();
  141. #endif /* __STDC__ */
  142.  
  143.  
  144. /*
  145.  * free matrix structure and its contents
  146.  */
  147. #ifdef __STDC__
  148. extern    void mxFreeMatrix(
  149.     Matrix    *pmat        /* pointer to matrix */
  150.     );
  151. #else
  152. extern    mxFreeMatrix();
  153. #endif /* __STDC__ */
  154.  
  155.  
  156. /*
  157.  * allocate memory on MATLAB's heap
  158.  */
  159. #ifdef __STDC__
  160. extern    void *mxCalloc(
  161.     unsigned    n,        /* number of elements */
  162.     unsigned    size        /* size of elements */
  163.     );
  164. #else
  165. extern    void *mxCalloc();
  166. #endif /* __STDC__ */
  167.  
  168.  
  169. /*
  170.  * return allocated memory to MATLAB's heap
  171.  */
  172. #ifdef __STDC__
  173. extern    void mxFree(
  174.     void    *ptr        /* pointer to allocated memory */
  175.     );
  176. #else
  177. extern    mxFree();
  178. #endif /* __STDC__ */
  179.  
  180.  
  181. /* 
  182.  * Get pointer to matrix name.
  183.  */
  184. #ifdef __STDC__
  185. extern    char *mxGetName(
  186.     const Matrix *pm        /* pointer to matrix */
  187.     );
  188. #else
  189. extern    char *mxGetName();
  190. #endif /* __STDC__ */
  191.  
  192.  
  193. /* 
  194.  * Set matrix name.  This routine copies the string pointed to by s
  195.  * into the mxMAXNAM length character name field.
  196.  */
  197. #ifdef __STDC__
  198. extern    void mxSetName(
  199.     Matrix    *pm,        /* pointer to matrix */
  200.     const char    *s        /* string to copy into name */
  201.     );
  202. #else
  203. extern    mxSetName();
  204. #endif /* __STDC__ */
  205.  
  206.  
  207. /*
  208.  * Get row dimension
  209.  */
  210. #ifdef __STDC__
  211. extern    int mxGetM(
  212.     const Matrix *pm        /* pointer to matrix */
  213.     );
  214. #else
  215. extern    int mxGetM();
  216. #endif /* __STDC__ */
  217.  
  218.  
  219. /*
  220.  * Set row dimension
  221.  */
  222. #ifdef __STDC__
  223. extern    void mxSetM(
  224.     Matrix    *pm,        /* pointer to matrix */
  225.     int        m        /* row dimension */
  226.     );
  227. #else
  228. extern    mxSetM();
  229. #endif /* __STDC__ */
  230.  
  231.  
  232. /*
  233.  * Get column dimension
  234.  */
  235. #ifdef __STDC__
  236. extern    int mxGetN(
  237.     const Matrix *pm        /* pointer to matrix */
  238.     );
  239. #else
  240. extern    int mxGetN();
  241. #endif /* __STDC__ */
  242.  
  243.  
  244. /*
  245.  * Set column dimension
  246.  */
  247. #ifdef __STDC__
  248. extern    void mxSetN(
  249.     Matrix    *pm,        /* pointer to matrix */
  250.     int        n        /* column dimension */
  251.     );
  252. #else
  253. extern    mxSetN();
  254. #endif /* __STDC__ */
  255.  
  256.  
  257. /*
  258.  * Get pointer to real part
  259.  */
  260. #ifdef __STDC__
  261. extern    Real *mxGetPr(
  262.     const Matrix *pm        /* pointer to matrix */
  263.     );
  264. #else
  265. extern    Real *mxGetPr();
  266. #endif /* __STDC__ */
  267.  
  268.  
  269. /*
  270.  * Set pointer to real part
  271.  */
  272. #ifdef __STDC__
  273. extern    void mxSetPr(    
  274.     Matrix    *pm,        /* pointer to matrix */    
  275.     Real    *pr        /* pointer to real part */
  276.     );
  277. #else
  278. extern    mxSetPr();
  279. #endif /* __STDC__ */
  280.  
  281.  
  282. /*
  283.  * Get pointer to imag part
  284.  */
  285. #ifdef __STDC__
  286. extern    Real *mxGetPi(
  287.     const Matrix *pm        /* pointer to matrix */    
  288.     );    
  289. #else
  290. extern    Real *mxGetPi();
  291. #endif /* __STDC__ */
  292.  
  293.  
  294. /*
  295.  * Set pointer to imag part
  296.  */
  297. #ifdef __STDC__
  298. extern    void mxSetPi(    
  299.     Matrix    *pm,        /* pointer to matrix */
  300.     Real    *pi        /* pointer to imag part */
  301.     );
  302. #else
  303. extern    mxSetPi();    
  304. #endif /* __STDC__ */
  305.  
  306.  
  307. /*
  308.  * Get number of nonzero elements of sparse matrix
  309.  */
  310. #ifdef __STDC__
  311. extern    int mxGetNzmax(    
  312.     const Matrix *pm        /* pointer to matrix */
  313.     );
  314. #else
  315. extern    int mxGetNzmax();    
  316. #endif /* __STDC__ */
  317.  
  318.  
  319. /*
  320.  * Set number of nonzero elements of sparse matrix
  321.  */
  322. #ifdef __STDC__
  323. extern    void mxSetNzmax(
  324.     Matrix    *pm,        /* pointer to matrix */
  325.     int        nzmax        /* number of nonzero elements */
  326.     );
  327. #else
  328. extern    mxSetNzmax();
  329. #endif /* __STDC__ */
  330.  
  331.  
  332. /*
  333.  * Get pointer to sparse ir array
  334.  */
  335. #ifdef __STDC__
  336. extern    int *mxGetIr(
  337.     const Matrix *pm        /* pointer to matrix */
  338.     );
  339. #else
  340. extern    int *mxGetIr();
  341. #endif /* __STDC__ */
  342.  
  343.  
  344. /*
  345.  * Set pointer to sparse ir array
  346.  */
  347. #ifdef __STDC__
  348. extern    void mxSetIr(    
  349.     Matrix    *pm,        /* pointer to matrix */
  350.     int        *ir        /* pointer to ir array */
  351.     );
  352. #else
  353. extern    mxSetIr();
  354. #endif /* __STDC__ */
  355.  
  356.  
  357. /*
  358.  * Get pointer to sparse jc array
  359.  */
  360. #ifdef __STDC__
  361. extern    int *mxGetJc(    
  362.     const Matrix *pm        /* pointer to matrix */
  363.     );
  364. #else
  365. extern    int *mxGetJc();
  366. #endif /* __STDC__ */
  367.  
  368.  
  369. /*
  370.  * Set pointer to sparse jc array
  371.  */
  372. #ifdef __STDC__
  373. extern    void mxSetJc(    
  374.     Matrix    *pm,        /* pointer to matrix */
  375.     int        *jc        /* pointer to sparse jc array */
  376.     );
  377. #else
  378. extern    mxSetJc();
  379. #endif /* __STDC__ */
  380.  
  381.  
  382. /*
  383.  * Convert MATLAB string to C string
  384.  */
  385. #ifdef __STDC__
  386. extern    int mxGetString(
  387.     const Matrix *pm,        /* pointer to matrix */
  388.     char    *str_ptr,    /* pointer to string holding results */
  389.     int        str_len        /* length of string that holds results */
  390.     );
  391. #else
  392. extern    int mxGetString();
  393. #endif /* __STDC__ */
  394.  
  395.  
  396. /*
  397.  * Put C string into MATLAB matrix
  398.  */
  399. #ifdef __STDC__
  400. extern    Matrix *mxCreateString(
  401.     const char    *str_ptr    /* input C string */
  402.     );
  403. #else
  404. extern    Matrix *mxCreateString();
  405. #endif /* __STDC__ */
  406.  
  407.  
  408. /*
  409.  * Return first number in matrix input (assumed to be real)
  410.  */
  411. #ifdef __STDC__
  412. extern    Real mxGetScalar(
  413.     Matrix    *pm        /* pointer to matrix */
  414.     );
  415. #else
  416. extern    Real mxGetScalar();
  417. #endif /* __STDC__ */
  418.  
  419.  
  420. /*
  421.  * Is matrix struc set to FULL
  422.  */
  423. #ifdef __STDC__
  424. extern    int mxIsFull(
  425.     const Matrix *pm        /* pointer to matrix */
  426.     );
  427. #else
  428. extern    int mxIsFull();
  429. #endif /* __STDC__ */
  430.  
  431.  
  432. /*
  433.  * Is matrix struc set to SPARSE
  434.  */
  435. #ifdef __STDC__
  436. extern    int mxIsSparse(
  437.     const Matrix *pm        /* pointer to matrix */
  438.     );
  439. #else
  440. extern    int mxIsSparse();
  441. #endif /* __STDC__ */
  442.  
  443.  
  444. /*
  445.  * Is matrix type DOUBLE
  446.  */
  447. #ifdef __STDC__
  448. extern    int mxIsDouble(
  449.     const Matrix *pm        /* pointer to matrix */
  450.     );
  451. #else
  452. extern    int mxIsDouble();
  453. #endif /* __STDC__ */
  454.  
  455.  
  456. /*
  457.  * Is matrix display mode STRING
  458.  */
  459. #ifdef __STDC__
  460. extern    int mxIsString(
  461.     const Matrix *pm        /* pointer to matrix */
  462.     );
  463. #else
  464. extern    int mxIsString();
  465. #endif /* __STDC__ */
  466.  
  467.  
  468. /*
  469.  * Is matrix display mode NUMBER
  470.  */
  471. #ifdef __STDC__
  472. extern    int mxIsNumeric(
  473.     const Matrix *pm        /* pointer to matrix */
  474.     );
  475. #else
  476. extern    int mxIsNumeric();
  477. #endif /* __STDC__ */
  478.  
  479.  
  480. /*
  481.  * Is matrix of type double and does is have a complex part
  482.  */
  483. #ifdef __STDC__
  484. extern    int mxIsComplex(
  485.     const Matrix *pm        /* pointer to matrix */
  486.     );
  487. #else
  488. extern    int mxIsComplex();
  489. #endif /* __STDC__ */
  490.  
  491.  
  492. /*
  493.  * Create a sparse matrix
  494.  */
  495. #ifdef __STDC__
  496. extern    Matrix *mxCreateSparse(
  497.     int        m,        /* number of rows */
  498.     int        n,        /* number of columns */
  499.     int        nzmax,        /* initial number of non-zeros elements */
  500.     int        cmplx_flg    /* complex data */
  501.     );
  502. #else
  503. extern    Matrix *mxCreateSparse();
  504. #endif /* __STDC__ */
  505.  
  506. #endif /* matrix_h */
  507.