diff options
Diffstat (limited to 'Eigen/src/Core/Product.h')
-rw-r--r-- | Eigen/src/Core/Product.h | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 22240b37a..156f043b7 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -169,33 +169,19 @@ struct ei_traits<GeneralProduct<Lhs,Rhs,InnerProduct> > template<typename Lhs, typename Rhs> class GeneralProduct<Lhs, Rhs, InnerProduct> : ei_no_assignment_operator, - public MatrixBase<GeneralProduct<Lhs, Rhs, InnerProduct> > + public Matrix<typename ei_scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> { + typedef Matrix<typename ei_scalar_product_traits<typename Lhs::Scalar, typename Rhs::Scalar>::ReturnType,1,1> Base; public: - typedef MatrixBase<GeneralProduct> Base; - EIGEN_DENSE_PUBLIC_INTERFACE(GeneralProduct) - - EIGEN_DONT_INLINE GeneralProduct(const Lhs& lhs, const Rhs& rhs) + GeneralProduct(const Lhs& lhs, const Rhs& rhs) { EIGEN_STATIC_ASSERT((ei_is_same_type<typename Lhs::RealScalar, typename Rhs::RealScalar>::ret), YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - m_value = (lhs.transpose().cwiseProduct(rhs)).sum(); - } - - int rows() const { return 1; } - int cols() const { return 1; } - - EIGEN_STRONG_INLINE Scalar value() const - { - return m_value; + Base::coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum(); } - EIGEN_STRONG_INLINE Scalar coeff(int, int) const { return value(); } - - EIGEN_STRONG_INLINE Scalar coeff(int) const { return value(); } - protected: - Scalar m_value; + typename Base::Scalar value() const { return Base::coeff(0,0); } }; /*********************************************************************** |