diff options
author | 2009-08-26 00:24:22 +0200 | |
---|---|---|
committer | 2009-08-26 00:24:22 +0200 | |
commit | 37054987217d04cf649ba86324092bc14e9f0788 (patch) | |
tree | fdb38471f97e7d9255ed0c92f2778b91a7dded41 /Eigen/src/Core | |
parent | d0a5da95b1236a6051f8a359dc4737f4b49d235f (diff) |
add coeff(int,int), coeff(int) and value() functions to the inner product specialization
Diffstat (limited to 'Eigen/src/Core')
-rw-r--r-- | Eigen/src/Core/Product.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index d70344deb..71203a362 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -164,11 +164,20 @@ class GeneralProduct<Lhs, Rhs, InnerProduct> GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {} + EIGEN_STRONG_INLINE Scalar value() const + { + return (m_lhs.transpose().cwise()*m_rhs).sum(); + } + template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const { ei_assert(dst.rows()==1 && dst.cols()==1); - dst.coeffRef(0,0) += alpha * (m_lhs.transpose().cwise()*m_rhs).sum(); + dst.coeffRef(0,0) += alpha * value(); } + + EIGEN_STRONG_INLINE Scalar coeff(int, int) const { return value(); } + + EIGEN_STRONG_INLINE Scalar coeff(int) const { return value(); } }; /*********************************************************************** |