Skip to content

Commit 1edacde

Browse files
committed
Review changes
1 parent 271e92c commit 1edacde

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/cov.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,11 @@ Compute the Pearson correlation matrix of `X` along the dimension
123123
cor(x::AbstractMatrix, w::AbstractWeights, dims::Int=1) =
124124
corm(x, mean(x, w, dims=dims), w, dims)
125125

126+
function mean_and_cov(x::AbstractVector; corrected::Bool=true)
127+
m = mean(x)
128+
return m, covm(x, m, corrected=corrected)
129+
end
130+
126131
function mean_and_cov(x::AbstractMatrix, dims::Int=1; corrected::Bool=true)
127132
m = mean(x, dims=dims)
128133
return m, covm(x, m, dims, corrected=corrected)
@@ -133,11 +138,6 @@ function mean_and_cov(x::AbstractMatrix, wv::AbstractWeights, dims::Int=1;
133138
return m, cov(x, wv, dims; corrected=depcheck(:mean_and_cov, corrected))
134139
end
135140

136-
function mean_and_cov(x::AbstractVector; corrected::Bool=true)
137-
m = mean(x)
138-
return m, covm(x, m, corrected=corrected)
139-
end
140-
141141
"""
142142
cov2cor(C, s)
143143

test/cov.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,6 @@ sparse_array = sprandn(3, 8, 0.2)
137137
cor1 = cor(X, wv1, 1)
138138
cor2 = cor(X, wv2, 2)
139139

140-
141140
@testset "cov2cor" begin
142141
@test cov2cor(cov(X, dims = 1), std(X, dims = 1)) cor(X, dims = 1)
143142
@test cov2cor(cov(X, dims = 2), std(X, dims = 2)) cor(X, dims = 2)

0 commit comments

Comments
 (0)