add isl_basic_set_full_compression
[isl.git] / include / isl_mat.h
blob0caf023e4a7d09f80cd148ecbaff4c7d6a2c7368
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 __isl_give isl_mat *isl_mat_diagonal(__isl_take isl_mat *mat1,
71 __isl_take isl_mat *mat2);
72 struct isl_mat *isl_mat_left_hermite(struct isl_mat *M,
73 int neg, struct isl_mat **U, struct isl_mat **Q);
74 struct isl_mat *isl_mat_lin_to_aff(struct isl_mat *mat);
75 struct isl_mat *isl_mat_inverse_product(struct isl_mat *left,
76 struct isl_mat *right);
77 struct isl_mat *isl_mat_product(struct isl_mat *left, struct isl_mat *right);
78 struct isl_mat *isl_mat_transpose(struct isl_mat *mat);
79 struct isl_mat *isl_mat_right_inverse(struct isl_mat *mat);
80 struct isl_mat *isl_mat_right_kernel(struct isl_mat *mat);
82 __isl_give isl_mat *isl_mat_normalize(__isl_take isl_mat *mat);
84 struct isl_mat *isl_mat_drop_cols(struct isl_mat *mat,
85 unsigned col, unsigned n);
86 struct isl_mat *isl_mat_drop_rows(struct isl_mat *mat,
87 unsigned row, unsigned n);
88 __isl_give isl_mat *isl_mat_insert_cols(__isl_take isl_mat *mat,
89 unsigned col, unsigned n);
90 __isl_give isl_mat *isl_mat_insert_rows(__isl_take isl_mat *mat,
91 unsigned row, unsigned n);
92 __isl_give isl_mat *isl_mat_move_cols(__isl_take isl_mat *mat,
93 unsigned dst_col, unsigned src_col, unsigned n);
95 void isl_mat_col_mul(struct isl_mat *mat, int dst_col, isl_int f, int src_col);
96 void isl_mat_col_submul(struct isl_mat *mat,
97 int dst_col, isl_int f, int src_col);
99 struct isl_mat *isl_mat_unimodular_complete(struct isl_mat *M, int row);
101 __isl_give isl_mat *isl_mat_from_row_vec(__isl_take isl_vec *vec);
102 __isl_give isl_mat *isl_mat_concat(__isl_take isl_mat *top,
103 __isl_take isl_mat *bot);
104 __isl_give isl_mat *isl_mat_vec_concat(__isl_take isl_mat *top,
105 __isl_take isl_vec *bot);
107 int isl_mat_is_equal(__isl_keep isl_mat *mat1, __isl_keep isl_mat *mat2);
109 void isl_mat_dump(struct isl_mat *mat, FILE *out, int indent);
111 #if defined(__cplusplus)
113 #endif
115 #endif