Skip to content

Construction from negative strides? #842

Open
@kngwyu

Description

@kngwyu

Hi, thank you for this great library.

I encountered a problem when creating an ArrayView with a pointer and negative strides (see PyO3/rust-numpy#151 for the full context).
We can do this by converting &[isize] to &[usize], but this causes panic by a debug assertion when building without --release flag.
So,

  • How about adding some unsafe API to do this? It would be like a public new_. I'm happy to create a PR if you're willing to.
  • Why are strides internally usize? It can be negative by slicing and I don't think it's reasonable to use usize.

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