Registered Member
|
Hi,
I've been searching all through Eigen docs, and found info about coeffs and how I should be able to access the first element of VectorXf using vector.x() or vector(0). This doesn't work for me though. When I use std::vector I can do it using vector[] and vector.at[]. But how can I do this using VectorXf and MatrixXf ? Thanks. |
Moderator
|
Everything is explained there: http://eigen.tuxfamily.org/dox-devel/gr ... tml#title4
What is not working for you? Make sure you compiled without -DNDEBUG to get feedback on out of range accesses and other common programming mistakes. |
Registered Member
|
Thank you for this link...is what I needed. Other problem is that I fail to convert from a VectorXf element to float. Using std::vector "float *t1 = std::vector &t.at[1];" works fine. However, "float *t1 = VectorXf &t(0);" does compile but ends with segmentation fault.
|
Moderator
|
float* t1 = &t(0); or better, float *t1 = t.data();
|
Registered Member
|
OK, found another detail I have to get used to using eigen: MatrixXf and VectorXf need their sizes set during initialization. Working now. Thank you. |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot], Yahoo [Bot]