We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
pairwise
Sinus
1 parent ec19a94 commit 018e4f0Copy full SHA for 018e4f0
1 file changed
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