isl_map_coalesce: allowing cutting equalities in adjacent facet
[isl.git] / include / isl_mat.h
blob1925d8721e6064429784e3b339a46c62212e1e70
1 /*
2 * Copyright 2008-2009 Katholieke Universiteit Leuven
4 * Use of this software is governed by the GNU LGPLv2.1 license
6 * Written by Sven Verdoolaege, K.U.Leuven, Departement
7 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
8 */
10 #ifndef ISL_MAT_H
11 #define ISL_MAT_H
13 #include <stdio.h>
15 #include <isl_int.h>
16 #include <isl_ctx.h>
17 #include <isl_blk.h>
18 #include <isl_vec.h>
20 #if defined(__cplusplus)
21 extern "C" {
22 #endif
24 struct isl_mat {
25 int ref;
27 struct isl_ctx *ctx;
29 #define ISL_MAT_BORROWED (1 << 0)
30 unsigned flags;
32 unsigned n_row;
33 unsigned n_col;
35 isl_int **row;
37 /* actual size of the rows in memory; n_col <= max_col */
38 unsigned max_col;
40 struct isl_blk block;
42 typedef struct isl_mat isl_mat;
44 struct isl_mat *isl_mat_alloc(struct isl_ctx *ctx,
45 unsigned n_row, unsigned n_col);
46 struct isl_mat *isl_mat_dup(struct isl_mat *mat);
47 struct isl_mat *isl_mat_extend(struct isl_mat *mat,
48 unsigned n_row, unsigned n_col);
49 struct isl_mat *isl_mat_identity(struct isl_ctx *ctx, unsigned n_row);
50 struct isl_mat *isl_mat_copy(struct isl_mat *mat);
51 struct isl_mat *isl_mat_cow(struct isl_mat *mat);
52 void isl_mat_free(struct isl_mat *mat);
54 struct isl_mat *isl_mat_sub_alloc(struct isl_ctx *ctx, isl_int **row,
55 unsigned first_row, unsigned n_row, unsigned first_col, unsigned n_col);
56 void isl_mat_sub_copy(struct isl_ctx *ctx, isl_int **dst, isl_int **src,
57 unsigned n_row, unsigned dst_col, unsigned src_col, unsigned n_col);
58 void isl_mat_sub_neg(struct isl_ctx *ctx, isl_int **dst, isl_int **src,
59 unsigned n_row, unsigned dst_col, unsigned src_col, unsigned n_col);
61 struct isl_mat *isl_mat_swap_cols(struct isl_mat *mat, unsigned i, unsigned j);
62 struct isl_mat *isl_mat_swap_rows(struct isl_mat *mat, unsigned i, unsigned j);
64 struct isl_vec *isl_mat_vec_product(struct isl_mat *mat, struct isl_vec *vec);
65 struct isl_vec *isl_vec_mat_product(struct isl_vec *vec, struct isl_mat *mat);
66 __isl_give isl_vec *isl_mat_vec_inverse_product(__isl_take isl_mat *mat,
67 __isl_take isl_vec *vec);
68 struct isl_mat *isl_mat_aff_direct_sum(struct isl_mat *left,
69 struct isl_mat *right);
70 struct isl_mat *isl_mat_left_hermite(struct isl_mat *M,
71 int neg, struct isl_mat **U, struct isl_mat **Q);
72 struct isl_mat *isl_mat_lin_to_aff(struct isl_mat *mat);
73 struct isl_mat *isl_mat_inverse_product(struct isl_mat *left,
74 struct isl_mat *right);
75 struct isl_mat *isl_mat_product(struct isl_mat *left, struct isl_mat *right);
76 struct isl_mat *isl_mat_transpose(struct isl_mat *mat);
77 struct isl_mat *isl_mat_right_inverse(struct isl_mat *mat);
78 struct isl_mat *isl_mat_right_kernel(struct isl_mat *mat);
80 struct isl_mat *isl_mat_drop_cols(struct isl_mat *mat,
81 unsigned col, unsigned n);
82 struct isl_mat *isl_mat_drop_rows(struct isl_mat *mat,
83 unsigned row, unsigned n);
84 __isl_give isl_mat *isl_mat_insert_cols(__isl_take isl_mat *mat,
85 unsigned col, unsigned n);
86 __isl_give isl_mat *isl_mat_move_cols(__isl_take isl_mat *mat,
87 unsigned dst_col, unsigned src_col, unsigned n);
89 void isl_mat_col_mul(struct isl_mat *mat, int dst_col, isl_int f, int src_col);
90 void isl_mat_col_submul(struct isl_mat *mat,
91 int dst_col, isl_int f, int src_col);
93 struct isl_mat *isl_mat_unimodular_complete(struct isl_mat *M, int row);
95 __isl_give isl_mat *isl_mat_from_row_vec(__isl_take isl_vec *vec);
96 __isl_give isl_mat *isl_mat_concat(__isl_take isl_mat *top,
97 __isl_take isl_mat *bot);
98 __isl_give isl_mat *isl_mat_vec_concat(__isl_take isl_mat *top,
99 __isl_take isl_vec *bot);
101 int isl_mat_is_equal(__isl_keep isl_mat *mat1, __isl_keep isl_mat *mat2);
103 void isl_mat_dump(struct isl_mat *mat, FILE *out, int indent);
105 #if defined(__cplusplus)
107 #endif
109 #endif