Floor isl_union_pw_qpolynomial

25 views
Skip to first unread message

Kelvin Yang

unread,
Apr 17, 2023, 7:34:09 AM4/17/23
to isl Development
After using isl_union_pw_qpolynomial_scale_down_val, I get the following isl_union_pw_qpolynomial:
{ T[i0] -> (5/64 - 1/64 * i0) : 2 <= i0 <= 4; T[i0] -> (1/64 + 1/64 * i0) : 0 <= i0 <= 1 }
I want to get the floor of  isl_union_pw_qpolynomial and get something like 
{T[i0] -> 0: 0<=i0<=4}.
Are there built-in functions in ISL for floor/round/ceiling functions for isl_union_pw_qpolynomial?

Thank you.

Sven Verdoolaege

unread,
Apr 19, 2023, 5:11:15 PM4/19/23
to Kelvin Yang, isl Development
As explained in the "Max Number in isl_union_pw_qpolynomial" thread,
it's not possible to represent the floor of a polynomial in isl.

Now, the polynomial above happens to be affine, so it would
in theory be possible to represent the floor of that expression,
but then you'd need some way to convert a polynomial to an affine expression.
I could make such a function available if that would help you.

skimo

Kelvin Yang

unread,
Apr 20, 2023, 2:57:01 AM4/20/23
to isl Development
>  As explained in the "Max Number in isl_union_pw_qpolynomial" thread,
it's not possible to represent the floor of a polynomial in isl.

Sorry for the repeated question, and thank you for your patience in answering again.


>  I could make such a function available if that would help you.

That would be helpful if you could make the function.

Thank you for all your assistance!

Kelvin
Sven Verdoolaege 在 2023年4月20日 星期四清晨5:11:15 [UTC+8] 的信中寫道:

Sven Verdoolaege

unread,
Apr 24, 2023, 12:34:52 PM4/24/23
to Kelvin Yang, isl Development
On Wed, Apr 19, 2023 at 11:57:01PM -0700, Kelvin Yang wrote:
> > I could make such a function available if that would help you.
>
> That would be helpful if you could make the function.

I've added an isl_qpolynomial_as_aff.
You can iterate over the pieces of an isl_pw_qpolynomial
using isl_pw_qpolynomial_foreach_piece and then
construct an isl_pw_aff from the converted pieces.
(I'm reluctant to add an isl_pw_qpolynomial_as_pw_aff
directly because an isl_pw_qpolynomial has a default value
zero while an isl_pw_aff does not.)

skimo

Kelvin Yang

unread,
May 6, 2023, 10:58:28 PM5/6/23
to isl Development

Thank you!
Sven Verdoolaege 在 2023年4月25日 星期二凌晨12:34:52 [UTC+8] 的信中寫道:
Reply all
Reply to author
Forward
0 new messages