From 96b290d142d5fe21b62e78b0cb0abe2a226ea79c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Designolle?= Date: Thu, 27 Jun 2024 22:39:19 +0200 Subject: [PATCH] Fix type signatures of entropy functions --- src/entropy.jl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/entropy.jl b/src/entropy.jl index d0f9c91..75eaa0a 100755 --- a/src/entropy.jl +++ b/src/entropy.jl @@ -1,4 +1,4 @@ -_log(base::Real, x) = x > 0 ? log(base, x) : zero(x) +_log(base::Real, x::Real) = x > 0 ? log(base, x) : zero(x) """ relative_entropy([base=2,] ρ::AbstractMatrix, σ::AbstractMatrix) @@ -7,7 +7,7 @@ Computes the (quantum) relative entropy tr(`ρ` (log `ρ` - log `σ`)) between p Reference: [Quantum relative entropy](https://en.wikipedia.org/wiki/Quantum_relative_entropy). """ -function relative_entropy(base::Real, ρ::AbstractMatrix{T}, σ::AbstractMatrix{S}) where {T,S} +function relative_entropy(base::Real, ρ::AbstractMatrix{T}, σ::AbstractMatrix{S}) where {T<:Real,S<:Real} R = real(promote_type(T, S)) if size(ρ) != size(σ) throw(ArgumentError("ρ and σ have the same size.")) @@ -40,7 +40,7 @@ Computes the relative entropy D(`p`||`q`) = Σᵢpᵢlog(pᵢ/qᵢ) between two Reference: [Relative entropy](https://en.wikipedia.org/wiki/Relative_entropy). """ -function relative_entropy(base::Real, p::AbstractVector{T}, q::AbstractVector{S}) where {T,S<:Real} +function relative_entropy(base::Real, p::AbstractVector{T}, q::AbstractVector{S}) where {T