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

var of empty vector of arrays should be vector of NaNs #51

Open
yha opened this issue Aug 17, 2020 · 0 comments
Open

var of empty vector of arrays should be vector of NaNs #51

yha opened this issue Aug 17, 2020 · 0 comments

Comments

@yha
Copy link

yha commented Aug 17, 2020

The var function operates pointwise on array arguments ( JuliaLang/julia#23897. It doesn't seem to be documented). But it fails for empty vector of arrays:

julia> using Statistics, StaticArrays

julia> var(SVector{2}.(1:5,2:6))
2-element SArray{Tuple{2},Float64,1,2} with indices SOneTo(2):
 2.5
 2.5

julia> var(SVector{2,Float64}[])
ERROR: MethodError: no method matching abs2(::SArray{Tuple{2},Float64,1,2})
[...]

This should return SVector(NaN,NaN), since var(Float64[]) === NaN.

@fredrikekre fredrikekre transferred this issue from JuliaLang/julia Aug 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant