home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / c / c_tutor / h / mat_h < prev    next >
Encoding:
Text File  |  1992-11-14  |  777 b   |  24 lines

  1. struct matrix {
  2.         int m_rows, m_cols;
  3.         };
  4.  
  5. struct m_ {
  6.         int m_rows, m_cols;
  7.         double m_value[1];
  8.         };
  9.  
  10. double m_cofactor(), m_determinant();
  11. struct matrix *m_copy(), *m_invert(), *m_transpose(), *m_multiply(), *m_solve();
  12.  
  13. #define m_v(m, r, c)    ((struct m_ *)m)->m_value[r * (m->m_cols) + c]
  14. #define M_NULL  ((struct matrix *)0)
  15.  
  16. #define m_create(m, r, c) {\
  17.                         if (((int)(m = (struct matrix *)malloc(sizeof(struct matrix) + (sizeof(double) * r * c)))) == 0) {\
  18.                                 printf("Allocation error: %s\n", __FILE__);\
  19.                                 exit(1);\
  20.                                 }\
  21.                         m->m_rows = r;\
  22.                         m->m_cols = c;\
  23.                         }
  24.