Registered Member
|
I'm trying to do comparison of two matrices. I'd like a bool result. The code I have feels hacky, and suspect there is a much cleaner way. Thank you for any help!
typedef Eigen::Array<bool, Eigen::Dynamic, Eigen::Dynamic> ArrayXb; TEST(hammimg, generator_matrix) { ArrayXb correct_gm(4,7); // here is what we are testing against correct_gm << 0,1,1,1,0,0,0, 1,0,1,0,1,0,0, 1,1,0,0,0,1,0, 1,1,1,0,0,0,1; // in the generator we we create the generator matrix Hamming ham(parity_bits); // hack starts here. I use a resultant matrix for the == operation // and make sure it is all ones.... ArrayXXb all_ones(4,7); all_ones = correct_gm == ham.generator_matrix; ASSERT_EQ(true, all_ones.isOnes()); } |
Moderator
|
The best is to use .all():
|
Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]