From 3492d9e2e59bc35ba4d38b0c8c48e66e5ae1743d Mon Sep 17 00:00:00 2001 From: Rasmus Munk Larsen Date: Fri, 10 Mar 2023 00:28:31 +0000 Subject: [PATCH] s/Lesser/Less/ --- Eigen/src/plugins/MatrixCwiseBinaryOps.h | 57 ++++++++++++------------ test/array_cwise.cpp | 16 +++---- 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Eigen/src/plugins/MatrixCwiseBinaryOps.h b/Eigen/src/plugins/MatrixCwiseBinaryOps.h index ad74c3568..fd5941452 100644 --- a/Eigen/src/plugins/MatrixCwiseBinaryOps.h +++ b/Eigen/src/plugins/MatrixCwiseBinaryOps.h @@ -27,9 +27,9 @@ cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const template using CwiseBinaryEqualReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; template using CwiseBinaryNotEqualReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; -template using CwiseBinaryLesserReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; +template using CwiseBinaryLessReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; template using CwiseBinaryGreaterReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; -template using CwiseBinaryLesserOrEqualReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; +template using CwiseBinaryLessOrEqualReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; template using CwiseBinaryGreaterOrEqualReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; /** \returns an expression of the coefficient-wise == operator of *this and \a other @@ -75,10 +75,10 @@ cwiseNotEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const /** \returns an expression of the coefficient-wise < operator of *this and \a other */ template EIGEN_DEVICE_FUNC -inline const CwiseBinaryLesserReturnType -cwiseLesser(const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) const +inline const CwiseBinaryLessReturnType +cwiseLess(const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) const { - return CwiseBinaryLesserReturnType(derived(), other.derived()); + return CwiseBinaryLessReturnType(derived(), other.derived()); } /** \returns an expression of the coefficient-wise > operator of *this and \a other */ @@ -93,10 +93,10 @@ cwiseGreater(const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) const /** \returns an expression of the coefficient-wise <= operator of *this and \a other */ template EIGEN_DEVICE_FUNC -inline const CwiseBinaryLesserOrEqualReturnType -cwiseLesserOrEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) const +inline const CwiseBinaryLessOrEqualReturnType +cwiseLessOrEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) const { - return CwiseBinaryLesserOrEqualReturnType(derived(), other.derived()); + return CwiseBinaryLessOrEqualReturnType(derived(), other.derived()); } /** \returns an expression of the coefficient-wise >= operator of *this and \a other */ @@ -180,9 +180,9 @@ cwiseQuotient(const EIGEN_CURRENT_STORAGE_BASE_CLASS &other) const using CwiseScalarEqualReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; using CwiseScalarNotEqualReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; -using CwiseScalarLesserReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; +using CwiseScalarLessReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; using CwiseScalarGreaterReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; -using CwiseScalarLesserOrEqualReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; +using CwiseScalarLessOrEqualReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; using CwiseScalarGreaterOrEqualReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; /** \returns an expression of the coefficient-wise == operator of \c *this and a scalar \a s @@ -220,10 +220,10 @@ cwiseNotEqual(const Scalar& s) const /** \returns an expression of the coefficient-wise < operator of \c *this and a scalar \a s */ EIGEN_DEVICE_FUNC -inline const CwiseScalarLesserReturnType -cwiseLesser(const Scalar& s) const +inline const CwiseScalarLessReturnType +cwiseLess(const Scalar& s) const { - return CwiseScalarLesserReturnType(derived(), Derived::Constant(rows(), cols(), s)); + return CwiseScalarLessReturnType(derived(), Derived::Constant(rows(), cols(), s)); } /** \returns an expression of the coefficient-wise > operator of \c *this and a scalar \a s */ @@ -236,10 +236,10 @@ cwiseGreater(const Scalar& s) const /** \returns an expression of the coefficient-wise <= operator of \c *this and a scalar \a s */ EIGEN_DEVICE_FUNC -inline const CwiseScalarLesserOrEqualReturnType -cwiseLesserOrEqual(const Scalar& s) const +inline const CwiseScalarLessOrEqualReturnType +cwiseLessOrEqual(const Scalar& s) const { - return CwiseScalarLesserOrEqualReturnType(derived(), Derived::Constant(rows(), cols(), s)); + return CwiseScalarLessOrEqualReturnType(derived(), Derived::Constant(rows(), cols(), s)); } /** \returns an expression of the coefficient-wise >= operator of \c *this and a scalar \a s */ @@ -252,9 +252,9 @@ cwiseGreaterOrEqual(const Scalar& s) const template using CwiseBinaryTypedEqualReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; template using CwiseBinaryTypedNotEqualReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; -template using CwiseBinaryTypedLesserReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; +template using CwiseBinaryTypedLessReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; template using CwiseBinaryTypedGreaterReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; -template using CwiseBinaryTypedLesserOrEqualReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; +template using CwiseBinaryTypedLessOrEqualReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; template using CwiseBinaryTypedGreaterOrEqualReturnType = CwiseBinaryOp, const Derived, const OtherDerived>; template @@ -266,16 +266,16 @@ EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryTypedNotEqualReturnType& other) const { return CwiseBinaryTypedNotEqualReturnType(derived(), other.derived()); } template -EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryTypedLesserReturnType -cwiseTypedLesser(const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) const { return CwiseBinaryTypedLesserReturnType(derived(), other.derived()); } +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryTypedLessReturnType +cwiseTypedLess(const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) const { return CwiseBinaryTypedLessReturnType(derived(), other.derived()); } template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryTypedGreaterReturnType cwiseTypedGreater(const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) const { return CwiseBinaryTypedGreaterReturnType(derived(), other.derived()); } template -EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryTypedLesserOrEqualReturnType -cwiseTypedLesserOrEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) const { return CwiseBinaryTypedLesserOrEqualReturnType(derived(), other.derived()); } +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryTypedLessOrEqualReturnType +cwiseTypedLessOrEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS& other) const { return CwiseBinaryTypedLessOrEqualReturnType(derived(), other.derived()); } template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseBinaryTypedGreaterOrEqualReturnType @@ -283,9 +283,9 @@ cwiseTypedGreaterOrEqual(const EIGEN_CURRENT_STORAGE_BASE_CLASS& o using CwiseScalarTypedEqualReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; using CwiseScalarTypedNotEqualReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; -using CwiseScalarTypedLesserReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; +using CwiseScalarTypedLessReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; using CwiseScalarTypedGreaterReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; -using CwiseScalarTypedLesserOrEqualReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; +using CwiseScalarTypedLessOrEqualReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; using CwiseScalarTypedGreaterOrEqualReturnType = CwiseBinaryOp, const Derived, const ConstantReturnType>; EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseScalarTypedEqualReturnType @@ -294,15 +294,14 @@ cwiseTypedEqual(const Scalar& s) const { return CwiseScalarTypedEqualReturnType( EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseScalarTypedNotEqualReturnType cwiseTypedNotEqual(const Scalar& s) const { return CwiseScalarTypedNotEqualReturnType(derived(), ConstantReturnType(rows(), cols(), s)); } -EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseScalarTypedLesserReturnType -cwiseTypedLesser(const Scalar& s) const { return CwiseScalarTypedLesserReturnType(derived(), ConstantReturnType(rows(), cols(), s)); } +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseScalarTypedLessReturnType +cwiseTypedLess(const Scalar& s) const { return CwiseScalarTypedLessReturnType(derived(), ConstantReturnType(rows(), cols(), s)); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseScalarTypedGreaterReturnType cwiseTypedGreater(const Scalar& s) const { return CwiseScalarTypedGreaterReturnType(derived(), ConstantReturnType(rows(), cols(), s)); } -EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseScalarTypedLesserOrEqualReturnType -cwiseTypedLesserOrEqual(const Scalar& s) const { return CwiseScalarTypedLesserOrEqualReturnType(derived(), ConstantReturnType(rows(), cols(), s)); } +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseScalarTypedLessOrEqualReturnType +cwiseTypedLessOrEqual(const Scalar& s) const { return CwiseScalarTypedLessOrEqualReturnType(derived(), ConstantReturnType(rows(), cols(), s)); } EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CwiseScalarTypedGreaterOrEqualReturnType cwiseTypedGreaterOrEqual(const Scalar& s) const { return CwiseScalarTypedGreaterOrEqualReturnType(derived(), ConstantReturnType(rows(), cols(), s)); } - diff --git a/test/array_cwise.cpp b/test/array_cwise.cpp index 2fd245dfb..4f8111bc6 100644 --- a/test/array_cwise.cpp +++ b/test/array_cwise.cpp @@ -636,41 +636,41 @@ template void comparisons(const ArrayType& m) // (m1 + Scalar(1)) > m1).all() VERIFY_IS_CWISE_EQUAL((m1 + Scalar(1)).cwiseTypedGreater(m1), typed_true); // (m1 - Scalar(1)) < m1).all() - VERIFY_IS_CWISE_EQUAL((m1 - Scalar(1)).cwiseTypedLesser(m1), typed_true); + VERIFY_IS_CWISE_EQUAL((m1 - Scalar(1)).cwiseTypedLess(m1), typed_true); // (m1 + Scalar(1)) == (m1 + Scalar(1))).all() VERIFY_IS_CWISE_EQUAL((m1 + Scalar(1)).cwiseTypedEqual(m1 + Scalar(1)), typed_true); // (m1 - Scalar(1)) != m1).all() VERIFY_IS_CWISE_EQUAL((m1 - Scalar(1)).cwiseTypedNotEqual(m1), typed_true); // (m1 <= m2 || m1 >= m2).all() - VERIFY_IS_CWISE_EQUAL(m1.cwiseTypedGreaterOrEqual(m2) || m1.cwiseTypedLesserOrEqual(m2), typed_true); + VERIFY_IS_CWISE_EQUAL(m1.cwiseTypedGreaterOrEqual(m2) || m1.cwiseTypedLessOrEqual(m2), typed_true); // use boolean comparisons, regardless of operator overload behavior ArrayXX::ConstantReturnType bool_true = ArrayXX::Constant(rows, cols, true); // (m1 + Scalar(1)) > m1).all() VERIFY_IS_CWISE_EQUAL((m1 + Scalar(1)).cwiseGreater(m1), bool_true); // (m1 - Scalar(1)) < m1).all() - VERIFY_IS_CWISE_EQUAL((m1 - Scalar(1)).cwiseLesser(m1), bool_true); + VERIFY_IS_CWISE_EQUAL((m1 - Scalar(1)).cwiseLess(m1), bool_true); // (m1 + Scalar(1)) == (m1 + Scalar(1))).all() VERIFY_IS_CWISE_EQUAL((m1 + Scalar(1)).cwiseEqual(m1 + Scalar(1)), bool_true); // (m1 - Scalar(1)) != m1).all() VERIFY_IS_CWISE_EQUAL((m1 - Scalar(1)).cwiseNotEqual(m1), bool_true); // (m1 <= m2 || m1 >= m2).all() - VERIFY_IS_CWISE_EQUAL(m1.cwiseLesserOrEqual(m2) || m1.cwiseGreaterOrEqual(m2), bool_true); + VERIFY_IS_CWISE_EQUAL(m1.cwiseLessOrEqual(m2) || m1.cwiseGreaterOrEqual(m2), bool_true); // test typed comparisons with scalar argument VERIFY_IS_CWISE_EQUAL((m1 - m1).cwiseTypedEqual(Scalar(0)), typed_true); VERIFY_IS_CWISE_EQUAL((m1.abs() + Scalar(1)).cwiseTypedNotEqual(Scalar(0)), typed_true); VERIFY_IS_CWISE_EQUAL((m1 + Scalar(1)).cwiseTypedGreater(m1.minCoeff()), typed_true); - VERIFY_IS_CWISE_EQUAL((m1 - Scalar(1)).cwiseTypedLesser(m1.maxCoeff()), typed_true); - VERIFY_IS_CWISE_EQUAL(m1.abs().cwiseTypedLesserOrEqual(NumTraits::highest()), typed_true); + VERIFY_IS_CWISE_EQUAL((m1 - Scalar(1)).cwiseTypedLess(m1.maxCoeff()), typed_true); + VERIFY_IS_CWISE_EQUAL(m1.abs().cwiseTypedLessOrEqual(NumTraits::highest()), typed_true); VERIFY_IS_CWISE_EQUAL(m1.abs().cwiseTypedGreaterOrEqual(Scalar(0)), typed_true); // test boolean comparisons with scalar argument VERIFY_IS_CWISE_EQUAL((m1 - m1).cwiseEqual(Scalar(0)), bool_true); VERIFY_IS_CWISE_EQUAL((m1.abs() + Scalar(1)).cwiseNotEqual(Scalar(0)), bool_true); VERIFY_IS_CWISE_EQUAL((m1 + Scalar(1)).cwiseGreater(m1.minCoeff()), bool_true); - VERIFY_IS_CWISE_EQUAL((m1 - Scalar(1)).cwiseLesser(m1.maxCoeff()), bool_true); - VERIFY_IS_CWISE_EQUAL(m1.abs().cwiseLesserOrEqual(NumTraits::highest()), bool_true); + VERIFY_IS_CWISE_EQUAL((m1 - Scalar(1)).cwiseLess(m1.maxCoeff()), bool_true); + VERIFY_IS_CWISE_EQUAL(m1.abs().cwiseLessOrEqual(NumTraits::highest()), bool_true); VERIFY_IS_CWISE_EQUAL(m1.abs().cwiseGreaterOrEqual(Scalar(0)), bool_true); // test Select