mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-07-20 20:04:26 +08:00
Much more NestByValue cleanup.
This commit is contained in:
parent
3091be5134
commit
2bf354da80
@ -440,7 +440,7 @@ template<typename ExpressionType, int Direction> class VectorwiseOp
|
||||
operator+(const MatrixBase<OtherDerived>& 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<typename ExpressionType, int Direction> class VectorwiseOp
|
||||
operator-(const MatrixBase<OtherDerived>& other) const
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived);
|
||||
return m_matrix - extendedTo(other).nestByValue();
|
||||
return m_matrix - extendedTo(other);
|
||||
}
|
||||
|
||||
/////////// Geometry module ///////////
|
||||
|
@ -141,7 +141,7 @@ class BandMatrix : public AnyMatrixBase<BandMatrix<_Scalar,Rows,Cols,Supers,Subs
|
||||
};
|
||||
typedef Block<DataType,1, DiagonalSize> BuildType;
|
||||
typedef typename ei_meta_if<Conjugate,
|
||||
CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>,NestByValue<BuildType> >,
|
||||
CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>,BuildType >,
|
||||
BuildType>::ret Type;
|
||||
};
|
||||
|
||||
|
@ -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<OP<typename ei_traits<ExpressionType>::Scalar>, ExpressionType, \
|
||||
NestByValue<typename ExpressionType::ConstantReturnType> >
|
||||
typename ExpressionType::ConstantReturnType >
|
||||
|
||||
/** \class Cwise
|
||||
*
|
||||
|
@ -248,7 +248,7 @@ template<typename Derived> class MatrixBase
|
||||
typedef CwiseUnaryView<ei_scalar_imag_op<Scalar>, Derived> NonConstImagReturnType;
|
||||
/** \internal the return type of MatrixBase::adjoint() */
|
||||
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
|
||||
CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<Derived> > >,
|
||||
CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<Derived> >,
|
||||
Transpose<Derived>
|
||||
>::ret AdjointReturnType;
|
||||
/** \internal the return type of MatrixBase::eigenvalues() */
|
||||
@ -445,11 +445,11 @@ template<typename Derived> class MatrixBase
|
||||
Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,Transpose<DerivedB> >& other);
|
||||
|
||||
template<typename OtherDerived>
|
||||
Derived& lazyAssign(const CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<OtherDerived> > >& other);
|
||||
Derived& lazyAssign(const CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<OtherDerived> >& other);
|
||||
template<typename DerivedA, typename DerivedB>
|
||||
Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedA> > >,DerivedB>& other);
|
||||
Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<DerivedA> >,DerivedB>& other);
|
||||
template<typename DerivedA, typename DerivedB>
|
||||
Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedB> > > >& other);
|
||||
Derived& lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<DerivedB> > >& other);
|
||||
#endif
|
||||
|
||||
RowXpr row(int i);
|
||||
@ -766,7 +766,7 @@ template<typename Derived> class MatrixBase
|
||||
ei_traits<Derived>::ColsAtCompileTime==1 ? SizeMinusOne : 1,
|
||||
ei_traits<Derived>::ColsAtCompileTime==1 ? 1 : SizeMinusOne> StartMinusOne;
|
||||
typedef CwiseUnaryOp<ei_scalar_quotient1_op<typename ei_traits<Derived>::Scalar>,
|
||||
NestByValue<StartMinusOne> > HNormalizedReturnType;
|
||||
StartMinusOne > HNormalizedReturnType;
|
||||
|
||||
const HNormalizedReturnType hnormalized() const;
|
||||
typedef Homogeneous<Derived,MatrixBase<Derived>::ColsAtCompileTime==1?Vertical:Horizontal> HomogeneousReturnType;
|
||||
|
@ -186,7 +186,7 @@ template<typename Derived>
|
||||
inline const typename MatrixBase<Derived>::AdjointReturnType
|
||||
MatrixBase<Derived>::adjoint() const
|
||||
{
|
||||
return transpose().nestByValue();
|
||||
return transpose();
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -326,31 +326,31 @@ lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,Transpose<Deriv
|
||||
template<typename Derived>
|
||||
template<typename OtherDerived> Derived&
|
||||
MatrixBase<Derived>::
|
||||
lazyAssign(const CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<OtherDerived> > >& other)
|
||||
lazyAssign(const CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<OtherDerived> >& other)
|
||||
{
|
||||
ei_assert(ei_extract_data(other) != ei_extract_data(derived())
|
||||
&& "aliasing detected during tranposition, please use adjointInPlace()");
|
||||
return lazyAssign(static_cast<const MatrixBase<CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<OtherDerived> > > >& >(other));
|
||||
return lazyAssign(static_cast<const MatrixBase<CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<OtherDerived> > >& >(other));
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
template<typename DerivedA, typename DerivedB>
|
||||
Derived& MatrixBase<Derived>::
|
||||
lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedA> > >,DerivedB>& other)
|
||||
lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<DerivedA> >,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<const MatrixBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedA> > >,DerivedB> >& >(other));
|
||||
return lazyAssign(static_cast<const MatrixBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<DerivedA> >,DerivedB> >& >(other));
|
||||
}
|
||||
|
||||
template<typename Derived>
|
||||
template<typename DerivedA, typename DerivedB>
|
||||
Derived& MatrixBase<Derived>::
|
||||
lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedB> > > >& other)
|
||||
lazyAssign(const CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<DerivedB> > >& other)
|
||||
{
|
||||
ei_assert(ei_extract_data(derived()) != ei_extract_data(other.rhs())
|
||||
&& "aliasing detected during tranposition, please evaluate your expression");
|
||||
return lazyAssign(static_cast<const MatrixBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, NestByValue<Eigen::Transpose<DerivedB> > > > >& >(other));
|
||||
return lazyAssign(static_cast<const MatrixBase<CwiseBinaryOp<ei_scalar_sum_op<Scalar>,DerivedA,CwiseUnaryOp<ei_scalar_conjugate_op<Scalar>, Eigen::Transpose<DerivedB> > > >& >(other));
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -222,18 +222,18 @@ template<typename _MatrixType, unsigned int _Mode> class TriangularView
|
||||
|
||||
|
||||
/** \sa MatrixBase::adjoint() */
|
||||
inline TriangularView<NestByValue<typename MatrixType::AdjointReturnType>,TransposeMode> adjoint()
|
||||
{ return m_matrix.adjoint().nestByValue(); }
|
||||
inline TriangularView<typename MatrixType::AdjointReturnType,TransposeMode> adjoint()
|
||||
{ return m_matrix.adjoint(); }
|
||||
/** \sa MatrixBase::adjoint() const */
|
||||
inline const TriangularView<NestByValue<typename MatrixType::AdjointReturnType>,TransposeMode> adjoint() const
|
||||
{ return m_matrix.adjoint().nestByValue(); }
|
||||
inline const TriangularView<typename MatrixType::AdjointReturnType,TransposeMode> adjoint() const
|
||||
{ return m_matrix.adjoint(); }
|
||||
|
||||
/** \sa MatrixBase::transpose() */
|
||||
inline TriangularView<NestByValue<Transpose<MatrixType> >,TransposeMode> transpose()
|
||||
{ return m_matrix.transpose().nestByValue(); }
|
||||
inline TriangularView<Transpose<MatrixType>,TransposeMode> transpose()
|
||||
{ return m_matrix.transpose(); }
|
||||
/** \sa MatrixBase::transpose() const */
|
||||
inline const TriangularView<NestByValue<Transpose<MatrixType> >,TransposeMode> transpose() const
|
||||
{ return m_matrix.transpose().nestByValue(); }
|
||||
inline const TriangularView<Transpose<MatrixType>,TransposeMode> transpose() const
|
||||
{ return m_matrix.transpose(); }
|
||||
|
||||
DenseMatrixType toDenseMatrix() const
|
||||
{
|
||||
|
@ -175,7 +175,7 @@ MatrixBase<Derived>::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<ExpressionType,Direction>::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<NestByValue<HNormalized_Factors>,
|
||||
Direction==Horizontal ? _expression().cols()-1 : _expression().cols()).cwise()/
|
||||
Replicate<HNormalized_Factors,
|
||||
Direction==Vertical ? HNormalized_SizeMinusOne : 1,
|
||||
Direction==Horizontal ? HNormalized_SizeMinusOne : 1>
|
||||
(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<typename MatrixType,typename Lhs>
|
||||
|
@ -187,7 +187,7 @@ public:
|
||||
/** type of read/write reference to the affine part of the transformation */
|
||||
typedef typename ei_meta_if<int(Mode)==int(AffineCompact),
|
||||
MatrixType&,
|
||||
NestByValue<Block<MatrixType,Dim,HDim> > >::ret AffinePartNested;
|
||||
Block<MatrixType,Dim,HDim> >::ret AffinePartNested;
|
||||
/** type of a vector */
|
||||
typedef Matrix<Scalar,Dim,1> VectorType;
|
||||
/** type of a read/write reference to the translation part of the rotation */
|
||||
|
@ -69,7 +69,7 @@ template<typename VectorsType, typename CoeffsType> class HouseholderSequence
|
||||
|
||||
typedef HouseholderSequence<VectorsType,
|
||||
typename ei_meta_if<NumTraits<Scalar>::IsComplex,
|
||||
NestByValue<typename ei_cleantype<typename CoeffsType::ConjugateReturnType>::type >,
|
||||
typename ei_cleantype<typename CoeffsType::ConjugateReturnType>::type,
|
||||
CoeffsType>::ret> ConjugateReturnType;
|
||||
|
||||
HouseholderSequence(const VectorsType& v, const CoeffsType& h, bool trans = false)
|
||||
|
@ -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<OP<typename ei_traits<ExpressionType>::Scalar>, ExpressionType, \
|
||||
NestByValue<typename ExpressionType::ConstantReturnType> >*/
|
||||
typename ExpressionType::ConstantReturnType >*/
|
||||
|
||||
template<typename ExpressionType> class SparseCwise
|
||||
{
|
||||
|
@ -76,14 +76,14 @@ extern "C"
|
||||
using namespace Eigen;
|
||||
|
||||
template<typename T>
|
||||
Block<NestByValue<Map<Matrix<T,Dynamic,Dynamic> > >, Dynamic, Dynamic>
|
||||
Block<Map<Matrix<T,Dynamic,Dynamic> >, Dynamic, Dynamic>
|
||||
matrix(T* data, int rows, int cols, int stride)
|
||||
{
|
||||
return Map<Matrix<T,Dynamic,Dynamic> >(data, stride, cols).nestByValue().block(0,0,rows,cols);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
Block<NestByValue<Map<Matrix<T,Dynamic,Dynamic,RowMajor> > >, Dynamic, 1>
|
||||
Block<Map<Matrix<T,Dynamic,Dynamic,RowMajor> >, Dynamic, 1>
|
||||
vector(T* data, int size, int incr)
|
||||
{
|
||||
return Map<Matrix<T,Dynamic,Dynamic,RowMajor> >(data, size, incr).nestByValue().col(0);
|
||||
@ -106,8 +106,8 @@ enum
|
||||
Conj = IsComplex
|
||||
};
|
||||
|
||||
typedef Block<NestByValue<Map<Matrix<Scalar,Dynamic,Dynamic> > >, Dynamic, Dynamic> MatrixType;
|
||||
typedef Block<NestByValue<Map<Matrix<Scalar,Dynamic,Dynamic, RowMajor> > >, Dynamic, 1> StridedVectorType;
|
||||
typedef Block<Map<Matrix<Scalar,Dynamic,Dynamic> >, Dynamic, Dynamic> MatrixType;
|
||||
typedef Block<Map<Matrix<Scalar,Dynamic,Dynamic, RowMajor> >, Dynamic, 1> StridedVectorType;
|
||||
typedef Map<Matrix<Scalar,Dynamic,1> > CompactVectorType;
|
||||
|
||||
#define EIGEN_BLAS_FUNC(X) EIGEN_CAT(SCALAR_SUFFIX,X##_)
|
||||
|
@ -43,7 +43,7 @@ template<typename Scalar> void quaternion(void)
|
||||
if (ei_is_same_type<Scalar,float>::ret)
|
||||
largeEps = 1e-3f;
|
||||
|
||||
Scalar eps = ei_random<Scalar>() * 1e-2;
|
||||
Scalar eps = ei_random<Scalar>() * Scalar(1e-2);
|
||||
|
||||
Vector3 v0 = Vector3::Random(),
|
||||
v1 = Vector3::Random(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user