-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add complex polygamma and Hurwitz zeta functions (fixes #7033)
- Loading branch information
Showing
4 changed files
with
348 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
76a7335
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.
Would it make any sense to roll the
@chorner
code into@horner
?76a7335
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.
It seems like there might be cases where you might not want the
@chorner
algorithm, so I opted for caution for the time being.e.g. I'm not sure how it performs for complex coefficients, but the algorithm certainly wasn't designed for that case. I suppose you could try to add more
isa
statements to detect that case.76a7335
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.
Hmm, it seems like it is still significantly faster than
@horner
for complex coefficients (and is still correct).Now that I think about it, this makes sense since the algorithm is of course linear in the coefficients.
76a7335
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.
We should also probably call it
@evalpoly
rather than@horner
, since it is not really Horner's method.Then we can export
@evalpoly
and leave@horner
there for people who need it, or for backwards compatibility (@horner
is currently used in Distributions.jl).76a7335
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.
See #7146
76a7335
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.
Does it have another name? The person who invented the technique?
76a7335
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 guess the good thing about
@evalpoly
is that it implies nothing about how you do it, just that you want to do that, so the implementation is free to choose whatever technique is most efficient. Horner's method for real values, this method for complex.76a7335
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.
Knuth doesn't give it a name. And the source he cites for it is a final-exam problem from the University of Bergen, which also doesn't name the technique.
It is also closely related to the Goetzel algorithm, but that algorithm is specialized to
|z| == 1
(Fourier series), in which case you can save another half of the multiplications.