Skip to content

Support zero-length axis in .map_axis/_mut() #579

Closed
@jturner314

Description

@jturner314

The implementation of .map_axis/_mut() panics when the specified axis is zero-length. Ideally, we'd just apply mapping to empty views instead.

Example:

extern crate ndarray;

use ndarray::prelude::*;

fn main() {
    let a = Array2::<f32>::zeros((0, 2));
    a.map_axis(Axis(0), |_| {});
}

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