- 
                Notifications
    You must be signed in to change notification settings 
- Fork 104
Owen's T function #483
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
base: master
Are you sure you want to change the base?
Owen's T function #483
Conversation
| Codecov ReportAll modified and coverable lines are covered by tests ✅ 
 Additional details and impacted files@@            Coverage Diff             @@
##           master     #483      +/-   ##
==========================================
+ Coverage   94.11%   94.17%   +0.06%     
==========================================
  Files          14       15       +1     
  Lines        2905     2935      +30     
==========================================
+ Hits         2734     2764      +30     
  Misses        171      171              
 Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. | 
|  | ||
| Worst case accuracy is about 2e-16. | ||
| """ | ||
| function owent(h::T, a::T) where {T <: Real} | 
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 this implementation is specific to Float64.
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.
Indeed. I adapted the integration.
        
          
                src/owent.jl
              
                Outdated
          
        
      | towen = zero(a) | ||
| @inbounds for i in eachindex(w) | ||
| towen += w[i] * t2(h,a,x[i]) | ||
| end | 
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.
Since these are tuples, you should be able to just do:
| towen = zero(a) | |
| @inbounds for i in eachindex(w) | |
| towen += w[i] * t2(h,a,x[i]) | |
| end | |
| towen = sum(w .* t2.(h, a, x)) | 
and it will be allocation-free and unrolled, no?
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.
Yes, thanks.
| In general, I think we're hoping to move in the direction of breaking different special functions into their own packages, rather than increasing the size of this package. Maybe this should just be its own package? | 
| 
 A single package just for this function? Or should it be a package devoted to Owen's table? | 
Following up on #242 and JuliaStats/StatsFuns.jl#99.
This implementation should not have any license issues, because it is based on JuliaStats/StatsFuns.jl#99 (comment).
I compared the implementation to scipy with the following code. The Julia version is usually 1.5-3 times faster than scipy; outliers are due to shortcut implementations in the Julia version.