Reply to topic

[SOLVED] using custom scalar type with Eigen

kfriddile
Registered Member
Posts
23
Karma
0
I've written a fixed-point number abstraction in anticipation of doing some work on devices without an FPU. I'd like to know what's required to use this abstraction with a few specific Eigen types. The specific types I would be using it with are:

Eigen::AngleAxis
Eigen::Matrix
Eigen::Matrix
Eigen::Matrix
Eigen::Matrix
Eigen::Quaternion

Is this simply a matter of specializing Eigen::NumTraits for my fixed-point type?
User avatar bjacob
Registered Member
Posts
658
Karma
3
In addition to specializing NumTraits you would have to implement the math functions (MathFunctions.h), then you should be OK :)


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
User avatar bjacob
Registered Member
Posts
658
Karma
3
Where things would become more tricky is if you wanted vectorization ... then you'd at least have to specialize the PacketMath.h functions.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
kfriddile
Registered Member
Posts
23
Karma
0
bjacob wrote:In addition to specializing NumTraits you would have to implement the math functions (MathFunctions.h), then you should be OK :)


Thanks, that doesn't look too difficult :-)
User avatar bjacob
Registered Member
Posts
658
Karma
3
By the way, you don't need to specialize the functions that you don't use.

For many use cases, all you'll need to specialize is ei_sqrt, ei_abs, ei_abs2.


Join us on Eigen's IRC channel: #eigen on irc.freenode.net
Have a serious interest in Eigen? Then join the mailing list!
kfriddile
Registered Member
Posts
23
Karma
0
Cool, got it working and passing all my unit tests :-)

 
Reply to topic

Bookmarks



Who is online

Registered users: aliveoceans, Baidu [Spider], Bing [Bot], Google [Bot], kareyuvar, kde-oldgeezer, konsultor, langsholt