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

bool multiplication with exclusive or, not or.

Tags: None
(comma "," separated)
keithgould
Registered Member
Posts
2
Karma
0
Hi,

I'm trying to implement hamming error correcting codes, and to do this I need to take a bool Vector and multiply it with a bool Matrix, performing XOR operations (instead of what looks like OR as Eigen's default bool behavior). An example of what I need is found in this simple tutorial: http://michael.dipperstein.com/hamming/

So for example a bit of code that does not quite work the right way:

typedef Eigen::Matrix<bool, 4, 7> Matrix4by7Bool;
typedef Eigen::Matrix<bool, 1, 4> Vector4Bool;
int main()
{
Matrix4by7Bool gm;
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;

Vector4Bool dm;
dm << 1,0,1,0;

cout << dm * gm;

currently results in: 1 1 1 1 0 1 0
but I need: 1 0 1 1 0 1 0

The difference is that the default behavior is to multiply and then OR each multiplication. Since I need XOR instead of OR, wondering what the best way to do this with Eigen is?

Happy to try and elaborate if this does not make sense.

BTW, not sure if it matters but I'm working on a MacBook Air, using G++. Just downloaded Eigen today so its prob the newest available.

Thank you,
Keith
User avatar
ggael
Moderator
Posts
3447
Karma
19
OS


Bookmarks



Who is online

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