-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
statisticsThe Statistics stdlib moduleThe Statistics stdlib module
Description
cov(rand(5),rand(5),dims=1)
fails, while both cov(rand(5),rand(5))
and cov(rand(5),rand(5,1),dims=1)
work.
Why bother? Well, to be consistent with the other functions in Statistics
. For instance, std(rand(5),dims=1)
gives a 1x1 vector. It is surely a convenience for users to be able to interchange Nx1 matrices and N-vectors in such basic calculations.
The quick fix is to add a dummy dims
argument to the current method (in Statistics.jl) as cov(x::AbstractVector, y::AbstractVector; dims::Int=1, corrected::Bool=true) =
. This would produce a Number. A better fix might be produce a 1x1 vector to be consistent with std
and other functions.
JeffBezanson
Metadata
Metadata
Assignees
Labels
statisticsThe Statistics stdlib moduleThe Statistics stdlib module