From 3c3046215ffb81fac6817b286fc33f8bb0d25b92 Mon Sep 17 00:00:00 2001 From: Antonio Saragga <47437960+ASaragga@users.noreply.github.com> Date: Tue, 16 Feb 2021 16:21:12 +0000 Subject: [PATCH] Allow computing the correlation matrix from the covariance matrix only (StatsBase.jl #652) --- src/Statistics.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Statistics.jl b/src/Statistics.jl index 588d03c8..0dd8dc62 100644 --- a/src/Statistics.jl +++ b/src/Statistics.jl @@ -662,6 +662,7 @@ function cov2cor!(C::AbstractMatrix, xsd::AbstractArray, ysd::AbstractArray) end return C end +cov2cor!(C::AbstractMatrix{T}, xsd::AbstractArray=[sqrt(C[i,i]) for i in 1:size(C, 1)]) # corzm (non-exported, with centered data)