Registered Member
|
I want to use Eigen in a project of mine but not in a way that will make it hard for me to try a different library in the future. In other words, I dont want to use Eigen explicitly in my code - I want to hide it behind a genaric interface and only implement the interface with Eigen.
What's a good way to do this? If I make a class called MyVector that stores an Eigen Vector3d for example, and implement the operators like this:
Then will I loose the optimization that Eigen provides? It seems like the custom + operator in MyVector will negate the advantages of Eigen's expression templates by returning a new MyVector for every call. Is this right? If so than how can I create an efficient wrapper? Thanks. |
Registered Member
|
Right, you lose the expression templates. You keep other optimizations though, such as SIMD and cache friendliness.
The best approach is probably to either use the plugins system to add method to Eigen classes, or if that isn't enough, inherit from Eigen classes. Both are described here: http://eigen.tuxfamily.org/dox-devel/Cu ... Eigen.html
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]