rework liveness dumper
[libfirm] / ir / kaps / matrix.h
1 /*
2  * Copyright (C) 1995-2008 University of Karlsruhe.  All right reserved.
3  *
4  * This file is part of libFirm.
5  *
6  * This file may be distributed and/or modified under the terms of the
7  * GNU General Public License version 2 as published by the Free Software
8  * Foundation and appearing in the file LICENSE.GPL included in the
9  * packaging of this file.
10  *
11  * Licensees holding valid libFirm Professional Edition licenses may use
12  * this file in accordance with the libFirm Commercial License.
13  * Agreement provided with the Software.
14  *
15  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE.
18  */
19
20 /**
21  * @file
22  * @brief   PBQP matrix.
23  * @date    02.10.2008
24  * @author  Sebastian Buchwald
25  */
26 #ifndef KAPS_MATRIX_H
27 #define KAPS_MATRIX_H
28
29 #include "matrix_t.h"
30
31 pbqp_matrix_t *pbqp_matrix_alloc(pbqp_t *pbqp, unsigned rows, unsigned cols);
32
33 /* Copy the given matrix. */
34 pbqp_matrix_t *pbqp_matrix_copy(pbqp_t *pbqp, pbqp_matrix_t *m);
35
36 pbqp_matrix_t *pbqp_matrix_copy_and_transpose(pbqp_t *pbqp, pbqp_matrix_t *m);
37
38 void pbqp_matrix_transpose(pbqp_t *pbqp, pbqp_matrix_t *mat);
39
40 /* sum += summand */
41 void pbqp_matrix_add(pbqp_matrix_t *sum, pbqp_matrix_t *summand);
42
43 void pbqp_matrix_set(pbqp_matrix_t *mat, unsigned row, unsigned col, num value);
44
45 num pbqp_matrix_get_col_min(pbqp_matrix_t *matrix, unsigned col_index, vector_t *flags);
46 num pbqp_matrix_get_row_min(pbqp_matrix_t *matrix, unsigned row_index, vector_t *flags);
47
48 unsigned pbqp_matrix_get_col_min_index(pbqp_matrix_t *matrix, unsigned col_index, vector_t *flags);
49 unsigned pbqp_matrix_get_row_min_index(pbqp_matrix_t *matrix, unsigned row_index, vector_t *flags);
50
51 void pbqp_matrix_set_col_value(pbqp_matrix_t *mat, unsigned col, num value);
52 void pbqp_matrix_set_row_value(pbqp_matrix_t *mat, unsigned row, num value);
53
54 void pbqp_matrix_sub_col_value(pbqp_matrix_t *matrix, unsigned col_index,
55                                vector_t *flags, num value);
56 void pbqp_matrix_sub_row_value(pbqp_matrix_t *matrix, unsigned row_index,
57                                vector_t *flags, num value);
58
59 int pbqp_matrix_is_zero(pbqp_matrix_t *mat, vector_t *src_vec, vector_t *tgt_vec);
60
61 void pbqp_matrix_add_to_all_cols(pbqp_matrix_t *mat, vector_t *vec);
62 void pbqp_matrix_add_to_all_rows(pbqp_matrix_t *mat, vector_t *vec);
63
64 #endif /* KAPS_MATRIX_H */