mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
added optimized matrix times diagonal matrix product via Diagonal flag shortcut.
This commit is contained in:
@@ -76,6 +76,14 @@ MatrixBase<Derived>::cwisePow(const Scalar& exponent) const
|
||||
(derived(), ei_scalar_pow_op<Scalar>(exponent));
|
||||
}
|
||||
|
||||
/** \returns an expression of the coefficient-wise reciprocal of *this. */
|
||||
template<typename Derived>
|
||||
inline const CwiseUnaryOp<ei_scalar_inverse_op<typename ei_traits<Derived>::Scalar>, Derived>
|
||||
MatrixBase<Derived>::cwiseInverse() const
|
||||
{
|
||||
return derived();
|
||||
}
|
||||
|
||||
// -- binary operators --
|
||||
|
||||
/** \returns an expression of the coefficient-wise \< operator of *this and \a other
|
||||
|
||||
@@ -100,6 +100,19 @@ template<typename Scalar>
|
||||
struct ei_functor_traits<ei_scalar_pow_op<Scalar> >
|
||||
{ enum { Cost = 5 * NumTraits<Scalar>::MulCost, IsVectorizable = false }; };
|
||||
|
||||
/** \internal
|
||||
* \brief Template functor to compute the reciprocal of a scalar
|
||||
*
|
||||
* \sa class CwiseUnaryOp, MatrixBase::cwiseInverse
|
||||
*/
|
||||
template<typename Scalar>
|
||||
struct ei_scalar_inverse_op {
|
||||
inline Scalar operator() (const Scalar& a) const { return Scalar(1)/a; }
|
||||
};
|
||||
template<typename Scalar>
|
||||
struct ei_functor_traits<ei_scalar_inverse_op<Scalar> >
|
||||
{ enum { Cost = NumTraits<Scalar>::MulCost, IsVectorizable = false }; };
|
||||
|
||||
// default ei_functor_traits for STL functors:
|
||||
|
||||
template<typename T>
|
||||
|
||||
Reference in New Issue
Block a user