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
This commit is contained in:
Erik Schultheis 2021-12-21 16:46:09 +00:00 committed by David Tellenbach
parent 2a6594de29
commit f7a056bf04
14 changed files with 28 additions and 27 deletions

View File

@ -246,7 +246,7 @@ template<typename MatrixType_, int UpLo_> class LDLT
* This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as:
* \code x = decomposition.adjoint().solve(b) \endcode * \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 rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); }
EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); }

View File

@ -201,7 +201,7 @@ template<typename MatrixType_, int UpLo_> class LLT
* This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as:
* \code x = decomposition.adjoint().solve(b) \endcode * \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 rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); }
inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); }

View File

@ -438,7 +438,7 @@ class CholmodBase : public SparseSolverBase<Derived>
if (m_cholmodFactor->is_ll) if (m_cholmodFactor->is_ll)
logDet *= 2.0; logDet *= 2.0;
return logDet; return logDet;
}; }
template<typename Stream> template<typename Stream>
void dumpMemory(Stream& /*s*/) void dumpMemory(Stream& /*s*/)

View File

@ -20,8 +20,8 @@ namespace Eigen {
* *
* \brief Expression of a diagonal/subdiagonal/superdiagonal in a matrix * \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 * \tparam 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 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. * 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. * You can also use DynamicIndex so the index can be set at runtime.
* *

View File

@ -118,9 +118,9 @@ class DiagonalBase : public EigenBase<Derived>
* *
* \brief Represents a diagonal matrix with its storage * \brief Represents a diagonal matrix with its storage
* *
* \param Scalar_ the type of coefficients * \tparam Scalar_ the type of coefficients
* \param SizeAtCompileTime the dimension of the matrix, or Dynamic * \tparam SizeAtCompileTime the dimension of the matrix, or Dynamic
* \param MaxSizeAtCompileTime the dimension of the matrix, or Dynamic. This parameter is optional and defaults * \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. * to SizeAtCompileTime. Most of the time, you do not need to specify it.
* *
* \sa class DiagonalWrapper * \sa class DiagonalWrapper
@ -261,7 +261,7 @@ class DiagonalMatrix
* *
* \brief Expression of a diagonal matrix * \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, * 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() * instead wrapping an existing vector expression. It is the return type of MatrixBase::asDiagonal()

View File

@ -19,9 +19,9 @@ namespace Eigen {
* *
* \brief Expression of a coefficient wise version of the C++ ternary operator ?: * \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 * \tparam ConditionMatrixType the type of the \em condition expression which must be a boolean matrix
* \param ThenMatrixType the type of the \em then expression * \tparam ThenMatrixType the type of the \em then expression
* \param ElseMatrixType the type of the \em else 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 ?:. * 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. * It is the return type of DenseBase::select() and most of the time this is the only way it is used.

View File

@ -20,8 +20,8 @@ namespace Eigen {
* *
* \brief Expression of a selfadjoint matrix from a triangular part of a dense matrix * \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 * \tparam MatrixType the type of the dense matrix storing the coefficients
* \param TriangularPart can be either \c #Lower or \c #Upper * \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 * 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() * with given dense storage of the coefficients. It is the return type of MatrixBase::selfadjointView()

View File

@ -155,8 +155,8 @@ template<typename Derived> class TriangularBase : public EigenBase<Derived>
* *
* \brief Expression of a triangular part in a matrix * \brief Expression of a triangular part in a matrix
* *
* \param MatrixType the type of the object in which we are taking the triangular part * \tparam 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 Mode the kind of triangular matrix expression to construct. Can be #Upper,
* #Lower, #UnitUpper, #UnitLower, #StrictlyUpper, or #StrictlyLower. * #Lower, #UnitUpper, #UnitLower, #StrictlyUpper, or #StrictlyLower.
* This is in fact a bit field; it must have either #Upper or #Lower, * This is in fact a bit field; it must have either #Upper or #Lower,
* and additionally it may have #UnitDiag or #ZeroDiag or neither. * and additionally it may have #UnitDiag or #ZeroDiag or neither.

View File

@ -46,7 +46,7 @@ class Serializer<T, typename std::enable_if<
/** /**
* Serializes a value to a byte buffer. * Serializes a value to a byte buffer.
* \param dest the destination buffer. * \param dest the destination buffer.
* \param T the value to serialize. * \param value the value to serialize.
* \return the next memory address past the end of the serialized data. * \return the next memory address past the end of the serialized data.
*/ */
EIGEN_DEVICE_FUNC uint8_t* serialize(uint8_t* dest, const T& value) { EIGEN_DEVICE_FUNC uint8_t* serialize(uint8_t* dest, const T& value) {

View File

@ -32,7 +32,7 @@ struct traits<CompleteOrthogonalDecomposition<MatrixType_> >
* *
* \brief Complete orthogonal decomposition (COD) of a matrix. * \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 * 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 * matrix \b A into matrices \b P, \b Q, \b T, and \b Z such that

View File

@ -454,8 +454,8 @@ class SparseLU : public SparseSolverBase<SparseLU<MatrixType_,OrderingType_> >,
return (m_detPermR * m_detPermC) > 0 ? det : -det; return (m_detPermR * m_detPermC) > 0 ? det : -det;
} }
Index nnzL() const { return m_nnzL; }; Index nnzL() const { return m_nnzL; }
Index nnzU() const { return m_nnzU; }; Index nnzU() const { return m_nnzU; }
protected: protected:
// Functions // Functions

View File

@ -209,8 +209,8 @@ void test_numtraits()
void test_arithmetic() void test_arithmetic()
{ {
VERIFY_IS_EQUAL(static_cast<float>(bfloat16(2) + bfloat16(2)), 4); VERIFY_IS_EQUAL(static_cast<float>(bfloat16(2) + bfloat16(2)), 4.f);
VERIFY_IS_EQUAL(static_cast<float>(bfloat16(2) + bfloat16(-2)), 0); VERIFY_IS_EQUAL(static_cast<float>(bfloat16(2) + bfloat16(-2)), 0.f);
VERIFY_IS_APPROX(static_cast<float>(bfloat16(0.33333f) + bfloat16(0.66667f)), 1.0f); VERIFY_IS_APPROX(static_cast<float>(bfloat16(0.33333f) + bfloat16(0.66667f)), 1.0f);
VERIFY_IS_EQUAL(static_cast<float>(bfloat16(2.0f) * bfloat16(-5.5f)), -11.0f); VERIFY_IS_EQUAL(static_cast<float>(bfloat16(2.0f) * bfloat16(-5.5f)), -11.0f);
VERIFY_IS_APPROX(static_cast<float>(bfloat16(1.0f) / bfloat16(3.0f)), 0.3339f); VERIFY_IS_APPROX(static_cast<float>(bfloat16(1.0f) / bfloat16(3.0f)), 0.3339f);

View File

@ -22,7 +22,7 @@
// The following includes of STL headers have to be done _before_ the // The following includes of STL headers have to be done _before_ the
// definition of macros min() and max(). The reason is that many STL // definition of macros min() and max(). The reason is that many STL
// implementations will not work properly as the min and max symbols collide // 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 // for the macro definition of min/max and issue a warning or undefine the
// macros. // macros.
// //
@ -420,7 +420,8 @@ template<> inline long double test_precision<std::complex<long double> >() { ret
inline bool test_isApprox(TYPE a, TYPE b) \ inline bool test_isApprox(TYPE a, TYPE b) \
{ return internal::isApprox(a, b, test_precision<TYPE>()); } \ { return internal::isApprox(a, b, test_precision<TYPE>()); } \
inline bool test_isCwiseApprox(TYPE a, TYPE b, bool exact) \ 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<TYPE>())); } \ (!exact && internal::isApprox(a, b, test_precision<TYPE>())); } \
inline bool test_isMuchSmallerThan(TYPE a, TYPE b) \ inline bool test_isMuchSmallerThan(TYPE a, TYPE b) \
{ return internal::isMuchSmallerThan(a, b, test_precision<TYPE>()); } \ { return internal::isMuchSmallerThan(a, b, test_precision<TYPE>()); } \
@ -664,7 +665,7 @@ bool test_isCwiseApprox(const DenseBase<Derived1>& m1,
template<typename T, typename U> template<typename T, typename U>
bool test_is_equal(const T& actual, const U& expected, bool expect_equal) 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; return true;
// false: // false:
std::cerr std::cerr

View File

@ -62,9 +62,9 @@ EIGEN_DECLARE_TEST(rand)
for(int i = 0; i < g_repeat*10000; i++) { for(int i = 0; i < g_repeat*10000; i++) {
CALL_SUBTEST(check_in_range<float>(10,11)); CALL_SUBTEST(check_in_range<float>(10,11));
CALL_SUBTEST(check_in_range<float>(1.24234523,1.24234523)); CALL_SUBTEST(check_in_range<float>(1.24234523f,1.24234523f));
CALL_SUBTEST(check_in_range<float>(-1,1)); CALL_SUBTEST(check_in_range<float>(-1,1));
CALL_SUBTEST(check_in_range<float>(-1432.2352,-1432.2352)); CALL_SUBTEST(check_in_range<float>(-1432.2352f,-1432.2352f));
CALL_SUBTEST(check_in_range<double>(10,11)); CALL_SUBTEST(check_in_range<double>(10,11));
CALL_SUBTEST(check_in_range<double>(1.24234523,1.24234523)); CALL_SUBTEST(check_in_range<double>(1.24234523,1.24234523));