Skip to content

Reshape #47

Description

@mcabbott

I get an error reshaping these lazy arrays, because their length means something else. Is there a reason not to fix this, perhaps like this?

using RecursiveArrayTools

A = VectorOfArray([rand(4) for i=1:3] )
size(A) == (4,3)

reshape(A, (2,6))  # error

function Base._reshape(parent::VectorOfArray, dims::Base.Dims)
    n = prod(size(parent))
    prod(dims) == n || _throw_dmrs(n, "size", dims)
    Base.__reshape((parent, IndexStyle(parent)), dims)
end

reshape(A, (2,6)) # no error! 

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions