add isl_mat_row_neg
authorSven Verdoolaege <skimo@kotnet.org>
Wed, 14 Dec 2016 16:29:49 +0000 (14 17:29 +0100)
committerSven Verdoolaege <sven.verdoolaege@gmail.com>
Thu, 25 May 2017 14:13:31 +0000 (25 16:13 +0200)
This function will be used in the next commit.

Signed-off-by: Sven Verdoolaege <sven.verdoolaege@gmail.com>
isl_mat.c
isl_mat_private.h

index ec20e66..71147a7 100644 (file)
--- a/isl_mat.c
+++ b/isl_mat.c
@@ -1539,6 +1539,21 @@ __isl_give isl_mat *isl_mat_col_neg(__isl_take isl_mat *mat, int col)
        return mat;
 }
 
+/* Negate row "row" of "mat" and return the result.
+ */
+__isl_give isl_mat *isl_mat_row_neg(__isl_take isl_mat *mat, int row)
+{
+       if (check_row(mat, row) < 0)
+               return isl_mat_free(mat);
+       if (isl_seq_first_non_zero(mat->row[row], mat->n_col) == -1)
+               return mat;
+       mat = isl_mat_cow(mat);
+       if (!mat)
+               return NULL;
+       isl_seq_neg(mat->row[row], mat->row[row], mat->n_col);
+       return mat;
+}
+
 __isl_give isl_mat *isl_mat_unimodular_complete(__isl_take isl_mat *M, int row)
 {
        int r;
index 7ab81ef..0fface7 100644 (file)
@@ -51,6 +51,7 @@ void isl_mat_col_submul(struct isl_mat *mat,
 __isl_give isl_mat *isl_mat_col_addmul(__isl_take isl_mat *mat, int dst_col,
        isl_int f, int src_col);
 __isl_give isl_mat *isl_mat_col_neg(__isl_take isl_mat *mat, int col);
+__isl_give isl_mat *isl_mat_row_neg(__isl_take isl_mat *mat, int row);
 
 int isl_mat_get_element(__isl_keep isl_mat *mat, int row, int col, isl_int *v);
 __isl_give isl_mat *isl_mat_set_element(__isl_take isl_mat *mat,