From 2bf354da80d15a7a1e7ad9f58f375a21c6e721aa Mon Sep 17 00:00:00 2001 From: Hauke Heibel Date: Tue, 1 Dec 2009 11:51:22 +0100 Subject: [PATCH] Much more NestByValue cleanup. --- Eigen/src/Array/VectorwiseOp.h | 4 ++-- Eigen/src/Core/BandMatrix.h | 2 +- Eigen/src/Core/Cwise.h | 2 +- Eigen/src/Core/MatrixBase.h | 10 +++++----- Eigen/src/Core/Transpose.h | 14 +++++++------- Eigen/src/Core/TriangularMatrix.h | 16 ++++++++-------- Eigen/src/Geometry/Homogeneous.h | 11 +++++------ Eigen/src/Geometry/Transform.h | 2 +- Eigen/src/Householder/HouseholderSequence.h | 2 +- Eigen/src/Sparse/SparseCwise.h | 2 +- blas/common.h | 8 ++++---- test/geo_quaternion.cpp | 2 +- 12 files changed, 37 insertions(+), 38 deletions(-) diff --git a/Eigen/src/Array/VectorwiseOp.h b/Eigen/src/Array/VectorwiseOp.h index 0a46f49fc..71b83eaad 100644 --- a/Eigen/src/Array/VectorwiseOp.h +++ b/Eigen/src/Array/VectorwiseOp.h @@ -440,7 +440,7 @@ template class VectorwiseOp operator+(const MatrixBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived); - return m_matrix + extendedTo(other).nestByValue(); + return m_matrix + extendedTo(other); } /** Returns the expression of the difference between each subvector of \c *this and the vector \a other */ @@ -451,7 +451,7 @@ template class VectorwiseOp operator-(const MatrixBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived); - return m_matrix - extendedTo(other).nestByValue(); + return m_matrix - extendedTo(other); } /////////// Geometry module /////////// diff --git a/Eigen/src/Core/BandMatrix.h b/Eigen/src/Core/BandMatrix.h index 85bd8dba7..7943e6280 100644 --- a/Eigen/src/Core/BandMatrix.h +++ b/Eigen/src/Core/BandMatrix.h @@ -141,7 +141,7 @@ class BandMatrix : public AnyMatrixBase BuildType; typedef typename ei_meta_if,NestByValue >, + CwiseUnaryOp,BuildType >, BuildType>::ret Type; }; diff --git a/Eigen/src/Core/Cwise.h b/Eigen/src/Core/Cwise.h index 4b143325e..80414782e 100644 --- a/Eigen/src/Core/Cwise.h +++ b/Eigen/src/Core/Cwise.h @@ -52,7 +52,7 @@ * convenient macro to defined the return type of a cwise comparison to a scalar */ #define EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(OP) \ CwiseBinaryOp::Scalar>, ExpressionType, \ - NestByValue > + typename ExpressionType::ConstantReturnType > /** \class Cwise * diff --git a/Eigen/src/Core/MatrixBase.h b/Eigen/src/Core/MatrixBase.h index 1cee31936..f1cf4ef90 100644 --- a/Eigen/src/Core/MatrixBase.h +++ b/Eigen/src/Core/MatrixBase.h @@ -248,7 +248,7 @@ template class MatrixBase typedef CwiseUnaryView, Derived> NonConstImagReturnType; /** \internal the return type of MatrixBase::adjoint() */ typedef typename ei_meta_if::IsComplex, - CwiseUnaryOp, NestByValue > >, + CwiseUnaryOp, Eigen::Transpose >, Transpose >::ret AdjointReturnType; /** \internal the return type of MatrixBase::eigenvalues() */ @@ -445,11 +445,11 @@ template class MatrixBase Derived& lazyAssign(const CwiseBinaryOp,DerivedA,Transpose >& other); template - Derived& lazyAssign(const CwiseUnaryOp, NestByValue > >& other); + Derived& lazyAssign(const CwiseUnaryOp, Eigen::Transpose >& other); template - Derived& lazyAssign(const CwiseBinaryOp,CwiseUnaryOp, NestByValue > >,DerivedB>& other); + Derived& lazyAssign(const CwiseBinaryOp,CwiseUnaryOp, Eigen::Transpose >,DerivedB>& other); template - Derived& lazyAssign(const CwiseBinaryOp,DerivedA,CwiseUnaryOp, NestByValue > > >& other); + Derived& lazyAssign(const CwiseBinaryOp,DerivedA,CwiseUnaryOp, Eigen::Transpose > >& other); #endif RowXpr row(int i); @@ -766,7 +766,7 @@ template class MatrixBase ei_traits::ColsAtCompileTime==1 ? SizeMinusOne : 1, ei_traits::ColsAtCompileTime==1 ? 1 : SizeMinusOne> StartMinusOne; typedef CwiseUnaryOp::Scalar>, - NestByValue > HNormalizedReturnType; + StartMinusOne > HNormalizedReturnType; const HNormalizedReturnType hnormalized() const; typedef Homogeneous::ColsAtCompileTime==1?Vertical:Horizontal> HomogeneousReturnType; diff --git a/Eigen/src/Core/Transpose.h b/Eigen/src/Core/Transpose.h index 990aa3807..79aef9fa7 100644 --- a/Eigen/src/Core/Transpose.h +++ b/Eigen/src/Core/Transpose.h @@ -186,7 +186,7 @@ template inline const typename MatrixBase::AdjointReturnType MatrixBase::adjoint() const { - return transpose().nestByValue(); + return transpose(); } /*************************************************************************** @@ -326,31 +326,31 @@ lazyAssign(const CwiseBinaryOp,DerivedA,Transpose template Derived& MatrixBase:: -lazyAssign(const CwiseUnaryOp, NestByValue > >& other) +lazyAssign(const CwiseUnaryOp, Eigen::Transpose >& other) { ei_assert(ei_extract_data(other) != ei_extract_data(derived()) && "aliasing detected during tranposition, please use adjointInPlace()"); - return lazyAssign(static_cast, NestByValue > > >& >(other)); + return lazyAssign(static_cast, Eigen::Transpose > >& >(other)); } template template Derived& MatrixBase:: -lazyAssign(const CwiseBinaryOp,CwiseUnaryOp, NestByValue > >,DerivedB>& other) +lazyAssign(const CwiseBinaryOp,CwiseUnaryOp, Eigen::Transpose >,DerivedB>& other) { ei_assert(ei_extract_data(derived()) != ei_extract_data(other.lhs()) && "aliasing detected during tranposition, please evaluate your expression"); - return lazyAssign(static_cast,CwiseUnaryOp, NestByValue > >,DerivedB> >& >(other)); + return lazyAssign(static_cast,CwiseUnaryOp, Eigen::Transpose >,DerivedB> >& >(other)); } template template Derived& MatrixBase:: -lazyAssign(const CwiseBinaryOp,DerivedA,CwiseUnaryOp, NestByValue > > >& other) +lazyAssign(const CwiseBinaryOp,DerivedA,CwiseUnaryOp, Eigen::Transpose > >& other) { ei_assert(ei_extract_data(derived()) != ei_extract_data(other.rhs()) && "aliasing detected during tranposition, please evaluate your expression"); - return lazyAssign(static_cast,DerivedA,CwiseUnaryOp, NestByValue > > > >& >(other)); + return lazyAssign(static_cast,DerivedA,CwiseUnaryOp, Eigen::Transpose > > >& >(other)); } #endif diff --git a/Eigen/src/Core/TriangularMatrix.h b/Eigen/src/Core/TriangularMatrix.h index e5d7367d8..aaf781d1f 100644 --- a/Eigen/src/Core/TriangularMatrix.h +++ b/Eigen/src/Core/TriangularMatrix.h @@ -222,18 +222,18 @@ template class TriangularView /** \sa MatrixBase::adjoint() */ - inline TriangularView,TransposeMode> adjoint() - { return m_matrix.adjoint().nestByValue(); } + inline TriangularView adjoint() + { return m_matrix.adjoint(); } /** \sa MatrixBase::adjoint() const */ - inline const TriangularView,TransposeMode> adjoint() const - { return m_matrix.adjoint().nestByValue(); } + inline const TriangularView adjoint() const + { return m_matrix.adjoint(); } /** \sa MatrixBase::transpose() */ - inline TriangularView >,TransposeMode> transpose() - { return m_matrix.transpose().nestByValue(); } + inline TriangularView,TransposeMode> transpose() + { return m_matrix.transpose(); } /** \sa MatrixBase::transpose() const */ - inline const TriangularView >,TransposeMode> transpose() const - { return m_matrix.transpose().nestByValue(); } + inline const TriangularView,TransposeMode> transpose() const + { return m_matrix.transpose(); } DenseMatrixType toDenseMatrix() const { diff --git a/Eigen/src/Geometry/Homogeneous.h b/Eigen/src/Geometry/Homogeneous.h index 035d213b7..ffa828f71 100644 --- a/Eigen/src/Geometry/Homogeneous.h +++ b/Eigen/src/Geometry/Homogeneous.h @@ -175,7 +175,7 @@ MatrixBase::hnormalized() const EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); return StartMinusOne(derived(),0,0, ColsAtCompileTime==1?size()-1:1, - ColsAtCompileTime==1?1:size()-1).nestByValue() / coeff(size()-1); + ColsAtCompileTime==1?1:size()-1) / coeff(size()-1); } /** \geometry_module @@ -192,18 +192,17 @@ VectorwiseOp::hnormalized() const { return HNormalized_Block(_expression(),0,0, Direction==Vertical ? _expression().rows()-1 : _expression().rows(), - Direction==Horizontal ? _expression().cols()-1 : _expression().cols()).nestByValue() - .cwise()/ - Replicate, + Direction==Horizontal ? _expression().cols()-1 : _expression().cols()).cwise()/ + Replicate (HNormalized_Factors(_expression(), Direction==Vertical ? _expression().rows()-1:0, Direction==Horizontal ? _expression().cols()-1:0, Direction==Vertical ? 1 : _expression().rows(), - Direction==Horizontal ? 1 : _expression().cols()).nestByValue(), + Direction==Horizontal ? 1 : _expression().cols()), Direction==Vertical ? _expression().rows()-1 : 1, - Direction==Horizontal ? _expression().cols()-1 : 1).nestByValue(); + Direction==Horizontal ? _expression().cols()-1 : 1); } template diff --git a/Eigen/src/Geometry/Transform.h b/Eigen/src/Geometry/Transform.h index d478675bd..363fa9dc4 100644 --- a/Eigen/src/Geometry/Transform.h +++ b/Eigen/src/Geometry/Transform.h @@ -187,7 +187,7 @@ public: /** type of read/write reference to the affine part of the transformation */ typedef typename ei_meta_if > >::ret AffinePartNested; + Block >::ret AffinePartNested; /** type of a vector */ typedef Matrix VectorType; /** type of a read/write reference to the translation part of the rotation */ diff --git a/Eigen/src/Householder/HouseholderSequence.h b/Eigen/src/Householder/HouseholderSequence.h index 85aa90362..afeb758b3 100644 --- a/Eigen/src/Householder/HouseholderSequence.h +++ b/Eigen/src/Householder/HouseholderSequence.h @@ -69,7 +69,7 @@ template class HouseholderSequence typedef HouseholderSequence::IsComplex, - NestByValue::type >, + typename ei_cleantype::type, CoeffsType>::ret> ConjugateReturnType; HouseholderSequence(const VectorsType& v, const CoeffsType& h, bool trans = false) diff --git a/Eigen/src/Sparse/SparseCwise.h b/Eigen/src/Sparse/SparseCwise.h index dd745fe7c..bf8f2355c 100644 --- a/Eigen/src/Sparse/SparseCwise.h +++ b/Eigen/src/Sparse/SparseCwise.h @@ -52,7 +52,7 @@ * convenient macro to defined the return type of a cwise comparison to a scalar */ /*#define EIGEN_CWISE_COMP_TO_SCALAR_RETURN_TYPE(OP) \ CwiseBinaryOp::Scalar>, ExpressionType, \ - NestByValue >*/ + typename ExpressionType::ConstantReturnType >*/ template class SparseCwise { diff --git a/blas/common.h b/blas/common.h index 74c3c9f11..4be530da2 100644 --- a/blas/common.h +++ b/blas/common.h @@ -76,14 +76,14 @@ extern "C" using namespace Eigen; template -Block > >, Dynamic, Dynamic> +Block >, Dynamic, Dynamic> matrix(T* data, int rows, int cols, int stride) { return Map >(data, stride, cols).nestByValue().block(0,0,rows,cols); } template -Block > >, Dynamic, 1> +Block >, Dynamic, 1> vector(T* data, int size, int incr) { return Map >(data, size, incr).nestByValue().col(0); @@ -106,8 +106,8 @@ enum Conj = IsComplex }; -typedef Block > >, Dynamic, Dynamic> MatrixType; -typedef Block > >, Dynamic, 1> StridedVectorType; +typedef Block >, Dynamic, Dynamic> MatrixType; +typedef Block >, Dynamic, 1> StridedVectorType; typedef Map > CompactVectorType; #define EIGEN_BLAS_FUNC(X) EIGEN_CAT(SCALAR_SUFFIX,X##_) diff --git a/test/geo_quaternion.cpp b/test/geo_quaternion.cpp index 2e97fe295..5a55138f9 100644 --- a/test/geo_quaternion.cpp +++ b/test/geo_quaternion.cpp @@ -43,7 +43,7 @@ template void quaternion(void) if (ei_is_same_type::ret) largeEps = 1e-3f; - Scalar eps = ei_random() * 1e-2; + Scalar eps = ei_random() * Scalar(1e-2); Vector3 v0 = Vector3::Random(), v1 = Vector3::Random(),