diff --git a/Eigen/src/SVD/SVD.h b/Eigen/src/SVD/SVD.h index 807e7058c..b43123384 100644 --- a/Eigen/src/SVD/SVD.h +++ b/Eigen/src/SVD/SVD.h @@ -40,9 +40,10 @@ template struct ei_svd_solve_impl; * * \sa MatrixBase::SVD() */ -template class SVD +template class SVD { public: + typedef _MatrixType MatrixType; typedef typename MatrixType::Scalar Scalar; typedef typename NumTraits::Real RealScalar; @@ -90,11 +91,11 @@ template class SVD * \sa MatrixBase::svd(), */ template - inline const ei_svd_solve_impl + inline const ei_solve_return_value solve(const MatrixBase& b) const { ei_assert(m_isInitialized && "SVD is not initialized."); - return ei_svd_solve_impl(*this, b.derived()); + return ei_solve_return_value(*this, b.derived()); } const MatrixUType& matrixU() const @@ -428,54 +429,33 @@ SVD& SVD::compute(const MatrixType& matrix) return *this; } -template -struct ei_traits > +template +struct ei_solve_impl, Rhs, Dest> + : ei_solve_return_value, Rhs> { - typedef Matrix ReturnMatrixType; -}; - -template -struct ei_svd_solve_impl : public ReturnByValue > -{ - typedef typename ei_cleantype::type RhsNested; - typedef SVD SVDType; - typedef typename MatrixType::RealScalar RealScalar; - typedef typename MatrixType::Scalar Scalar; - const SVDType& m_svd; - const typename Rhs::Nested m_rhs; - - ei_svd_solve_impl(const SVDType& svd, const Rhs& rhs) - : m_svd(svd), m_rhs(rhs) - {} - - inline int rows() const { return m_svd.cols(); } - inline int cols() const { return m_rhs.cols(); } - - template void evalTo(Dest& dst) const + void evalTo(Dest& dst) const { - ei_assert(m_rhs.rows() == m_svd.rows()); + typedef typename MatrixType::Scalar Scalar; + typedef typename MatrixType::RealScalar RealScalar; + const int cols = this->cols(); + const SVD& svd = this->m_dec; + const Rhs& rhs = this->m_rhs; + ei_assert(rhs.rows() == svd.rows()); - dst.resize(rows(), cols()); - - for (int j=0; j aux = m_svd.matrixU().adjoint() * m_rhs.col(j); + Matrix aux = svd.matrixU().adjoint() * rhs.col(j); - for (int i = 0; i