From ffee27bf7266998d962aff110614119f8e76121b Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Wed, 14 Oct 2009 08:33:36 +0200 Subject: [PATCH] Fixed uninitialized variables in unit tests. Fixed /W4 warning C4512 (LU was left out on purpose). --- Eigen/src/Array/Functors.h | 4 ++++ Eigen/src/Array/PartialRedux.h | 5 +++++ Eigen/src/Core/CommaInitializer.h | 3 +++ Eigen/src/Core/Cwise.h | 3 +++ Eigen/src/Core/Flagged.h | 3 +++ Eigen/src/Core/Functors.h | 10 ++++++++++ Eigen/src/Core/NestByValue.h | 3 +++ Eigen/src/Core/Part.h | 4 +++- Eigen/src/Core/Swap.h | 3 +++ Eigen/src/Sparse/AmbiVector.h | 3 +++ Eigen/src/Sparse/DynamicSparseMatrix.h | 4 +++- Eigen/src/Sparse/SparseBlock.h | 5 +++++ Eigen/src/Sparse/SparseCwise.h | 3 +++ Eigen/src/Sparse/SparseCwiseBinaryOp.h | 11 +++++++++++ Eigen/src/Sparse/SparseCwiseUnaryOp.h | 3 +++ Eigen/src/Sparse/SparseDiagonalProduct.h | 2 ++ Eigen/src/Sparse/SparseFlagged.h | 7 ++++++- Eigen/src/Sparse/SparseMatrix.h | 3 +++ Eigen/src/Sparse/SparseTranspose.h | 7 ++++++- Eigen/src/Sparse/SparseVector.h | 3 +++ test/visitor.cpp | 4 ++-- 21 files changed, 87 insertions(+), 6 deletions(-) diff --git a/Eigen/src/Array/Functors.h b/Eigen/src/Array/Functors.h index 0aae7fd2c..c2c325a78 100644 --- a/Eigen/src/Array/Functors.h +++ b/Eigen/src/Array/Functors.h @@ -43,6 +43,8 @@ struct ei_scalar_add_op { inline const PacketScalar packetOp(const PacketScalar& a) const { return ei_padd(a, ei_pset1(m_other)); } const Scalar m_other; +private: + ei_scalar_add_op& operator=(const ei_scalar_add_op&); }; template struct ei_functor_traits > @@ -138,6 +140,8 @@ struct ei_scalar_pow_op { inline ei_scalar_pow_op(const Scalar& exponent) : m_exponent(exponent) {} inline Scalar operator() (const Scalar& a) const { return ei_pow(a, m_exponent); } const Scalar m_exponent; +private: + ei_scalar_pow_op& operator=(const ei_scalar_pow_op&); }; template struct ei_functor_traits > diff --git a/Eigen/src/Array/PartialRedux.h b/Eigen/src/Array/PartialRedux.h index b1e8fd4ba..3a052ca8a 100644 --- a/Eigen/src/Array/PartialRedux.h +++ b/Eigen/src/Array/PartialRedux.h @@ -133,6 +133,8 @@ struct ei_member_redux { inline result_type operator()(const MatrixBase& mat) const { return mat.redux(m_functor); } const BinaryOp m_functor; +private: + ei_member_redux& operator=(const ei_member_redux&); }; /** \array_module \ingroup Array @@ -290,6 +292,9 @@ template class PartialRedux protected: ExpressionTypeNested m_matrix; + + private: + PartialRedux& operator=(const PartialRedux&); }; /** \array_module diff --git a/Eigen/src/Core/CommaInitializer.h b/Eigen/src/Core/CommaInitializer.h index ed28e0ca3..f66cbd6d5 100644 --- a/Eigen/src/Core/CommaInitializer.h +++ b/Eigen/src/Core/CommaInitializer.h @@ -116,6 +116,9 @@ struct CommaInitializer int m_row; // current row id int m_col; // current col id int m_currentBlockRows; // current block height + +private: + CommaInitializer& operator=(const CommaInitializer&); }; /** \anchor MatrixBaseCommaInitRef diff --git a/Eigen/src/Core/Cwise.h b/Eigen/src/Core/Cwise.h index 0e92dce4e..4dc9d514b 100644 --- a/Eigen/src/Core/Cwise.h +++ b/Eigen/src/Core/Cwise.h @@ -178,6 +178,9 @@ template class Cwise protected: ExpressionTypeNested m_matrix; + + private: + Cwise& operator=(const Cwise&); }; /** \returns a Cwise wrapper of *this providing additional coefficient-wise operations diff --git a/Eigen/src/Core/Flagged.h b/Eigen/src/Core/Flagged.h index ce50246cb..e3d25341d 100644 --- a/Eigen/src/Core/Flagged.h +++ b/Eigen/src/Core/Flagged.h @@ -109,6 +109,9 @@ template clas protected: ExpressionTypeNested m_matrix; + +private: + Flagged& operator=(const Flagged&); }; /** \returns an expression of *this with added flags diff --git a/Eigen/src/Core/Functors.h b/Eigen/src/Core/Functors.h index c8ca3dac1..969cad78d 100644 --- a/Eigen/src/Core/Functors.h +++ b/Eigen/src/Core/Functors.h @@ -279,6 +279,8 @@ struct ei_scalar_multiple_op { EIGEN_STRONG_INLINE const PacketScalar packetOp(const PacketScalar& a) const { return ei_pmul(a, ei_pset1(m_other)); } const Scalar m_other; +private: + ei_scalar_multiple_op& operator=(const ei_scalar_multiple_op&); }; template struct ei_functor_traits > @@ -294,6 +296,8 @@ struct ei_scalar_quotient1_impl { EIGEN_STRONG_INLINE const PacketScalar packetOp(const PacketScalar& a) const { return ei_pmul(a, ei_pset1(m_other)); } const Scalar m_other; +private: + ei_scalar_quotient1_impl& operator=(const ei_scalar_quotient1_impl&); }; template struct ei_functor_traits > @@ -306,6 +310,8 @@ struct ei_scalar_quotient1_impl { EIGEN_STRONG_INLINE ei_scalar_quotient1_impl(const Scalar& other) : m_other(other) {} EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a / m_other; } const Scalar m_other; +private: + ei_scalar_quotient1_impl& operator=(const ei_scalar_quotient1_impl&); }; template struct ei_functor_traits > @@ -323,6 +329,8 @@ template struct ei_scalar_quotient1_op : ei_scalar_quotient1_impl::HasFloatingPoint > { EIGEN_STRONG_INLINE ei_scalar_quotient1_op(const Scalar& other) : ei_scalar_quotient1_impl::HasFloatingPoint >(other) {} +private: + ei_scalar_quotient1_op& operator=(const ei_scalar_quotient1_op&); }; // nullary functors @@ -335,6 +343,8 @@ struct ei_scalar_constant_op { EIGEN_STRONG_INLINE const Scalar operator() (int, int = 0) const { return m_other; } EIGEN_STRONG_INLINE const PacketScalar packetOp() const { return ei_pset1(m_other); } const Scalar m_other; +private: + ei_scalar_constant_op& operator=(const ei_scalar_constant_op&); }; template struct ei_functor_traits > diff --git a/Eigen/src/Core/NestByValue.h b/Eigen/src/Core/NestByValue.h index da79315bf..2a14ab1f1 100644 --- a/Eigen/src/Core/NestByValue.h +++ b/Eigen/src/Core/NestByValue.h @@ -100,6 +100,9 @@ template class NestByValue protected: const ExpressionType m_expression; + + private: + NestByValue& operator=(const NestByValue&); }; /** \returns an expression of the temporary version of *this. diff --git a/Eigen/src/Core/Part.h b/Eigen/src/Core/Part.h index 9c273f249..96229f43b 100644 --- a/Eigen/src/Core/Part.h +++ b/Eigen/src/Core/Part.h @@ -124,8 +124,10 @@ template class Part } protected: - const typename MatrixType::Nested m_matrix; + + private: + Part& operator=(const Part&); }; /** \nonstableyet diff --git a/Eigen/src/Core/Swap.h b/Eigen/src/Core/Swap.h index 77d562cd3..9aaac652f 100644 --- a/Eigen/src/Core/Swap.h +++ b/Eigen/src/Core/Swap.h @@ -117,6 +117,9 @@ template class SwapWrapper protected: ExpressionType& m_expression; + + private: + SwapWrapper& operator=(const SwapWrapper&); }; /** swaps *this with the expression \a other. diff --git a/Eigen/src/Sparse/AmbiVector.h b/Eigen/src/Sparse/AmbiVector.h index 220995c25..f279e80f0 100644 --- a/Eigen/src/Sparse/AmbiVector.h +++ b/Eigen/src/Sparse/AmbiVector.h @@ -370,6 +370,9 @@ class AmbiVector<_Scalar>::Iterator int m_cachedIndex; // current coordinate Scalar m_cachedValue; // current value bool m_isDense; // mode of the vector + + private: + Iterator& operator=(const Iterator&); }; diff --git a/Eigen/src/Sparse/DynamicSparseMatrix.h b/Eigen/src/Sparse/DynamicSparseMatrix.h index 7119a84bd..01f97cd6d 100644 --- a/Eigen/src/Sparse/DynamicSparseMatrix.h +++ b/Eigen/src/Sparse/DynamicSparseMatrix.h @@ -289,9 +289,11 @@ class DynamicSparseMatrix::InnerIterator : public SparseVector, Size> inline InnerIterator(const SparseInnerVectorSet& xpr, int outer) : MatrixType::InnerIterator(xpr.m_matrix, xpr.m_outerStart + outer) {} + private: + InnerIterator& operator=(const InnerIterator&); }; inline SparseInnerVectorSet(const MatrixType& matrix, int outerStart, int outerSize) diff --git a/Eigen/src/Sparse/SparseCwise.h b/Eigen/src/Sparse/SparseCwise.h index 2206883cc..ac285ec1a 100644 --- a/Eigen/src/Sparse/SparseCwise.h +++ b/Eigen/src/Sparse/SparseCwise.h @@ -156,6 +156,9 @@ template class SparseCwise protected: ExpressionTypeNested m_matrix; + + private: + SparseCwise& operator=(const SparseCwise&); }; template diff --git a/Eigen/src/Sparse/SparseCwiseBinaryOp.h b/Eigen/src/Sparse/SparseCwiseBinaryOp.h index d19970efc..da9746e20 100644 --- a/Eigen/src/Sparse/SparseCwiseBinaryOp.h +++ b/Eigen/src/Sparse/SparseCwiseBinaryOp.h @@ -126,6 +126,8 @@ class SparseCwiseBinaryOp::InnerIterator EIGEN_STRONG_INLINE InnerIterator(const SparseCwiseBinaryOp& binOp, int outer) : Base(binOp,outer) {} + private: + InnerIterator& operator=(const InnerIterator&); }; /*************************************************************************** @@ -197,6 +199,9 @@ class ei_sparse_cwise_binary_op_inner_iterator_selector, LhsIterator m_lhsIter; RhsIterator m_rhsIter; const BinaryFunc& m_functor; + + private: + ei_sparse_cwise_binary_op_inner_iterator_selector& operator=(const ei_sparse_cwise_binary_op_inner_iterator_selector&); }; // sparse - dense (product) @@ -290,6 +298,9 @@ class ei_sparse_cwise_binary_op_inner_iterator_selector, LhsIterator m_lhsIter; const BinaryFunc m_functor; const int m_outer; + + private: + ei_sparse_cwise_binary_op_inner_iterator_selector& operator=(const ei_sparse_cwise_binary_op_inner_iterator_selector&); }; // sparse - dense (product) diff --git a/Eigen/src/Sparse/SparseCwiseUnaryOp.h b/Eigen/src/Sparse/SparseCwiseUnaryOp.h index b11c0f8a3..2ed7a1557 100644 --- a/Eigen/src/Sparse/SparseCwiseUnaryOp.h +++ b/Eigen/src/Sparse/SparseCwiseUnaryOp.h @@ -90,6 +90,9 @@ class SparseCwiseUnaryOp::InnerIterator protected: MatrixTypeIterator m_iter; const UnaryOp m_functor; + + private: + InnerIterator& operator=(const InnerIterator&); }; template diff --git a/Eigen/src/Sparse/SparseDiagonalProduct.h b/Eigen/src/Sparse/SparseDiagonalProduct.h index 932daf220..9b7432a82 100644 --- a/Eigen/src/Sparse/SparseDiagonalProduct.h +++ b/Eigen/src/Sparse/SparseDiagonalProduct.h @@ -120,6 +120,8 @@ class ei_sparse_diagonal_product_inner_iterator_selector const SparseDiagonalProductType& expr, int outer) : Base(expr.rhs().innerVector(outer) .cwise()* expr.lhs().diagonal(), 0) {} + private: + ei_sparse_diagonal_product_inner_iterator_selector& operator=(const ei_sparse_diagonal_product_inner_iterator_selector&); }; template diff --git a/Eigen/src/Sparse/SparseFlagged.h b/Eigen/src/Sparse/SparseFlagged.h index c47e162f5..315ec4af3 100644 --- a/Eigen/src/Sparse/SparseFlagged.h +++ b/Eigen/src/Sparse/SparseFlagged.h @@ -64,16 +64,21 @@ template clas protected: ExpressionTypeNested m_matrix; + + private: + SparseFlagged& operator=(const SparseFlagged&); }; template class SparseFlagged::InnerIterator : public ExpressionType::InnerIterator { public: - EIGEN_STRONG_INLINE InnerIterator(const SparseFlagged& xpr, int outer) : ExpressionType::InnerIterator(xpr.m_matrix, outer) {} + + private: + InnerIterator& operator=(const InnerIterator&); }; template diff --git a/Eigen/src/Sparse/SparseMatrix.h b/Eigen/src/Sparse/SparseMatrix.h index 56ea65888..86b35d4af 100644 --- a/Eigen/src/Sparse/SparseMatrix.h +++ b/Eigen/src/Sparse/SparseMatrix.h @@ -444,6 +444,9 @@ class SparseMatrix::InnerIterator int m_id; const int m_start; const int m_end; + + private: + InnerIterator& operator=(const InnerIterator&); }; #endif // EIGEN_SPARSEMATRIX_H diff --git a/Eigen/src/Sparse/SparseTranspose.h b/Eigen/src/Sparse/SparseTranspose.h index 89a14d707..7386294e4 100644 --- a/Eigen/src/Sparse/SparseTranspose.h +++ b/Eigen/src/Sparse/SparseTranspose.h @@ -62,15 +62,20 @@ template class SparseTranspose protected: const typename MatrixType::Nested m_matrix; + + private: + SparseTranspose& operator=(const SparseTranspose&); }; template class SparseTranspose::InnerIterator : public MatrixType::InnerIterator { public: - EIGEN_STRONG_INLINE InnerIterator(const SparseTranspose& trans, int outer) : MatrixType::InnerIterator(trans.m_matrix, outer) {} + + private: + InnerIterator& operator=(const InnerIterator&); }; template class SparseTranspose::ReverseInnerIterator : public MatrixType::ReverseInnerIterator diff --git a/Eigen/src/Sparse/SparseVector.h b/Eigen/src/Sparse/SparseVector.h index 8e5a6efed..5d47209f7 100644 --- a/Eigen/src/Sparse/SparseVector.h +++ b/Eigen/src/Sparse/SparseVector.h @@ -360,6 +360,9 @@ class SparseVector::InnerIterator const CompressedStorage& m_data; int m_id; const int m_end; + + private: + InnerIterator& operator=(const InnerIterator&); }; #endif // EIGEN_SPARSEVECTOR_H diff --git a/test/visitor.cpp b/test/visitor.cpp index b78782b78..6ec442bc8 100644 --- a/test/visitor.cpp +++ b/test/visitor.cpp @@ -40,7 +40,7 @@ template void matrixVisitor(const MatrixType& p) m(i) = ei_random(); Scalar minc = Scalar(1000), maxc = Scalar(-1000); - int minrow,mincol,maxrow,maxcol; + int minrow=0,mincol=0,maxrow=0,maxcol=0; for(int j = 0; j < cols; j++) for(int i = 0; i < rows; i++) { @@ -86,7 +86,7 @@ template void vectorVisitor(const VectorType& w) v(i) = ei_random(); Scalar minc = Scalar(1000), maxc = Scalar(-1000); - int minidx,maxidx; + int minidx=0,maxidx=0; for(int i = 0; i < size; i++) { if(v(i) < minc)