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

export @evalpoly macro (née @chorner) #7146

Merged
merged 2 commits into from
Jun 9, 2014

Conversation

stevengj
Copy link
Member

@stevengj stevengj commented Jun 5, 2014

This exports the @evalpoly(z, c...) macro for efficient inline evaluation of polynomials (either by Horner's rule or, for complex z, using a more efficient algorithm due to described by Knuth). Discussed in #7033 and commit 76a7335.

This should probably not be merged until isa(x, Complex) is evaluated statically, as discussed in #7060, as otherwise it will cause a performance regression.

In Matlab, the analogous function is called polyval, but I intentionally did not use that name since the arguments are different: in Matlab you callpolyval(c, z), and the coefficients are in reverse order.

It might also be worth providing an evalpoly(z, c) function that does the same thing but at runtime.

cc: @StefanKarpinski, @jiahao

@jiahao
Copy link
Member

jiahao commented Jun 5, 2014

lgtm

I randomly tested a few values of digamma with Float64 inputs and they agree to within 16ϵ of the tabulated values, so I think it's fine. (The original program was run on a machine with Float60s.)

@stevengj
Copy link
Member Author

stevengj commented Jun 5, 2014

(@jiahao, I increased the Stirling-series degree by one in digamma compared to Kölbig's original paper, since I noticed the accuracy was a little lower than desired with his original cutoff, which was probably designed for 60-bit floats as you say.)

JeffBezanson added a commit that referenced this pull request Jun 9, 2014
@JeffBezanson JeffBezanson merged commit ff8c271 into JuliaLang:master Jun 9, 2014
@stevengj stevengj deleted the evalpoly branch August 1, 2019 16:56
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.

3 participants