diff options
author | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2014-09-23 14:28:23 +0200 |
---|---|---|
committer | Christoph Hertzberg <chtz@informatik.uni-bremen.de> | 2014-09-23 14:28:23 +0200 |
commit | 36448c9e287935b8c408791bf88b2907292d6c80 (patch) | |
tree | 841afdf4ea165433ad3b0f797498441815344eeb /Eigen/src/SparseCholesky | |
parent | de0d8a010e8cee66901786e0e2819beeaa5cb253 (diff) |
Make constructors explicit if they could lead to unintended implicit conversion
Diffstat (limited to 'Eigen/src/SparseCholesky')
-rw-r--r-- | Eigen/src/SparseCholesky/SimplicialCholesky.h | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Eigen/src/SparseCholesky/SimplicialCholesky.h b/Eigen/src/SparseCholesky/SimplicialCholesky.h index 3c8cef5db..0e8fa6628 100644 --- a/Eigen/src/SparseCholesky/SimplicialCholesky.h +++ b/Eigen/src/SparseCholesky/SimplicialCholesky.h @@ -57,7 +57,7 @@ class SimplicialCholeskyBase : public SparseSolverBase<Derived> : m_info(Success), m_shiftOffset(0), m_shiftScale(1) {} - SimplicialCholeskyBase(const MatrixType& matrix) + explicit SimplicialCholeskyBase(const MatrixType& matrix) : m_info(Success), m_shiftOffset(0), m_shiftScale(1) { derived().compute(matrix); @@ -239,8 +239,8 @@ template<typename _MatrixType, int _UpLo, typename _Ordering> struct traits<Simp typedef SparseMatrix<Scalar, ColMajor, Index> CholMatrixType; typedef TriangularView<CholMatrixType, Eigen::Lower> MatrixL; typedef TriangularView<typename CholMatrixType::AdjointReturnType, Eigen::Upper> MatrixU; - static inline MatrixL getL(const MatrixType& m) { return m; } - static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); } + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } }; template<typename _MatrixType,int _UpLo, typename _Ordering> struct traits<SimplicialLDLT<_MatrixType,_UpLo,_Ordering> > @@ -253,8 +253,8 @@ template<typename _MatrixType,int _UpLo, typename _Ordering> struct traits<Simpl typedef SparseMatrix<Scalar, ColMajor, Index> CholMatrixType; typedef TriangularView<CholMatrixType, Eigen::UnitLower> MatrixL; typedef TriangularView<typename CholMatrixType::AdjointReturnType, Eigen::UnitUpper> MatrixU; - static inline MatrixL getL(const MatrixType& m) { return m; } - static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); } + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } }; template<typename _MatrixType, int _UpLo, typename _Ordering> struct traits<SimplicialCholesky<_MatrixType,_UpLo,_Ordering> > @@ -303,7 +303,7 @@ public: /** Default constructor */ SimplicialLLT() : Base() {} /** Constructs and performs the LLT factorization of \a matrix */ - SimplicialLLT(const MatrixType& matrix) + explicit SimplicialLLT(const MatrixType& matrix) : Base(matrix) {} /** \returns an expression of the factor L */ @@ -393,7 +393,7 @@ public: SimplicialLDLT() : Base() {} /** Constructs and performs the LLT factorization of \a matrix */ - SimplicialLDLT(const MatrixType& matrix) + explicit SimplicialLDLT(const MatrixType& matrix) : Base(matrix) {} /** \returns a vector expression of the diagonal D */ @@ -473,7 +473,7 @@ public: public: SimplicialCholesky() : Base(), m_LDLT(true) {} - SimplicialCholesky(const MatrixType& matrix) + explicit SimplicialCholesky(const MatrixType& matrix) : Base(), m_LDLT(true) { compute(matrix); |