From 4436a4d68c598abed80a123a6a907df65e2ab366 Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Tue, 4 Aug 2009 00:27:58 +0200 Subject: [PATCH] use explicit Block/VectorBlock xprs to make sure that compile-time known sizes are used --- Eigen/src/Householder/Householder.h | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index b5571f40d..8972806de 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -50,7 +50,8 @@ void MatrixBase::makeHouseholder( Scalar sign = coeff(0) / ei_abs(coeff(0)); c0 = coeff(0) + sign * ei_sqrt(_squaredNorm); } - *essential = end(size()-1) / c0; // FIXME take advantage of fixed size + VectorBlock tail(derived(), 1, size()-1); + *essential = tail / c0; const RealScalar c0abs2 = ei_abs2(c0); *beta = RealScalar(2) * c0abs2 / (c0abs2 + _squaredNorm - ei_abs2(coeff(0))); } @@ -62,12 +63,10 @@ void MatrixBase::applyHouseholderOnTheLeft( const RealScalar& beta) { Matrix tmp(cols()); - tmp = row(0) + essential.adjoint() * block(1,0,rows()-1,cols()); - // FIXME take advantage of fixed size - // FIXME play with lazy() - // FIXME maybe not a good idea to use matrix product + Block bottom(derived(), 1, 0, rows()-1, cols()); + tmp = row(0) + essential.adjoint() * bottom; row(0) -= beta * tmp; - block(1,0,rows()-1,cols()) -= beta * essential * tmp; + bottom -= beta * essential * tmp; } template @@ -77,12 +76,10 @@ void MatrixBase::applyHouseholderOnTheRight( const RealScalar& beta) { Matrix tmp(rows()); - tmp = col(0) + block(0,1,rows(),cols()-1) * essential.conjugate(); - // FIXME take advantage of fixed size - // FIXME play with lazy() - // FIXME maybe not a good idea to use matrix product + Block right(derived(), 0, 1, rows(), cols()-1); + tmp = col(0) + right * essential.conjugate(); col(0) -= beta * tmp; - block(0,1,rows(),cols()-1) -= beta * tmp * essential.transpose(); + right -= beta * tmp * essential.transpose(); } #endif // EIGEN_HOUSEHOLDER_H