matlab.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /**************************************************************************
  2. **
  3. ** Copyright (C) 1993 David E. Steward & Zbigniew Leyk, all rights reserved.
  4. **
  5. ** Meschach Library
  6. **
  7. ** This Meschach Library is provided "as is" without any express
  8. ** or implied warranty of any kind with respect to this software.
  9. ** In particular the authors shall not be liable for any direct,
  10. ** indirect, special, incidental or consequential damages arising
  11. ** in any way from use of the software.
  12. **
  13. ** Everyone is granted permission to copy, modify and redistribute this
  14. ** Meschach Library, provided:
  15. ** 1. All copies contain this copyright notice.
  16. ** 2. All modified copies shall carry a notice stating who
  17. ** made the last modification and the date of such modification.
  18. ** 3. No charge is made for this software or works derived from it.
  19. ** This clause shall not be construed as constraining other software
  20. ** distributed on the same medium as this software, nor is a
  21. ** distribution fee considered a charge.
  22. **
  23. ***************************************************************************/
  24. /* matlab.h -- Header file for matlab.c, spmatlab.c and zmatlab.c
  25. for save/load formats */
  26. #ifndef MATLAB_DEF
  27. #define MATLAB_DEF
  28. /* structure required by MATLAB */
  29. typedef struct {
  30. long type; /* matrix type */
  31. long m; /* # rows */
  32. long n; /* # cols */
  33. long imag; /* is complex? */
  34. long namlen; /* length of variable name */
  35. } matlab;
  36. /* macros for matrix storage type */
  37. #define INTEL 0 /* for 80x87 format */
  38. #define PC INTEL
  39. #define MOTOROLA 1 /* 6888x format */
  40. #define SUN MOTOROLA
  41. #define APOLLO MOTOROLA
  42. #define MAC MOTOROLA
  43. #define VAX_D 2
  44. #define VAX_G 3
  45. #define COL_ORDER 0
  46. #define ROW_ORDER 1
  47. #define DOUBLE_PREC 0 /* double precision */
  48. #define SINGLE_PREC 1 /* single precision */
  49. #define INT_32 2 /* 32 bit integers (signed) */
  50. #define INT_16 3 /* 16 bit integers (signed) */
  51. #define INT_16u 4 /* 16 bit integers (unsigned) */
  52. /* end of macros for matrix storage type */
  53. #ifndef MACH_ID
  54. #define MACH_ID MOTOROLA
  55. #endif
  56. #define ORDER COL_ORDER
  57. #if REAL == DOUBLE
  58. #define PRECISION DOUBLE_PREC
  59. #elif REAL == FLOAT
  60. #define PRECISION SINGLE_PREC
  61. #endif
  62. /* prototypes */
  63. #ifdef ANSI_C
  64. MAT *m_save(FILE *,MAT *,const char *);
  65. MAT *m_load(FILE *,char **);
  66. VEC *v_save(FILE *,VEC *,const char *);
  67. double d_save(FILE *,double,const char *);
  68. #else
  69. extern MAT *m_save(), *m_load();
  70. extern VEC *v_save();
  71. extern double d_save();
  72. #endif
  73. /* complex variant */
  74. #ifdef COMPLEX
  75. #include "zmatrix.h"
  76. #ifdef ANSI_C
  77. extern ZMAT *zm_save(FILE *fp,ZMAT *A,char *name);
  78. extern ZVEC *zv_save(FILE *fp,ZVEC *x,char *name);
  79. extern complex z_save(FILE *fp,complex z,char *name);
  80. extern ZMAT *zm_load(FILE *fp,char **name);
  81. #else
  82. extern ZMAT *zm_save();
  83. extern ZVEC *zv_save();
  84. extern complex z_save();
  85. extern ZMAT *zm_load();
  86. #endif
  87. #endif
  88. #endif