diff --git a/Project.toml b/Project.toml index ec85039..247fccc 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SpectralDistances" uuid = "2b0dec9d-f767-4f95-9e73-7df56487de68" authors = ["Fredrik Bagge Carlson "] -version = "0.1.14" +version = "0.1.15" [deps] ControlSystemsBase = "aaaaaaaa-a6ca-5380-bf3e-84a91bcd477e" diff --git a/src/losses.jl b/src/losses.jl index 5cf223d..15ab6ac 100644 --- a/src/losses.jl +++ b/src/losses.jl @@ -23,6 +23,8 @@ Base.Broadcast.broadcastable(p::Identity) = Ref(p) Base.Broadcast.broadcastable(p::Log) = Ref(p) magnitude(d) = Identity() +Distances.result_type(::AbstractDistance, a, b) = promote_type(eltype(a), eltype(b)) + evaluate(d::DistanceCollection,x,y;kwargs...) = sum(evaluate(d,x,y;kwargs...) for d in d) Base.:(+)(d::AbstractDistance...) = d diff --git a/test/runtests.jl b/test/runtests.jl index f444712..3bea698 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -22,8 +22,8 @@ using SpectralDistances: ngradient, nhessian, njacobian, polyconv, hproots, rev D2,S = complete_distmat(D0, W) - @test (norm(D-D2)/norm(D)) < 1e-5 - @test (norm(W .* (D-D2))/norm(D)) < 1e-5 + @test (norm(D-D2)/norm(D)) < 1e-4 + @test (norm(W .* (D-D2))/norm(D)) < 1e-4 X = Diagonal(sqrt.(S.S))*S.Vt