mirror of
https://gitlab.com/libeigen/eigen.git
synced 2025-01-18 14:34:17 +08:00
add coeff(int,int), coeff(int) and value() functions to the inner product specialization
This commit is contained in:
parent
d0a5da95b1
commit
3705498721
@ -164,11 +164,20 @@ class GeneralProduct<Lhs, Rhs, InnerProduct>
|
|||||||
|
|
||||||
GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) {}
|
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
|
template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const
|
||||||
{
|
{
|
||||||
ei_assert(dst.rows()==1 && dst.cols()==1);
|
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(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
Loading…
Reference in New Issue
Block a user