bf70cf7c902404ee58d306d31fee23eb063ba516
[ghc-hetmet.git] / utils / prof / cgprof / matrix.h
1 /* ------------------------------------------------------------------------
2  * $Id: matrix.h,v 1.1 2000/04/05 10:06:36 simonmar Exp $
3  *                                                                      
4  *      Copyright (C) 1995-2000 University of Oxford
5  *                                                                      
6  * Permission to use, copy, modify, and distribute this software,
7  * and to incorporate it, in whole or in part, into other software,
8  * is hereby granted without fee, provided that
9  *   (1) the above copyright notice and this permission notice appear in
10  *       all copies of the source code, and the above copyright notice
11  *       appear in clearly visible form on all supporting documentation
12  *       and distribution media;
13  *   (2) modified versions of this software be accompanied by a complete
14  *       change history describing author, date, and modifications made;
15  *       and
16  *   (3) any redistribution of the software, in original or modified
17  *       form, be without fee and subject to these same conditions.
18  * --------------------------------------------------------------------- */
19
20 #ifndef _MATRIX_H_
21 #define _MATRIX_H_
22 typedef struct _Matrix_element {
23   int                     x,y;
24   void                   *data;
25   struct _Matrix_element *next;
26 } Matrix_element;
27
28 typedef struct {
29   int             elsize;
30   void           *zero;
31   int             rows,cols;
32   Matrix_element *mat;
33 } Matrix;
34
35
36 extern Matrix newMat(int,int,int,void*);
37 extern void   *_Mat(Matrix*,int,int,int,char*);
38 extern int    Mat_dense(Matrix,int,int);
39 extern void   freeMat(Matrix *);
40
41 #define Mat(t,m,i,j) (*((t*) _Mat(&(m),i,j,__LINE__,__FILE__)))
42 #endif