From d751b3a2e68cbb7a130fd3ff32962259601957de Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Mon, 22 Mar 2010 13:04:52 +0100 Subject: [PATCH] add isl_pw_qpolynomial_fix_dim --- include/isl_polynomial.h | 4 ++++ isl_pw_templ.c | 23 +++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/include/isl_polynomial.h b/include/isl_polynomial.h index 39c932a..b2eb52e 100644 --- a/include/isl_polynomial.h +++ b/include/isl_polynomial.h @@ -115,6 +115,10 @@ __isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_move( enum isl_dim_type dst_type, unsigned dst_pos, enum isl_dim_type src_type, unsigned src_pos, unsigned n); +__isl_give isl_pw_qpolynomial *isl_pw_qpolynomial_fix_dim( + __isl_take isl_pw_qpolynomial *pwqp, + enum isl_dim_type type, unsigned n, isl_int v); + __isl_give isl_qpolynomial *isl_pw_qpolynomial_eval( __isl_take isl_pw_qpolynomial *pwqp, __isl_take isl_point *pnt); diff --git a/isl_pw_templ.c b/isl_pw_templ.c index 4d24e80..7ba5bfa 100644 --- a/isl_pw_templ.c +++ b/isl_pw_templ.c @@ -449,3 +449,26 @@ error: FN(PW,free)(pw); return NULL; } + +__isl_give PW *FN(PW,fix_dim)(__isl_take PW *pw, + enum isl_dim_type type, unsigned pos, isl_int v) +{ + int i; + + if (!pw) + return NULL; + + pw = FN(PW,cow)(pw); + if (!pw) + return NULL; + for (i = 0; i < pw->n; ++i) { + pw->p[i].set = isl_set_fix(pw->p[i].set, type, pos, v); + if (!pw->p[i].set) + goto error; + } + + return pw; +error: + FN(PW,free)(pw); + return NULL; +} -- 2.7.4