fix dynamic allocation for fixed size objects in matrix-vector product

This commit is contained in:
Gael Guennebaud
2011-01-31 21:30:27 +01:00
parent 5ca407de54
commit f46ace61d3
2 changed files with 74 additions and 17 deletions

View File

@@ -71,6 +71,16 @@ 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();
m2.col(0).noalias() -= m1.adjoint() * m1.row(0).adjoint();
m2.row(0).noalias() = m1.row(0) * m1;
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();
}
template<typename Scalar>