Skip to content

Commit 264b6d8

Browse files
committed
Cleanup unneeded cor() methods and docstrings
Remove methods which are no longer needed now that deprecations have been removed. Add types to signatures in docstrings.
1 parent 07a8ef4 commit 264b6d8

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

base/statistics.jl

+6-14
Original file line numberDiff line numberDiff line change
@@ -479,41 +479,33 @@ corm(x::AbstractVecOrMat, xmean, y::AbstractVecOrMat, ymean, vardim::Int=1) =
479479

480480
# cor
481481
"""
482-
cor(x)
482+
cor(x::AbstractVector)
483483
484484
Return the number one.
485485
"""
486486
cor(x::AbstractVector) = one(real(eltype(x)))
487-
# This ugly hack is necessary to make the method below considered more specific than the deprecated method. When the old keyword version has been completely deprecated, these two methods can be merged
488487

489488
"""
490-
cor(X[, vardim=1])
489+
cor(X::AbstractMatrix[, vardim::Int=1])
491490
492491
Compute the Pearson correlation matrix of the matrix `X` along the dimension `vardim`.
493492
"""
494-
cor(X::AbstractMatrix, vardim::Int) = corm(X, _vmean(X, vardim), vardim)
495-
# This ugly hack is necessary to make the method below considered more specific than the deprecated method. When the old keyword version has been completely deprecated, these two methods can be merged
496-
cor(X::AbstractMatrix) = cor(X, 1)
493+
cor(X::AbstractMatrix, vardim::Int=1) = corm(X, _vmean(X, vardim), vardim)
497494

498495
"""
499-
cor(x, y)
496+
cor(x::AbstractVector, y::AbstractVector)
500497
501498
Compute the Pearson correlation between the vectors `x` and `y`.
502499
"""
503500
cor(x::AbstractVector, y::AbstractVector) = corm(x, Base.mean(x), y, Base.mean(y))
504-
# This ugly hack is necessary to make the method below considered more specific than the deprecated method. When the old keyword version has been completely deprecated, these two methods can be merged
505501

506502
"""
507-
cor(X, Y[, vardim=1])
503+
cor(X::AbstractVecOrMat, Y::AbstractVecOrMat[, vardim=1])
508504
509505
Compute the Pearson correlation between the vectors or matrices `X` and `Y` along the dimension `vardim`.
510506
"""
511-
cor(x::AbstractVecOrMat, y::AbstractVecOrMat, vardim::Int) =
507+
cor(x::AbstractVecOrMat, y::AbstractVecOrMat, vardim::Int=1) =
512508
corm(x, _vmean(x, vardim), y, _vmean(y, vardim), vardim)
513-
# This ugly hack is necessary to make the method below considered more specific than the deprecated method. When the old keyword version has been completely deprecated, these methods can be merged
514-
cor(x::AbstractVector, Y::AbstractMatrix) = cor(x, Y, 1)
515-
cor(X::AbstractMatrix, y::AbstractVector) = cor(X, y, 1)
516-
cor(X::AbstractMatrix, Y::AbstractMatrix) = cor(X, Y, 1)
517509

518510
##### median & quantiles #####
519511

0 commit comments

Comments
 (0)