else {
isl_mat *eq;
unsigned nvar = isl_basic_set_total_dim(bset);
- eq = isl_mat_sub_alloc(bset->ctx, bset->eq, 0, bset->n_eq,
+ eq = isl_mat_sub_alloc6(bset->ctx, bset->eq, 0, bset->n_eq,
1, nvar);
eq = isl_mat_left_hermite(eq, 0, NULL, &tab->basis);
tab->basis = isl_mat_lin_to_aff(tab->basis);
total = isl_basic_set_total_dim(cone);
cone_dim = total - cone->n_eq;
- M = isl_mat_sub_alloc(bset->ctx, cone->eq, 0, cone->n_eq, 1, total);
+ M = isl_mat_sub_alloc6(bset->ctx, cone->eq, 0, cone->n_eq, 1, total);
M = isl_mat_left_hermite(M, 0, &U, &Q);
if (!M)
goto error;
if (!set || !lin)
goto error;
lin_dim = total - lin->n_eq;
- M = isl_mat_sub_alloc(set->ctx, lin->eq, 0, lin->n_eq, 1, total);
+ M = isl_mat_sub_alloc6(set->ctx, lin->eq, 0, lin->n_eq, 1, total);
M = isl_mat_left_hermite(M, 0, &U, &Q);
if (!M)
goto error;
total = isl_dim_total(set->dim);
for (i = 0; i < set->p[best]->n_ineq; ++i) {
- constraints[i].c = isl_mat_sub_alloc(hull->ctx,
+ constraints[i].c = isl_mat_sub_alloc6(hull->ctx,
set->p[best]->ineq + i, 0, 1, 0, 1 + total);
if (!constraints[i].c)
goto error;
M = isl_mat_left_hermite(M, 0, &U, NULL);
if (!M || !U)
goto error;
- H = isl_mat_sub_alloc(B->ctx, M->row, 0, B->n_row, 0, B->n_row);
+ H = isl_mat_sub_alloc(M, 0, B->n_row, 0, B->n_row);
H = isl_mat_lin_to_aff(H);
C = isl_mat_inverse_product(H, C);
if (!C)
if (i < B->n_row)
cst = isl_mat_alloc(B->ctx, B->n_row, 0);
else
- cst = isl_mat_sub_alloc(C->ctx, C->row, 1, B->n_row, 0, 1);
- T = isl_mat_sub_alloc(U->ctx, U->row, B->n_row, B->n_col - 1, 0, B->n_row);
+ cst = isl_mat_sub_alloc(C, 1, B->n_row, 0, 1);
+ T = isl_mat_sub_alloc(U, B->n_row, B->n_col - 1, 0, B->n_row);
cst = isl_mat_product(T, cst);
isl_mat_free(M);
isl_mat_free(C);
D, U->row[j][k]);
}
A = isl_mat_left_hermite(A, 0, NULL, NULL);
- T = isl_mat_sub_alloc(A->ctx, A->row, 0, A->n_row, 0, A->n_row);
+ T = isl_mat_sub_alloc(A, 0, A->n_row, 0, A->n_row);
T = isl_mat_lin_to_aff(T);
if (!T)
goto error;
goto error;
dim = B->n_col - 1;
- H = isl_mat_sub_alloc(B->ctx, B->row, 0, B->n_row, 1, dim);
+ H = isl_mat_sub_alloc(B, 0, B->n_row, 1, dim);
H = isl_mat_left_hermite(H, 0, &U, T2);
if (!H || !U || (T2 && !*T2))
goto error;
goto error;
isl_int_set_si(C->row[0][0], 1);
isl_mat_sub_neg(C->ctx, C->row+1, B->row, B->n_row, 0, 0, 1);
- H1 = isl_mat_sub_alloc(H->ctx, H->row, 0, H->n_row, 0, H->n_row);
+ H1 = isl_mat_sub_alloc(H, 0, H->n_row, 0, H->n_row);
H1 = isl_mat_lin_to_aff(H1);
TC = isl_mat_inverse_product(H1, C);
if (!TC)
}
isl_int_set_si(TC->row[0][0], 1);
}
- U1 = isl_mat_sub_alloc(U->ctx, U->row, 0, U->n_row, 0, B->n_row);
+ U1 = isl_mat_sub_alloc(U, 0, U->n_row, 0, B->n_row);
U1 = isl_mat_lin_to_aff(U1);
- U2 = isl_mat_sub_alloc(U->ctx, U->row, 0, U->n_row,
- B->n_row, U->n_row - B->n_row);
+ U2 = isl_mat_sub_alloc(U, 0, U->n_row, B->n_row, U->n_row - B->n_row);
U2 = isl_mat_lin_to_aff(U2);
isl_mat_free(U);
TC = isl_mat_product(U1, TC);
if (bset->n_eq == 0)
return bset;
- B = isl_mat_sub_alloc(bset->ctx, bset->eq, 0, bset->n_eq, 0, 1 + dim);
+ B = isl_mat_sub_alloc6(bset->ctx, bset->eq, 0, bset->n_eq, 0, 1 + dim);
TC = isl_mat_variable_compression(B, T2);
if (!TC)
goto error;
ctx = bset->ctx;
total = isl_basic_set_total_dim(bset);
nparam = isl_basic_set_n_param(bset);
- H = isl_mat_sub_alloc(bset->ctx, bset->eq, 0, bset->n_eq, 1, total);
+ H = isl_mat_sub_alloc6(bset->ctx, bset->eq, 0, bset->n_eq, 1, total);
H = isl_mat_left_hermite(H, 0, &U, NULL);
if (!H)
return -1;
goto error;
isl_int_set_si(C->row[0][0], 1);
isl_mat_sub_neg(C->ctx, C->row+1, bset->eq, bset->n_eq, 0, 0, 1);
- H1 = isl_mat_sub_alloc(H->ctx, H->row, 0, H->n_row, 0, H->n_row);
+ H1 = isl_mat_sub_alloc(H, 0, H->n_row, 0, H->n_row);
H1 = isl_mat_lin_to_aff(H1);
C = isl_mat_inverse_product(H1, C);
isl_mat_free(H);
- U1 = isl_mat_sub_alloc(U->ctx, U->row, nparam+pos, 1, 0, bset->n_eq);
+ U1 = isl_mat_sub_alloc(U, nparam+pos, 1, 0, bset->n_eq);
U1 = isl_mat_lin_to_aff(U1);
isl_mat_free(U);
C = isl_mat_product(U1, C);
if (i == bset->n_eq)
return isl_basic_set_lexmin(bset);
- eq = isl_mat_sub_alloc(bset->ctx, bset->eq, i, bset->n_eq - i,
+ eq = isl_mat_sub_alloc6(bset->ctx, bset->eq, i, bset->n_eq - i,
0, 1 + nparam);
eq = isl_mat_cow(eq);
T = isl_mat_variable_compression(isl_mat_copy(eq), &T2);
return bmap;
if (div_eq < bmap->n_eq) {
- B = isl_mat_sub_alloc(bmap->ctx, bmap->eq, div_eq,
+ B = isl_mat_sub_alloc6(bmap->ctx, bmap->eq, div_eq,
bmap->n_eq - div_eq, 0, 1 + total);
C = isl_mat_variable_compression(B, &C2);
if (!C || !C2)
--j;
isl_int_set(d->block.data[i], bmap->eq[i][1 + total + j]);
}
- B = isl_mat_sub_alloc(bmap->ctx, bmap->eq, 0, div_eq, 0, 1 + total);
+ B = isl_mat_sub_alloc6(bmap->ctx, bmap->eq, 0, div_eq, 0, 1 + total);
if (C) {
B = isl_mat_product(B, C);
return NULL;
total = isl_basic_set_total_dim(bset);
- B = isl_mat_sub_alloc(bset->ctx, bset->eq, 0, bset->n_eq, 0, 1 + total);
+ B = isl_mat_sub_alloc6(bset->ctx, bset->eq, 0, bset->n_eq, 0, 1 + total);
C = isl_mat_variable_compression(B, NULL);
if (!C)
return bset;
isl_mat_free(C);
return isl_basic_set_set_to_empty(bset);
}
- B = isl_mat_sub_alloc(bset->ctx, bset->ineq,
+ B = isl_mat_sub_alloc6(bset->ctx, bset->ineq,
0, bset->n_ineq, 0, 1 + total);
C = isl_mat_product(B, C);
if (!C)
return uset_gist_full(bset, context);
}
total = isl_basic_set_total_dim(bset);
- eq = isl_mat_sub_alloc(bset->ctx, aff->eq, 0, aff->n_eq, 0, 1 + total);
+ eq = isl_mat_sub_alloc6(bset->ctx, aff->eq, 0, aff->n_eq, 0, 1 + total);
eq = isl_mat_cow(eq);
T = isl_mat_variable_compression(eq, &T2);
if (T && T->n_col == 0) {
return NULL;
}
-struct isl_mat *isl_mat_sub_alloc(struct isl_ctx *ctx, isl_int **row,
+__isl_give isl_mat *isl_mat_sub_alloc6(isl_ctx *ctx, isl_int **row,
unsigned first_row, unsigned n_row, unsigned first_col, unsigned n_col)
{
int i;
return NULL;
}
+__isl_give isl_mat *isl_mat_sub_alloc(__isl_keep isl_mat *mat,
+ unsigned first_row, unsigned n_row, unsigned first_col, unsigned n_col)
+{
+ if (!mat)
+ return NULL;
+ return isl_mat_sub_alloc6(mat->ctx, mat->row, first_row, n_row,
+ first_col, n_col);
+}
+
void isl_mat_sub_copy(struct isl_ctx *ctx, isl_int **dst, isl_int **src,
unsigned n_row, unsigned dst_col, unsigned src_col, unsigned n_col)
{
if (has_div)
for (i = 0; i < n; ++i)
isl_int_mul(q[i][0], q[i][0], mat->row[0][0]);
- t = isl_mat_sub_alloc(mat->ctx, q, 0, n, has_div, mat->n_row);
+ t = isl_mat_sub_alloc6(mat->ctx, q, 0, n, has_div, mat->n_row);
t = isl_mat_product(t, mat);
if (!t)
return -1;
struct isl_blk block;
};
-struct isl_mat *isl_mat_sub_alloc(struct isl_ctx *ctx, isl_int **row,
+__isl_give isl_mat *isl_mat_sub_alloc(__isl_keep isl_mat *mat,
+ unsigned first_row, unsigned n_row, unsigned first_col, unsigned n_col);
+__isl_give isl_mat *isl_mat_sub_alloc6(isl_ctx *ctx, isl_int **row,
unsigned first_row, unsigned n_row, unsigned first_col, unsigned n_col);
void isl_mat_sub_copy(struct isl_ctx *ctx, isl_int **dst, isl_int **src,
unsigned n_row, unsigned dst_col, unsigned src_col, unsigned n_col);
if (n_eq == 0)
return isl_morph_identity(bset);
- H = isl_mat_sub_alloc(bset->ctx, bset->eq, f_eq, n_eq, otype, ntype);
+ H = isl_mat_sub_alloc6(bset->ctx, bset->eq, f_eq, n_eq, otype, ntype);
H = isl_mat_left_hermite(H, 0, &U, &Q);
if (!H || !U || !Q)
goto error;
isl_int_set_si(C->row[0][0], 1);
isl_seq_clr(C->row[0] + 1, otype - 1);
isl_mat_sub_neg(C->ctx, C->row + 1, bset->eq + f_eq, n_eq, 0, 0, otype);
- H1 = isl_mat_sub_alloc(H->ctx, H->row, 0, H->n_row, 0, H->n_row);
+ H1 = isl_mat_sub_alloc(H, 0, H->n_row, 0, H->n_row);
H1 = isl_mat_lin_to_aff(H1);
C = isl_mat_inverse_product(H1, C);
if (!C)
C = isl_mat_normalize(C);
}
- U1 = isl_mat_sub_alloc(U->ctx, U->row, 0, U->n_row, 0, n_eq);
+ U1 = isl_mat_sub_alloc(U, 0, U->n_row, 0, n_eq);
U1 = isl_mat_lin_to_aff(U1);
- U2 = isl_mat_sub_alloc(U->ctx, U->row, 0, U->n_row, n_eq, U->n_row - n_eq);
+ U2 = isl_mat_sub_alloc(U, 0, U->n_row, n_eq, U->n_row - n_eq);
U2 = isl_mat_lin_to_aff(U2);
isl_mat_free(U);
isl_assert(bset->ctx, n_eq <= nvar, return NULL);
d = isl_vec_alloc(bset->ctx, n_eq);
- B = isl_mat_sub_alloc(bset->ctx, bset->eq, 0, n_eq, 0, 1 + nparam);
- H = isl_mat_sub_alloc(bset->ctx, bset->eq, 0, n_eq, 1 + nparam, nvar);
+ B = isl_mat_sub_alloc6(bset->ctx, bset->eq, 0, n_eq, 0, 1 + nparam);
+ H = isl_mat_sub_alloc6(bset->ctx, bset->eq, 0, n_eq, 1 + nparam, nvar);
H = isl_mat_left_hermite(H, 0, NULL, NULL);
H = isl_mat_drop_cols(H, n_eq, nvar - n_eq);
H = isl_mat_lin_to_aff(H);
if (isl_basic_set_alloc_div(res) < 0)
goto error;
- mat = isl_mat_sub_alloc(bset->ctx, bset->eq, 0, bset->n_eq,
+ mat = isl_mat_sub_alloc6(bset->ctx, bset->eq, 0, bset->n_eq,
0, morph->inv->n_row);
mat = isl_mat_product(mat, isl_mat_copy(morph->inv));
if (!mat)
}
isl_mat_free(mat);
- mat = isl_mat_sub_alloc(bset->ctx, bset->ineq, 0, bset->n_ineq,
+ mat = isl_mat_sub_alloc6(bset->ctx, bset->ineq, 0, bset->n_ineq,
0, morph->inv->n_row);
mat = isl_mat_product(mat, isl_mat_copy(morph->inv));
if (!mat)
}
isl_mat_free(mat);
- mat = isl_mat_sub_alloc(bset->ctx, bset->div, 0, bset->n_div,
+ mat = isl_mat_sub_alloc6(bset->ctx, bset->div, 0, bset->n_div,
1, morph->inv->n_row);
mat = isl_mat_product(mat, isl_mat_copy(morph->inv));
if (!mat)
total = isl_basic_set_total_dim(cone);
cone_dim = total - cone->n_eq;
- M = isl_mat_sub_alloc(bset->ctx, cone->eq, 0, cone->n_eq, 1, total);
+ M = isl_mat_sub_alloc6(bset->ctx, cone->eq, 0, cone->n_eq, 1, total);
M = isl_mat_left_hermite(M, 0, &U, NULL);
if (!M)
goto error;