I’m new in implementing Eigen Library in VS C++ 2010.
My problem is that I can’t find the operator XOR to make it in my matrix. I use ^ to make my XOR operations C++ and it does work but in Eigen it doesn’t works. Can anyone tell me if there’s an XOR Operator for Eigen ? I all ready read the documentation but I can’t find it. Heres the code that I’m working on :
m(0,1) = 1;
for (i = 0; i < 7; i++) {
for (j = 0; j < 7; j++) {
m(i + 1,j + 1) = m(i,j) ^ m(i, j + 2);
cout << m(i,j) << " ";
}
cout << endl;
}
Thanks for your help.
Not sure about your question, as very important bits of your code are missing (the declaration of m). Let’s try to give an answer under different assumptions:
1) The snipped you provided is the code you want but it’s not working as intended:
In case you have declared
masThe code should work. Something like
Eigen::Matrix<float,9,9>would not work, since the^operator is not defined on float types in c++.Eigen::MatrixXfwould be a dynamic version of your matrix, and result in the same error. You don’t provide what the error is, so it could also be something completely different, e.g. wrong dimensioning ofm2) The snippet you provided is working for you, and you seek to replicate the same functionality with built-in eigen operators:
There is no
^operator defined on Eigen types in the reference. But again, the operator in your snipped is not on Eigen types, as the return value of of your access operationm(i,j)is a ValueType reference to whatever type you used to declaremwith.