Skip to content
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

Merged
merged 15 commits into from Sep 22, 2017
Merged

Add erf function #234

merged 15 commits into from Sep 22, 2017

Conversation

benjello
Copy link
Collaborator

@benjello benjello commented May 16, 2017

This PR adds an erf function using scipy.

@gdementen
Copy link
Member

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.

@benjello
Copy link
Collaborator Author

@gdementen : what is your favorite implementation ?
I would choose an optional scipy as a standard practice but the function you gave may be faster
and sufficient for liam2 needs.

@gdementen
Copy link
Member

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.

@gdementen
Copy link
Member

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.

@benjello
Copy link
Collaborator Author

There is a link to the implementation in C on this page.

I will use the scipy version.

@benjello
Copy link
Collaborator Author

If the implementation suits you I can even write a line in the changelog ;-)

@benjello
Copy link
Collaborator Author

@gdementen : any chance this get merged soon ?

Copy link
Member

@gdementen gdementen left a 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.

def compute(self, context, expr):
if scipy is None:
raise ImportError(
"Scipy was not succesfully imported",
Copy link
Member

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."

@benjello
Copy link
Collaborator Author

benjello commented Sep 22, 2017

Needs to be done:

  • changelog
  • note in documentation

@benjello
Copy link
Collaborator Author

@gdementen : rebased, doc and changelog added

@gdementen gdementen merged commit e8fc667 into liam2:master Sep 22, 2017
@gdementen
Copy link
Member

Thanks

@benjello benjello deleted the add_erf_function branch September 23, 2017 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants