There are three overloads of .select() function in Eigen:
template<typename Derived >
template<typename ThenDerived , typename ElseDerived >
const Select< Derived, ThenDerived, ElseDerived > Eigen::DenseBase< Derived >::select (
const DenseBase< ThenDerived > & thenMatrix,
const DenseBase< ElseDerived > & elseMatrix
) const;
template<typename Derived >
template<typename ThenDerived >
const Select< Derived, ThenDerived, typename ThenDerived::ConstantReturnType > Eigen::DenseBase< Derived >::select (
const DenseBase< ThenDerived > & thenMatrix,
const typename ThenDerived::Scalar & elseScalar
) const;
template<typename Derived >
template<typename ElseDerived >
const Select< Derived, typename ElseDerived::ConstantReturnType, ElseDerived > Eigen::DenseBase< Derived >::select (
const typename ElseDerived::Scalar & thenScalar,
const DenseBase< ElseDerived > & elseMatrix
) const;
Why isn't there an overload that accepts two Scalars?
This has been asked before at strange behavior of eigen::select(), but that question itself is not answered. The answers just say "if you want to .select() two scalars, you can write balabala", they didn't say why there is not an overload that selects two scalars.