mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-04-16 14:49:39 +08:00
adapt select, replicate and reverse
This commit is contained in:
parent
8e05f9cfa1
commit
7caf751fdd
@ -179,27 +179,6 @@ template<typename Derived> class ArrayBase
|
||||
// const VectorwiseOp<Derived,Vertical> colwise() const;
|
||||
// VectorwiseOp<Derived,Vertical> colwise();
|
||||
|
||||
// template<typename ThenDerived,typename ElseDerived>
|
||||
// const Select<Derived,ThenDerived,ElseDerived>
|
||||
// select(const ArrayBase<ThenDerived>& thenMatrix,
|
||||
// const ArrayBase<ElseDerived>& elseMatrix) const;
|
||||
|
||||
// template<typename ThenDerived>
|
||||
// inline const Select<Derived,ThenDerived, NestByValue<typename ThenDerived::ConstantReturnType> >
|
||||
// select(const ArrayBase<ThenDerived>& thenMatrix, typename ThenDerived::Scalar elseScalar) const;
|
||||
|
||||
// template<typename ElseDerived>
|
||||
// inline const Select<Derived, NestByValue<typename ElseDerived::ConstantReturnType>, ElseDerived >
|
||||
// select(typename ElseDerived::Scalar thenScalar, const ArrayBase<ElseDerived>& elseMatrix) const;
|
||||
|
||||
// template<int RowFactor, int ColFactor>
|
||||
// const Replicate<Derived,RowFactor,ColFactor> replicate() const;
|
||||
// const Replicate<Derived,Dynamic,Dynamic> replicate(int rowFacor,int colFactor) const;
|
||||
|
||||
// Eigen::Reverse<Derived, BothDirections> reverse();
|
||||
// const Eigen::Reverse<Derived, BothDirections> reverse() const;
|
||||
// void reverseInPlace();
|
||||
|
||||
#ifdef EIGEN_ARRAYBASE_PLUGIN
|
||||
#include EIGEN_ARRAYBASE_PLUGIN
|
||||
#endif
|
||||
|
@ -33,10 +33,10 @@
|
||||
* \param MatrixType the type of the object we are replicating
|
||||
*
|
||||
* This class represents an expression of the multiple replication of a matrix or vector.
|
||||
* It is the return type of MatrixBase::replicate() and most of the time
|
||||
* It is the return type of DenseBase::replicate() and most of the time
|
||||
* this is the only way it is used.
|
||||
*
|
||||
* \sa MatrixBase::replicate()
|
||||
* \sa DenseBase::replicate()
|
||||
*/
|
||||
template<typename MatrixType,int RowFactor,int ColFactor>
|
||||
struct ei_traits<Replicate<MatrixType,RowFactor,ColFactor> >
|
||||
@ -60,11 +60,12 @@ struct ei_traits<Replicate<MatrixType,RowFactor,ColFactor> >
|
||||
};
|
||||
|
||||
template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
|
||||
: public MatrixBase<Replicate<MatrixType,RowFactor,ColFactor> >
|
||||
: public MatrixType::template MakeBase< Replicate<MatrixType,RowFactor,ColFactor> >::Type
|
||||
{
|
||||
public:
|
||||
|
||||
EIGEN_GENERIC_PUBLIC_INTERFACE(Replicate)
|
||||
typedef typename MatrixType::template MakeBase< Replicate<MatrixType,RowFactor,ColFactor> >::Type Base;
|
||||
_EIGEN_GENERIC_PUBLIC_INTERFACE(Replicate)
|
||||
|
||||
template<typename OriginalMatrixType>
|
||||
inline explicit Replicate(const OriginalMatrixType& matrix)
|
||||
@ -106,12 +107,12 @@ template<typename MatrixType,int RowFactor,int ColFactor> class Replicate
|
||||
* Example: \include MatrixBase_replicate.cpp
|
||||
* Output: \verbinclude MatrixBase_replicate.out
|
||||
*
|
||||
* \sa VectorwiseOp::replicate(), MatrixBase::replicate(int,int), class Replicate
|
||||
* \sa VectorwiseOp::replicate(), DenseBase::replicate(int,int), class Replicate
|
||||
*/
|
||||
template<typename Derived>
|
||||
template<int RowFactor, int ColFactor>
|
||||
inline const Replicate<Derived,RowFactor,ColFactor>
|
||||
MatrixBase<Derived>::replicate() const
|
||||
DenseBase<Derived>::replicate() const
|
||||
{
|
||||
return Replicate<Derived,RowFactor,ColFactor>(derived());
|
||||
}
|
||||
@ -122,11 +123,11 @@ MatrixBase<Derived>::replicate() const
|
||||
* Example: \include MatrixBase_replicate_int_int.cpp
|
||||
* Output: \verbinclude MatrixBase_replicate_int_int.out
|
||||
*
|
||||
* \sa VectorwiseOp::replicate(), MatrixBase::replicate<int,int>(), class Replicate
|
||||
* \sa VectorwiseOp::replicate(), DenseBase::replicate<int,int>(), class Replicate
|
||||
*/
|
||||
template<typename Derived>
|
||||
inline const Replicate<Derived,Dynamic,Dynamic>
|
||||
MatrixBase<Derived>::replicate(int rowFactor,int colFactor) const
|
||||
DenseBase<Derived>::replicate(int rowFactor,int colFactor) const
|
||||
{
|
||||
return Replicate<Derived,Dynamic,Dynamic>(derived(),rowFactor,colFactor);
|
||||
}
|
||||
@ -137,7 +138,7 @@ MatrixBase<Derived>::replicate(int rowFactor,int colFactor) const
|
||||
* Example: \include DirectionWise_replicate_int.cpp
|
||||
* Output: \verbinclude DirectionWise_replicate_int.out
|
||||
*
|
||||
* \sa VectorwiseOp::replicate(), MatrixBase::replicate(), class Replicate
|
||||
* \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate
|
||||
*/
|
||||
template<typename ExpressionType, int Direction>
|
||||
const Replicate<ExpressionType,(Direction==Vertical?Dynamic:1),(Direction==Horizontal?Dynamic:1)>
|
||||
|
@ -76,11 +76,12 @@ template<typename PacketScalar> struct ei_reverse_packet_cond<PacketScalar,false
|
||||
};
|
||||
|
||||
template<typename MatrixType, int Direction> class Reverse
|
||||
: public MatrixBase<Reverse<MatrixType, Direction> >
|
||||
: public MatrixType::template MakeBase< Reverse<MatrixType, Direction> >::Type
|
||||
{
|
||||
public:
|
||||
|
||||
EIGEN_GENERIC_PUBLIC_INTERFACE(Reverse)
|
||||
typedef typename MatrixType::template MakeBase< Reverse<MatrixType, Direction> >::Type Base;
|
||||
_EIGEN_GENERIC_PUBLIC_INTERFACE(Reverse)
|
||||
|
||||
protected:
|
||||
enum {
|
||||
@ -168,7 +169,7 @@ template<typename MatrixType, int Direction> class Reverse
|
||||
*/
|
||||
template<typename Derived>
|
||||
inline Reverse<Derived, BothDirections>
|
||||
MatrixBase<Derived>::reverse()
|
||||
DenseBase<Derived>::reverse()
|
||||
{
|
||||
return derived();
|
||||
}
|
||||
@ -176,7 +177,7 @@ MatrixBase<Derived>::reverse()
|
||||
/** This is the const version of reverse(). */
|
||||
template<typename Derived>
|
||||
inline const Reverse<Derived, BothDirections>
|
||||
MatrixBase<Derived>::reverse() const
|
||||
DenseBase<Derived>::reverse() const
|
||||
{
|
||||
return derived();
|
||||
}
|
||||
@ -194,7 +195,7 @@ MatrixBase<Derived>::reverse() const
|
||||
*
|
||||
* \sa reverse() */
|
||||
template<typename Derived>
|
||||
inline void MatrixBase<Derived>::reverseInPlace()
|
||||
inline void DenseBase<Derived>::reverseInPlace()
|
||||
{
|
||||
derived() = derived().reverse().eval();
|
||||
}
|
||||
|
@ -36,9 +36,9 @@
|
||||
* \param ElseMatrixType the type of the \em else expression
|
||||
*
|
||||
* This class represents an expression of a coefficient wise version of the C++ ternary operator ?:.
|
||||
* It is the return type of MatrixBase::select() and most of the time this is the only way it is used.
|
||||
* It is the return type of DenseBase::select() and most of the time this is the only way it is used.
|
||||
*
|
||||
* \sa MatrixBase::select(const MatrixBase<ThenDerived>&, const MatrixBase<ElseDerived>&) const
|
||||
* \sa DenseBase::select(const DenseBase<ThenDerived>&, const DenseBase<ElseDerived>&) const
|
||||
*/
|
||||
|
||||
template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
|
||||
@ -63,11 +63,12 @@ struct ei_traits<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
|
||||
|
||||
template<typename ConditionMatrixType, typename ThenMatrixType, typename ElseMatrixType>
|
||||
class Select : ei_no_assignment_operator,
|
||||
public MatrixBase<Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >
|
||||
public ConditionMatrixType::template MakeBase< Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >::Type
|
||||
{
|
||||
public:
|
||||
|
||||
EIGEN_GENERIC_PUBLIC_INTERFACE(Select)
|
||||
typedef typename ConditionMatrixType::template MakeBase< Select<ConditionMatrixType, ThenMatrixType, ElseMatrixType> >::Type Base;
|
||||
_EIGEN_GENERIC_PUBLIC_INTERFACE(Select)
|
||||
|
||||
Select(const ConditionMatrixType& conditionMatrix,
|
||||
const ThenMatrixType& thenMatrix,
|
||||
@ -117,23 +118,23 @@ class Select : ei_no_assignment_operator,
|
||||
template<typename Derived>
|
||||
template<typename ThenDerived,typename ElseDerived>
|
||||
inline const Select<Derived,ThenDerived,ElseDerived>
|
||||
MatrixBase<Derived>::select(const MatrixBase<ThenDerived>& thenMatrix,
|
||||
const MatrixBase<ElseDerived>& elseMatrix) const
|
||||
DenseBase<Derived>::select(const DenseBase<ThenDerived>& thenMatrix,
|
||||
const DenseBase<ElseDerived>& elseMatrix) const
|
||||
{
|
||||
return Select<Derived,ThenDerived,ElseDerived>(derived(), thenMatrix.derived(), elseMatrix.derived());
|
||||
}
|
||||
|
||||
/** \array_module
|
||||
*
|
||||
* Version of MatrixBase::select(const MatrixBase&, const MatrixBase&) with
|
||||
* Version of DenseBase::select(const DenseBase&, const DenseBase&) with
|
||||
* the \em else expression being a scalar value.
|
||||
*
|
||||
* \sa MatrixBase::select(const MatrixBase<ThenDerived>&, const MatrixBase<ElseDerived>&) const, class Select
|
||||
* \sa DenseBase::select(const DenseBase<ThenDerived>&, const DenseBase<ElseDerived>&) const, class Select
|
||||
*/
|
||||
template<typename Derived>
|
||||
template<typename ThenDerived>
|
||||
inline const Select<Derived,ThenDerived, NestByValue<typename ThenDerived::ConstantReturnType> >
|
||||
MatrixBase<Derived>::select(const MatrixBase<ThenDerived>& thenMatrix,
|
||||
DenseBase<Derived>::select(const DenseBase<ThenDerived>& thenMatrix,
|
||||
typename ThenDerived::Scalar elseScalar) const
|
||||
{
|
||||
return Select<Derived,ThenDerived,NestByValue<typename ThenDerived::ConstantReturnType> >(
|
||||
@ -142,16 +143,16 @@ MatrixBase<Derived>::select(const MatrixBase<ThenDerived>& thenMatrix,
|
||||
|
||||
/** \array_module
|
||||
*
|
||||
* Version of MatrixBase::select(const MatrixBase&, const MatrixBase&) with
|
||||
* Version of DenseBase::select(const DenseBase&, const DenseBase&) with
|
||||
* the \em then expression being a scalar value.
|
||||
*
|
||||
* \sa MatrixBase::select(const MatrixBase<ThenDerived>&, const MatrixBase<ElseDerived>&) const, class Select
|
||||
* \sa DenseBase::select(const DenseBase<ThenDerived>&, const DenseBase<ElseDerived>&) const, class Select
|
||||
*/
|
||||
template<typename Derived>
|
||||
template<typename ElseDerived>
|
||||
inline const Select<Derived, NestByValue<typename ElseDerived::ConstantReturnType>, ElseDerived >
|
||||
MatrixBase<Derived>::select(typename ElseDerived::Scalar thenScalar,
|
||||
const MatrixBase<ElseDerived>& elseMatrix) const
|
||||
DenseBase<Derived>::select(typename ElseDerived::Scalar thenScalar,
|
||||
const DenseBase<ElseDerived>& elseMatrix) const
|
||||
{
|
||||
return Select<Derived,NestByValue<typename ElseDerived::ConstantReturnType>,ElseDerived>(
|
||||
derived(), ElseDerived::Constant(rows(),cols(),thenScalar), elseMatrix.derived());
|
||||
|
@ -74,11 +74,12 @@ struct ei_traits<PartialReduxExpr<MatrixType, MemberOp, Direction> >
|
||||
|
||||
template< typename MatrixType, typename MemberOp, int Direction>
|
||||
class PartialReduxExpr : ei_no_assignment_operator,
|
||||
public MatrixBase<PartialReduxExpr<MatrixType, MemberOp, Direction> >
|
||||
public MatrixType::template MakeBase< PartialReduxExpr<MatrixType, MemberOp, Direction> >::Type
|
||||
{
|
||||
public:
|
||||
|
||||
EIGEN_GENERIC_PUBLIC_INTERFACE(PartialReduxExpr)
|
||||
typedef typename MatrixType::template MakeBase< PartialReduxExpr<MatrixType, MemberOp, Direction> >::Type Base;
|
||||
_EIGEN_GENERIC_PUBLIC_INTERFACE(PartialReduxExpr)
|
||||
typedef typename ei_traits<PartialReduxExpr>::MatrixTypeNested MatrixTypeNested;
|
||||
typedef typename ei_traits<PartialReduxExpr>::_MatrixTypeNested _MatrixTypeNested;
|
||||
|
||||
|
@ -37,6 +37,7 @@
|
||||
*/
|
||||
template<typename Derived> class DenseBase
|
||||
#ifndef EIGEN_PARSED_BY_DOXYGEN
|
||||
// : public AnyMatrixBase<Derived>
|
||||
: public ei_special_scalar_op_base<Derived,typename ei_traits<Derived>::Scalar,
|
||||
typename NumTraits<typename ei_traits<Derived>::Scalar>::Real>
|
||||
#endif // not EIGEN_PARSED_BY_DOXYGEN
|
||||
|
@ -61,8 +61,7 @@ template<typename Derived> class MatrixBase
|
||||
/** Construct the base class type for the derived class OtherDerived */
|
||||
template <typename OtherDerived> struct MakeBase { typedef MatrixBase<OtherDerived> Type; };
|
||||
|
||||
using ei_special_scalar_op_base<Derived,typename ei_traits<Derived>::Scalar,
|
||||
typename NumTraits<typename ei_traits<Derived>::Scalar>::Real>::operator*;
|
||||
// using DenseBase<Derived>::operator*;
|
||||
|
||||
class InnerIterator;
|
||||
|
||||
@ -442,29 +441,8 @@ template<typename Derived> class MatrixBase
|
||||
const VectorwiseOp<Derived,Vertical> colwise() const;
|
||||
VectorwiseOp<Derived,Vertical> colwise();
|
||||
|
||||
template<typename ThenDerived,typename ElseDerived>
|
||||
const Select<Derived,ThenDerived,ElseDerived>
|
||||
select(const MatrixBase<ThenDerived>& thenMatrix,
|
||||
const MatrixBase<ElseDerived>& elseMatrix) const;
|
||||
|
||||
template<typename ThenDerived>
|
||||
inline const Select<Derived,ThenDerived, NestByValue<typename ThenDerived::ConstantReturnType> >
|
||||
select(const MatrixBase<ThenDerived>& thenMatrix, typename ThenDerived::Scalar elseScalar) const;
|
||||
|
||||
template<typename ElseDerived>
|
||||
inline const Select<Derived, NestByValue<typename ElseDerived::ConstantReturnType>, ElseDerived >
|
||||
select(typename ElseDerived::Scalar thenScalar, const MatrixBase<ElseDerived>& elseMatrix) const;
|
||||
|
||||
template<int p> RealScalar lpNorm() const;
|
||||
|
||||
template<int RowFactor, int ColFactor>
|
||||
const Replicate<Derived,RowFactor,ColFactor> replicate() const;
|
||||
const Replicate<Derived,Dynamic,Dynamic> replicate(int rowFacor,int colFactor) const;
|
||||
|
||||
Eigen::Reverse<Derived, BothDirections> reverse();
|
||||
const Eigen::Reverse<Derived, BothDirections> reverse() const;
|
||||
void reverseInPlace();
|
||||
|
||||
ArrayWrapper<Derived> array() { return derived(); }
|
||||
const ArrayWrapper<Derived> array() const { return derived(); }
|
||||
|
||||
|
@ -237,7 +237,7 @@ struct ei_special_scalar_op_base<Derived,Scalar,OtherScalar,true> : public AnyM
|
||||
|
||||
inline friend const CwiseUnaryOp<ei_scalar_multiple2_op<Scalar,OtherScalar>, Derived>
|
||||
operator*(const OtherScalar& scalar, const Derived& matrix)
|
||||
{ return matrix*scalar; }
|
||||
{ return static_cast<const ei_special_scalar_op_base&>(matrix).operator*(scalar); }
|
||||
};
|
||||
|
||||
/** \internal Gives the type of a sub-matrix or sub-vector of a matrix of type \a ExpressionType and size \a Size
|
||||
|
@ -612,7 +612,7 @@ Transform<Scalar,Dim,Mode>&
|
||||
Transform<Scalar,Dim,Mode>::scale(const MatrixBase<OtherDerived> &other)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
|
||||
linearExt() = (linearExt() * other.asDiagonal()).lazy();
|
||||
linearExt().noalias() = (linearExt() * other.asDiagonal());
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -637,7 +637,7 @@ Transform<Scalar,Dim,Mode>&
|
||||
Transform<Scalar,Dim,Mode>::prescale(const MatrixBase<OtherDerived> &other)
|
||||
{
|
||||
EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(OtherDerived,int(Dim))
|
||||
m_matrix.template block<Dim,HDim>(0,0) = (other.asDiagonal() * m_matrix.template block<Dim,HDim>(0,0)).lazy();
|
||||
m_matrix.template block<Dim,HDim>(0,0).noalias() = (other.asDiagonal() * m_matrix.template block<Dim,HDim>(0,0));
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -1118,7 +1118,7 @@ struct ei_transform_right_product_impl<Other,Mode, Dim,HDim, Dim,Dim>
|
||||
{
|
||||
TransformType res;
|
||||
res.matrix().col(Dim) = tr.matrix().col(Dim);
|
||||
res.linearExt() = (tr.linearExt() * other).lazy();
|
||||
res.linearExt().noalias() = (tr.linearExt() * other);
|
||||
if(Mode==Affine)
|
||||
res.matrix().row(Dim).template start<Dim>() = tr.matrix().row(Dim).template start<Dim>();
|
||||
return res;
|
||||
@ -1136,7 +1136,7 @@ struct ei_transform_right_product_impl<Other,Mode, Dim,HDim, Dim,HDim>
|
||||
{
|
||||
TransformType res;
|
||||
const int Rows = Mode==Projective ? HDim : Dim;
|
||||
res.matrix().template block<Rows,HDim>(0,0) = (tr.linearExt() * other).lazy();
|
||||
res.matrix().template block<Rows,HDim>(0,0).noalias() = (tr.linearExt() * other);
|
||||
res.translationExt() += tr.translationExt();
|
||||
if(Mode!=Affine)
|
||||
res.makeAffine();
|
||||
@ -1152,7 +1152,7 @@ struct ei_transform_right_product_impl<Other,Mode, Dim,HDim, HDim,HDim>
|
||||
typedef typename TransformType::MatrixType MatrixType;
|
||||
typedef Transform<typename Other::Scalar,Dim,Projective> ResultType;
|
||||
static ResultType run(const TransformType& tr, const Other& other)
|
||||
{ return ResultType((tr.matrix() * other).lazy()); }
|
||||
{ return ResultType(tr.matrix() * other); }
|
||||
};
|
||||
|
||||
// AffineCompact * generic matrix => Projective
|
||||
@ -1164,7 +1164,7 @@ struct ei_transform_right_product_impl<Other,AffineCompact, Dim,HDim, HDim,HDim>
|
||||
static ResultType run(const TransformType& tr, const Other& other)
|
||||
{
|
||||
ResultType res;
|
||||
res.affine() = (tr.matrix() * other).lazy();
|
||||
res.affine().noalias() = tr.matrix() * other;
|
||||
res.makeAffine();
|
||||
return res;
|
||||
}
|
||||
@ -1179,7 +1179,7 @@ struct ei_transform_left_product_impl<Other,Mode,Dim,HDim, HDim,HDim>
|
||||
typedef typename TransformType::MatrixType MatrixType;
|
||||
typedef Transform<typename Other::Scalar,Dim,Projective> ResultType;
|
||||
static ResultType run(const Other& other,const TransformType& tr)
|
||||
{ return ResultType((other * tr.matrix()).lazy()); }
|
||||
{ return ResultType(other * tr.matrix()); }
|
||||
};
|
||||
|
||||
// generic HDim x HDim matrix * AffineCompact => Projective
|
||||
@ -1192,7 +1192,7 @@ struct ei_transform_left_product_impl<Other,AffineCompact,Dim,HDim, HDim,HDim>
|
||||
static ResultType run(const Other& other,const TransformType& tr)
|
||||
{
|
||||
ResultType res;
|
||||
res.matrix() = (other.template block<HDim,Dim>(0,0) * tr.matrix()).lazy();
|
||||
res.matrix().noalias() = other.template block<HDim,Dim>(0,0) * tr.matrix();
|
||||
res.matrix().col(Dim) += other.col(Dim);
|
||||
return res;
|
||||
}
|
||||
@ -1208,7 +1208,7 @@ struct ei_transform_left_product_impl<Other,Mode,Dim,HDim, Dim,HDim>
|
||||
static ResultType run(const Other& other,const TransformType& tr)
|
||||
{
|
||||
ResultType res;
|
||||
res.affine() = (other * tr.matrix()).lazy();
|
||||
res.affine().noalias() = other * tr.matrix();
|
||||
res.matrix().row(Dim) = tr.matrix().row(Dim);
|
||||
return res;
|
||||
}
|
||||
@ -1224,7 +1224,7 @@ struct ei_transform_left_product_impl<Other,AffineCompact,Dim,HDim, Dim,HDim>
|
||||
static ResultType run(const Other& other,const TransformType& tr)
|
||||
{
|
||||
ResultType res;
|
||||
res.matrix() = (other.template block<Dim,Dim>(0,0) * tr.matrix()).lazy();
|
||||
res.matrix().noalias() = other.template block<Dim,Dim>(0,0) * tr.matrix();
|
||||
res.translation() += other.col(Dim);
|
||||
return res;
|
||||
}
|
||||
@ -1242,8 +1242,8 @@ struct ei_transform_left_product_impl<Other,Mode,Dim,HDim, Dim,Dim>
|
||||
TransformType res;
|
||||
if(Mode!=AffineCompact)
|
||||
res.matrix().row(Dim) = tr.matrix().row(Dim);
|
||||
res.matrix().template corner<Dim,HDim>(TopLeft)
|
||||
= (other * tr.matrix().template corner<Dim,HDim>(TopLeft)).lazy();
|
||||
res.matrix().template corner<Dim,HDim>(TopLeft).noalias()
|
||||
= other * tr.matrix().template corner<Dim,HDim>(TopLeft);
|
||||
return res;
|
||||
}
|
||||
};
|
||||
@ -1259,7 +1259,7 @@ struct ei_transform_transform_product_impl<Transform<Scalar,Dim,Mode>,Transform<
|
||||
typedef TransformType ResultType;
|
||||
static ResultType run(const TransformType& lhs, const TransformType& rhs)
|
||||
{
|
||||
return ResultType((lhs.matrix() * rhs.matrix()).lazy());
|
||||
return ResultType(lhs.matrix() * rhs.matrix());
|
||||
}
|
||||
};
|
||||
|
||||
@ -1297,7 +1297,7 @@ struct ei_transform_transform_product_impl<Transform<Scalar,Dim,AffineCompact>,
|
||||
typedef Transform<Scalar,Dim,AffineCompact> ResultType;
|
||||
static ResultType run(const Lhs& lhs, const Rhs& rhs)
|
||||
{
|
||||
return ResultType((lhs.matrix() * rhs.matrix()).lazy());
|
||||
return ResultType(lhs.matrix() * rhs.matrix());
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -32,13 +32,28 @@
|
||||
*
|
||||
* \sa class CwiseBinaryOp, cwiseAbs2
|
||||
*/
|
||||
|
||||
#define EIGEN_CWISE_PRODUCT_RETURN_TYPE \
|
||||
CwiseBinaryOp< \
|
||||
ei_scalar_product_op< \
|
||||
typename ei_scalar_product_traits< \
|
||||
typename ei_traits<Derived>::Scalar, \
|
||||
typename ei_traits<OtherDerived>::Scalar \
|
||||
>::ReturnType \
|
||||
>, \
|
||||
Derived, \
|
||||
OtherDerived \
|
||||
>
|
||||
|
||||
template<typename OtherDerived>
|
||||
EIGEN_STRONG_INLINE const CwiseBinaryOp<ei_scalar_product_op<Scalar>, Derived, OtherDerived>
|
||||
EIGEN_STRONG_INLINE const EIGEN_CWISE_PRODUCT_RETURN_TYPE
|
||||
cwiseProduct(const EIGEN_CURRENT_STORAGE_BASE_CLASS<OtherDerived> &other) const
|
||||
{
|
||||
return CwiseBinaryOp<ei_scalar_product_op<Scalar>, Derived, OtherDerived>(derived(), other.derived());
|
||||
return EIGEN_CWISE_PRODUCT_RETURN_TYPE(derived(), other.derived());
|
||||
}
|
||||
|
||||
#undef EIGEN_CWISE_PRODUCT_RETURN_TYPE
|
||||
|
||||
/** \returns an expression of the coefficient-wise == operator of *this and \a other
|
||||
*
|
||||
* \warning this performs an exact comparison, which is generally a bad idea with floating-point types.
|
||||
|
@ -128,7 +128,7 @@ template<typename Scalar, int Mode> void transformations(void)
|
||||
t0.pretranslate(v0);
|
||||
t0.scale(v1);
|
||||
t1.linear() = q1.conjugate().toRotationMatrix();
|
||||
t1.prescale(v1.cwise().inverse());
|
||||
t1.prescale(v1.cwiseInverse());
|
||||
t1.translate(-v0);
|
||||
|
||||
VERIFY((t0 * t1).matrix().isIdentity(test_precision<Scalar>()));
|
||||
@ -183,7 +183,7 @@ template<typename Scalar, int Mode> void transformations(void)
|
||||
Transform3 t6(sv3);
|
||||
t4 = sv3;
|
||||
VERIFY_IS_APPROX(t6.matrix(), t4.matrix());
|
||||
t4.scale(v3.cwise().inverse());
|
||||
t4.scale(v3.cwiseInverse());
|
||||
VERIFY_IS_APPROX(t4.matrix(), MatrixType::Identity());
|
||||
t4 *= sv3;
|
||||
VERIFY_IS_APPROX(t6.matrix(), t4.matrix());
|
||||
@ -213,7 +213,7 @@ template<typename Scalar, int Mode> void transformations(void)
|
||||
t21.setIdentity();
|
||||
t21.linear() = Rotation2D<Scalar>(-a).toRotationMatrix();
|
||||
VERIFY( (t20.fromPositionOrientationScale(v20,a,v21)
|
||||
* (t21.prescale(v21.cwise().inverse()).translate(-v20))).matrix().isIdentity(test_precision<Scalar>()) );
|
||||
* (t21.prescale(v21.cwiseInverse()).translate(-v20))).matrix().isIdentity(test_precision<Scalar>()) );
|
||||
|
||||
// Transform - new API
|
||||
// 3D
|
||||
|
@ -79,7 +79,7 @@ template<typename MatrixType> void linearStructure(const MatrixType& m)
|
||||
|
||||
// use .block to disable vectorization and compare to the vectorized version
|
||||
VERIFY_IS_APPROX(m1+m1.block(0,0,rows,cols), m1+m1);
|
||||
VERIFY_IS_APPROX(m1.cwise() * m1.block(0,0,rows,cols), m1.cwise() * m1);
|
||||
VERIFY_IS_APPROX(m1.cwiseProduct(m1.block(0,0,rows,cols)), m1.cwiseProduct(m1));
|
||||
VERIFY_IS_APPROX(m1 - m1.block(0,0,rows,cols), m1 - m1);
|
||||
VERIFY_IS_APPROX(m1.block(0,0,rows,cols) * s1, m1 * s1);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user