What is the best way to perform modulus operator over a vector or matrix in c++ Armadillo?
The vector and matrix classes overload the %
operator to perform element-wise multiplication. Trying to use it yields an invalid operands
error. I was expecting that
uvec a = {0, 1, 2, 3};
uvec b = a % 2;
cout << "b" << endl;
would yield the following:
b:
0
1
0
1