We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
pairwise
Sinus
1 parent 9a2f7bb commit f31f160Copy full SHA for f31f160
src/distances/sinus.jl
@@ -21,3 +21,7 @@ Distances.result_type(::Sinus{T}, Ta::Type, Tb::Type) where {T} = promote_type(T
21
end
22
return sum(abs2, sinpi.(a - b) ./ d.r)
23
24
+
25
+# Optimizations for scalar inputs (avoiding allocations)
26
+pairwise(d::Sinus, x::AbstractVector{<:Real}) = pairwise(d, x, x)
27
+pairwise(d::Sinus, x::AbstractVector{<:Real}, y::AbstractVector{<:Real}) = abs2.(sinpi.(x .- y') ./ only(d.r))
0 commit comments