Registered Member
|
I would like to know how to do that and if it works with Eigen ?
for example: void my_func(Eigen::MatrixXf &myMat) { //... use myMat ... } int main() { Eigen::MatrixXf mat(6,4); my_func(mat); } or should I use pointers and how to do that ? PS: I know I can pass the .data() and matrix size and then use Map to use the matrix, but I've seen some matrix functionality is not available like that. I want to know if I can do something like above and basically how to do it ? |
Registered Member
|
You can perfectly pass either pointers or references to Eigen objects, as you want. Eigen doesn't make any difference here. Also, pointers and references are the same thing, once the code is compiled. This is generally true in c++, not eigen specific. So your code snippet will work. Make sure to use /constant/ references wherever possible.
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]