aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/plugins/MatrixCwiseBinaryOps.h
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2015-06-09 10:52:04 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2015-06-09 10:52:04 +0200
commit3a4299b2454859cc386a14c1ea97ed868bffd2bf (patch)
tree56f975dc4a52fc3d982d8392ed67390d3190602f /Eigen/src/plugins/MatrixCwiseBinaryOps.h
parent9aef0db9928e54d1b0a317b07c2cc3a9b42fe5b2 (diff)
bug #872: remove usage of deprecated bind1st.
Diffstat (limited to 'Eigen/src/plugins/MatrixCwiseBinaryOps.h')
-rw-r--r--Eigen/src/plugins/MatrixCwiseBinaryOps.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/Eigen/src/plugins/MatrixCwiseBinaryOps.h b/Eigen/src/plugins/MatrixCwiseBinaryOps.h
index b9582a5a0..6dd2e1192 100644
--- a/Eigen/src/plugins/MatrixCwiseBinaryOps.h
+++ b/Eigen/src/plugins/MatrixCwiseBinaryOps.h
@@ -132,3 +132,21 @@ cwiseQuotient(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
{
return CwiseBinaryOp<internal::scalar_quotient_op<Scalar>, const Derived, const OtherDerived>(derived(), other.derived());
}
+
+typedef CwiseBinaryOp<internal::scalar_cmp_op<Scalar,internal::cmp_EQ>, const Derived, const ConstantReturnType> CwiseScalarEqualReturnType;
+
+/** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s
+ *
+ * \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
+ * In order to check for equality between two vectors or matrices with floating-point coefficients, it is
+ * generally a far better idea to use a fuzzy comparison as provided by isApprox() and
+ * isMuchSmallerThan().
+ *
+ * \sa cwiseEqual(const MatrixBase<OtherDerived> &) const
+ */
+EIGEN_DEVICE_FUNC
+inline const CwiseScalarEqualReturnType
+cwiseEqual(const Scalar& s) const
+{
+ return CwiseScalarEqualReturnType(derived(), Derived::Constant(rows(), cols(), s), internal::scalar_cmp_op<Scalar,internal::cmp_EQ>());
+}