Skip to content

Improve to_ndarray with better dimensionality awareness #2

Closed
@Enet4

Description

@Enet4

At the end of #1, there was a discussion of whether it would be possible to specify the dimensionality for the Array created with to_ndarray. In particular, it might be more useful to have this method prototype instead:

fn to_ndarray<T, D>(self) -> Result<Array<T, D>>
where
    T: ...,
    D: IntoDimension;

I will leave this issue for discussion on the feasibility of this. Basically, this requires a conversion (which can fail) from a dynamic shape to an arbitrary dimension type D. I haven't found a way to do this yet in ndarray. There is also the small drawback that one has to specify two parameter types instead of just one. IxDyn is a good default, but default type parameters do not work on functions (rust/#36887).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions