moble / SphericalFunctions.jl

Spherical functions of arbitrary float types
MIT License
9 stars 2 forks source link

Specialize on types passed as arguments #25

Closed moble closed 1 year ago

moble commented 1 year ago

Somehow, I forgot the right way to use types as arguments, because we really have to specialize the code on these types. This apparently happened sometimes with the old version, but not always.

moble commented 1 year ago

The second commit is there because you have to name keyword arguments (unlike positional arguments), and I already chose T as those names, but I can't use to inside the function. For example, something like this (but possibly more complicated) won't successfully specialize:

function f(a; T::Type{TT}) where TT
    zero(T)
end

Instead, the function body has to use zero(TT).

codecov[bot] commented 1 year ago

Codecov Report

Merging #25 (3a6df80) into main (9a67d47) will not change coverage. The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main      #25   +/-   ##
=======================================
  Coverage   98.94%   98.94%           
=======================================
  Files          16       16           
  Lines        1137     1137           
=======================================
  Hits         1125     1125           
  Misses         12       12           
Impacted Files Coverage Δ
src/evaluate.jl 100.00% <100.00%> (ø)
src/operators.jl 100.00% <100.00%> (ø)
src/pixelizations.jl 100.00% <100.00%> (ø)
src/ssht/direct.jl 100.00% <100.00%> (ø)
src/ssht/minimal.jl 95.27% <100.00%> (ø)
src/ssht/rs.jl 95.78% <100.00%> (ø)
src/utils.jl 100.00% <100.00%> (ø)

:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more