for (i = 0; i < mat->n_row; ++i)
isl_int_mul(mat->row[i][dst_col], f, mat->row[i][src_col]);
}
+
+struct isl_mat *isl_mat_unimodular_complete(struct isl_ctx *ctx,
+ struct isl_mat *M, int row)
+{
+ int r;
+ struct isl_mat *H = NULL, *Q = NULL;
+
+ isl_assert(ctx, M->n_row == M->n_col, goto error);
+ M->n_row = row;
+ H = isl_mat_left_hermite(ctx, isl_mat_copy(ctx, M), 0, NULL, &Q);
+ M->n_row = M->n_col;
+ if (!H)
+ goto error;
+ for (r = 0; r < row; ++r)
+ isl_assert(ctx, isl_int_is_one(H->row[r][r]), goto error);
+ for (r = row; r < M->n_row; ++r)
+ isl_seq_cpy(M->row[r], Q->row[r], M->n_col);
+ isl_mat_free(ctx, H);
+ isl_mat_free(ctx, Q);
+ return M;
+error:
+ isl_mat_free(ctx, H);
+ isl_mat_free(ctx, Q);
+ isl_mat_free(ctx, M);
+ return NULL;
+}