Skip to content

Commit

Permalink
fix _bhattacharyya_coeff signature type (#248)
Browse files Browse the repository at this point in the history
Co-authored-by: Daniel Karrasch <Daniel.Karrasch@posteo.de>
  • Loading branch information
aviatesk and dkarrasch authored Mar 8, 2023
1 parent aae27b2 commit 3b90e79
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Distances"
uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7"
version = "0.10.7"
version = "0.10.8"

[deps]
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
Expand Down
10 changes: 5 additions & 5 deletions src/bhattacharyya.jl
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ end
end
return sqab, asum, bsum
end
@inline function _bhattacharyya_coeff(a::AbstractVector{Ta}, b::AbstractVector{Tb}) where {Ta<:Number,Tb<:Number}
T = typeof(sqrt(oneunit(Ta)*oneunit(Tb)))
@inline function _bhattacharyya_coeff(a::AbstractVector, b::AbstractVector)
T = typeof(sqrt(oneunit(eltype(a))*oneunit(eltype(b))))
sqab = zero(T)
asum = zero(Ta)
bsum = zero(Tb)
asum = zero(eltype(a))
bsum = zero(eltype(b))

@simd for i in eachindex(a, b)
@inbounds ai = a[i]
Expand All @@ -50,7 +50,7 @@ end
return sqab, asum, bsum
end

@inline function _bhattacharyya_coeff(a::SparseVectorUnion{<:Number}, b::SparseVectorUnion{<:Number})
@inline function _bhattacharyya_coeff(a::SparseVectorUnion, b::SparseVectorUnion)
anzind = nonzeroinds(a)
bnzind = nonzeroinds(b)
anzval = nonzeros(a)
Expand Down

2 comments on commit 3b90e79

@dkarrasch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/79145

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.10.8 -m "<description of version>" 3b90e79daf49d122791dbb160623e4861eb9bd05
git push origin v0.10.8

Please sign in to comment.