Skip to content

Type instability when iterating nested recursive arrays #323

Description

@lukas-weber

I noticed that the following is type unstable (on v3.3.3 and julia 1.10.0)

using RecursiveArrayTools

sum(ArrayPartition(ArrayPartition(zeros(4,4)))) # ::Any

sum(VectorOfArray([zeros(4), VectorOfArray([zeros(4,4)])])) # ::Any

Curiously, all of the following are stable.

sum(ArrayPartition(ArrayPartition(zeros(4)))) # ::Float64
sum(ArrayPartition(zeros(4,4))) # ::Float64

sum(VectorOfArray([VectorOfArray([zeros(4,4)])])) # ::Float64

The other recursive array types seem to be affected as well. Not sure if getting these stable is in-scope, but it would be super helpful.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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