Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change real to float in cor of a single collection #61

Merged
merged 3 commits into from
Feb 13, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Statistics.jl
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ end

# corzm (non-exported, with centered data)

corzm(x::AbstractVector{T}) where {T} = one(real(T))
corzm(x::AbstractVector{T}) where {T} = one(float(T))
function corzm(x::AbstractMatrix, vardim::Int=1)
c = unscaled_covzm(x, vardim)
return cov2cor!(c, collect(sqrt(c[i,i]) for i in 1:min(size(c)...)))
Expand All @@ -671,7 +671,7 @@ corzm(x::AbstractMatrix, y::AbstractMatrix, vardim::Int=1) =

# corm

corm(x::AbstractVector{T}, xmean) where {T} = one(real(T))
corm(x::AbstractVector{T}, xmean) where {T} = one(float(T))
corm(x::AbstractMatrix, xmean, vardim::Int=1) = corzm(x .- xmean, vardim)
function corm(x::AbstractVector, mx, y::AbstractVector, my)
require_one_based_indexing(x, y)
Expand Down 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(float(eltype(x)))

"""
cor(X::AbstractMatrix; dims::Int=1)
Expand Down