How to express "<array-of-true-or-false> = <array> <= <scalar> using Eigen 3?
I am porting some MATLAB code to C ++ using the Eigen 3 template library, and I am looking for a good mapping for this common MATLAB idiom:
K>> [1 2 3 4 5] <= 3 ans = 1 1 1 0 0 So, compare the array and scalar, returning an array of logical elements that have the same shape.
I understand that the Eigen Array class has a comparison operator for coefficients, but if I interpret the documents correctly, they only work with another array; not with scalar values.
Is there any option that I missed that will perform a comparison with a scalar? Or, if it is not, a good idiomatic way to create an Array filled with a scalar value for an RHS expression?