You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The data itself should be fine since the Error doesn't occur if y is a Vector{Int16}.
The thrown exception is the following:
ERROR: DomainError with -112.0:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
[1] sqrt at ./math.jl:492 [inlined]
[2] sqrt at ./math.jl:518 [inlined]
[3] corm(::Array{UInt8,1}, ::Float64, ::Array{Int8,1}, ::Float64) at /build/julia/src/julia-1.1.1/usr/share/julia/stdlib/v1.1/Statistics/src/Statistics.jl:592
[4] cor at /build/julia/src/julia-1.1.1/usr/share/julia/stdlib/v1.1/Statistics/src/Statistics.jl:629 [inlined]
[5] a() at ./REPL[13]:4
[6] top-level scope at none:0
The output of versioninfo() is
Julia Version 1.1.1
Commit 55e36cc308 (2019-05-16 04:10 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-6.0.1 (ORCJIT, skylake)
The text was updated successfully, but these errors were encountered:
Hello! Just to reduce your gist to a minimal example:
julia>using Statistics
julia>cor([0], Int8[80])
NaN
julia>cor([0], Int16[81])
NaN
julia>cor([0], Int8[81])
ERROR: DomainError with -95.0:
sqrt will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
[1] throw_complex_domainerror(::Symbol, ::Float64) at ./math.jl:31
[2] sqrt at ./math.jl:493 [inlined]
[3] sqrt at ./math.jl:519 [inlined]
[4] corm(::Array{Int64,1}, ::Float64, ::Array{Int8,1}, ::Float64) at /julia/usr/share/julia/stdlib/v1.3/Statistics/src/Statistics.jl:649
[5] cor(::Array{Int64,1}, ::Array{Int8,1}) at /julia/usr/share/julia/stdlib/v1.3/Statistics/src/Statistics.jl:686
[6] top-level scope at REPL[29]:1
This comes from an overflow in Int8 when computing abs2:
I never touched nor used this part of julia so I don't know what fix to propose. The two related issues that led to the current use of sqrt(abs2(x[1]))seem to be #17420 and #21093.
@andreasnoack, I think you were the last person to touch that function.
This code causes
Statistics.cor
to throw a DomainError:https://gist.github.com/manuelVo/dce2a962bbe6f5cb6181c8f55f3e1dbf
The data itself should be fine since the Error doesn't occur if
y
is aVector{Int16}
.The thrown exception is the following:
The output of
versioninfo()
isThe text was updated successfully, but these errors were encountered: