mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-06-04 18:54:00 +08:00
Call product_generic_impl by default, and remove lot of boilerplate code
This commit is contained in:
parent
cd0ff253ec
commit
bae2e3327b
@ -67,8 +67,8 @@ struct evaluator_traits_base
|
|||||||
// typedef evaluator<T> nestedType;
|
// typedef evaluator<T> nestedType;
|
||||||
|
|
||||||
// by default, get evaluator kind and shape from storage
|
// by default, get evaluator kind and shape from storage
|
||||||
typedef typename storage_kind_to_evaluator_kind<typename T::StorageKind>::Kind Kind;
|
typedef typename storage_kind_to_evaluator_kind<typename traits<T>::StorageKind>::Kind Kind;
|
||||||
typedef typename storage_kind_to_shape<typename T::StorageKind>::Shape Shape;
|
typedef typename storage_kind_to_shape<typename traits<T>::StorageKind>::Shape Shape;
|
||||||
|
|
||||||
// 1 if assignment A = B assumes aliasing when B is of type T and thus B needs to be evaluated into a
|
// 1 if assignment A = B assumes aliasing when B is of type T and thus B needs to be evaluated into a
|
||||||
// temporary; 0 if not.
|
// temporary; 0 if not.
|
||||||
|
@ -108,8 +108,8 @@ class Product : public ProductImpl<_Lhs,_Rhs,Option,
|
|||||||
|
|
||||||
typedef typename ProductImpl<
|
typedef typename ProductImpl<
|
||||||
Lhs, Rhs, Option,
|
Lhs, Rhs, Option,
|
||||||
typename internal::product_promote_storage_type<typename Lhs::StorageKind,
|
typename internal::product_promote_storage_type<typename internal::traits<Lhs>::StorageKind,
|
||||||
typename Rhs::StorageKind,
|
typename internal::traits<Rhs>::StorageKind,
|
||||||
internal::product_type<Lhs,Rhs>::ret>::ret>::Base Base;
|
internal::product_type<Lhs,Rhs>::ret>::ret>::Base Base;
|
||||||
EIGEN_GENERIC_PUBLIC_INTERFACE(Product)
|
EIGEN_GENERIC_PUBLIC_INTERFACE(Product)
|
||||||
|
|
||||||
|
@ -90,9 +90,10 @@ struct evaluator_traits<Product<Lhs, Rhs, DefaultProduct> >
|
|||||||
enum { AssumeAliasing = 1 };
|
enum { AssumeAliasing = 1 };
|
||||||
};
|
};
|
||||||
|
|
||||||
// The evaluator for default dense products creates a temporary and call generic_product_impl
|
// This is the default evaluator implementation for products:
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
// It creates a temporary and call generic_product_impl
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, DenseShape, DenseShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
template<typename Lhs, typename Rhs, int ProductTag, typename LhsShape, typename RhsShape>
|
||||||
|
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, LhsShape, RhsShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar>
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
||||||
{
|
{
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
||||||
@ -118,7 +119,7 @@ struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, DenseSha
|
|||||||
//
|
//
|
||||||
// generic_product_impl<LhsNestedCleaned, RhsNestedCleaned>::evalTo(m_result, lhs, rhs);
|
// generic_product_impl<LhsNestedCleaned, RhsNestedCleaned>::evalTo(m_result, lhs, rhs);
|
||||||
|
|
||||||
generic_product_impl<Lhs, Rhs>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
generic_product_impl<Lhs, Rhs, LhsShape, RhsShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -501,8 +502,8 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs>
|
template<typename Lhs, typename Rhs>
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, LazyCoeffBasedProductMode, DenseShape, DenseShape, typename Lhs::Scalar, typename Rhs::Scalar >
|
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, LazyCoeffBasedProductMode, DenseShape, DenseShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar >
|
||||||
: product_evaluator<Product<Lhs, Rhs, LazyProduct>, CoeffBasedProductMode, DenseShape, DenseShape, typename Lhs::Scalar, typename Rhs::Scalar >
|
: product_evaluator<Product<Lhs, Rhs, LazyProduct>, CoeffBasedProductMode, DenseShape, DenseShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar >
|
||||||
{
|
{
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
||||||
typedef Product<Lhs, Rhs, LazyProduct> BaseProduct;
|
typedef Product<Lhs, Rhs, LazyProduct> BaseProduct;
|
||||||
@ -607,26 +608,6 @@ struct generic_product_impl<Lhs,Rhs,TriangularShape,DenseShape,ProductTag>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, TriangularShape, DenseShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
|
||||||
{
|
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
||||||
typedef typename XprType::PlainObject PlainObject;
|
|
||||||
typedef typename evaluator<PlainObject>::type Base;
|
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
|
||||||
: m_result(xpr.rows(), xpr.cols())
|
|
||||||
{
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
|
||||||
generic_product_impl<Lhs, Rhs, TriangularShape, DenseShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PlainObject m_result;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
template<typename Lhs, typename Rhs, int ProductTag>
|
||||||
struct generic_product_impl<Lhs,Rhs,DenseShape,TriangularShape,ProductTag>
|
struct generic_product_impl<Lhs,Rhs,DenseShape,TriangularShape,ProductTag>
|
||||||
: generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,DenseShape,TriangularShape,ProductTag> >
|
: generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,DenseShape,TriangularShape,ProductTag> >
|
||||||
@ -640,26 +621,6 @@ struct generic_product_impl<Lhs,Rhs,DenseShape,TriangularShape,ProductTag>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, DenseShape, TriangularShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
|
||||||
{
|
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
||||||
typedef typename XprType::PlainObject PlainObject;
|
|
||||||
typedef typename evaluator<PlainObject>::type Base;
|
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
|
||||||
: m_result(xpr.rows(), xpr.cols())
|
|
||||||
{
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
|
||||||
generic_product_impl<Lhs, Rhs, DenseShape, TriangularShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PlainObject m_result;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* SelfAdjoint products
|
* SelfAdjoint products
|
||||||
@ -681,26 +642,6 @@ struct generic_product_impl<Lhs,Rhs,SelfAdjointShape,DenseShape,ProductTag>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, SelfAdjointShape, DenseShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
|
||||||
{
|
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
||||||
typedef typename XprType::PlainObject PlainObject;
|
|
||||||
typedef typename evaluator<PlainObject>::type Base;
|
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
|
||||||
: m_result(xpr.rows(), xpr.cols())
|
|
||||||
{
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
|
||||||
generic_product_impl<Lhs, Rhs, SelfAdjointShape, DenseShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PlainObject m_result;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
template<typename Lhs, typename Rhs, int ProductTag>
|
||||||
struct generic_product_impl<Lhs,Rhs,DenseShape,SelfAdjointShape,ProductTag>
|
struct generic_product_impl<Lhs,Rhs,DenseShape,SelfAdjointShape,ProductTag>
|
||||||
: generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,DenseShape,SelfAdjointShape,ProductTag> >
|
: generic_product_impl_base<Lhs,Rhs,generic_product_impl<Lhs,Rhs,DenseShape,SelfAdjointShape,ProductTag> >
|
||||||
@ -714,24 +655,6 @@ struct generic_product_impl<Lhs,Rhs,DenseShape,SelfAdjointShape,ProductTag>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, DenseShape, SelfAdjointShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
|
||||||
{
|
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
||||||
typedef typename XprType::PlainObject PlainObject;
|
|
||||||
typedef typename evaluator<PlainObject>::type Base;
|
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
|
||||||
: m_result(xpr.rows(), xpr.cols())
|
|
||||||
{
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
|
||||||
generic_product_impl<Lhs, Rhs, DenseShape, SelfAdjointShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PlainObject m_result;
|
|
||||||
};
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
* Diagonal products
|
* Diagonal products
|
||||||
@ -933,45 +856,6 @@ struct generic_product_impl<Lhs, Transpose<Rhs>, DenseShape, PermutationShape, P
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: left/right and self-adj/symmetric/permutation look the same ... Too much boilerplate?
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, PermutationShape, DenseShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar>
|
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
|
||||||
{
|
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
||||||
typedef typename XprType::PlainObject PlainObject;
|
|
||||||
typedef typename evaluator<PlainObject>::type Base;
|
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
|
||||||
: m_result(xpr.rows(), xpr.cols())
|
|
||||||
{
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
|
||||||
generic_product_impl<Lhs, Rhs, PermutationShape, DenseShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PlainObject m_result;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, DenseShape, PermutationShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar>
|
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
|
||||||
{
|
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
||||||
typedef typename XprType::PlainObject PlainObject;
|
|
||||||
typedef typename evaluator<PlainObject>::type Base;
|
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
|
||||||
: m_result(xpr.rows(), xpr.cols())
|
|
||||||
{
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
|
||||||
generic_product_impl<Lhs, Rhs, DenseShape, PermutationShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PlainObject m_result;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
@ -48,8 +48,10 @@ struct traits<Homogeneous<MatrixType,Direction> >
|
|||||||
TmpFlags = _MatrixTypeNested::Flags & HereditaryBits,
|
TmpFlags = _MatrixTypeNested::Flags & HereditaryBits,
|
||||||
Flags = ColsAtCompileTime==1 ? (TmpFlags & ~RowMajorBit)
|
Flags = ColsAtCompileTime==1 ? (TmpFlags & ~RowMajorBit)
|
||||||
: RowsAtCompileTime==1 ? (TmpFlags | RowMajorBit)
|
: RowsAtCompileTime==1 ? (TmpFlags | RowMajorBit)
|
||||||
: TmpFlags,
|
: TmpFlags
|
||||||
CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
#ifndef EIGEN_TEST_EVALUATORS
|
||||||
|
, CoeffReadCost = _MatrixTypeNested::CoeffReadCost
|
||||||
|
#endif // EIGEN_TEST_EVALUATORS
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -63,6 +65,7 @@ template<typename MatrixType,int _Direction> class Homogeneous
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
typedef MatrixType NestedExpression;
|
||||||
enum { Direction = _Direction };
|
enum { Direction = _Direction };
|
||||||
|
|
||||||
typedef MatrixBase<Homogeneous> Base;
|
typedef MatrixBase<Homogeneous> Base;
|
||||||
@ -74,7 +77,10 @@ template<typename MatrixType,int _Direction> class Homogeneous
|
|||||||
|
|
||||||
inline Index rows() const { return m_matrix.rows() + (int(Direction)==Vertical ? 1 : 0); }
|
inline Index rows() const { return m_matrix.rows() + (int(Direction)==Vertical ? 1 : 0); }
|
||||||
inline Index cols() const { return m_matrix.cols() + (int(Direction)==Horizontal ? 1 : 0); }
|
inline Index cols() const { return m_matrix.cols() + (int(Direction)==Horizontal ? 1 : 0); }
|
||||||
|
|
||||||
|
const NestedExpression& nestedExpression() const { return m_matrix; }
|
||||||
|
|
||||||
|
#ifndef EIGEN_TEST_EVALUATORS
|
||||||
inline Scalar coeff(Index row, Index col) const
|
inline Scalar coeff(Index row, Index col) const
|
||||||
{
|
{
|
||||||
if( (int(Direction)==Vertical && row==m_matrix.rows())
|
if( (int(Direction)==Vertical && row==m_matrix.rows())
|
||||||
@ -106,6 +112,31 @@ template<typename MatrixType,int _Direction> class Homogeneous
|
|||||||
eigen_assert(int(Direction)==Vertical);
|
eigen_assert(int(Direction)==Vertical);
|
||||||
return internal::homogeneous_left_product_impl<Homogeneous,Transform<Scalar,Dim,Mode,Options> >(lhs,rhs.m_matrix);
|
return internal::homogeneous_left_product_impl<Homogeneous,Transform<Scalar,Dim,Mode,Options> >(lhs,rhs.m_matrix);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
template<typename Rhs>
|
||||||
|
inline const Product<Homogeneous,Rhs>
|
||||||
|
operator* (const MatrixBase<Rhs>& rhs) const
|
||||||
|
{
|
||||||
|
eigen_assert(int(Direction)==Horizontal);
|
||||||
|
return Product<Homogeneous,Rhs>(*this,rhs.derived());
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Lhs> friend
|
||||||
|
inline const Product<Lhs,Homogeneous>
|
||||||
|
operator* (const MatrixBase<Lhs>& lhs, const Homogeneous& rhs)
|
||||||
|
{
|
||||||
|
eigen_assert(int(Direction)==Vertical);
|
||||||
|
return Product<Lhs,Homogeneous>(lhs.derived(),rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
template<typename Scalar, int Dim, int Mode, int Options> friend
|
||||||
|
inline const Product<Transform<Scalar,Dim,Mode,Options>, Homogeneous >
|
||||||
|
operator* (const Transform<Scalar,Dim,Mode,Options>& lhs, const Homogeneous& rhs)
|
||||||
|
{
|
||||||
|
eigen_assert(int(Direction)==Vertical);
|
||||||
|
return Product<Transform<Scalar,Dim,Mode,Options>, Homogeneous>(lhs,rhs);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typename MatrixType::Nested m_matrix;
|
typename MatrixType::Nested m_matrix;
|
||||||
@ -300,6 +331,146 @@ struct homogeneous_right_product_impl<Homogeneous<MatrixType,Horizontal>,Rhs>
|
|||||||
typename Rhs::Nested m_rhs;
|
typename Rhs::Nested m_rhs;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef EIGEN_TEST_EVALUATORS
|
||||||
|
template<typename ArgType,int Direction>
|
||||||
|
struct unary_evaluator<Homogeneous<ArgType,Direction>, IndexBased>
|
||||||
|
: evaluator<typename Homogeneous<ArgType,Direction>::PlainObject >::type
|
||||||
|
{
|
||||||
|
typedef Homogeneous<ArgType,Direction> XprType;
|
||||||
|
typedef typename XprType::PlainObject PlainObject;
|
||||||
|
typedef typename evaluator<PlainObject>::type Base;
|
||||||
|
|
||||||
|
unary_evaluator(const XprType& op)
|
||||||
|
: Base(), m_temp(op)
|
||||||
|
{
|
||||||
|
::new (static_cast<Base*>(this)) Base(m_temp);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
PlainObject m_temp;
|
||||||
|
};
|
||||||
|
|
||||||
|
// dense = homogeneous
|
||||||
|
template< typename DstXprType, typename ArgType, typename Scalar>
|
||||||
|
struct Assignment<DstXprType, Homogeneous<ArgType,Vertical>, internal::assign_op<Scalar>, Dense2Dense, Scalar>
|
||||||
|
{
|
||||||
|
typedef Homogeneous<ArgType,Vertical> SrcXprType;
|
||||||
|
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<Scalar> &)
|
||||||
|
{
|
||||||
|
dst.template topRows<ArgType::RowsAtCompileTime>(src.nestedExpression().rows()) = src.nestedExpression();
|
||||||
|
// dst.topRows(src.nestedExpression().rows()) = src.nestedExpression();
|
||||||
|
dst.row(dst.rows()-1).setOnes();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// dense = homogeneous
|
||||||
|
template< typename DstXprType, typename ArgType, typename Scalar>
|
||||||
|
struct Assignment<DstXprType, Homogeneous<ArgType,Horizontal>, internal::assign_op<Scalar>, Dense2Dense, Scalar>
|
||||||
|
{
|
||||||
|
typedef Homogeneous<ArgType,Horizontal> SrcXprType;
|
||||||
|
static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op<Scalar> &)
|
||||||
|
{
|
||||||
|
dst.template leftCols<ArgType::ColsAtCompileTime>(src.nestedExpression().cols()) = src.nestedExpression();
|
||||||
|
// dst.leftCols(src.nestedExpression().cols()) = src.nestedExpression();
|
||||||
|
dst.col(dst.cols()-1).setOnes();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename LhsArg, typename Rhs, int ProductTag>
|
||||||
|
struct generic_product_impl<Homogeneous<LhsArg,Horizontal>, Rhs, DenseShape, DenseShape, ProductTag>
|
||||||
|
{
|
||||||
|
template<typename Dest>
|
||||||
|
static void evalTo(Dest& dst, const Homogeneous<LhsArg,Horizontal>& lhs, const Rhs& rhs)
|
||||||
|
{
|
||||||
|
homogeneous_right_product_impl<Homogeneous<LhsArg,Horizontal>, Rhs>(lhs.nestedExpression(), rhs).evalTo(dst);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Lhs, typename RhsArg, int ProductTag>
|
||||||
|
struct generic_product_impl<Lhs, Homogeneous<RhsArg,Vertical>, DenseShape, DenseShape, ProductTag>
|
||||||
|
{
|
||||||
|
template<typename Dest>
|
||||||
|
static void evalTo(Dest& dst, const Lhs& lhs, const Homogeneous<RhsArg,Vertical>& rhs)
|
||||||
|
{
|
||||||
|
homogeneous_left_product_impl<Homogeneous<RhsArg,Vertical>, Lhs>(rhs.nestedExpression(), lhs).evalTo(dst);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Scalar, int Dim, int Mode,int Options, typename RhsArg, int ProductTag>
|
||||||
|
struct generic_product_impl<Transform<Scalar,Dim,Mode,Options>, Homogeneous<RhsArg,Vertical>, DenseShape, DenseShape, ProductTag>
|
||||||
|
{
|
||||||
|
typedef Transform<Scalar,Dim,Mode,Options> TransformType;
|
||||||
|
template<typename Dest>
|
||||||
|
static void evalTo(Dest& dst, const TransformType& lhs, const Homogeneous<RhsArg,Vertical>& rhs)
|
||||||
|
{
|
||||||
|
homogeneous_left_product_impl<Homogeneous<RhsArg,Vertical>, TransformType>(rhs.nestedExpression(), lhs).evalTo(dst);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template<typename LhsArg, typename Rhs, int ProductTag>
|
||||||
|
struct product_evaluator<Product<Homogeneous<LhsArg,Horizontal>, Rhs, DefaultProduct>, ProductTag, DenseShape, DenseShape, typename traits<LhsArg>::Scalar, typename traits<Rhs>::Scalar>
|
||||||
|
: public evaluator<typename Product<Homogeneous<LhsArg,Horizontal>, Rhs, DefaultProduct>::PlainObject>::type
|
||||||
|
{
|
||||||
|
typedef Homogeneous<LhsArg,Horizontal> Lhs;
|
||||||
|
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
||||||
|
typedef typename XprType::PlainObject PlainObject;
|
||||||
|
typedef typename evaluator<PlainObject>::type Base;
|
||||||
|
|
||||||
|
product_evaluator(const XprType& xpr)
|
||||||
|
: m_result(xpr.rows(), xpr.cols())
|
||||||
|
{
|
||||||
|
::new (static_cast<Base*>(this)) Base(m_result);
|
||||||
|
generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
PlainObject m_result;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Lhs, typename RhsArg, int ProductTag>
|
||||||
|
struct product_evaluator<Product<Lhs, Homogeneous<RhsArg,Vertical>, DefaultProduct>, ProductTag, DenseShape, DenseShape, typename traits<Lhs>::Scalar, typename traits<RhsArg>::Scalar>
|
||||||
|
: public evaluator<typename Product<Lhs, Homogeneous<RhsArg,Vertical>, DefaultProduct>::PlainObject>::type
|
||||||
|
{
|
||||||
|
typedef Homogeneous<RhsArg,Vertical> Rhs;
|
||||||
|
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
||||||
|
typedef typename XprType::PlainObject PlainObject;
|
||||||
|
typedef typename evaluator<PlainObject>::type Base;
|
||||||
|
|
||||||
|
product_evaluator(const XprType& xpr)
|
||||||
|
: m_result(xpr.rows(), xpr.cols())
|
||||||
|
{
|
||||||
|
::new (static_cast<Base*>(this)) Base(m_result);
|
||||||
|
generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
PlainObject m_result;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename Scalar, int Dim, int Mode,int Options, typename RhsArg, int ProductTag>
|
||||||
|
struct product_evaluator<Product<Transform<Scalar,Dim,Mode,Options>, Homogeneous<RhsArg,Vertical>, DefaultProduct>, ProductTag, DenseShape, DenseShape, Scalar, typename traits<RhsArg>::Scalar>
|
||||||
|
: public evaluator<typename Product<Transform<Scalar,Dim,Mode,Options>, Homogeneous<RhsArg,Vertical>, DefaultProduct>::PlainObject>::type
|
||||||
|
{
|
||||||
|
typedef Transform<Scalar,Dim,Mode,Options> Lhs;
|
||||||
|
typedef Homogeneous<RhsArg,Vertical> Rhs;
|
||||||
|
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
||||||
|
typedef typename XprType::PlainObject PlainObject;
|
||||||
|
typedef typename evaluator<PlainObject>::type Base;
|
||||||
|
|
||||||
|
product_evaluator(const XprType& xpr)
|
||||||
|
: m_result(xpr.rows(), xpr.cols())
|
||||||
|
{
|
||||||
|
::new (static_cast<Base*>(this)) Base(m_result);
|
||||||
|
generic_product_impl<Lhs, Rhs, DenseShape, DenseShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
PlainObject m_result;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // EIGEN_TEST_EVALUATORS
|
||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
||||||
} // end namespace Eigen
|
} // end namespace Eigen
|
||||||
|
@ -62,6 +62,23 @@ struct transform_construct_from_matrix;
|
|||||||
|
|
||||||
template<typename TransformType> struct transform_take_affine_part;
|
template<typename TransformType> struct transform_take_affine_part;
|
||||||
|
|
||||||
|
#ifdef EIGEN_TEST_EVALUATORS
|
||||||
|
template<typename _Scalar, int _Dim, int _Mode, int _Options>
|
||||||
|
struct traits<Transform<_Scalar,_Dim,_Mode,_Options> >
|
||||||
|
{
|
||||||
|
typedef _Scalar Scalar;
|
||||||
|
typedef DenseIndex Index;
|
||||||
|
typedef Dense StorageKind;
|
||||||
|
enum {
|
||||||
|
RowsAtCompileTime = _Dim,
|
||||||
|
ColsAtCompileTime = _Dim,
|
||||||
|
MaxRowsAtCompileTime = _Dim,
|
||||||
|
MaxColsAtCompileTime = _Dim,
|
||||||
|
Flags = 0
|
||||||
|
};
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
} // end namespace internal
|
} // end namespace internal
|
||||||
|
|
||||||
/** \geometry_module \ingroup Geometry_Module
|
/** \geometry_module \ingroup Geometry_Module
|
||||||
@ -355,6 +372,11 @@ public:
|
|||||||
inline Transform& operator=(const QTransform& other);
|
inline Transform& operator=(const QTransform& other);
|
||||||
inline QTransform toQTransform(void) const;
|
inline QTransform toQTransform(void) const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EIGEN_TEST_EVALUATORS
|
||||||
|
Index rows() const { return m_matrix.cols(); }
|
||||||
|
Index cols() const { return m_matrix.cols(); }
|
||||||
|
#endif
|
||||||
|
|
||||||
/** shortcut for m_matrix(row,col);
|
/** shortcut for m_matrix(row,col);
|
||||||
* \sa MatrixBase::operator(Index,Index) const */
|
* \sa MatrixBase::operator(Index,Index) const */
|
||||||
|
@ -410,44 +410,6 @@ struct generic_product_impl<Lhs, Rhs, DenseShape, SparseShape, ProductType>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, SparseShape, DenseShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
|
||||||
{
|
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
||||||
typedef typename XprType::PlainObject PlainObject;
|
|
||||||
typedef typename evaluator<PlainObject>::type Base;
|
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
|
||||||
: m_result(xpr.rows(), xpr.cols())
|
|
||||||
{
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
|
||||||
generic_product_impl<Lhs, Rhs, SparseShape, DenseShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PlainObject m_result;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, DenseShape, SparseShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
|
||||||
{
|
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
||||||
typedef typename XprType::PlainObject PlainObject;
|
|
||||||
typedef typename evaluator<PlainObject>::type Base;
|
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
|
||||||
: m_result(xpr.rows(), xpr.cols())
|
|
||||||
{
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
|
||||||
generic_product_impl<Lhs, Rhs, DenseShape, SparseShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PlainObject m_result;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename LhsT, typename RhsT, bool Transpose>
|
template<typename LhsT, typename RhsT, bool Transpose>
|
||||||
struct sparse_dense_outer_product_evaluator
|
struct sparse_dense_outer_product_evaluator
|
||||||
{
|
{
|
||||||
@ -530,7 +492,7 @@ protected:
|
|||||||
|
|
||||||
// sparse * dense outer product
|
// sparse * dense outer product
|
||||||
template<typename Lhs, typename Rhs>
|
template<typename Lhs, typename Rhs>
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, OuterProduct, SparseShape, DenseShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, OuterProduct, SparseShape, DenseShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar>
|
||||||
: sparse_dense_outer_product_evaluator<Lhs,Rhs, Lhs::IsRowMajor>
|
: sparse_dense_outer_product_evaluator<Lhs,Rhs, Lhs::IsRowMajor>
|
||||||
{
|
{
|
||||||
typedef sparse_dense_outer_product_evaluator<Lhs,Rhs, Lhs::IsRowMajor> Base;
|
typedef sparse_dense_outer_product_evaluator<Lhs,Rhs, Lhs::IsRowMajor> Base;
|
||||||
@ -545,7 +507,7 @@ struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, OuterProduct, Sparse
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs>
|
template<typename Lhs, typename Rhs>
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, OuterProduct, DenseShape, SparseShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, OuterProduct, DenseShape, SparseShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar>
|
||||||
: sparse_dense_outer_product_evaluator<Lhs,Rhs, Rhs::IsRowMajor>
|
: sparse_dense_outer_product_evaluator<Lhs,Rhs, Rhs::IsRowMajor>
|
||||||
{
|
{
|
||||||
typedef sparse_dense_outer_product_evaluator<Lhs,Rhs, Rhs::IsRowMajor> Base;
|
typedef sparse_dense_outer_product_evaluator<Lhs,Rhs, Rhs::IsRowMajor> Base;
|
||||||
|
@ -197,11 +197,11 @@ enum {
|
|||||||
template<typename SparseXprType, typename DiagonalCoeffType, int SDP_Tag>
|
template<typename SparseXprType, typename DiagonalCoeffType, int SDP_Tag>
|
||||||
struct sparse_diagonal_product_evaluator;
|
struct sparse_diagonal_product_evaluator;
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int Options, int ProductTag>
|
template<typename Lhs, typename Rhs, int ProductTag>
|
||||||
struct product_evaluator<Product<Lhs, Rhs, Options>, ProductTag, DiagonalShape, SparseShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, DiagonalShape, SparseShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar>
|
||||||
: public sparse_diagonal_product_evaluator<Rhs, typename Lhs::DiagonalVectorType, Rhs::Flags&RowMajorBit?SDP_AsScalarProduct:SDP_AsCwiseProduct>
|
: public sparse_diagonal_product_evaluator<Rhs, typename Lhs::DiagonalVectorType, Rhs::Flags&RowMajorBit?SDP_AsScalarProduct:SDP_AsCwiseProduct>
|
||||||
{
|
{
|
||||||
typedef Product<Lhs, Rhs, Options> XprType;
|
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
||||||
typedef evaluator<XprType> type;
|
typedef evaluator<XprType> type;
|
||||||
typedef evaluator<XprType> nestedType;
|
typedef evaluator<XprType> nestedType;
|
||||||
enum { CoeffReadCost = Dynamic, Flags = Rhs::Flags&RowMajorBit }; // FIXME CoeffReadCost & Flags
|
enum { CoeffReadCost = Dynamic, Flags = Rhs::Flags&RowMajorBit }; // FIXME CoeffReadCost & Flags
|
||||||
@ -210,11 +210,11 @@ struct product_evaluator<Product<Lhs, Rhs, Options>, ProductTag, DiagonalShape,
|
|||||||
product_evaluator(const XprType& xpr) : Base(xpr.rhs(), xpr.lhs().diagonal()) {}
|
product_evaluator(const XprType& xpr) : Base(xpr.rhs(), xpr.lhs().diagonal()) {}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int Options, int ProductTag>
|
template<typename Lhs, typename Rhs, int ProductTag>
|
||||||
struct product_evaluator<Product<Lhs, Rhs, Options>, ProductTag, SparseShape, DiagonalShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, SparseShape, DiagonalShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar>
|
||||||
: public sparse_diagonal_product_evaluator<Lhs, Transpose<const typename Rhs::DiagonalVectorType>, Lhs::Flags&RowMajorBit?SDP_AsCwiseProduct:SDP_AsScalarProduct>
|
: public sparse_diagonal_product_evaluator<Lhs, Transpose<const typename Rhs::DiagonalVectorType>, Lhs::Flags&RowMajorBit?SDP_AsCwiseProduct:SDP_AsScalarProduct>
|
||||||
{
|
{
|
||||||
typedef Product<Lhs, Rhs, Options> XprType;
|
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
||||||
typedef evaluator<XprType> type;
|
typedef evaluator<XprType> type;
|
||||||
typedef evaluator<XprType> nestedType;
|
typedef evaluator<XprType> nestedType;
|
||||||
enum { CoeffReadCost = Dynamic, Flags = Lhs::Flags&RowMajorBit }; // FIXME CoeffReadCost & Flags
|
enum { CoeffReadCost = Dynamic, Flags = Lhs::Flags&RowMajorBit }; // FIXME CoeffReadCost & Flags
|
||||||
|
@ -196,6 +196,10 @@ struct generic_product_impl<Lhs, Transpose<Rhs>, SparseShape, PermutationShape,
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// TODO, the following two overloads are only needed to define the right temporary type through
|
||||||
|
// typename traits<permut_sparsematrix_product_retval<Rhs,Lhs,OnTheRight,false> >::ReturnType
|
||||||
|
// while it should be correctly handled by traits<Product<> >::PlainObject
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
template<typename Lhs, typename Rhs, int ProductTag>
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, PermutationShape, SparseShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar>
|
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, PermutationShape, SparseShape, typename traits<Lhs>::Scalar, typename traits<Rhs>::Scalar>
|
||||||
: public evaluator<typename traits<permut_sparsematrix_product_retval<Lhs,Rhs,OnTheRight,false> >::ReturnType>::type
|
: public evaluator<typename traits<permut_sparsematrix_product_retval<Lhs,Rhs,OnTheRight,false> >::ReturnType>::type
|
||||||
|
@ -224,25 +224,6 @@ struct generic_product_impl<Lhs, Rhs, SparseShape, SparseShape, ProductType>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, SparseShape, SparseShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
|
||||||
{
|
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
||||||
typedef typename XprType::PlainObject PlainObject;
|
|
||||||
typedef typename evaluator<PlainObject>::type Base;
|
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
|
||||||
: m_result(xpr.rows(), xpr.cols())
|
|
||||||
{
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
|
||||||
generic_product_impl<Lhs, Rhs, SparseShape, SparseShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PlainObject m_result;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int Options>
|
template<typename Lhs, typename Rhs, int Options>
|
||||||
struct evaluator<SparseView<Product<Lhs, Rhs, Options> > >
|
struct evaluator<SparseView<Product<Lhs, Rhs, Options> > >
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
||||||
|
@ -441,46 +441,11 @@ struct generic_product_impl<Lhs, RhsView, DenseShape, SparseSelfAdjointShape, Pr
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
// NOTE: these two overloads are needed to evaluate the sparse sefladjoint view into a full sparse matrix
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, SparseSelfAdjointShape, DenseShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
// TODO: maybe the copy could be handled by generic_product_impl so that these overloads would not be needed anymore
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
|
||||||
{
|
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
||||||
typedef typename XprType::PlainObject PlainObject;
|
|
||||||
typedef typename evaluator<PlainObject>::type Base;
|
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
|
||||||
: m_result(xpr.rows(), xpr.cols())
|
|
||||||
{
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
|
||||||
generic_product_impl<Lhs, Rhs, SparseSelfAdjointShape, DenseShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PlainObject m_result;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename Lhs, typename Rhs, int ProductTag>
|
|
||||||
struct product_evaluator<Product<Lhs, Rhs, DefaultProduct>, ProductTag, DenseShape, SparseSelfAdjointShape, typename Lhs::Scalar, typename Rhs::Scalar>
|
|
||||||
: public evaluator<typename Product<Lhs, Rhs, DefaultProduct>::PlainObject>::type
|
|
||||||
{
|
|
||||||
typedef Product<Lhs, Rhs, DefaultProduct> XprType;
|
|
||||||
typedef typename XprType::PlainObject PlainObject;
|
|
||||||
typedef typename evaluator<PlainObject>::type Base;
|
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
|
||||||
: m_result(xpr.rows(), xpr.cols())
|
|
||||||
{
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
|
||||||
generic_product_impl<Lhs, Rhs, DenseShape, SparseSelfAdjointShape, ProductTag>::evalTo(m_result, xpr.lhs(), xpr.rhs());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
|
||||||
PlainObject m_result;
|
|
||||||
};
|
|
||||||
|
|
||||||
template<typename LhsView, typename Rhs, int ProductTag>
|
template<typename LhsView, typename Rhs, int ProductTag>
|
||||||
struct product_evaluator<Product<LhsView, Rhs, DefaultProduct>, ProductTag, SparseSelfAdjointShape, SparseShape, typename LhsView::Scalar, typename Rhs::Scalar>
|
struct product_evaluator<Product<LhsView, Rhs, DefaultProduct>, ProductTag, SparseSelfAdjointShape, SparseShape, typename traits<LhsView>::Scalar, typename traits<Rhs>::Scalar>
|
||||||
: public evaluator<typename Product<typename Rhs::PlainObject, Rhs, DefaultProduct>::PlainObject>::type
|
: public evaluator<typename Product<typename Rhs::PlainObject, Rhs, DefaultProduct>::PlainObject>::type
|
||||||
{
|
{
|
||||||
typedef Product<LhsView, Rhs, DefaultProduct> XprType;
|
typedef Product<LhsView, Rhs, DefaultProduct> XprType;
|
||||||
@ -488,9 +453,8 @@ struct product_evaluator<Product<LhsView, Rhs, DefaultProduct>, ProductTag, Spar
|
|||||||
typedef typename evaluator<PlainObject>::type Base;
|
typedef typename evaluator<PlainObject>::type Base;
|
||||||
|
|
||||||
product_evaluator(const XprType& xpr)
|
product_evaluator(const XprType& xpr)
|
||||||
: /*m_lhs(xpr.lhs()),*/ m_result(xpr.rows(), xpr.cols())
|
: m_lhs(xpr.lhs()), m_result(xpr.rows(), xpr.cols())
|
||||||
{
|
{
|
||||||
m_lhs = xpr.lhs();
|
|
||||||
::new (static_cast<Base*>(this)) Base(m_result);
|
::new (static_cast<Base*>(this)) Base(m_result);
|
||||||
generic_product_impl<typename Rhs::PlainObject, Rhs, SparseShape, SparseShape, ProductTag>::evalTo(m_result, m_lhs, xpr.rhs());
|
generic_product_impl<typename Rhs::PlainObject, Rhs, SparseShape, SparseShape, ProductTag>::evalTo(m_result, m_lhs, xpr.rhs());
|
||||||
}
|
}
|
||||||
@ -501,7 +465,7 @@ protected:
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<typename Lhs, typename RhsView, int ProductTag>
|
template<typename Lhs, typename RhsView, int ProductTag>
|
||||||
struct product_evaluator<Product<Lhs, RhsView, DefaultProduct>, ProductTag, SparseShape, SparseSelfAdjointShape, typename Lhs::Scalar, typename RhsView::Scalar>
|
struct product_evaluator<Product<Lhs, RhsView, DefaultProduct>, ProductTag, SparseShape, SparseSelfAdjointShape, typename traits<Lhs>::Scalar, typename traits<RhsView>::Scalar>
|
||||||
: public evaluator<typename Product<Lhs, typename Lhs::PlainObject, DefaultProduct>::PlainObject>::type
|
: public evaluator<typename Product<Lhs, typename Lhs::PlainObject, DefaultProduct>::PlainObject>::type
|
||||||
{
|
{
|
||||||
typedef Product<Lhs, RhsView, DefaultProduct> XprType;
|
typedef Product<Lhs, RhsView, DefaultProduct> XprType;
|
||||||
|
@ -279,13 +279,7 @@ inline bool test_isApproxOrLessThan(const long double& a, const long double& b)
|
|||||||
template<typename Type1, typename Type2>
|
template<typename Type1, typename Type2>
|
||||||
inline bool test_isApprox(const Type1& a, const Type2& b)
|
inline bool test_isApprox(const Type1& a, const Type2& b)
|
||||||
{
|
{
|
||||||
#ifdef EIGEN_TEST_EVALUATORS
|
|
||||||
typename internal::eval<Type1>::type a_eval(a);
|
|
||||||
typename internal::eval<Type2>::type b_eval(b);
|
|
||||||
return a_eval.isApprox(b_eval, test_precision<typename Type1::Scalar>());
|
|
||||||
#else
|
|
||||||
return a.isApprox(b, test_precision<typename Type1::Scalar>());
|
return a.isApprox(b, test_precision<typename Type1::Scalar>());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// The idea behind this function is to compare the two scalars a and b where
|
// The idea behind this function is to compare the two scalars a and b where
|
||||||
|
Loading…
x
Reference in New Issue
Block a user