fix trmv regarding strided vectors and static allocation of temporaries

This commit is contained in:
Gael Guennebaud
2011-02-01 11:38:46 +01:00
parent 0fdd01fe24
commit c60818fca8
3 changed files with 198 additions and 30 deletions

View File

@@ -71,7 +71,7 @@ template<typename MatrixType> void nomalloc(const MatrixType& m)
VERIFY_IS_APPROX((m1+m2)(r,c), (m1(r,c))+(m2(r,c)));
VERIFY_IS_APPROX(m1.cwiseProduct(m1.block(0,0,rows,cols)), (m1.array()*m1.array()).matrix());
VERIFY_IS_APPROX((m1*m1.transpose())*m2, m1*(m1.transpose()*m2));
m2.col(0).noalias() = m1 * m1.col(0);
m2.col(0).noalias() -= m1.adjoint() * m1.col(0);
m2.col(0).noalias() -= m1 * m1.row(0).adjoint();
@@ -81,6 +81,36 @@ template<typename MatrixType> void nomalloc(const MatrixType& m)
m2.row(0).noalias() -= m1.row(0) * m1.adjoint();
m2.row(0).noalias() -= m1.col(0).adjoint() * m1;
m2.row(0).noalias() -= m1.col(0).adjoint() * m1.adjoint();
VERIFY_IS_APPROX(m2,m2);
m2.col(0).noalias() = m1.template triangularView<Upper>() * m1.col(0);
m2.col(0).noalias() -= m1.adjoint().template triangularView<Upper>() * m1.col(0);
m2.col(0).noalias() -= m1.template triangularView<Upper>() * m1.row(0).adjoint();
m2.col(0).noalias() -= m1.adjoint().template triangularView<Upper>() * m1.row(0).adjoint();
m2.row(0).noalias() = m1.row(0) * m1.template triangularView<Upper>();
m2.row(0).noalias() -= m1.row(0) * m1.adjoint().template triangularView<Upper>();
m2.row(0).noalias() -= m1.col(0).adjoint() * m1.template triangularView<Upper>();
m2.row(0).noalias() -= m1.col(0).adjoint() * m1.adjoint().template triangularView<Upper>();
VERIFY_IS_APPROX(m2,m2);
m2.col(0).noalias() = m1.template selfadjointView<Upper>() * m1.col(0);
m2.col(0).noalias() -= m1.adjoint().template selfadjointView<Upper>() * m1.col(0);
m2.col(0).noalias() -= m1.template selfadjointView<Upper>() * m1.row(0).adjoint();
m2.col(0).noalias() -= m1.adjoint().template selfadjointView<Upper>() * m1.row(0).adjoint();
m2.row(0).noalias() = m1.row(0) * m1.template selfadjointView<Upper>();
m2.row(0).noalias() -= m1.row(0) * m1.adjoint().template selfadjointView<Upper>();
m2.row(0).noalias() -= m1.col(0).adjoint() * m1.template selfadjointView<Upper>();
m2.row(0).noalias() -= m1.col(0).adjoint() * m1.adjoint().template selfadjointView<Upper>();
VERIFY_IS_APPROX(m2,m2);
// The following fancy matrix-matrix products are not safe yet regarding static allocation
// m1 += m1.template triangularView<Upper>() * m2.col(;
// m1.template selfadjointView<Lower>().rankUpdate(m2);
// m1 += m1.template triangularView<Upper>() * m2;
// m1 += m1.template selfadjointView<Lower>() * m2;
// VERIFY_IS_APPROX(m1,m1);
}
template<typename Scalar>