diff options
author | Gael Guennebaud <g.gael@free.fr> | 2009-08-15 13:12:50 +0200 |
---|---|---|
committer | Gael Guennebaud <g.gael@free.fr> | 2009-08-15 13:12:50 +0200 |
commit | 13a8956188d1c8441c01a6218dc24c745ff0b210 (patch) | |
tree | 2012391d821debd79cbe5e4ada1ec291ec885c1b | |
parent | 7b60713e87ba24d3b0fa8f486bba8665151e9f31 (diff) |
bugfix in inner-product specialization,
compilation fix in stable norm,
optimize apply householder
-rw-r--r-- | Eigen/src/Core/Product.h | 2 | ||||
-rw-r--r-- | Eigen/src/Core/StableNorm.h | 10 | ||||
-rw-r--r-- | Eigen/src/Householder/Householder.h | 6 |
3 files changed, 10 insertions, 8 deletions
diff --git a/Eigen/src/Core/Product.h b/Eigen/src/Core/Product.h index 610d5c84a..fba4241b1 100644 --- a/Eigen/src/Core/Product.h +++ b/Eigen/src/Core/Product.h @@ -156,7 +156,7 @@ class GeneralProduct<Lhs, Rhs, InnerProduct> template<typename Dest> void scaleAndAddTo(Dest& dst, Scalar alpha) const { ei_assert(dst.rows()==1 && dst.cols()==1); - dst.coeffRef(0,0) += alpha * (m_lhs.cwise()*m_rhs).sum(); + dst.coeffRef(0,0) += alpha * (m_lhs.transpose().cwise()*m_rhs).sum(); } }; diff --git a/Eigen/src/Core/StableNorm.h b/Eigen/src/Core/StableNorm.h index 6056cafab..77fe79782 100644 --- a/Eigen/src/Core/StableNorm.h +++ b/Eigen/src/Core/StableNorm.h @@ -115,17 +115,17 @@ MatrixBase<Derived>::blueNorm() const ei_assert(false && "the algorithm cannot be guaranteed on this computer"); } iexp = -((1-iemin)/2); - b1 = Scalar(std::pow(double(ibeta),iexp)); // lower boundary of midrange + b1 = RealScalar(std::pow(double(ibeta),iexp)); // lower boundary of midrange iexp = (iemax + 1 - it)/2; - b2 = Scalar(std::pow(double(ibeta),iexp)); // upper boundary of midrange + b2 = RealScalar(std::pow(double(ibeta),iexp)); // upper boundary of midrange iexp = (2-iemin)/2; - s1m = Scalar(std::pow(double(ibeta),iexp)); // scaling factor for lower range + s1m = RealScalar(std::pow(double(ibeta),iexp)); // scaling factor for lower range iexp = - ((iemax+it)/2); - s2m = Scalar(std::pow(double(ibeta),iexp)); // scaling factor for upper range + s2m = RealScalar(std::pow(double(ibeta),iexp)); // scaling factor for upper range overfl = rbig*s2m; // overfow boundary for abig - eps = Scalar(std::pow(double(ibeta), 1-it)); + eps = RealScalar(std::pow(double(ibeta), 1-it)); relerr = ei_sqrt(eps); // tolerance for neglecting asml abig = 1.0/eps - 1.0; if (RealScalar(nbig)>abig) nmax = int(abig); // largest safe n diff --git a/Eigen/src/Householder/Householder.h b/Eigen/src/Householder/Householder.h index 2a4b1395c..42635cb18 100644 --- a/Eigen/src/Householder/Householder.h +++ b/Eigen/src/Householder/Householder.h @@ -73,7 +73,8 @@ void MatrixBase<Derived>::applyHouseholderOnTheLeft( { Matrix<Scalar, 1, ColsAtCompileTime, PlainMatrixType::Options, 1, MaxColsAtCompileTime> tmp(cols()); Block<Derived, EssentialPart::SizeAtCompileTime, Derived::ColsAtCompileTime> bottom(derived(), 1, 0, rows()-1, cols()); - tmp = row(0) + essential.adjoint() * bottom; + tmp = (essential.adjoint() * bottom).lazy(); + tmp += row(0); row(0) -= beta * tmp; bottom -= beta * essential * tmp; } @@ -86,7 +87,8 @@ void MatrixBase<Derived>::applyHouseholderOnTheRight( { Matrix<Scalar, RowsAtCompileTime, 1, PlainMatrixType::Options, MaxRowsAtCompileTime, 1> tmp(rows()); Block<Derived, Derived::RowsAtCompileTime, EssentialPart::SizeAtCompileTime> right(derived(), 0, 1, rows(), cols()-1); - tmp = col(0) + right * essential.conjugate(); + tmp = (right * essential.conjugate()).lazy(); + tmp += col(0); col(0) -= beta * tmp; right -= beta * tmp * essential.transpose(); } |