Registered Member
|
Hey everyone,
as mentioned above, I want to compare to matrices which I have calculated with Eigen. One matrix is a MatrixXd with six rows and eight columns and the other one is calculated by a complex algorithm - of course also a MatrixXd with six rows and eight columns. The two matrices are delivering the exact same values, but if i want to compare them with ASSERT_EQ from GoogleTest, the test fails. -.- The output shows this values: Actual: 24-byte object <A0-D4 AE-01 00-00 00-00 06-00 00-00 00-00 00-00 08-00 00-00 00-00 00-00> Expected: resultMatrix Which is: 24-byte object <F0-24 AE-01 00-00 00-00 06-00 00-00 00-00 00-00 08-00 00-00 00-00 00-00> Can someone tell me how I should compare this two matrices? Thx & GB buzzzzzz |
Moderator
|
You need a fuzzy comparison tolerating a few bits of round-off error, something like:
ASSERT( A.isApprox(B) ); and replace "ASSERT" by the appropriate GTest macro. You can also specify the tolerance as a second argument to isApprox. |
Registered Member
|
Hey,
thank you, i saw that the values were different in the 7th position... now I am calculating the norm of the matrices and compare these two -> but first i have to check how to cut off the other values. I don't need so much comma positions... Thx for your advice! bl |
Registered users: Bing [Bot], Google [Bot], Sogou [Bot]