1

I'm trying to achieve row indexing of a matrix using an array of indices in Eigen-3.2.0 whose Matlab equivalent is the following: consider a matrix A:

>> A = [2 3 0 ; 1 9 2 ; 4 7 2]

A =

     2     3     0
     1     9     2
     4     7     2

>> A( [1 3 2 1 3], : )

ans =

     2     3     0
     4     7     2
     1     9     2
     2     3     0
     4     7     2

I've been able to obtain an array of row indices ( of the type MatrixXd::Index ) which contains the numbers (1, 3, 2, 1, 3). But I've not been able to figure out a way of applying this array to the Matlab-like indexing described above. Is this even possible in Eigen? Or is there a smarter way of doing it? Any help at all will be great.

Thanks!

sid
  • 131
  • 3
  • What do you want to do with the result? Print it, store it, use it in another calculation? – Floris Jan 02 '14 at 22:32
  • not yet implemented, see this [entry](http://eigen.tuxfamily.org/bz/show_bug.cgi?id=329). – ggael Jan 03 '14 at 09:26
  • @Floris: I want to use it in another calculation. The idea is to be able to create a bigger array from A with repeated rows. – sid Jan 03 '14 at 17:10
  • @ggael:thanks for the info! – sid Jan 03 '14 at 17:17
  • Based on @ggael's link, I guess you will have to construct the new array "the slow way". Luckily, creating loops in `eigen` isn't as slow as in Matlab... – Floris Jan 03 '14 at 17:28

0 Answers0