Registered Member
|
I have two lists of fixed size vectorizable matrices, that I want to frequently copy back and forth between each other (so I can do calculations on a trial modification, and then either accept [copy back] or reject [recopy original] the trial).
I'm looking at how best to do the copying quickly. My first thought was:
So my questions are: 1. Can I do this? (Or is there additional data in Matrix<double,16,16> that will not tolerate this kind of bitwise copy?) 2. Should I do this? (Or is there no guarantee that it will continue to work with future versions of Eigen?) 3. Is there a faster way? In particular can I force the compiler to use vectorization since I know the data are all aligned? With respect to question 3, I'm assuming that while it would make use of vectorization the very naive:
would still be much slower than a memcpy? But if people think maybe not I can try and profile it... |
Moderator
|
yes for 1 and 2. Regarding 3, usually memcpy makes use of vectorization, so I also doubt the for loop will be faster. Both solutions should be equivalent, but the only way to be sure is to benchmark.
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]