Skip to content

ndarray::ArrayViewMut::windows should produce mutable windows #1357

Open

Description

@Chris00

Calling .windows() on an ndarray::ArrayViewMut should return mutable windows. That's very useful when, for example, you iterate over a partition of an interval and the quantities you compute affect values living on both ends of the interval.

Activity

  1. bluss commented on Feb 5, 2024

    @bluss
    Member

    That's not possible by lifetime rules in Rust - the iterator's elements are simultaneously valid, and since they are windows, they partially overlap, which is not allowed for mutable references.

    We'll need to update the issue with a plan for a way to get the intended effect in a way we can implement.

  2. akern40 commented on Oct 24, 2024

    @akern40
    Collaborator

    There is a pattern known as "lending iterators" which allow things like windows_mut. See this article by Niko Matsakis for the general concept, and these crates for implementations of that pattern. We could then support a windows_mut function that returns this kind of iterator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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