Missing modulus operator
Describe the feature you would like to be implemented.
Currently in eigen 3.4.0 Array supports only +, -, *, and / by scalar, but no %:
auto m = Eigen::ArrayXXi(1, 5);
m << 1, 2, 3, 4, 5;
std::cout << m / 2 << '\n'; // 0 1 1 2 2
std::cout << m * 2 << '\n'; // 2 4 6 8 10
std::cout << m % 2 << '\n'; // error
Numpy for example do have modulus:
>>> a = numpy.array([1,2,3,4,5,10,15], dtype=int)
>>> a
array([ 1, 2, 3, 4, 5, 10, 15])
>>> a % 2
array([1, 0, 1, 0, 1, 0, 1])
For now I'm using a workaround with ranges: std::ranges::for_each(m, [](auto &x) { x %= 2; }).
Are there any plans to add a modulus operator?
Would such a feature be useful for other users? Why?
It would be useful for matrix arithmetic in a finite filed Z/2.
I also noticed Array has a xor operator with another Array, but not with a scalar bool. Any other Array's arithmetic operation has version with scalars.