Fix several uninitialized member from ctor

This commit is contained in:
Gael Guennebaud 2018-11-23 15:10:28 +01:00
parent a476054879
commit a7842daef2
9 changed files with 57 additions and 16 deletions

View File

@ -110,7 +110,7 @@ template<typename _MatrixType> class EigenSolver
* *
* \sa compute() for an example. * \sa compute() for an example.
*/ */
EigenSolver() : m_eivec(), m_eivalues(), m_isInitialized(false), m_realSchur(), m_matT(), m_tmp() {} EigenSolver() : m_eivec(), m_eivalues(), m_isInitialized(false), m_eigenvectorsOk(false), m_realSchur(), m_matT(), m_tmp() {}
/** \brief Default constructor with memory preallocation /** \brief Default constructor with memory preallocation
* *

View File

@ -90,8 +90,9 @@ namespace Eigen {
m_Z(size, size), m_Z(size, size),
m_workspace(size*2), m_workspace(size*2),
m_maxIters(400), m_maxIters(400),
m_isInitialized(false) m_isInitialized(false),
{ } m_computeQZ(true)
{}
/** \brief Constructor; computes real QZ decomposition of given matrices /** \brief Constructor; computes real QZ decomposition of given matrices
* *
@ -108,9 +109,11 @@ namespace Eigen {
m_Z(A.rows(),A.cols()), m_Z(A.rows(),A.cols()),
m_workspace(A.rows()*2), m_workspace(A.rows()*2),
m_maxIters(400), m_maxIters(400),
m_isInitialized(false) { m_isInitialized(false),
compute(A, B, computeQZ); m_computeQZ(true)
} {
compute(A, B, computeQZ);
}
/** \brief Returns matrix Q in the QZ decomposition. /** \brief Returns matrix Q in the QZ decomposition.
* *

View File

@ -122,7 +122,8 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
m_eivalues(), m_eivalues(),
m_subdiag(), m_subdiag(),
m_info(InvalidInput), m_info(InvalidInput),
m_isInitialized(false) m_isInitialized(false),
m_eigenvectorsOk(false)
{ } { }
/** \brief Constructor, pre-allocates memory for dynamic-size matrices. /** \brief Constructor, pre-allocates memory for dynamic-size matrices.
@ -142,7 +143,8 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
: m_eivec(size, size), : m_eivec(size, size),
m_eivalues(size), m_eivalues(size),
m_subdiag(size > 1 ? size - 1 : 1), m_subdiag(size > 1 ? size - 1 : 1),
m_isInitialized(false) m_isInitialized(false),
m_eigenvectorsOk(false)
{} {}
/** \brief Constructor; computes eigendecomposition of given matrix. /** \brief Constructor; computes eigendecomposition of given matrix.
@ -166,7 +168,8 @@ template<typename _MatrixType> class SelfAdjointEigenSolver
: m_eivec(matrix.rows(), matrix.cols()), : m_eivec(matrix.rows(), matrix.cols()),
m_eivalues(matrix.cols()), m_eivalues(matrix.cols()),
m_subdiag(matrix.rows() > 1 ? matrix.rows() - 1 : 1), m_subdiag(matrix.rows() > 1 ? matrix.rows() - 1 : 1),
m_isInitialized(false) m_isInitialized(false),
m_eigenvectorsOk(false)
{ {
compute(matrix.derived(), options); compute(matrix.derived(), options);
} }

View File

@ -76,12 +76,12 @@ class IncompleteCholesky : public SparseSolverBase<IncompleteCholesky<Scalar,_Up
* *
* \sa IncompleteCholesky(const MatrixType&) * \sa IncompleteCholesky(const MatrixType&)
*/ */
IncompleteCholesky() : m_initialShift(1e-3),m_factorizationIsOk(false) {} IncompleteCholesky() : m_initialShift(1e-3),m_analysisIsOk(false),m_factorizationIsOk(false) {}
/** Constructor computing the incomplete factorization for the given matrix \a matrix. /** Constructor computing the incomplete factorization for the given matrix \a matrix.
*/ */
template<typename MatrixType> template<typename MatrixType>
IncompleteCholesky(const MatrixType& matrix) : m_initialShift(1e-3),m_factorizationIsOk(false) IncompleteCholesky(const MatrixType& matrix) : m_initialShift(1e-3),m_analysisIsOk(false),m_factorizationIsOk(false)
{ {
compute(matrix); compute(matrix);
} }

View File

@ -123,6 +123,7 @@ class PardisoImpl : public SparseSolverBase<Derived>
}; };
PardisoImpl() PardisoImpl()
: m_analysisIsOk(false), m_factorizationIsOk(false), m_pt(0)
{ {
eigen_assert((sizeof(StorageIndex) >= sizeof(_INTEGER_t) && sizeof(StorageIndex) <= 8) && "Non-supported index type"); eigen_assert((sizeof(StorageIndex) >= sizeof(_INTEGER_t) && sizeof(StorageIndex) <= 8) && "Non-supported index type");
m_iparm.setZero(); m_iparm.setZero();

View File

@ -74,13 +74,35 @@ class SPQR : public SparseSolverBase<SPQR<_MatrixType> >
}; };
public: public:
SPQR() SPQR()
: m_ordering(SPQR_ORDERING_DEFAULT), m_allow_tol(SPQR_DEFAULT_TOL), m_tolerance (NumTraits<Scalar>::epsilon()), m_useDefaultThreshold(true) : m_analysisIsOk(false),
m_factorizationIsOk(false),
m_isRUpToDate(false),
m_ordering(SPQR_ORDERING_DEFAULT),
m_allow_tol(SPQR_DEFAULT_TOL),
m_tolerance (NumTraits<Scalar>::epsilon()),
m_cR(0),
m_E(0),
m_H(0),
m_HPinv(0),
m_HTau(0),
m_useDefaultThreshold(true)
{ {
cholmod_l_start(&m_cc); cholmod_l_start(&m_cc);
} }
explicit SPQR(const _MatrixType& matrix) explicit SPQR(const _MatrixType& matrix)
: m_ordering(SPQR_ORDERING_DEFAULT), m_allow_tol(SPQR_DEFAULT_TOL), m_tolerance (NumTraits<Scalar>::epsilon()), m_useDefaultThreshold(true) : m_analysisIsOk(false),
m_factorizationIsOk(false),
m_isRUpToDate(false),
m_ordering(SPQR_ORDERING_DEFAULT),
m_allow_tol(SPQR_DEFAULT_TOL),
m_tolerance (NumTraits<Scalar>::epsilon()),
m_cR(0),
m_E(0),
m_H(0),
m_HPinv(0),
m_HTau(0),
m_useDefaultThreshold(true)
{ {
cholmod_l_start(&m_cc); cholmod_l_start(&m_cc);
compute(matrix); compute(matrix);

View File

@ -110,7 +110,7 @@ public:
* The default constructor is useful in cases in which the user intends to * The default constructor is useful in cases in which the user intends to
* perform decompositions via BDCSVD::compute(const MatrixType&). * perform decompositions via BDCSVD::compute(const MatrixType&).
*/ */
BDCSVD() : m_algoswap(16), m_numIters(0) BDCSVD() : m_algoswap(16), m_isTranspose(false), m_compU(false), m_compV(false), m_numIters(0)
{} {}

View File

@ -245,6 +245,10 @@ protected:
: m_isInitialized(false), : m_isInitialized(false),
m_isAllocated(false), m_isAllocated(false),
m_usePrescribedThreshold(false), m_usePrescribedThreshold(false),
m_computeFullU(false),
m_computeThinU(false),
m_computeFullV(false),
m_computeThinV(false),
m_computationOptions(0), m_computationOptions(0),
m_rows(-1), m_cols(-1), m_diagSize(0) m_rows(-1), m_cols(-1), m_diagSize(0)
{ {

View File

@ -80,11 +80,19 @@ class SimplicialCholeskyBase : public SparseSolverBase<Derived>
/** Default constructor */ /** Default constructor */
SimplicialCholeskyBase() SimplicialCholeskyBase()
: m_info(Success), m_shiftOffset(0), m_shiftScale(1) : m_info(Success),
m_factorizationIsOk(false),
m_analysisIsOk(false),
m_shiftOffset(0),
m_shiftScale(1)
{} {}
explicit SimplicialCholeskyBase(const MatrixType& matrix) explicit SimplicialCholeskyBase(const MatrixType& matrix)
: m_info(Success), m_shiftOffset(0), m_shiftScale(1) : m_info(Success),
m_factorizationIsOk(false),
m_analysisIsOk(false),
m_shiftOffset(0),
m_shiftScale(1)
{ {
derived().compute(matrix); derived().compute(matrix);
} }