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

make x_of_nans work on 0-dimensional arrays #141

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

stevengj
Copy link

@stevengj stevengj commented Jul 19, 2021

The x_of_nans function gives a MethodError for 0-dimensional arrays due to JuliaLang/julia#41643. A workaround is to use map(Tf, x) instead of Tf.(x).

Before this PR:

julia> x_of_nans(fill(0.0))
ERROR: MethodError: no method matching fill!(::Float64, ::Float64)
...

After this PR:

julia> x_of_nans(fill(0.0))
0-dimensional Array{Float64, 0}:
NaN

Without this PR, nlsolve fails for 0-dimensional arrays.

@stevengj
Copy link
Author

Not sure which file you would want a test in?

@test isequal.(x_of_nans(fill(0.0))::Array{Float64,0}, NaN)

should suffice.

@pkofod
Copy link
Member

pkofod commented Jul 26, 2021

Interesting. I wasn't even aware of zero-dimensional arrays with elements in them. Is this meant to be a non-Number "scalar" for linear algebra use, or?

Edit: I see now that this is related to the nlsovle.jl issue

@stevengj
Copy link
Author

Bump.

1 similar comment
@mateuszbaran
Copy link

Bump.

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

Successfully merging this pull request may close these issues.

3 participants