From e0b7d76f79f68b0145c4e1995824da3d2c4b3acc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20Agas=C3=B8ster=20Haaga?= Date: Sun, 6 Oct 2024 17:01:53 +0200 Subject: [PATCH] Fix erroneous change of constructor signature. (#427) * Fix erroneous change of constructor signature. The `where V` must be *inside* the outer brackets, because the element type of the outcome vectors may be different (when categorical data are used - we can mix integers, strings, etc). * Update changelog and increment version * fix version/changelog and add test --- Project.toml | 2 +- src/core/probabilities.jl | 2 +- test/probabilities/probabilities.jl | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Project.toml b/Project.toml index 22385b734..0999bdd59 100644 --- a/Project.toml +++ b/Project.toml @@ -2,7 +2,7 @@ name = "ComplexityMeasures" uuid = "ab4b797d-85ee-42ba-b621-05d793b346a2" authors = "Kristian Agasøster Haaga , George Datseries " repo = "https://github.com/juliadynamics/ComplexityMeasures.jl.git" -version = "3.7.0" +version = "3.7.1" [deps] Combinatorics = "861a8166-3701-5b0c-9a16-15d98fcdc6aa" diff --git a/src/core/probabilities.jl b/src/core/probabilities.jl index 39b2c8259..6e2e31f67 100644 --- a/src/core/probabilities.jl +++ b/src/core/probabilities.jl @@ -57,7 +57,7 @@ struct Probabilities{T, N, S} <: AbstractArray{T, N} dimlabels::NTuple{N, S} function Probabilities(x::AbstractArray{T, N}, - outcomes::Tuple{Vararg{V, N}} where V, + outcomes::Tuple{Vararg{V, N} where V}, dimlabels::NTuple{N, S}; normed::Bool = false) where {T, N, S} if !normed # `normed` is an internal argument that skips checking the sum. diff --git a/test/probabilities/probabilities.jl b/test/probabilities/probabilities.jl index 4e6600fb9..0abdd0ff9 100644 --- a/test/probabilities/probabilities.jl +++ b/test/probabilities/probabilities.jl @@ -11,6 +11,11 @@ outs = collect(1:10) @test Probabilities(rand(rng, 10), (outs,)) isa Probabilities @test Probabilities(rand(rng, 10), (outs,), (:x1, )) isa Probabilities +# outcome vectors for different eltypes +outs1 = ["a", "b"]; outs2 = [1, 2]; +cts = rand(1:10, 2, 2); +@test Probabilities(cts, (outs1, outs2)) isa Probabilities + # ---------------------------------------------------------------- # Base extensions # ----------------------------------------------------------------