Fix compiler warnings from GCC 13 and Clang 18

libeigen/eigen!2146

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-02-17 10:09:39 -08:00
parent 113207a9de
commit b6b2f31ba8
4 changed files with 28 additions and 18 deletions

View File

@@ -84,7 +84,13 @@ class LDLT : public SolverBase<LDLT<MatrixType_, UpLo_> > {
* The default constructor is useful in cases in which the user intends to
* perform decompositions via LDLT::compute(const MatrixType&).
*/
LDLT() : m_matrix(), m_transpositions(), m_sign(internal::ZeroSign), m_isInitialized(false) {}
LDLT()
: m_matrix(),
m_l1_norm(0),
m_transpositions(),
m_sign(internal::ZeroSign),
m_isInitialized(false),
m_info(InvalidInput) {}
/** \brief Default Constructor with memory preallocation
*
@@ -94,10 +100,12 @@ class LDLT : public SolverBase<LDLT<MatrixType_, UpLo_> > {
*/
explicit LDLT(Index size)
: m_matrix(size, size),
m_l1_norm(0),
m_transpositions(size),
m_temporary(size),
m_sign(internal::ZeroSign),
m_isInitialized(false) {}
m_isInitialized(false),
m_info(InvalidInput) {}
/** \brief Constructor with decomposition
*
@@ -108,10 +116,12 @@ class LDLT : public SolverBase<LDLT<MatrixType_, UpLo_> > {
template <typename InputType>
explicit LDLT(const EigenBase<InputType>& matrix)
: m_matrix(matrix.rows(), matrix.cols()),
m_l1_norm(0),
m_transpositions(matrix.rows()),
m_temporary(matrix.rows()),
m_sign(internal::ZeroSign),
m_isInitialized(false) {
m_isInitialized(false),
m_info(InvalidInput) {
compute(matrix.derived());
}
@@ -125,10 +135,12 @@ class LDLT : public SolverBase<LDLT<MatrixType_, UpLo_> > {
template <typename InputType>
explicit LDLT(EigenBase<InputType>& matrix)
: m_matrix(matrix.derived()),
m_l1_norm(0),
m_transpositions(matrix.rows()),
m_temporary(matrix.rows()),
m_sign(internal::ZeroSign),
m_isInitialized(false) {
m_isInitialized(false),
m_info(InvalidInput) {
compute(matrix.derived());
}

View File

@@ -86,7 +86,7 @@ class LLT : public SolverBase<LLT<MatrixType_, UpLo_> > {
* The default constructor is useful in cases in which the user intends to
* perform decompositions via LLT::compute(const MatrixType&).
*/
LLT() : m_matrix(), m_isInitialized(false) {}
LLT() : m_matrix(), m_l1_norm(0), m_isInitialized(false), m_info(InvalidInput) {}
/** \brief Default Constructor with memory preallocation
*
@@ -94,10 +94,11 @@ class LLT : public SolverBase<LLT<MatrixType_, UpLo_> > {
* according to the specified problem \a size.
* \sa LLT()
*/
explicit LLT(Index size) : m_matrix(size, size), m_isInitialized(false) {}
explicit LLT(Index size) : m_matrix(size, size), m_l1_norm(0), m_isInitialized(false), m_info(InvalidInput) {}
template <typename InputType>
explicit LLT(const EigenBase<InputType>& matrix) : m_matrix(matrix.rows(), matrix.cols()), m_isInitialized(false) {
explicit LLT(const EigenBase<InputType>& matrix)
: m_matrix(matrix.rows(), matrix.cols()), m_l1_norm(0), m_isInitialized(false), m_info(InvalidInput) {
compute(matrix.derived());
}
@@ -109,7 +110,8 @@ class LLT : public SolverBase<LLT<MatrixType_, UpLo_> > {
* \sa LLT(const EigenBase&)
*/
template <typename InputType>
explicit LLT(EigenBase<InputType>& matrix) : m_matrix(matrix.derived()), m_isInitialized(false) {
explicit LLT(EigenBase<InputType>& matrix)
: m_matrix(matrix.derived()), m_l1_norm(0), m_isInitialized(false), m_info(InvalidInput) {
compute(matrix.derived());
}

View File

@@ -73,12 +73,12 @@ void array_for_matrix(const MatrixType& m) {
VERIFY_IS_EQUAL(m1.block(0, 0, rows, 0).rowwise().prod(), ColVectorType::Ones(rows));
// verify the const accessors exist
const Scalar& ref_m1 = m.matrix().array().coeffRef(0);
const Scalar& ref_m2 = m.matrix().array().coeffRef(0, 0);
const Scalar& ref_a1 = m.array().matrix().coeffRef(0);
const Scalar& ref_a2 = m.array().matrix().coeffRef(0, 0);
VERIFY(&ref_a1 == &ref_m1);
VERIFY(&ref_a2 == &ref_m2);
const Scalar* ptr_m1 = &m.matrix().array().coeffRef(0);
const Scalar* ptr_m2 = &m.matrix().array().coeffRef(0, 0);
const Scalar* ptr_a1 = &m.array().matrix().coeffRef(0);
const Scalar* ptr_a2 = &m.array().matrix().coeffRef(0, 0);
VERIFY(ptr_a1 == ptr_m1);
VERIFY(ptr_a2 == ptr_m2);
// Check write accessors:
m1.array().coeffRef(0, 0) = 1;

View File

@@ -1687,10 +1687,6 @@ void packetmath_complex() {
CHECK_CWISE1_N(std::log, internal::plog, size);
// Test misc. corner cases.
const RealScalar zero = RealScalar(0);
const RealScalar one = RealScalar(1);
const RealScalar inf = std::numeric_limits<RealScalar>::infinity();
const RealScalar nan = std::numeric_limits<RealScalar>::quiet_NaN();
for (RealScalar x : {zero, one, inf}) {
for (RealScalar y : {zero, one, inf}) {
data1[0] = Scalar(x, y);