mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Fix 1x1 selfadjoint matrix-vector product bug
This commit is contained in:
@@ -173,6 +173,11 @@ struct selfadjoint_product_impl<Lhs, LhsMode, false, Rhs, 0, true> {
|
|||||||
|
|
||||||
eigen_assert(dest.rows() == a_lhs.rows() && dest.cols() == a_rhs.cols());
|
eigen_assert(dest.rows() == a_lhs.rows() && dest.cols() == a_rhs.cols());
|
||||||
|
|
||||||
|
if (a_lhs.rows() == 1) {
|
||||||
|
dest = (alpha * a_lhs.coeff(0, 0)) * a_rhs;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
add_const_on_value_type_t<ActualLhsType> lhs = LhsBlasTraits::extract(a_lhs);
|
add_const_on_value_type_t<ActualLhsType> lhs = LhsBlasTraits::extract(a_lhs);
|
||||||
add_const_on_value_type_t<ActualRhsType> rhs = RhsBlasTraits::extract(a_rhs);
|
add_const_on_value_type_t<ActualRhsType> rhs = RhsBlasTraits::extract(a_rhs);
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,10 @@ void product_selfadjoint(const MatrixType& m) {
|
|||||||
v1.tail(rows - 1) * v2.head(cols - 1).adjoint() + v2.head(cols - 1) * v1.tail(rows - 1).adjoint();
|
v1.tail(rows - 1) * v2.head(cols - 1).adjoint() + v2.head(cols - 1) * v1.tail(rows - 1).adjoint();
|
||||||
VERIFY_IS_APPROX(m2, m3.template triangularView<Lower>().toDenseMatrix());
|
VERIFY_IS_APPROX(m2, m3.template triangularView<Lower>().toDenseMatrix());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// matrix-vector
|
||||||
|
m2 = m1.template triangularView<Lower>();
|
||||||
|
VERIFY_IS_APPROX(m1 * m4, m2.template selfadjointView<Lower>() * m4);
|
||||||
}
|
}
|
||||||
|
|
||||||
EIGEN_DECLARE_TEST(product_selfadjoint) {
|
EIGEN_DECLARE_TEST(product_selfadjoint) {
|
||||||
|
|||||||
Reference in New Issue
Block a user