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
Add erf function #234
Add erf function #234
Conversation
I do not want to depend on scipy, so the function must be either optional (only available if scipy is installed) or computed via an expression like shown at http://stackoverflow.com/questions/457408/is-there-an-easily-available-implementation-of-erf-for-python, if the later approach gives sufficient precision. |
@gdementen : what is your favorite implementation ? |
I have no idea if what I linked to is precise enough. I am not really qualified to tell. I would accept either, so do what you prefer/think is best. The second option might be faster indeed thanks to numexpr/multi-threading, but that would need to be tested. |
I cannot find to code of the erf function in scipy, it seems like it links to a C implementation from some other lib, so it is unlikely we will get any faster, at least with a single thread. |
There is a link to the implementation in C on this page. I will use the scipy version. |
If the implementation suits you I can even write a line in the changelog ;-) |
…d with an invalid id
@gdementen : any chance this get merged soon ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the awful delay. It completely went off my radar. If you could add a note in the documentation & changelog, that would be great.
liam2/exprmisc.py
Outdated
def compute(self, context, expr): | ||
if scipy is None: | ||
raise ImportError( | ||
"Scipy was not succesfully imported", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like a better message for people trying to use it without scipy installed. Something like:
"Failed to import scipy, which is required for erf(). Please make sure scipy is installed and working."
Needs to be done:
|
@gdementen : rebased, doc and changelog added |
Thanks |
This PR adds an erf function using scipy.