Skip to content

Building a 2D ndarray from rows or columns #539

Open
@paulkernfeld

Description

@paulkernfeld

A couple different times I have wanted to construct a 2D array from an iterator of 1D arrays. Is this something that should be added to ndarray?

Roughly, I'm thinking of a function from_rows<I: Iterator<Item=Array1>>(rows: I) -> Array2 and an analogous from_columns.

One design question that I'm not currently sure about is whether the user should have to specify any information about the dimensions. I am leaning towards "no," especially because it may be difficult to know the size of an iterator beforehand.

Possibly, it would make more sense to collect my iterator and use stack rather than adding new functionality. However, if this sounds useful, I would be happy to take a whack at implementing it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions