![]() Registered Member ![]()
|
Hi,
I am trying to pass Matrix blocks into functions so that they can perform read/write operations on the blocks. I am creating the blocks by calling the MatrixXd.block(a,b,c,d) method. However when I try to pass the result to a method, I keep getting compile time conversion errors. Most of the errors were to the effect of
I went thru the below web-page which talks about passing EigenTypes between functions and the following sentence stood out: http://eigen.tuxfamily.org/dox-devel/To ... Types.html
the article then talked about using a 'hack of the form'
Which did not work for me. Now in addition to the original conversion error, I am getting the following error
My compiler is VC++ 2010. Can someone please advise me on how to do this. Thanks. |
![]() Registered Member ![]()
|
Hi,
over here, the following self contained example is working with VS2010
Which version are you using? Regards, Hauke |
![]() Registered Member ![]()
|
Hi Hauke,
Thanks for the help. I was using the following method:
During my attempt at debugging the problem, I copy/pasted your code into vc++ and got the following build errors:
It looks like I might be using a different version or have some configuration problem. To check to see if the Eigen library was installed correctly, I compiled and ran the following code succesfully:
Any thoughts as to whats going on? |
![]() Registered Member ![]()
|
It seems your problem is of a different nature. In case you can post a simple failing example, we can most likely help you.
The version of Eigen can be determined by looking for these macros in the Macros.h header file:
Regards, Hauke |
![]() Registered Member ![]()
|
Hauke,
Sorry for the delay, I was been busy at work. I downloaded the latest version of eigen (2.0.15) and the errors persisted. The code that generated the errors that I posted in my previous post, was exactly the code that you posted. That said, I played around with the code you posted and found that the code you posted did not include <Eigen/Array> which is apparently necessary for using Random. Anyways, the code now looks like this:
And the only compile time error I am getting is the following:
which is caused by the below line:
Thanks again for the interest and I hope you can figure this out. Thanks. |
![]() Registered Member ![]()
|
I don't recall all the changes since version 2 but the tutorial is for Eigen 3.0. We have a beta download ready at
http://eigen.tuxfamily.org/index.php?title=3.0-beta1 but you may as well try out the most recent version from the default branch. One of the changes is that <Eigen/Core> is now automatically including the array module which explains the error you have seen earlier. The other thing is that EIGEN_REF_TO_TEMPORARY does not exist in Eigen 2. If you need to stick to version 2, you can define it yourself as
Good luck, - Hauke |
![]() Registered Member ![]()
|
We really need to make it (even) more clear that the docs under dox-devel/ are for Eigen3: this is at least the second time that this has caused confusion!
Confirming that apparently the only thing you need is to replace EIGEN_REF_TO_TEMPORARY by const&
Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list! |
![]() Registered Member ![]()
|
Thank you. You were most helpful.
|
Registered users: Bing [Bot], blue_bullet, Google [Bot], rockscient, Yahoo [Bot]