aboutsummaryrefslogtreecommitdiffhomepage
path: root/Eigen/src/Householder
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-08-04 00:27:58 +0200
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-08-04 00:27:58 +0200
commit4436a4d68c598abed80a123a6a907df65e2ab366 (patch)
treec53def5bebafd25b9db4a3f16f994b57735e7105 /Eigen/src/Householder
parent523cdedf58a95c02c73ede59fe9d22c5799a9df5 (diff)
use explicit Block/VectorBlock xprs to make sure that compile-time known sizes are used
Diffstat (limited to 'Eigen/src/Householder')
-rw-r--r--Eigen/src/Householder/Householder.h19
1 files 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<Derived>::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<Derived, EssentialPart::SizeAtCompileTime> 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<Derived>::applyHouseholderOnTheLeft(
const RealScalar& beta)
{
Matrix<Scalar, 1, ColsAtCompileTime, PlainMatrixType::Options, 1, MaxColsAtCompileTime> 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<Derived, EssentialPart::SizeAtCompileTime, Derived::ColsAtCompileTime> 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<typename Derived>
@@ -77,12 +76,10 @@ void MatrixBase<Derived>::applyHouseholderOnTheRight(
const RealScalar& beta)
{
Matrix<Scalar, RowsAtCompileTime, 1, PlainMatrixType::Options, MaxRowsAtCompileTime, 1> 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<Derived, Derived::RowsAtCompileTime, EssentialPart::SizeAtCompileTime> 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