From df73f3e6b1ddc3dd06ca5f11c1e33e80db12eb5a Mon Sep 17 00:00:00 2001 From: Ishaanj18 Date: Fri, 15 Sep 2023 23:51:13 +0530 Subject: [PATCH 1/3] added data types UInt16,UInt32,UInt64 to bitinformation_wrapper.jl Signed-off-by: Ishaanj18 --- xbitinfo/bitinformation_wrapper.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xbitinfo/bitinformation_wrapper.jl b/xbitinfo/bitinformation_wrapper.jl index aa9cba4e..e0c84d11 100644 --- a/xbitinfo/bitinformation_wrapper.jl +++ b/xbitinfo/bitinformation_wrapper.jl @@ -11,7 +11,7 @@ function get_bitinformation(X::AbstractArray{T}; kwargs...) where {T<:Base.IEEEF end -function get_bitinformation(X::AbstractArray{T}; kwargs...) where {T<:Union{Int16,Int32,Int64}} +function get_bitinformation(X::AbstractArray{T}; kwargs...) where {T<:Union{UInt16,UInt32,UInt64,Int16,Int32,Int64}} IC = bitinformation(X; kwargs...) From f6c80c5e343c2423e88ef6a3d8e0b653172461e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Kl=C3=B6wer?= Date: Tue, 19 Sep 2023 11:41:31 -0400 Subject: [PATCH 2/3] julia interface cleanup + comments --- xbitinfo/bitinformation_wrapper.jl | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/xbitinfo/bitinformation_wrapper.jl b/xbitinfo/bitinformation_wrapper.jl index e0c84d11..4e162a8f 100644 --- a/xbitinfo/bitinformation_wrapper.jl +++ b/xbitinfo/bitinformation_wrapper.jl @@ -1,23 +1,14 @@ using BitInformation using StatsBase -function get_bitinformation(X::AbstractArray{T}; kwargs...) where {T<:Base.IEEEFloat} - - BitInformation.signed_exponent!(X) - IC = bitinformation(X; kwargs...) - - return IC - +# version for floats with biased to signed exponent conversion +function get_bitinformation(X::AbstractArray{<:Base.IEEEFloat}; kwargs...) + BitInformation.signed_exponent!(X) # this changes X in-place + return bitinformation(X; kwargs...) end - -function get_bitinformation(X::AbstractArray{T}; kwargs...) where {T<:Union{UInt16,UInt32,UInt64,Int16,Int32,Int64}} - - IC = bitinformation(X; kwargs...) - - return IC - -end +# version for (un-/signed) integers +get_bitinformation(X::AbstractArray{<:Integer}; kwargs...)I = bitinformation(X; kwargs...) function get_keepbits(bitinfo_dict) # filter insignificant information via binomial distribution as explained in methods From 755a11b80d86028a90e1591a8568682db9fddf07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Milan=20Kl=C3=B6wer?= Date: Tue, 19 Sep 2023 11:42:58 -0400 Subject: [PATCH 3/3] typo removed --- xbitinfo/bitinformation_wrapper.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xbitinfo/bitinformation_wrapper.jl b/xbitinfo/bitinformation_wrapper.jl index 4e162a8f..1b9fc719 100644 --- a/xbitinfo/bitinformation_wrapper.jl +++ b/xbitinfo/bitinformation_wrapper.jl @@ -8,7 +8,7 @@ function get_bitinformation(X::AbstractArray{<:Base.IEEEFloat}; kwargs...) end # version for (un-/signed) integers -get_bitinformation(X::AbstractArray{<:Integer}; kwargs...)I = bitinformation(X; kwargs...) +get_bitinformation(X::AbstractArray{<:Integer}; kwargs...) = bitinformation(X; kwargs...) function get_keepbits(bitinfo_dict) # filter insignificant information via binomial distribution as explained in methods