aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc/examples/class_CwiseUnaryOp.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-07-08 07:56:01 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2008-07-08 07:56:01 +0000
commit6f09d3a67d333d68e7c971147ec77600e86e93f3 (patch)
tree36095d2bb12c0b02b9688775f60ee5531d2b0372 /doc/examples/class_CwiseUnaryOp.cpp
parentf5791eeb7054b78ded6eb080e9712651da6c6a34 (diff)
- many updates after Cwise change
- fix compilation in product.cpp with std::complex - fix bug in MatrixBase::operator!=
Diffstat (limited to 'doc/examples/class_CwiseUnaryOp.cpp')
-rw-r--r--doc/examples/class_CwiseUnaryOp.cpp3
1 files changed, 1 insertions, 2 deletions
diff --git a/doc/examples/class_CwiseUnaryOp.cpp b/doc/examples/class_CwiseUnaryOp.cpp
index 37d121cd8..c4d8fd4ce 100644
--- a/doc/examples/class_CwiseUnaryOp.cpp
+++ b/doc/examples/class_CwiseUnaryOp.cpp
@@ -9,12 +9,11 @@ struct CwiseClampOp {
CwiseClampOp(const Scalar& inf, const Scalar& sup) : m_inf(inf), m_sup(sup) {}
const Scalar operator()(const Scalar& x) const { return x<m_inf ? m_inf : (x>m_sup ? m_sup : x); }
Scalar m_inf, m_sup;
- enum { Cost = Eigen::ConditionalJumpCost + Eigen::NumTraits<Scalar>::AddCost };
};
int main(int, char**)
{
Matrix4d m1 = Matrix4d::random();
- cout << m1 << endl << "becomes: " << endl << m1.cwise(CwiseClampOp<double>(-0.5,0.5)) << endl;
+ cout << m1 << endl << "becomes: " << endl << m1.unaryExpr(CwiseClampOp<double>(-0.5,0.5)) << endl;
return 0;
}