jmert / AssociatedLegendrePolynomials.jl

A library for calculating the Associated Legendre polynomials
https://jmert.github.io/AssociatedLegendrePolynomials.jl/
MIT License
20 stars 2 forks source link

Tweak spherical norm coefficients #16

Closed jmert closed 4 years ago

jmert commented 4 years ago

The first commit simply eliminates a few unwanted instructions.

The second commit is more subtle. The expression for the μ_ℓ coefficient in the spherical normalization is modified to gain a few ulps of accuracy across what is probably the entire practical domain of degrees (ℓ). (N.B. the muladd subexpression does not need to be an FMA to maintain accuracy, but FMA is allowed if it is more efficient.)

Before:

julia> f1(l) = Legendre.Plm_μ(LegendreSphereNorm(), Float64, l);

julia> f2(l) = Float64(Legendre.Plm_μ(LegendreSphereNorm(), BigFloat, l));

julia> Δ(l) = f1(l) - f2(l);

julia> findfirst(!=(0), Δ.(1:500_000))
11

With this PR:

julia> findfirst(!=(0), Δ.(1:500_000))
31722
codecov[bot] commented 4 years ago

Codecov Report

Merging #16 into master will increase coverage by 0.01%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #16      +/-   ##
==========================================
+ Coverage   95.51%   95.52%   +0.01%     
==========================================
  Files           9        9              
  Lines         245      246       +1     
==========================================
+ Hits          234      235       +1     
  Misses         11       11              
Impacted Files Coverage Δ
src/norm_sphere.jl 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update a0eadb8...2210077. Read the comment docs.