ba8ac0799efe83dde359a5e2132f3b80c13e9600
[platform/upstream/isl.git] / isl_mat.h
1 #ifndef ISL_MAT_H
2 #define ISL_MAT_H
3
4 #include <stdio.h>
5
6 #include <isl_int.h>
7 #include <isl_ctx.h>
8 #include <isl_blk.h>
9 #include <isl_set.h>
10 #include "isl_vec.h"
11
12 #if defined(__cplusplus)
13 extern "C" {
14 #endif
15
16 struct isl_mat {
17         int ref;
18
19 #define ISL_MAT_BORROWED                (1 << 0)
20         unsigned flags;
21
22         unsigned n_row;
23         unsigned n_col;
24
25         isl_int **row;
26
27         struct isl_blk block;
28 };
29
30 struct isl_mat *isl_mat_alloc(struct isl_ctx *ctx,
31         unsigned n_row, unsigned n_col);
32 struct isl_mat *isl_mat_identity(struct isl_ctx *ctx, unsigned n_row);
33 struct isl_mat *isl_mat_copy(struct isl_ctx *ctx, struct isl_mat *mat);
34 struct isl_mat *isl_mat_cow(struct isl_ctx *ctx, struct isl_mat *mat);
35 void isl_mat_free(struct isl_ctx *ctx, struct isl_mat *mat);
36
37 struct isl_mat *isl_mat_sub_alloc(struct isl_ctx *ctx, isl_int **row,
38         unsigned first_row, unsigned n_row, unsigned first_col, unsigned n_col);
39 void isl_mat_sub_copy(struct isl_ctx *ctx, isl_int **dst, isl_int **src,
40         unsigned n_row, unsigned dst_col, unsigned src_col, unsigned n_col);
41 void isl_mat_sub_neg(struct isl_ctx *ctx, isl_int **dst, isl_int **src,
42         unsigned n_row, unsigned dst_col, unsigned src_col, unsigned n_col);
43
44 struct isl_mat *isl_mat_swap_rows(struct isl_ctx *ctx,
45         struct isl_mat *mat, unsigned i, unsigned j);
46
47 struct isl_vec *isl_mat_vec_product(struct isl_ctx *ctx,
48         struct isl_mat *mat, struct isl_vec *vec);
49 struct isl_mat *isl_mat_aff_direct_sum(struct isl_ctx *ctx,
50         struct isl_mat *left, struct isl_mat *right);
51 struct isl_mat *isl_mat_left_hermite(struct isl_ctx *ctx,
52         struct isl_mat *M, int neg, struct isl_mat **U, struct isl_mat **Q);
53 struct isl_mat *isl_mat_lin_to_aff(struct isl_ctx *ctx, struct isl_mat *mat);
54 struct isl_mat *isl_mat_inverse_product(struct isl_ctx *ctx,
55         struct isl_mat *left, struct isl_mat *right);
56 struct isl_mat *isl_mat_product(struct isl_ctx *ctx,
57         struct isl_mat *left, struct isl_mat *right);
58 struct isl_mat *isl_mat_right_inverse(struct isl_ctx *ctx,
59         struct isl_mat *mat);
60
61 struct isl_mat *isl_mat_drop_cols(struct isl_ctx *ctx, struct isl_mat *mat,
62                                 unsigned col, unsigned n);
63 struct isl_mat *isl_mat_drop_rows(struct isl_ctx *ctx, struct isl_mat *mat,
64                                 unsigned row, unsigned n);
65
66 struct isl_basic_set *isl_basic_set_preimage(struct isl_ctx *ctx,
67         struct isl_basic_set *bset, struct isl_mat *mat);
68 struct isl_set *isl_set_preimage(struct isl_ctx *ctx,
69         struct isl_set *set, struct isl_mat *mat);
70
71 void isl_mat_dump(struct isl_ctx *ctx, struct isl_mat *mat,
72                                 FILE *out, int indent);
73
74 #if defined(__cplusplus)
75 }
76 #endif
77
78 #endif