You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Declare constant scalars with the fortran parameter keyword and use the fact that their value is known to treat indexing with a constant in the same way as indexing with a literal.
Test Code
Provide code which does not currently work but which should do when this issue is fixed:
A constant variable initialised with a Literal should be saved in a pyccel.ast.variable.Constant . Constants should be declared in the generated code as parameters. They should be handled in the same way as literals when handling indexing (i.e. avoiding unnecessary positivity checks.
As described the issue only optimises for Literals. I agree that handling your example would be great but this is more complex so I would rather leave it for a second issue to avoid having huge PRs
Relevant Discussion
#1805 (comment)
Describe the feature
Declare constant scalars with the fortran
parameter
keyword and use the fact that their value is known to treat indexing with a constant in the same way as indexing with a literal.Test Code
Provide code which does not currently work but which should do when this issue is fixed:
Proposed Solution
A constant variable initialised with a
Literal
should be saved in apyccel.ast.variable.Constant
.Constant
s should be declared in the generated code asparameter
s. They should be handled in the same way as literals when handling indexing (i.e. avoiding unnecessary positivity checks._Originally suggested by @said-hadjout in #1805 (comment)
The text was updated successfully, but these errors were encountered: