Skip to content

Support subviews in slice s! syntax #215

Closed
@clamydo

Description

@clamydo

It would be nice, if giving just an integer (not a range) to the s! macro, would result into a subview.

I imagine it like this

let a = arr3(&[[[ 1,  2,  3],
                [ 4,  5,  6]], 
               [[ 7,  8,  9],
                [10, 11, 12]]]);

let a = a.slice(s![0, .., 1]);
let r = arr2(&[[2],[5]]);
assert_eq!(a, r);

where a is a vector (an array with shape (2,1)). So this would make slicing similar to the a[0, :, 1] syntax in Python's Numpy.

Is this feasible?

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