-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Complex and constant Theano code generation (revived #9187) #15885
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
By default (i.e. if sympy symbols are not real (x.is_real is False or None)) we assume complex valued (maybe a mechanism to control the default behaviour would be nice)
complex fortran code will be generated if codegen.ALLOW_COMPLEX is set to true. This also fixes the old unit tests.
|
✅ Hi, I am the SymPy bot (v147). I'm here to help you write a release notes entry. Please read the guide on how to write release notes. Your release notes are in good order. Here is what the release notes will look like:
This will be added to https://github.com/sympy/sympy/wiki/Release-Notes-for-1.5. Note: This comment will be updated with the latest check if you edit the pull request. You need to reload the page to see it. Click here to see the pull request description that was parsed.
Update The release notes on the wiki have been updated. |
|
Not sure why the azure tests failed when the Travis tests passed. Closing and reopening to re-run the tests. |
|
Why does this need a I guess that the keyword argument is preferable but it's difficult to implement because it would need to be added to |
|
I guess that is the case as well. Clearly propagating it would be the solution. Not sure how tedious it is though... I'm not sure how it is detected if the data is complex nor how it is handled if there is complex data, but the language cannot handle it. (Basically, I have very limited clues about what is going on in the codegen part...) |
|
I think the code can be improved but it might not be easy to do. This seems useful so I'll probably merge this soon if no one objects. |
|
As long that we are a bit cautious when merging future PRs that make use of the global variable (so that there are not even more places to change), I agree that this probably can be merged as it would extend the functionality in a useful way. |
References to other Issues or PRs
CLoses #9187
Brief description of what is fixed or changed
I decided to revive #9187 as it seemed useful and easy.
Complex variables are explicitly supported for Theano.
Constant functions do no longer generate a crash.
Explicit support for complex variables in codegen. I updated the comment as it seemed like rust does not support complex variables (although I just found https://autumnai.github.io/cuticula/num/complex/struct.Complex.html but do not know the status of that (hadn't even heard of rust before...))
Other comments
It seems like
sympy.utilities.codegen.COMPLEX_ALLOWEDis used to control the code generation's use of complex variables. Probably better to pass it throughcodegenbut there may be a reason it is not done (have not analyzed the code that much).As the FIXME says, one should probably add en exception for the case of explicitly complex variables and code generation in c or rust(?).
Release Notes
printing
codegen