-
Notifications
You must be signed in to change notification settings - Fork 18k
math: add inverse error function #6359
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
Comments
It's not clear whether we want to expand the set of functions. We've resisted before, keeping it to just what the standard C library has. We should decide one way or the other for Go 1.3. Labels changed: added priority-later, go1.3maybe, removed priority-triage. Status changed to Thinking. |
Have you had a lot of requests? In the issue tracker I only see one request (for Round). I don't think it has to be a binary (some additional functions can be added without adding all possible functions). Erfinv and Erfcinv are a good fit for the math package because they a) compliment functions aleady in the math package (right now you can use the math package to compute the cumulative distribution of a Gaussian at x but not inverse problem of finding the x which gives that cdf) and and b) are not a one or two line function to implement (erf and erfc combine for about 200 lines of code) |
Hi I need inverse error function for my monte carlo project. It would be great if I don't have to code it myself. |
I wrote a inverse error function here: https://github.com/markthelaw/GoStatHelper/blob/master/StatUtil/StatUtil.go |
It seems like this is something we could add, with signatures
We can't take Apache-licensed code but if someone would like to write one from scratch or using one of the sources we already derive from in package math, that would be fine. -rsc for @golang/proposal-review |
I didn't see these new comments on the issue (didn't realize I wasn't subscribed). Just this week I submitted an optimized version of the NormalQuantile function to gonum/mathext (https://github.com/gonum/mathext/blob/master/erf.go). I adopted it from code.google.com/p/probab, written by @ThePaw and @skelterjohn , who may be willing to transfer the copyright. It's a simple transformation to go from NormalQuantile to Erfinv. |
Otherwise it's all already BSD code if that's okay. |
I am happy to transfer any copyrights. I don't recall writing that
particular function, so it might be up to @ThePaw.
…On Tue, Feb 21, 2017 at 1:45 PM, Brendan Tracey ***@***.***> wrote:
Otherwise it's all already BSD code if that's okay.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6359 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAUZ1qsScBmHWbjNnJ1cFVqggpa7z5A9ks5rezCygaJpZM4ErTFf>
.
|
Otherwise, the algorithm used in that PR is given in https://www.jstor.org/stable/pdf/2347330.pdf if someone would like to adopt it de novo (I probably can't because of already adapting the probab code). However, I did compare this algorithm with several other published ones and it seems to be the best. |
I would like to start contributing to go and this seems like a relatively simpler task. Should I give this is a try? |
@lakshayg it's labelled
Localized, I'd say. I'm not sure about simple, this kind of function is often tricky to implement correctly. |
I have written a C++ implementation of The error for floats is of the order 10^-7 and for doubles it is of the order 10^-16. Feedback will be appreciated. |
@lakshayg, thanks for working on this. Until there is assembly, don't write:
Instead, write only:
When you are using the declaration pair above, you have to provide assembly that at least glues them together (see stubs_*.s in that directory). |
@rsc Yes, I just figured that out. I have added the |
@lakshayg you don't need any stub because you're implementing this in pure go. Just write
and remove the stubs.
Unfortunately no, there isn't. |
I ran |
@lakshayg perhaps you don't have your $GOPATH/bin in your $PATH? (See https://golang.org/doc/install#install.) |
CL https://golang.org/cl/46990 mentions this issue. |
@cespare That fixed the problem, thanks! Just submitted the code for review. |
Thanks. We're in the Go 1.9 release freeze right now and won't review it until the Go 1.10 cycle opens (~Aug 1), but we appreciate the contribution. |
Can anybody on this issue review https://golang.org/cl/46990? Thanks. |
|
@ALTree |
Just sent in a CL for |
Change https://golang.org/cl/57090 mentions this issue: |
The text was updated successfully, but these errors were encountered: