home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / mesch12a.zip / matlab.h < prev    next >
C/C++ Source or Header  |  1994-01-13  |  3KB  |  113 lines

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