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

no methods implemented for integer arrays #26

Open
mvhulten opened this issue Feb 2, 2018 · 2 comments
Open

no methods implemented for integer arrays #26

mvhulten opened this issue Feb 2, 2018 · 2 comments

Comments

@mvhulten
Copy link

mvhulten commented Feb 2, 2018

Maybe this is a specific case of #17, but I don't understand everything in that issue. All users (even myself!) will understand this issue:

julia> mean([1 2 3])
2.0

julia> NaNMath.mean([1 2 3])
ERROR: MethodError: no method matching mean(::Array{Int64,2})
You may have intended to import Base.mean
Closest candidates are:
  mean(::AbstractArray{T<:AbstractFloat,N} where N) where T<:AbstractFloat at /home/mhu027/.julia/v0.6/NaNMath/src/NaNMath.jl:163

julia> NaNMath.mean([1 2 π])
2.047197551196598

It would be a useful feature if the NaNMath routines will accept more types like integer.

I am using Julia 0.6.2 and NaNMath 0.3.0.

@carmagnole
Copy link

Since NaN is defined as a float-point number in IEEE 754, I guess NaNMath deals with floats as default. I use something like nanmean(x) = any(isnan, x) ? NaNMath.mean(x) : mean(x) as circumvention.

@xgdgsc
Copy link

xgdgsc commented Aug 28, 2020

Also in casual use cases accepting Array of Any would also help.

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

3 participants