selectRows :: Elt e => Acc (Vector Int) -> Acc (Matrix e) -> Acc (Matrix e)
selectRows rs xs =
let Z :. rows = unlift (shape rs)
cols = indexHead (shape xs)
in
generate (index2 rows cols) (\ix -> let Z :. r :. c = unlift ix
in xs ! index2 (rs!!r) c)
Hello cafe,
Is there a generic way to reshape an array in accelerate[1] assuming the
number of dimensions remains constant? For example, given a matrix, is
there a way to add or, more importantly, remove several rows or columns?
It seems to me that the API is lacking in this case, but I hope I'm wrong.
Thank you.
[1]: https://hackage.haskell.org/package/accelerate-1.2.0.1/
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.