5 template<
typename Scalar>
7 CwiseClampOp(
const Scalar& inf,
const Scalar& sup) : m_inf(inf), m_sup(sup) {}
8 const Scalar
operator()(
const Scalar&
x)
const {
return x<m_inf ? m_inf : (
x>m_sup ? m_sup :
x); }
15 std::cout <<
m1 << std::endl <<
"becomes: " << std::endl <<
m1.unaryExpr(CwiseClampOp<double>(-0.5,0.5)) << std::endl;
IndexedView_or_Block operator()(const RowIndices &rowIndices, const ColIndices &colIndices)
static const RandomReturnType Random()
The matrix class, also used for vectors and row-vectors.