In MATLAB it is common to slice out values that satisfy some condition from a matrix/array (called logical indexing).
vec = [1 2 3 4 5];
condition = vec > 3;
vec(condition) = 3;
How do I do this in Eigen? So far I have:
Eigen::Matrix<bool, 1, 5> condition = vec.array() > 3;
See Question&Answers more detail:os