fix rbitset_is_empty; put opening brace of functions on an own line
[libfirm] / include / libfirm / adt / gaussseidel.h
1 #ifndef MATRIX_H_
2 #define MATRIX_H_
3
4 #include <stdio.h>
5
6 typedef struct _gs_matrix_t gs_matrix_t;
7
8 /**
9  * Allocate a new matrix and init internal data for a matrix of size
10  * row_init X col_init. Matrix cannot grow beyond these init values.
11  * All elements are initially (implicitly) set to 0.
12  */
13 gs_matrix_t *gs_new_matrix(int n_init_rows, int n_init_cols);
14
15 /**
16  * Free space used by matrix m
17  */
18 void gs_delete_matrix(gs_matrix_t *m);
19
20 void gs_matrix_assure_row_capacity(gs_matrix_t *m, int row, int min_capacity);
21
22 void gs_matrix_trim_row_capacities(gs_matrix_t *m);
23
24 void gs_matrix_delete_zero_entries(gs_matrix_t *m);
25
26 /**
27  * Sets m[row, col] to val
28  * @p increase If non-zero @p val is added to the existing
29  */
30 void gs_matrix_set(gs_matrix_t *m, int row, int col, double val);
31
32 /**
33  * Returns the value stored in m[row, col].
34  */
35 double gs_matrix_get(const gs_matrix_t *m, int row, int col);
36
37 /**
38  * Performs one step of the Gauss-Seidel algorithm
39  * @p m         The iteration matrix
40  * @p x         The iteration vector
41  * @p a         The dimension of the matrix (axa matrix)
42  */
43 double gs_matrix_gauss_seidel(const gs_matrix_t *m, double *x, int n);
44
45 unsigned gs_matrix_get_n_entries(const gs_matrix_t *m);
46
47 /**
48  * Dumps the matrix factor*m to the stream @p out.
49  */
50 void gs_matrix_dump(const gs_matrix_t *m, int a, int b, FILE *out);
51
52 int gs_matrix_get_sizeof_allocated_memory(const gs_matrix_t *m);
53
54 void gs_matrix_export(const gs_matrix_t *m, double *nw, int size);
55
56 #endif /*MATRIX_H_*/