This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Custom scalars

Tags: None
(comma "," separated)
p0wertripper
Registered Member
Posts
6
Karma
0

Custom scalars

Mon May 06, 2013 6:55 pm
I have a certain structure which can be viewed as a finite field defined as a class in C++ with multiplicative and additive operations (well) defined through overloading of standard c++ operators. I am interested in whether I can use it as a custom scalar class for dense Eigen matrices. I have already tried it and it works for simple operations like matrix addition, multiplication, multiplication by scalar and determinant.
However, I would like to know what can go wrong if someone tries to use other methods of matrix class. Generally, I am interested to know what operators need to be defined for the custom scalar class to allow all methods of the dense Matrix class to work. Is overloading +,-(x2),*,/,+=,-=,*=,/=,++,--,= going to be enough?

Code: Select all
Matrix<myscalar, Dynamic, Dynamic> A;
(myscalar is a custom class representing a certain field)

I tried Eigen documentation, but I do not think it has been written for this feature yet. Here's the link about custom scalars in Eigen documentation: http://eigen.tuxfamily.org/dox/TopicScalarTypes.html

Thank you for your help in advance.
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS

Re: Custom scalars  Topic is solved

Tue May 07, 2013 9:34 am
++ and -- are not used by Eigen. On the other hand you might also need standard functions as: min, max, abs, <, >.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Sogou [Bot]