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

Comparison operators

Tags: None
(comma "," separated)
muccabarucca
Registered Member
Posts
2
Karma
0
OS

Comparison operators

Mon Mar 22, 2010 9:30 pm
Hello :)
I'm trying to debug the following code:

Code: Select all
Matrix3d fix = <some upper triangular matrix>;
fix = fix.cwise() > fix;
fix = fix.diagonal().asDiagonal();


Problem is in line 2, which throws the failed assertion "YOU MIXED DIFFERENT NUMERIC TYPES YOU NEED TO USE THE CAST METHOD OF MATRIXBASE TO CAST NUMERIC TYPES EXPLICITLY".

What type does the comparison operator returns? How should I fix the above example? The desired equivalent matlab code is reported below...

Code: Select all
fix = eye(3) .* sign(K + eps);


Thanks in advance, R
muccabarucca
Registered Member
Posts
2
Karma
0
OS

Re: Comparison operators  Topic is solved

Mon Mar 22, 2010 10:10 pm
This works :)

Code: Select all
Matrix3d fix = K;
fix = (fix.cwise() > fix).cast<double>();
fix = fix.diagonal().asDiagonal();


An example along these lines in the documentation could be helpful :)

// R


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]