Skip to content

any(isnan, ArrayPartition([ NaN ], [ NaN ])) returns false #392

@bvdmitri

Description

@bvdmitri

Describe the bug 🐞

Seems like any does not behave correctly for ArrayPartition

Expected behavior

any(isnan, ArrayPartition([ NaN ], [ NaN ])) should return true, but currently returns false

Minimal Reproducible Example 👇

julia> using RecursiveArrayTools

julia> p = ArrayPartition([ NaN ], [ NaN ])
([NaN], [NaN])

julia> collect(p)
2-element Vector{Float64}:
 NaN
 NaN

julia> any(isnan, p)
false

julia> any(isnan, collect(p))
true

Interestingly enough, all does behave correctly

julia> p = ArrayPartition([ NaN ], [ NaN ])
([NaN], [NaN])

julia> all(isnan, p)
true

julia> p = ArrayPartition([ NaN ], [ 2.0 ])
([NaN], [2.0])

julia> all(isnan, p)
false

Environment (please complete the following information):

  • Output of using Pkg; Pkg.status()
(@temp) pkg> st
Status `~/.julia/environments/temp/Project.toml`
⌃ [731186ca] RecursiveArrayTools v3.23.1
  • Output of versioninfo()
julia> versioninfo()
Julia Version 1.10.4
Commit 48d4fd48430 (2024-06-04 10:41 UTC)
Build Info:
  Official https://julialang.org/ release
Platform Info:
  OS: macOS (arm64-apple-darwin22.4.0)
  CPU: 11 × Apple M3 Pro
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-15.0.7 (ORCJIT, apple-m1)
Threads: 1 default, 0 interactive, 1 GC (on 5 virtual cores)

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions