How to dynamically remove rows with a vec of idexes


#1

Hi,

I have a matrix that looks like the below:

    I can hard code to remove rows e.g. let B = A.remove_rows(1,2).clone_owned();

   But I will have a vec with a list if row index to remove e.g. [1, 2, 6, 10]
    
  So I woulkd think something like this but of course does not work:

       let B = A.remove_rows( [1, 2, 6, 10]).clone_owned();

So how do I dynamically remove rows with a list?

Thanks

  ┌         ┐
  │ 1 0 0 0 │
  │ 0 1 0 0 │
  │ 0 0 1 0 │
  │ 0 0 0 1 │
  │ 1 0 0 0 │
  │ 0 1 0 0 │
  │ 0 0 1 0 │
  │ 0 0 0 1 │
  │ 1 0 0 0 │
  │ 0 1 0 0 │
  │ 0 0 1 0 │
  │ 0 0 0 1 │
  └         ┘

#2

Hi! This is unfortunately not yet supported explicitly by nalgebra. A workaround for now you would be to remove rows by starting with the one with highest index (10, then 6, etc. down to 1).

I’ve created an issue to track the addition of this feature: https://github.com/rustsim/nalgebra/issues/530.