From f7a056bf049df31a96d97523c04033f44824f270 Mon Sep 17 00:00:00 2001 From: Erik Schultheis Date: Tue, 21 Dec 2021 16:46:09 +0000 Subject: [PATCH] Small fixes This MR fixes a bunch of smaller issues, making the following changes: * Template parameters in the documentation are documented with `\tparam` instead of `\param` * Superfluous semicolon warnings fixed * Fixed the type of literals used to initialize float variables --- Eigen/src/Cholesky/LDLT.h | 2 +- Eigen/src/Cholesky/LLT.h | 2 +- Eigen/src/CholmodSupport/CholmodSupport.h | 2 +- Eigen/src/Core/Diagonal.h | 4 ++-- Eigen/src/Core/DiagonalMatrix.h | 8 ++++---- Eigen/src/Core/Select.h | 6 +++--- Eigen/src/Core/SelfAdjointView.h | 4 ++-- Eigen/src/Core/TriangularMatrix.h | 4 ++-- Eigen/src/Core/util/Serializer.h | 2 +- Eigen/src/QR/CompleteOrthogonalDecomposition.h | 2 +- Eigen/src/SparseLU/SparseLU.h | 4 ++-- test/bfloat16_float.cpp | 4 ++-- test/main.h | 7 ++++--- test/rand.cpp | 4 ++-- 14 files changed, 28 insertions(+), 27 deletions(-) diff --git a/Eigen/src/Cholesky/LDLT.h b/Eigen/src/Cholesky/LDLT.h index 267440596..ef1c11f62 100644 --- a/Eigen/src/Cholesky/LDLT.h +++ b/Eigen/src/Cholesky/LDLT.h @@ -246,7 +246,7 @@ template class LDLT * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: * \code x = decomposition.adjoint().solve(b) \endcode */ - const LDLT& adjoint() const { return *this; }; + const LDLT& adjoint() const { return *this; } EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } diff --git a/Eigen/src/Cholesky/LLT.h b/Eigen/src/Cholesky/LLT.h index f22d2a751..c223da266 100644 --- a/Eigen/src/Cholesky/LLT.h +++ b/Eigen/src/Cholesky/LLT.h @@ -201,7 +201,7 @@ template class LLT * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: * \code x = decomposition.adjoint().solve(b) \endcode */ - const LLT& adjoint() const EIGEN_NOEXCEPT { return *this; }; + const LLT& adjoint() const EIGEN_NOEXCEPT { return *this; } inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } diff --git a/Eigen/src/CholmodSupport/CholmodSupport.h b/Eigen/src/CholmodSupport/CholmodSupport.h index d33af5487..91c1cfc14 100644 --- a/Eigen/src/CholmodSupport/CholmodSupport.h +++ b/Eigen/src/CholmodSupport/CholmodSupport.h @@ -438,7 +438,7 @@ class CholmodBase : public SparseSolverBase if (m_cholmodFactor->is_ll) logDet *= 2.0; return logDet; - }; + } template void dumpMemory(Stream& /*s*/) diff --git a/Eigen/src/Core/Diagonal.h b/Eigen/src/Core/Diagonal.h index 6d8df3d03..4dd56db0e 100644 --- a/Eigen/src/Core/Diagonal.h +++ b/Eigen/src/Core/Diagonal.h @@ -20,8 +20,8 @@ namespace Eigen { * * \brief Expression of a diagonal/subdiagonal/superdiagonal in a matrix * - * \param MatrixType the type of the object in which we are taking a sub/main/super diagonal - * \param DiagIndex the index of the sub/super diagonal. The default is 0 and it means the main diagonal. + * \tparam MatrixType the type of the object in which we are taking a sub/main/super diagonal + * \tparam DiagIndex the index of the sub/super diagonal. The default is 0 and it means the main diagonal. * A positive value means a superdiagonal, a negative value means a subdiagonal. * You can also use DynamicIndex so the index can be set at runtime. * diff --git a/Eigen/src/Core/DiagonalMatrix.h b/Eigen/src/Core/DiagonalMatrix.h index d5053d643..453f69bc9 100644 --- a/Eigen/src/Core/DiagonalMatrix.h +++ b/Eigen/src/Core/DiagonalMatrix.h @@ -118,9 +118,9 @@ class DiagonalBase : public EigenBase * * \brief Represents a diagonal matrix with its storage * - * \param Scalar_ the type of coefficients - * \param SizeAtCompileTime the dimension of the matrix, or Dynamic - * \param MaxSizeAtCompileTime the dimension of the matrix, or Dynamic. This parameter is optional and defaults + * \tparam Scalar_ the type of coefficients + * \tparam SizeAtCompileTime the dimension of the matrix, or Dynamic + * \tparam MaxSizeAtCompileTime the dimension of the matrix, or Dynamic. This parameter is optional and defaults * to SizeAtCompileTime. Most of the time, you do not need to specify it. * * \sa class DiagonalWrapper @@ -261,7 +261,7 @@ class DiagonalMatrix * * \brief Expression of a diagonal matrix * - * \param DiagonalVectorType_ the type of the vector of diagonal coefficients + * \tparam DiagonalVectorType_ the type of the vector of diagonal coefficients * * This class is an expression of a diagonal matrix, but not storing its own vector of diagonal coefficients, * instead wrapping an existing vector expression. It is the return type of MatrixBase::asDiagonal() diff --git a/Eigen/src/Core/Select.h b/Eigen/src/Core/Select.h index f2a2a0328..d9ed2b213 100644 --- a/Eigen/src/Core/Select.h +++ b/Eigen/src/Core/Select.h @@ -19,9 +19,9 @@ namespace Eigen { * * \brief Expression of a coefficient wise version of the C++ ternary operator ?: * - * \param ConditionMatrixType the type of the \em condition expression which must be a boolean matrix - * \param ThenMatrixType the type of the \em then expression - * \param ElseMatrixType the type of the \em else expression + * \tparam ConditionMatrixType the type of the \em condition expression which must be a boolean matrix + * \tparam ThenMatrixType the type of the \em then expression + * \tparam ElseMatrixType the type of the \em else expression * * This class represents an expression of a coefficient wise version of the C++ ternary operator ?:. * It is the return type of DenseBase::select() and most of the time this is the only way it is used. diff --git a/Eigen/src/Core/SelfAdjointView.h b/Eigen/src/Core/SelfAdjointView.h index 6b1124718..7096058bf 100644 --- a/Eigen/src/Core/SelfAdjointView.h +++ b/Eigen/src/Core/SelfAdjointView.h @@ -20,8 +20,8 @@ namespace Eigen { * * \brief Expression of a selfadjoint matrix from a triangular part of a dense matrix * - * \param MatrixType the type of the dense matrix storing the coefficients - * \param TriangularPart can be either \c #Lower or \c #Upper + * \tparam MatrixType the type of the dense matrix storing the coefficients + * \tparam TriangularPart can be either \c #Lower or \c #Upper * * This class is an expression of a sefladjoint matrix from a triangular part of a matrix * with given dense storage of the coefficients. It is the return type of MatrixBase::selfadjointView() diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index 9376a79a1..28f515fa4 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -155,8 +155,8 @@ template class TriangularBase : public EigenBase * * \brief Expression of a triangular part in a matrix * - * \param MatrixType the type of the object in which we are taking the triangular part - * \param Mode the kind of triangular matrix expression to construct. Can be #Upper, + * \tparam MatrixType the type of the object in which we are taking the triangular part + * \tparam Mode the kind of triangular matrix expression to construct. Can be #Upper, * #Lower, #UnitUpper, #UnitLower, #StrictlyUpper, or #StrictlyLower. * This is in fact a bit field; it must have either #Upper or #Lower, * and additionally it may have #UnitDiag or #ZeroDiag or neither. diff --git a/Eigen/src/Core/util/Serializer.h b/Eigen/src/Core/util/Serializer.h index 7ec5eedd5..4f7e06213 100644 --- a/Eigen/src/Core/util/Serializer.h +++ b/Eigen/src/Core/util/Serializer.h @@ -46,7 +46,7 @@ class Serializer > * * \brief Complete orthogonal decomposition (COD) of a matrix. * - * \param MatrixType the type of the matrix of which we are computing the COD. + * \tparam MatrixType_ the type of the matrix of which we are computing the COD. * * This class performs a rank-revealing complete orthogonal decomposition of a * matrix \b A into matrices \b P, \b Q, \b T, and \b Z such that diff --git a/Eigen/src/SparseLU/SparseLU.h b/Eigen/src/SparseLU/SparseLU.h index 1516d26b0..6fc7d3327 100644 --- a/Eigen/src/SparseLU/SparseLU.h +++ b/Eigen/src/SparseLU/SparseLU.h @@ -454,8 +454,8 @@ class SparseLU : public SparseSolverBase >, return (m_detPermR * m_detPermC) > 0 ? det : -det; } - Index nnzL() const { return m_nnzL; }; - Index nnzU() const { return m_nnzU; }; + Index nnzL() const { return m_nnzL; } + Index nnzU() const { return m_nnzU; } protected: // Functions diff --git a/test/bfloat16_float.cpp b/test/bfloat16_float.cpp index c3de0b19a..b2a22ceb2 100644 --- a/test/bfloat16_float.cpp +++ b/test/bfloat16_float.cpp @@ -209,8 +209,8 @@ void test_numtraits() void test_arithmetic() { - VERIFY_IS_EQUAL(static_cast(bfloat16(2) + bfloat16(2)), 4); - VERIFY_IS_EQUAL(static_cast(bfloat16(2) + bfloat16(-2)), 0); + VERIFY_IS_EQUAL(static_cast(bfloat16(2) + bfloat16(2)), 4.f); + VERIFY_IS_EQUAL(static_cast(bfloat16(2) + bfloat16(-2)), 0.f); VERIFY_IS_APPROX(static_cast(bfloat16(0.33333f) + bfloat16(0.66667f)), 1.0f); VERIFY_IS_EQUAL(static_cast(bfloat16(2.0f) * bfloat16(-5.5f)), -11.0f); VERIFY_IS_APPROX(static_cast(bfloat16(1.0f) / bfloat16(3.0f)), 0.3339f); diff --git a/test/main.h b/test/main.h index 041233d1d..0e341372e 100644 --- a/test/main.h +++ b/test/main.h @@ -22,7 +22,7 @@ // The following includes of STL headers have to be done _before_ the // definition of macros min() and max(). The reason is that many STL // implementations will not work properly as the min and max symbols collide -// with the STL functions std:min() and std::max(). The STL headers may check +// with the STL functions std::min() and std::max(). The STL headers may check // for the macro definition of min/max and issue a warning or undefine the // macros. // @@ -420,7 +420,8 @@ template<> inline long double test_precision >() { ret inline bool test_isApprox(TYPE a, TYPE b) \ { return internal::isApprox(a, b, test_precision()); } \ inline bool test_isCwiseApprox(TYPE a, TYPE b, bool exact) \ - { return a == b || ((numext::isnan)(a) && (numext::isnan)(b)) || \ + { return numext::equal_strict(a, b) || \ + ((numext::isnan)(a) && (numext::isnan)(b)) || \ (!exact && internal::isApprox(a, b, test_precision())); } \ inline bool test_isMuchSmallerThan(TYPE a, TYPE b) \ { return internal::isMuchSmallerThan(a, b, test_precision()); } \ @@ -664,7 +665,7 @@ bool test_isCwiseApprox(const DenseBase& m1, template bool test_is_equal(const T& actual, const U& expected, bool expect_equal) { - if ((actual==expected) == expect_equal) + if (numext::equal_strict(actual, expected) == expect_equal) return true; // false: std::cerr diff --git a/test/rand.cpp b/test/rand.cpp index 984c01f53..b4cc17920 100644 --- a/test/rand.cpp +++ b/test/rand.cpp @@ -62,9 +62,9 @@ EIGEN_DECLARE_TEST(rand) for(int i = 0; i < g_repeat*10000; i++) { CALL_SUBTEST(check_in_range(10,11)); - CALL_SUBTEST(check_in_range(1.24234523,1.24234523)); + CALL_SUBTEST(check_in_range(1.24234523f,1.24234523f)); CALL_SUBTEST(check_in_range(-1,1)); - CALL_SUBTEST(check_in_range(-1432.2352,-1432.2352)); + CALL_SUBTEST(check_in_range(-1432.2352f,-1432.2352f)); CALL_SUBTEST(check_in_range(10,11)); CALL_SUBTEST(check_in_range(1.24234523,1.24234523));