![]() Registered Member ![]()
|
Hello,
I am extending the Eigen::Matrix class in order to conform API in my project. Following the instructions in the documentation I came up with the following code:
I also have GenericVector<T> which is derived from Eigen::Matrix<T, Eigen::Dynamic, 1>. Very similar constructors... The reason I am going this is way is because I am trying to use Eigen in a project with an existing matrix/vector API. I am aware that there is another, plugin based, approach, but this one looks more clean to me... (so far). I am using Eigen 3.2.0 (OS X 10.7, gcc 4.7) and the following example code works:
When I want to solve a linear system with:
I get a lot of some nasty errors, ending with
Next, when I try to do Cholesky decomposition
I also get a load of errors... Since the error logs are quite long I can submit them upon request ![]() So, can you please help me to overcome these issues? Thanx a lot in advance! |
![]() Moderator ![]()
|
Please also paste the GenericVector class so that we can reproduce and also the first errors. If you can use c++11 features, then the best would be the plugin based approach with template typedefs to define GenericMatrix and GenericVector.
|
![]() Registered Member ![]()
|
Hi,
Here is the vector class:
Thanx for your reply btw ![]() All in all, I feel I am missing some ctors and typedefs in my classes to make this work. I would appreciate greatly your help! ![]() |
![]() Moderator ![]()
|
You are missing many operator= overloads. The best is to remove the one you have and add:
using Base::operator=; You might also need to forward more ctor. Look at Matrix.h. |
![]() Registered Member ![]()
|
OK, here is the solution:
and
I removed my own namespace for clarity... This compiles and works. The key was to use: - using Base::operator= - define traits (for Matrix) - forward a few ctors Here are test cases that work:
and
Thanx for the help! ![]() ![]() |
![]() Moderator ![]()
|
For the traits:
|
![]() Registered Member ![]()
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]