Skip to content

Zip indexed rows from 2d arrays #995

Closed

Description

@vikigenius

Say, I have two Array2 objects:

type M = Array2<f32>;
let mut a = M::eye(2);
let mut b = 2.0 * a;

I want to iterate over the rows of a and b in lockstep, but also have the row index simultaneously:

for example:
(ridx, (row_a, row_b)) in Zip(a.rows(), b.rows()).enumerate()

I should get

(0, ([1.0, 0], [2.0, 0]))
(1, ([0, 1.0], [0, 2.0]))

How can I do this efficiently? Also can i do the same thing in parallel (over row indices) ?

Activity

  1. bluss commented on May 9, 2021

    @bluss
    Member

    Zip::indexed can do this

  2. locked and limited conversation to collaborators on May 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions