isl_dim.c \
isl_dim_map.h \
isl_dim_map.c \
- isl_div.c \
- isl_div_private.h \
isl_equalities.c \
isl_equalities.h \
isl_factorization.c \
include/isl/constraint.h \
include/isl/ctx.h \
include/isl/dim.h \
- include/isl/div.h \
include/isl/flow.h \
include/isl/id.h \
include/isl/ilp.h \
An C<isl_local_space> can be created from an C<isl_space>
using C<isl_local_space_from_space>.
+=item * The C<isl_div> type has been removed. Functions that used
+to return an C<isl_div> now return an C<isl_aff>.
+Note that the space of an C<isl_aff> is that of relation.
+When replacing a call to C<isl_div_get_coefficient> by a call to
+C<isl_aff_get_coefficient> any C<isl_dim_set> argument needs
+to be replaced by C<isl_dim_in>.
+A call to C<isl_aff_from_div> can be replaced by a call
+to C<isl_aff_floor>.
+A call to C<isl_qpolynomial_div(div)> call be replaced by
+the nested call
+
+ isl_qpolynomial_from_aff(isl_aff_floor(div))
+
+The function C<isl_constraint_div> has also been renamed
+to C<isl_constraint_get_div>.
+
=back
=head1 Installation
enum isl_dim_type type, unsigned pos, const char *s);
__isl_give isl_space *isl_local_space_get_space(
__isl_keep isl_local_space *ls);
- __isl_give isl_div *isl_local_space_get_div(
+ __isl_give isl_aff *isl_local_space_get_div(
__isl_keep isl_local_space *ls, int pos);
__isl_give isl_local_space *isl_local_space_copy(
__isl_keep isl_local_space *ls);
enum isl_dim_type type, unsigned first, unsigned n);
The explicit representations of the existentially quantified
-variables can be inspected using the following functions.
-Note that the user is only allowed to use these functions
+variables can be inspected using the following function.
+Note that the user is only allowed to use this function
if the inspected set or map is the result of a call
to C<isl_set_compute_divs> or C<isl_map_compute_divs>.
+The existentially quantified variable is equal to the floor
+of the returned affine expression. The affine expression
+itself can be inspected using the functions in
+L<"Piecewise Quasi Affine Expressions">.
- __isl_give isl_div *isl_constraint_div(
+ __isl_give isl_aff *isl_constraint_get_div(
__isl_keep isl_constraint *constraint, int pos);
- isl_ctx *isl_div_get_ctx(__isl_keep isl_div *div);
- void isl_div_get_constant(__isl_keep isl_div *div,
- isl_int *v);
- void isl_div_get_denominator(__isl_keep isl_div *div,
- isl_int *v);
- void isl_div_get_coefficient(__isl_keep isl_div *div,
- enum isl_dim_type type, int pos, isl_int *v);
To obtain the constraints of a basic set or map in matrix
form, use the following functions.
Note that the space in which the resulting object lives is a map space
with the given space as domain and a one-dimensional range.
-A quasi affine expression can also be initialized from an C<isl_div>:
-
- #include <isl/div.h>
- __isl_give isl_aff *isl_aff_from_div(__isl_take isl_div *div);
-
An empty piecewise quasi affine expression (one with no cells)
or a piecewise quasi affine expression with a single cell can
be created using the following functions.
enum isl_dim_type type, int pos, isl_int *v);
int isl_aff_get_denominator(__isl_keep isl_aff *aff,
isl_int *v);
- __isl_give isl_div *isl_aff_get_div(
+ __isl_give isl_aff *isl_aff_get_div(
__isl_keep isl_aff *aff, int pos);
int isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff,
__isl_give isl_qpolynomial *isl_qpolynomial_rat_cst_on_domain(
__isl_take isl_space *domain,
const isl_int n, const isl_int d);
- __isl_give isl_qpolynomial *isl_qpolynomial_div(
- __isl_take isl_div *div);
__isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(
__isl_take isl_space *domain,
enum isl_dim_type type, unsigned pos);
isl_int *d);
int isl_term_get_exp(__isl_keep isl_term *term,
enum isl_dim_type type, unsigned pos);
- __isl_give isl_div *isl_term_get_div(
+ __isl_give isl_aff *isl_term_get_div(
__isl_keep isl_term *term, unsigned pos);
void isl_term_free(__isl_take isl_term *term);
#ifndef ISL_AFF_H
#define ISL_AFF_H
-#include <isl/div.h>
#include <isl/local_space.h>
#include <isl/printer.h>
#include <isl/set_type.h>
int isl_aff_plain_is_equal(__isl_keep isl_aff *aff1, __isl_keep isl_aff *aff2);
int isl_aff_plain_is_zero(__isl_keep isl_aff *aff);
-__isl_give isl_div *isl_aff_get_div(__isl_keep isl_aff *aff, int pos);
+__isl_give isl_aff *isl_aff_get_div(__isl_keep isl_aff *aff, int pos);
__isl_give isl_aff *isl_aff_neg(__isl_take isl_aff *aff);
__isl_give isl_aff *isl_aff_ceil(__isl_take isl_aff *aff);
#define ISL_CONSTRAINT_H
#include <isl/local_space.h>
+#include <isl/space.h>
#include <isl/aff_type.h>
-#include <isl/div.h>
#include <isl/set_type.h>
#include <isl/printer.h>
__isl_take isl_constraint *constraint,
enum isl_dim_type type, int pos, int v);
-__isl_give isl_div *isl_constraint_div(__isl_keep isl_constraint *constraint,
+__isl_give isl_aff *isl_constraint_get_div(__isl_keep isl_constraint *constraint,
int pos);
struct isl_constraint *isl_constraint_negate(struct isl_constraint *constraint);
+++ /dev/null
-/*
- * Copyright 2008-2009 Katholieke Universiteit Leuven
- *
- * Use of this software is governed by the GNU LGPLv2.1 license
- *
- * Written by Sven Verdoolaege, K.U.Leuven, Departement
- * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
- */
-
-#ifndef ISL_DIV_H
-#define ISL_DIV_H
-
-#include <isl/space.h>
-#include <isl/aff_type.h>
-
-#if defined(__cplusplus)
-extern "C" {
-#endif
-
-struct isl_div;
-typedef struct isl_div isl_div;
-
-isl_ctx *isl_div_get_ctx(__isl_keep isl_div *div);
-
-__isl_give isl_div *isl_div_alloc(__isl_take isl_space *dim);
-__isl_give isl_div *isl_div_copy(__isl_keep isl_div *div);
-void isl_div_free(struct isl_div *c);
-
-void isl_div_get_constant(__isl_keep isl_div *div, isl_int *v);
-void isl_div_get_denominator(__isl_keep isl_div *div, isl_int *v);
-void isl_div_get_coefficient(__isl_keep isl_div *div,
- enum isl_dim_type type, int pos, isl_int *v);
-void isl_div_set_constant(struct isl_div *div, isl_int v);
-void isl_div_set_denominator(struct isl_div *div, isl_int v);
-void isl_div_set_coefficient(struct isl_div *div,
- enum isl_dim_type type, int pos, isl_int v);
-
-unsigned isl_div_dim(__isl_keep isl_div *div, enum isl_dim_type type);
-__isl_give isl_div *isl_div_div(__isl_take isl_div *div, int pos);
-
-__isl_give isl_aff *isl_aff_from_div(__isl_take isl_div *div);
-
-#if defined(__cplusplus)
-}
-#endif
-
-#endif
#ifndef ISL_LOCAL_SPACE_H
#define ISL_LOCAL_SPACE_H
-#include <isl/div.h>
+#include <isl/aff_type.h>
+#include <isl/space.h>
#include <isl/printer.h>
#if defined(__cplusplus)
__isl_take isl_local_space *ls,
enum isl_dim_type type, unsigned pos, const char *s);
__isl_give isl_space *isl_local_space_get_space(__isl_keep isl_local_space *ls);
-__isl_give isl_div *isl_local_space_get_div(__isl_keep isl_local_space *ls,
+__isl_give isl_aff *isl_local_space_get_div(__isl_keep isl_local_space *ls,
int pos);
__isl_give isl_local_space *isl_local_space_domain(
#include <isl/ctx.h>
#include <isl/blk.h>
#include <isl/space.h>
-#include <isl/div.h>
#include <isl/vec.h>
#include <isl/mat.h>
#include <isl/printer.h>
__isl_give isl_space *isl_basic_map_get_space(__isl_keep isl_basic_map *bmap);
__isl_give isl_space *isl_map_get_space(__isl_keep isl_map *map);
-struct isl_div *isl_basic_map_div(struct isl_basic_map *bmap, int pos);
+__isl_give isl_aff *isl_basic_map_get_div(__isl_keep isl_basic_map *bmap,
+ int pos);
__isl_give isl_local_space *isl_basic_map_get_local_space(
__isl_keep isl_basic_map *bmap);
#include <isl/ctx.h>
#include <isl/constraint.h>
#include <isl/space.h>
-#include <isl/div.h>
#include <isl/set_type.h>
#include <isl/point.h>
#include <isl/printer.h>
__isl_give isl_qpolynomial *isl_qpolynomial_nan_on_domain(__isl_take isl_space *dim);
__isl_give isl_qpolynomial *isl_qpolynomial_rat_cst_on_domain(__isl_take isl_space *dim,
const isl_int n, const isl_int d);
-__isl_give isl_qpolynomial *isl_qpolynomial_div(__isl_take isl_div *div);
__isl_give isl_qpolynomial *isl_qpolynomial_var_on_domain(__isl_take isl_space *dim,
enum isl_dim_type type, unsigned pos);
__isl_give isl_qpolynomial *isl_qpolynomial_copy(__isl_keep isl_qpolynomial *qp);
void isl_term_get_den(__isl_keep isl_term *term, isl_int *d);
int isl_term_get_exp(__isl_keep isl_term *term,
enum isl_dim_type type, unsigned pos);
-__isl_give isl_div *isl_term_get_div(__isl_keep isl_term *term, unsigned pos);
+__isl_give isl_aff *isl_term_get_div(__isl_keep isl_term *term, unsigned pos);
int isl_qpolynomial_foreach_term(__isl_keep isl_qpolynomial *qp,
int (*fn)(__isl_take isl_term *term, void *user), void *user);
__isl_give isl_set *isl_set_reset_space(__isl_take isl_set *set,
__isl_take isl_space *dim);
-struct isl_div *isl_basic_set_div(struct isl_basic_set *bset, int pos);
+__isl_give isl_aff *isl_basic_set_get_div(__isl_keep isl_basic_set *bset,
+ int pos);
__isl_give isl_local_space *isl_basic_set_get_local_space(
__isl_keep isl_basic_set *bset);
return aff;
}
-__isl_give isl_div *isl_aff_get_div(__isl_keep isl_aff *aff, int pos)
+__isl_give isl_aff *isl_aff_get_div(__isl_keep isl_aff *aff, int pos)
{
if (!aff)
return NULL;
#include <isl_map_private.h>
#include <isl_constraint_private.h>
#include <isl_space_private.h>
-#include <isl_div_private.h>
#include <isl/seq.h>
#include <isl_aff_private.h>
#include <isl_local_space_private.h>
isl_int_set(*v, constraint->v->el[pos]);
}
-struct isl_div *isl_constraint_div(struct isl_constraint *constraint, int pos)
+__isl_give isl_aff *isl_constraint_get_div(__isl_keep isl_constraint *constraint,
+ int pos)
{
if (!constraint)
return NULL;
+++ /dev/null
-/*
- * Copyright 2008-2009 Katholieke Universiteit Leuven
- *
- * Use of this software is governed by the GNU LGPLv2.1 license
- *
- * Written by Sven Verdoolaege, K.U.Leuven, Departement
- * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
- */
-
-#include <isl_map_private.h>
-#include <isl_div_private.h>
-#include <isl/map.h>
-#include <isl_space_private.h>
-#include <isl/seq.h>
-#include <isl/aff.h>
-
-isl_ctx *isl_div_get_ctx(__isl_keep isl_div *div)
-{
- return div ? div->ctx : NULL;
-}
-
-static unsigned n(struct isl_div *d, enum isl_dim_type type)
-{
- isl_space *dim = d->bmap->dim;
- switch (type) {
- case isl_dim_param: return dim->nparam;
- case isl_dim_in: return dim->n_in;
- case isl_dim_out: return dim->n_out;
- case isl_dim_div: return d->bmap->n_div;
- default: return 0;
- }
-}
-
-unsigned isl_div_dim(__isl_keep isl_div *div, enum isl_dim_type type)
-{
- return n(div, type);
-}
-
-static unsigned offset(struct isl_div *d, enum isl_dim_type type)
-{
- isl_space *dim = d->bmap->dim;
- switch (type) {
- case isl_dim_param: return 1 + 1;
- case isl_dim_in: return 1 + 1 + dim->nparam;
- case isl_dim_out: return 1 + 1 + dim->nparam + dim->n_in;
- case isl_dim_div: return 1 + 1 + dim->nparam + dim->n_in + dim->n_out;
- default: return 0;
- }
-}
-
-struct isl_div *isl_basic_map_div(struct isl_basic_map *bmap, int pos)
-{
- struct isl_div *div;
-
- if (!bmap)
- goto error;
-
- isl_assert(bmap->ctx, pos < bmap->n_div, goto error);
-
- div = isl_alloc_type(bmap->ctx, struct isl_div);
- if (!div)
- goto error;
-
- div->ctx = bmap->ctx;
- isl_ctx_ref(div->ctx);
- div->ref = 1;
- div->bmap = bmap;
- div->line = &bmap->div[pos];
-
- return div;
-error:
- isl_basic_map_free(bmap);
- return NULL;
-}
-
-struct isl_div *isl_basic_set_div(struct isl_basic_set *bset, int pos)
-{
- return isl_basic_map_div((struct isl_basic_map *)bset, pos);
-}
-
-__isl_give isl_div *isl_div_div(__isl_take isl_div *div, int pos)
-{
- isl_basic_map *bmap;
- if (!div)
- return NULL;
- bmap = isl_basic_map_copy(div->bmap);
- isl_div_free(div);
- return isl_basic_map_div(bmap, pos);
-}
-
-__isl_give isl_div *isl_div_alloc(__isl_take isl_space *dim)
-{
- struct isl_basic_map *bmap;
-
- if (!dim)
- return NULL;
-
- bmap = isl_basic_map_alloc_space(dim, 1, 0, 0);
- if (!bmap)
- return NULL;
-
- isl_basic_map_alloc_div(bmap);
- isl_seq_clr(bmap->div[0], 1 + 1 + isl_basic_map_total_dim(bmap));
- return isl_basic_map_div(bmap, 0);
-}
-
-__isl_give isl_div *isl_div_copy(__isl_keep isl_div *div)
-{
- if (!div)
- return NULL;
-
- div->ref++;
- return div;
-}
-
-void isl_div_free(struct isl_div *c)
-{
- if (!c)
- return;
-
- if (--c->ref > 0)
- return;
-
- isl_basic_map_free(c->bmap);
- isl_ctx_deref(c->ctx);
- free(c);
-}
-
-void isl_div_get_constant(struct isl_div *div, isl_int *v)
-{
- if (!div)
- return;
- isl_int_set(*v, div->line[0][1]);
-}
-
-void isl_div_get_denominator(struct isl_div *div, isl_int *v)
-{
- if (!div)
- return;
- isl_int_set(*v, div->line[0][0]);
-}
-
-void isl_div_get_coefficient(struct isl_div *div,
- enum isl_dim_type type, int pos, isl_int *v)
-{
- if (!div)
- return;
-
- isl_assert(div->ctx, pos < n(div, type), return);
- isl_int_set(*v, div->line[0][offset(div, type) + pos]);
-}
-
-void isl_div_set_constant(struct isl_div *div, isl_int v)
-{
- if (!div)
- return;
- isl_int_set(div->line[0][1], v);
-}
-
-void isl_div_set_denominator(struct isl_div *div, isl_int v)
-{
- if (!div)
- return;
- isl_int_set(div->line[0][0], v);
-}
-
-void isl_div_set_coefficient(struct isl_div *div,
- enum isl_dim_type type, int pos, isl_int v)
-{
- if (!div)
- return;
-
- isl_assert(div->ctx, pos < n(div, type), return);
- isl_int_set(div->line[0][offset(div, type) + pos], v);
-}
-
-__isl_give isl_aff *isl_aff_from_div(__isl_take isl_div *div)
-{
- isl_aff *aff;
- int pos;
-
- if (!div)
- return NULL;
-
- pos = div->line - div->bmap->div;
- aff = isl_aff_zero_on_domain(isl_basic_map_get_local_space(div->bmap));
- aff = isl_aff_set_coefficient_si(aff, isl_dim_div, pos, 1);
-
- isl_div_free(div);
- return aff;
-}
+++ /dev/null
-#include <isl/div.h>
-#include <isl/map.h>
-
-struct isl_div {
- int ref;
- struct isl_ctx *ctx;
-
- struct isl_basic_map *bmap;
- isl_int **line;
-};
#include <isl_map_private.h>
#include <isl/set.h>
#include <isl/seq.h>
-#include <isl/div.h>
#include <isl_stream_private.h>
#include <isl/obj.h>
#include "isl_polynomial_private.h"
#include <isl_local_space_private.h>
#include <isl_space_private.h>
#include <isl_mat_private.h>
+#include <isl_aff_private.h>
#include <isl/seq.h>
isl_ctx *isl_local_space_get_ctx(__isl_keep isl_local_space *ls)
return ls ? isl_space_get_dim_name(ls->dim, type, pos) : NULL;
}
-__isl_give isl_div *isl_local_space_get_div(__isl_keep isl_local_space *ls,
+__isl_give isl_aff *isl_local_space_get_div(__isl_keep isl_local_space *ls,
int pos)
{
- isl_basic_map *bmap;
+ isl_aff *aff;
if (!ls)
return NULL;
isl_die(isl_local_space_get_ctx(ls), isl_error_invalid,
"expression of div unknown", return NULL);
- bmap = isl_basic_map_from_local_space(isl_local_space_copy(ls));
- return isl_basic_map_div(bmap, pos);
+ aff = isl_aff_alloc(isl_local_space_copy(ls));
+ if (!aff)
+ return NULL;
+ isl_seq_cpy(aff->v->el, ls->div->row[pos], aff->v->size);
+ return aff;
}
__isl_give isl_space *isl_local_space_get_space(__isl_keep isl_local_space *ls)
#ifndef ISL_LOCAL_SPACE_PRIVATE_H
#define ISL_LOCAL_SPACE_PRIVATE_H
-#include <isl/div.h>
#include <isl/mat.h>
#include <isl/set.h>
#include <isl/local_space.h>
__isl_give isl_local_space *isl_local_space_alloc(__isl_take isl_space *dim,
unsigned n_div);
+__isl_give isl_local_space *isl_local_space_alloc_div(__isl_take isl_space *dim,
+ __isl_take isl_mat *div);
__isl_give isl_local_space *isl_local_space_add_div(
__isl_take isl_local_space *ls, __isl_take isl_vec *div);
isl_map_free(map);
return NULL;
}
+
+__isl_give isl_aff *isl_basic_map_get_div(__isl_keep isl_basic_map *bmap,
+ int pos)
+{
+ isl_aff *div;
+ isl_local_space *ls;
+
+ if (!bmap)
+ return NULL;
+
+ if (!isl_basic_map_divs_known(bmap))
+ isl_die(isl_basic_map_get_ctx(bmap), isl_error_invalid,
+ "some divs are unknown", return NULL);
+
+ ls = isl_basic_map_get_local_space(bmap);
+ div = isl_local_space_get_div(ls, pos);
+ isl_local_space_free(ls);
+
+ return div;
+}
+
+__isl_give isl_aff *isl_basic_set_get_div(__isl_keep isl_basic_set *bset,
+ int pos)
+{
+ return isl_basic_map_get_div(bset, pos);
+}
#include <isl_polynomial_private.h>
#include <isl_point_private.h>
#include <isl_space_private.h>
-#include <isl_div_private.h>
#include <isl_mat_private.h>
#include <isl_range.h>
#include <isl_local_space_private.h>
return NULL;
}
-/* Assumes each div only depends on earlier divs.
- */
-__isl_give isl_qpolynomial *isl_qpolynomial_div_pow(__isl_take isl_div *div,
- int power)
-{
- struct isl_qpolynomial *qp = NULL;
- struct isl_upoly_rec *rec;
- struct isl_upoly_cst *cst;
- int i, d;
- int pos;
-
- if (!div)
- return NULL;
-
- d = div->line - div->bmap->div;
-
- pos = isl_space_dim(div->bmap->dim, isl_dim_all) + d;
- rec = isl_upoly_alloc_rec(div->ctx, pos, 1 + power);
- qp = isl_qpolynomial_alloc(isl_basic_map_get_space(div->bmap),
- div->bmap->n_div, &rec->up);
- if (!qp)
- goto error;
-
- for (i = 0; i < div->bmap->n_div; ++i)
- isl_seq_cpy(qp->div->row[i], div->bmap->div[i], qp->div->n_col);
-
- for (i = 0; i < 1 + power; ++i) {
- rec->p[i] = isl_upoly_zero(div->ctx);
- if (!rec->p[i])
- goto error;
- rec->n++;
- }
- cst = isl_upoly_as_cst(rec->p[power]);
- isl_int_set_si(cst->n, 1);
-
- isl_div_free(div);
-
- qp = reduce_divs(qp);
-
- return qp;
-error:
- isl_qpolynomial_free(qp);
- isl_div_free(div);
- return NULL;
-}
-
-__isl_give isl_qpolynomial *isl_qpolynomial_div(__isl_take isl_div *div)
-{
- return isl_qpolynomial_div_pow(div, 1);
-}
-
__isl_give isl_qpolynomial *isl_qpolynomial_rat_cst_on_domain(
__isl_take isl_space *dim, const isl_int n, const isl_int d)
{
return term->pow[pos];
}
-__isl_give isl_div *isl_term_get_div(__isl_keep isl_term *term, unsigned pos)
+__isl_give isl_aff *isl_term_get_div(__isl_keep isl_term *term, unsigned pos)
{
- isl_basic_map *bmap;
+ isl_local_space *ls;
+ isl_aff *aff;
unsigned total;
- int k;
if (!term)
return NULL;
term->div->n_row) == -1,
return NULL);
- bmap = isl_basic_map_alloc_space(isl_space_copy(term->dim), 1, 0, 0);
- if ((k = isl_basic_map_alloc_div(bmap)) < 0)
- goto error;
+ ls = isl_local_space_alloc_div(isl_space_copy(term->dim),
+ isl_mat_copy(term->div));
+ aff = isl_aff_alloc(ls);
+ if (!aff)
+ return NULL;
- isl_seq_cpy(bmap->div[k], term->div->row[pos], 2 + total);
+ isl_seq_cpy(aff->v->el, term->div->row[pos], aff->v->size);
- return isl_basic_map_div(bmap, k);
-error:
- isl_basic_map_free(bmap);
- return NULL;
+ return aff;
}
__isl_give isl_term *isl_upoly_foreach_term(__isl_keep struct isl_upoly *up,
#include <stdio.h>
-#include <isl/div.h>
#include <isl/map.h>
#include <isl/mat.h>
#include <isl_morph.h>
isl_int v);
__isl_give isl_qpolynomial *isl_qpolynomial_var_pow_on_domain(__isl_take isl_space *dim,
int pos, int power);
-__isl_give isl_qpolynomial *isl_qpolynomial_div_pow(__isl_take isl_div *div,
- int power);
int isl_qpolynomial_is_one(__isl_keep isl_qpolynomial *qp);
int isl_qpolynomial_is_affine(__isl_keep isl_qpolynomial *qp);