islpy icon indicating copy to clipboard operation
islpy copied to clipboard

Aff `get_coefficients_by_name` intended behavior?

Open thisiscam opened this issue 5 years ago • 3 comments

import islpy
aff = islpy.Aff("[N] -> { [x] -> [x+1] } ")
aff.get_coefficients_by_name(dimtype=None)

gives

isl_aff.c:763: output/set dimension does not have a coefficient

According the doc, setting dimtype to None should produce the coefficients for all dimensions? I digged a little, in the generated _isl.py,

_CHECK_DIM_TYPES = [
        dim_type.in_, dim_type.param, dim_type.set]

which is used by obj_get_coefficients_by_name to retrieve the coefficients. When does Aff has a set dimension? Is this a bug or intended behavior?

thisiscam avatar Mar 03 '20 07:03 thisiscam

Btw, to the maintainer of this repo: I have no intention to flood this repo's issues (I felt guilty for the fact that the most recent issues were all opened by me). islpy is a wonderful library! I really appreciate the effort put into this interface, and just hope that some of my nitpicks can help in its development. Thanks for the work!

thisiscam avatar Mar 03 '20 07:03 thisiscam

>>> import islpy
>>> aff = islpy.Aff("[N] -> { [x] -> [x+1] } ")
>>> aff.get_dim_name(islpy.dim_type.param, 0)
'N'
>>> aff.get_dim_name(islpy.dim_type.in_, 0)
'x'
>>> 

I'd be OK special-casing Aff in get_coefficients_by_name(None) to avoid triggering the issue. Asking about the "out" dimension of an Aff doesn't make much sense IMO.

inducer avatar Mar 03 '20 22:03 inducer

Also, no worries about opening multiple issues in quick succession. It's good to know someone is finding this useful. :)

inducer avatar Mar 03 '20 22:03 inducer