diff --git a/Project.toml b/Project.toml index 6cd3216..ce5cf6b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "NaNStatistics" uuid = "b946abbf-3ea7-4610-9019-9858bfdeaf2d" authors = ["C. Brenhin Keller"] -version = "0.6.8" +version = "0.6.9" [deps] IfElse = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" diff --git a/src/Sorting/nanmedian.jl b/src/Sorting/nanmedian.jl index 3cfc94b..7e3825f 100644 --- a/src/Sorting/nanmedian.jl +++ b/src/Sorting/nanmedian.jl @@ -95,7 +95,7 @@ end # Reduce all the dims! _nanmedian!(A, ::Tuple{Colon}) = _nanmedian!(A, :) -function _nanmedian!(A::AbstractArray{T}, ::Colon) where T +function _nanmedian!(A::AbstractArray{T}, ::Colon) where {T} iₗ, iᵤ = firstindex(A), lastindex(A) A, iₗ, iᵤ = sortnans!(A, iₗ, iᵤ) diff --git a/src/Sorting/nanpctile.jl b/src/Sorting/nanpctile.jl index 366221e..97b2c26 100644 --- a/src/Sorting/nanpctile.jl +++ b/src/Sorting/nanpctile.jl @@ -164,7 +164,7 @@ end # Reduce all the dims! _nanquantile!(A, q::Real, ::Tuple{Colon}) = _nanquantile!(A, q, :) -function _nanquantile!(A, q::Real, ::Colon) +function _nanquantile!(A::AbstractArray{T}, q::Real, ::Colon) where {T} iₗ, iᵤ = firstindex(A), lastindex(A) A, iₗ, iᵤ = sortnans!(A, iₗ, iᵤ) diff --git a/test/testSorting.jl b/test/testSorting.jl index f3fbee6..21e2c53 100644 --- a/test/testSorting.jl +++ b/test/testSorting.jl @@ -76,6 +76,7 @@ @test nanmedian!(0:10) == 5 @test nanmedian!(1:10) == 5.5 + @test nanmedian!(fill(NaN, 10)) === NaN A = rand(100) @test nanmedian!(copy(A)) == median(A) @@ -110,6 +111,7 @@ @test nanpctile!(0:10, 100) == 10 @test nanpctile!(0:10, 13.582) ≈ 1.3582 @test nanpctile!(collect(1:10), 50) == 5.5 + @test nanpctile!(fill(NaN, 10), 50) === NaN A = rand(100) @test nanpctile!(copy(A), 50) == median(A) @@ -144,6 +146,7 @@ @test nanquantile(0:10, 1.) == 10 @test nanquantile(0:10, 0.13582) ≈ 1.3582 @test nanquantile(collect(1:10), 0.5) == 5.5 + @test nanquantile(fill(NaN,10), 0.5) === NaN A = rand(100) @test nanquantile(A, 0.5) == median(A)