![]() Registered Member ![]()
|
hello,
i'm trying to multiply a matrix with a huge amount of vectors. the following code shows basically what i'm doing right now:
this method works, and does what i want it to do, but i would love to see it go faster. is there a way to multiply all vectors with the matrix at once, without looping through all the vectors individually? maybe i could get some performance boost there? The amount of vectors could sometimes be 16 million, so i will probably still have to do it in multiple steps ![]() sorry for my English |
![]() Moderator ![]()
|
Hi,
yes you can store your (rows * columns) vectors into a 3 x (rows * columns) matrix and simply do: Matrix<float, 3, Dynamic> A, B, C; // ... A = m * B; C = A.colwise().reverse().normalized(); Then your "A[i][j]" become "A.col(i+j*rows)". You could wrap this into a function returning a Matrix<float, 3, Dynamic>::ColXpr object. |
Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]