1 #ifndef __GSL_SPMATRIX_H__
2 #define __GSL_SPMATRIX_H__
3 
4 enum
5 {
6   GSL_SPMATRIX_COO = 0, /* coordinate/triplet representation */
7   GSL_SPMATRIX_CSC = 1, /* compressed sparse column */
8   GSL_SPMATRIX_CSR = 2, /* compressed sparse row */
9   GSL_SPMATRIX_TRIPLET = GSL_SPMATRIX_COO,
10   GSL_SPMATRIX_CCS = GSL_SPMATRIX_CSC,
11   GSL_SPMATRIX_CRS = GSL_SPMATRIX_CSR
12 };
13 
14 /* memory pool for binary tree node allocation */
15 struct gsl_spmatrix_pool_node
16 {
17   struct gsl_spmatrix_pool_node * next;
18   void * block_ptr;          /* pointer to memory block, of size n*tree_node_size */
19   unsigned char * free_slot; /* pointer to next available slot */
20 };
21 
22 typedef struct gsl_spmatrix_pool_node gsl_spmatrix_pool;
23 
24 #define GSL_SPMATRIX_ISCOO(m)         ((m)->sptype == GSL_SPMATRIX_COO)
25 #define GSL_SPMATRIX_ISCSC(m)         ((m)->sptype == GSL_SPMATRIX_CSC)
26 #define GSL_SPMATRIX_ISCSR(m)         ((m)->sptype == GSL_SPMATRIX_CSR)
27 
28 #define GSL_SPMATRIX_ISTRIPLET(m)     GSL_SPMATRIX_ISCOO(m)
29 #define GSL_SPMATRIX_ISCCS(m)         GSL_SPMATRIX_ISCSC(m)
30 #define GSL_SPMATRIX_ISCRS(m)         GSL_SPMATRIX_ISCSR(m)
31 
32 #define GSL_SPMATRIX_FLG_GROW         (1 << 0) /* allow size of matrix to grow as elements are added */
33 #define GSL_SPMATRIX_FLG_FIXED        (1 << 1) /* sparsity pattern is fixed */
34 
35 /* compare matrix entries (ia,ja) and (ib,jb) - sort by rows first, then by columns */
36 #define GSL_SPMATRIX_COMPARE_ROWCOL(m,ia,ja,ib,jb)   ((ia) < (ib) ? -1 : ((ia) > (ib) ? 1 : ((ja) < (jb) ? -1 : ((ja) > (jb)))))
37 
38 /* common/utility functions */
39 
40 void gsl_spmatrix_cumsum(const size_t n, int * c);
41 
42 #include <gsl/gsl_spmatrix_complex_long_double.h>
43 #include <gsl/gsl_spmatrix_complex_double.h>
44 #include <gsl/gsl_spmatrix_complex_float.h>
45 
46 #include <gsl/gsl_spmatrix_long_double.h>
47 #include <gsl/gsl_spmatrix_double.h>
48 #include <gsl/gsl_spmatrix_float.h>
49 
50 #include <gsl/gsl_spmatrix_ulong.h>
51 #include <gsl/gsl_spmatrix_long.h>
52 
53 #include <gsl/gsl_spmatrix_uint.h>
54 #include <gsl/gsl_spmatrix_int.h>
55 
56 #include <gsl/gsl_spmatrix_ushort.h>
57 #include <gsl/gsl_spmatrix_short.h>
58 
59 #include <gsl/gsl_spmatrix_uchar.h>
60 #include <gsl/gsl_spmatrix_char.h>
61 
62 #endif /* __GSL_SPMATRIX_H__ */
63