Skip to content

Commit

Permalink
adding Union complexF type in cor
Browse files Browse the repository at this point in the history
  • Loading branch information
josemanuel22 committed Jan 16, 2021
1 parent ba90d86 commit f8b85ef
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Statistics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -705,7 +705,7 @@ corm(x::AbstractVecOrMat, xmean, y::AbstractVecOrMat, ymean, vardim::Int=1) =
Return the number one.
"""
cor(x::AbstractVector) = one(real(eltype(x)))
cor(x::AbstractVector) = one(real(eltype(convert(AbstractVector{Union{ComplexF64, Missing}}, x))))

"""
cor(X::AbstractMatrix; dims::Int=1)
Expand Down Expand Up @@ -973,9 +973,9 @@ end
require_one_based_indexing(v)

n = length(v)

@assert n > 0 # this case should never happen here

m = alpha + p * (one(alpha) - alpha - beta)
aleph = n*p + oftype(p, m)
j = clamp(trunc(Int, aleph), 1, n-1)
Expand All @@ -988,7 +988,7 @@ end
a = v[j]
b = v[j + 1]
end

if isfinite(a) && isfinite(b)
return a + γ*(b-a)
else
Expand Down

0 comments on commit f8b85ef

Please sign in to comment.