{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/18330","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/18330/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/18330/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/18330/events","html_url":"https://github.com/JuliaLang/julia/pull/18330","id":174671745,"number":18330,"title":"more accurate and faster lgamma, and use a more standard branch cut","user":{"login":"stevengj","id":2913679,"avatar_url":"https://avatars.githubusercontent.com/u/2913679?v=3","gravatar_id":"","url":"https://api.github.com/users/stevengj","html_url":"https://github.com/stevengj","followers_url":"https://api.github.com/users/stevengj/followers","following_url":"https://api.github.com/users/stevengj/following{/other_user}","gists_url":"https://api.github.com/users/stevengj/gists{/gist_id}","starred_url":"https://api.github.com/users/stevengj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevengj/subscriptions","organizations_url":"https://api.github.com/users/stevengj/orgs","repos_url":"https://api.github.com/users/stevengj/repos","events_url":"https://api.github.com/users/stevengj/events{/privacy}","received_events_url":"https://api.github.com/users/stevengj/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/breaking","name":"breaking","color":"800000"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/maths","name":"maths","color":"009800"}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-09-02T03:13:53Z","updated_at":"2016-09-06T21:58:35Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/18330","html_url":"https://github.com/JuliaLang/julia/pull/18330","diff_url":"https://github.com/JuliaLang/julia/pull/18330.diff","patch_url":"https://github.com/JuliaLang/julia/pull/18330.patch"},"body":"This fixes #18292, replacing @JeffBezanson's 2011 `lgamma` function from 4675b10e1284e606e948fa400081aceb8d3ef11b with a rewritten one that should fix several accuracy problems, and is also about 3x faster (and about 40% faster than the one in SciPy).\r\n\r\nI am marking this \"breaking\" because I changed it to use a more standard branch cut for `real(z) < 0`, the same as SciPy's [loggamma](http://docs.scipy.org/doc/scipy/reference/generated/scipy.special.loggamma.html#scipy.special.loggamma) function and Mathematica's [LogGamma](https://reference.wolfram.com/language/ref/LogGamma.html).   This is a different branch cut than you would get from `log(gamma(z))`! (It differs by some multiple of 2π in the imaginary part, so `exp(lgamma(z))` is still the same Γ function.)  The new branch cut has the advantage of being analytic everywhere in the complex plane except along the negative real axis.\r\n\r\nTo do:\r\n- [x] Needs more tests.\r\n- [x] The recurrence relation can be sped up using a trick by Hare (1997), which is used in SciPy, of taking the log of the product of the shifts and keeping track of the sign of the real part so that the correct branch cut is chosen, rather than computing the sum of the logs of the shifts.\r\n- [x] Fix accuracy close to zero at z=2"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/245109263","html_url":"https://github.com/JuliaLang/julia/pull/18330#issuecomment-245109263","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/18330","id":245109263,"user":{"login":"StefanKarpinski","id":153596,"avatar_url":"https://avatars.githubusercontent.com/u/153596?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanKarpinski","html_url":"https://github.com/StefanKarpinski","followers_url":"https://api.github.com/users/StefanKarpinski/followers","following_url":"https://api.github.com/users/StefanKarpinski/following{/other_user}","gists_url":"https://api.github.com/users/StefanKarpinski/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanKarpinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanKarpinski/subscriptions","organizations_url":"https://api.github.com/users/StefanKarpinski/orgs","repos_url":"https://api.github.com/users/StefanKarpinski/repos","events_url":"https://api.github.com/users/StefanKarpinski/events{/privacy}","received_events_url":"https://api.github.com/users/StefanKarpinski/received_events","type":"User","site_admin":false},"created_at":"2016-09-06T21:58:35Z","updated_at":"2016-09-06T21:58:35Z","body":"Sure, although I'm not remotely qualified to judge this :)"}}
{"actor":{"display_login":"StefanKarpinski"}}