Removed NestByValue dependency from Cholesky, Eigenvalues, LU and QR.

This commit is contained in:
Hauke Heibel 2009-12-01 10:22:54 +01:00
parent 7b3e205ebd
commit 3091be5134
7 changed files with 21 additions and 22 deletions

View File

@ -224,18 +224,18 @@ template<> struct ei_llt_inplace<UpperTriangular>
template<typename MatrixType> struct LLT_Traits<MatrixType,LowerTriangular> template<typename MatrixType> struct LLT_Traits<MatrixType,LowerTriangular>
{ {
typedef TriangularView<MatrixType, LowerTriangular> MatrixL; typedef TriangularView<MatrixType, LowerTriangular> MatrixL;
typedef TriangularView<NestByValue<typename MatrixType::AdjointReturnType>, UpperTriangular> MatrixU; typedef TriangularView<typename MatrixType::AdjointReturnType, UpperTriangular> MatrixU;
inline static MatrixL getL(const MatrixType& m) { return m; } inline static MatrixL getL(const MatrixType& m) { return m; }
inline static MatrixU getU(const MatrixType& m) { return m.adjoint().nestByValue(); } inline static MatrixU getU(const MatrixType& m) { return m.adjoint(); }
static bool inplace_decomposition(MatrixType& m) static bool inplace_decomposition(MatrixType& m)
{ return ei_llt_inplace<LowerTriangular>::blocked(m); } { return ei_llt_inplace<LowerTriangular>::blocked(m); }
}; };
template<typename MatrixType> struct LLT_Traits<MatrixType,UpperTriangular> template<typename MatrixType> struct LLT_Traits<MatrixType,UpperTriangular>
{ {
typedef TriangularView<NestByValue<typename MatrixType::AdjointReturnType>, LowerTriangular> MatrixL; typedef TriangularView<typename MatrixType::AdjointReturnType, LowerTriangular> MatrixL;
typedef TriangularView<MatrixType, UpperTriangular> MatrixU; typedef TriangularView<MatrixType, UpperTriangular> MatrixU;
inline static MatrixL getL(const MatrixType& m) { return m.adjoint().nestByValue(); } inline static MatrixL getL(const MatrixType& m) { return m.adjoint(); }
inline static MatrixU getU(const MatrixType& m) { return m; } inline static MatrixU getU(const MatrixType& m) { return m; }
static bool inplace_decomposition(MatrixType& m) static bool inplace_decomposition(MatrixType& m)
{ return ei_llt_inplace<UpperTriangular>::blocked(m); } { return ei_llt_inplace<UpperTriangular>::blocked(m); }

View File

@ -58,10 +58,10 @@ template<typename _MatrixType> class HessenbergDecomposition
typedef Matrix<RealScalar, Size, 1> DiagonalType; typedef Matrix<RealScalar, Size, 1> DiagonalType;
typedef Matrix<RealScalar, SizeMinusOne, 1> SubDiagonalType; typedef Matrix<RealScalar, SizeMinusOne, 1> SubDiagonalType;
typedef typename NestByValue<Diagonal<MatrixType,0> >::RealReturnType DiagonalReturnType; typedef typename Diagonal<MatrixType,0>::RealReturnType DiagonalReturnType;
typedef typename NestByValue<Diagonal< typedef typename Diagonal<
NestByValue<Block<MatrixType,SizeMinusOne,SizeMinusOne> >,0 > >::RealReturnType SubDiagonalReturnType; Block<MatrixType,SizeMinusOne,SizeMinusOne>,0 >::RealReturnType SubDiagonalReturnType;
/** This constructor initializes a HessenbergDecomposition object for /** This constructor initializes a HessenbergDecomposition object for
* further use with HessenbergDecomposition::compute() * further use with HessenbergDecomposition::compute()

View File

@ -61,15 +61,15 @@ template<typename _MatrixType> class Tridiagonalization
typedef Matrix<RealScalar, SizeMinusOne, 1> SubDiagonalType; typedef Matrix<RealScalar, SizeMinusOne, 1> SubDiagonalType;
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex, typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
typename NestByValue<Diagonal<MatrixType,0> >::RealReturnType, typename Diagonal<MatrixType,0>::RealReturnType,
Diagonal<MatrixType,0> Diagonal<MatrixType,0>
>::ret DiagonalReturnType; >::ret DiagonalReturnType;
typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex, typedef typename ei_meta_if<NumTraits<Scalar>::IsComplex,
typename NestByValue<Diagonal< typename Diagonal<
NestByValue<Block<MatrixType,SizeMinusOne,SizeMinusOne> >,0 > >::RealReturnType, Block<MatrixType,SizeMinusOne,SizeMinusOne>,0 >::RealReturnType,
Diagonal< Diagonal<
NestByValue<Block<MatrixType,SizeMinusOne,SizeMinusOne> >,0 > Block<MatrixType,SizeMinusOne,SizeMinusOne>,0 >
>::ret SubDiagonalReturnType; >::ret SubDiagonalReturnType;
/** This constructor initializes a Tridiagonalization object for /** This constructor initializes a Tridiagonalization object for
@ -144,7 +144,7 @@ template<typename MatrixType>
const typename Tridiagonalization<MatrixType>::DiagonalReturnType const typename Tridiagonalization<MatrixType>::DiagonalReturnType
Tridiagonalization<MatrixType>::diagonal(void) const Tridiagonalization<MatrixType>::diagonal(void) const
{ {
return m_matrix.diagonal().nestByValue(); return m_matrix.diagonal();
} }
/** \returns an expression of the sub-diagonal vector */ /** \returns an expression of the sub-diagonal vector */
@ -153,8 +153,7 @@ const typename Tridiagonalization<MatrixType>::SubDiagonalReturnType
Tridiagonalization<MatrixType>::subDiagonal(void) const Tridiagonalization<MatrixType>::subDiagonal(void) const
{ {
int n = m_matrix.rows(); int n = m_matrix.rows();
return Block<MatrixType,SizeMinusOne,SizeMinusOne>(m_matrix, 1, 0, n-1,n-1) return Block<MatrixType,SizeMinusOne,SizeMinusOne>(m_matrix, 1, 0, n-1,n-1).diagonal();
.nestByValue().diagonal().nestByValue();
} }
/** constructs and returns the tridiagonal matrix T. /** constructs and returns the tridiagonal matrix T.

View File

@ -351,11 +351,11 @@ template<typename _MatrixType> class FullPivLU
* *
* \sa MatrixBase::inverse() * \sa MatrixBase::inverse()
*/ */
inline const ei_solve_retval<FullPivLU,NestByValue<typename MatrixType::IdentityReturnType> > inverse() const inline const ei_solve_retval<FullPivLU,typename MatrixType::IdentityReturnType> inverse() const
{ {
ei_assert(m_isInitialized && "LU is not initialized."); ei_assert(m_isInitialized && "LU is not initialized.");
ei_assert(m_lu.rows() == m_lu.cols() && "You can't take the inverse of a non-square matrix!"); ei_assert(m_lu.rows() == m_lu.cols() && "You can't take the inverse of a non-square matrix!");
return ei_solve_retval<FullPivLU,NestByValue<typename MatrixType::IdentityReturnType> > return ei_solve_retval<FullPivLU,typename MatrixType::IdentityReturnType>
(*this, MatrixType::Identity(m_lu.rows(), m_lu.cols()).nestByValue()); (*this, MatrixType::Identity(m_lu.rows(), m_lu.cols()).nestByValue());
} }

View File

@ -143,10 +143,10 @@ template<typename _MatrixType> class PartialPivLU
* *
* \sa MatrixBase::inverse(), LU::inverse() * \sa MatrixBase::inverse(), LU::inverse()
*/ */
inline const ei_solve_retval<PartialPivLU,NestByValue<typename MatrixType::IdentityReturnType> > inverse() const inline const ei_solve_retval<PartialPivLU,typename MatrixType::IdentityReturnType> inverse() const
{ {
ei_assert(m_isInitialized && "PartialPivLU is not initialized."); ei_assert(m_isInitialized && "PartialPivLU is not initialized.");
return ei_solve_retval<PartialPivLU,NestByValue<typename MatrixType::IdentityReturnType> > return ei_solve_retval<PartialPivLU,typename MatrixType::IdentityReturnType>
(*this, MatrixType::Identity(m_lu.rows(), m_lu.cols()).nestByValue()); (*this, MatrixType::Identity(m_lu.rows(), m_lu.cols()).nestByValue());
} }

View File

@ -214,11 +214,11 @@ template<typename _MatrixType> class ColPivHouseholderQR
* Use isInvertible() to first determine whether this matrix is invertible. * Use isInvertible() to first determine whether this matrix is invertible.
*/ */
inline const inline const
ei_solve_retval<ColPivHouseholderQR, NestByValue<typename MatrixType::IdentityReturnType> > ei_solve_retval<ColPivHouseholderQR, typename MatrixType::IdentityReturnType>
inverse() const inverse() const
{ {
ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized."); ei_assert(m_isInitialized && "ColPivHouseholderQR is not initialized.");
return ei_solve_retval<ColPivHouseholderQR,NestByValue<typename MatrixType::IdentityReturnType> > return ei_solve_retval<ColPivHouseholderQR,typename MatrixType::IdentityReturnType>
(*this, MatrixType::Identity(m_qr.rows(), m_qr.cols()).nestByValue()); (*this, MatrixType::Identity(m_qr.rows(), m_qr.cols()).nestByValue());
} }

View File

@ -216,11 +216,11 @@ template<typename _MatrixType> class FullPivHouseholderQR
* \note If this matrix is not invertible, the returned matrix has undefined coefficients. * \note If this matrix is not invertible, the returned matrix has undefined coefficients.
* Use isInvertible() to first determine whether this matrix is invertible. * Use isInvertible() to first determine whether this matrix is invertible.
*/ inline const */ inline const
ei_solve_retval<FullPivHouseholderQR, NestByValue<typename MatrixType::IdentityReturnType> > ei_solve_retval<FullPivHouseholderQR, typename MatrixType::IdentityReturnType>
inverse() const inverse() const
{ {
ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized."); ei_assert(m_isInitialized && "FullPivHouseholderQR is not initialized.");
return ei_solve_retval<FullPivHouseholderQR,NestByValue<typename MatrixType::IdentityReturnType> > return ei_solve_retval<FullPivHouseholderQR,typename MatrixType::IdentityReturnType>
(*this, MatrixType::Identity(m_qr.rows(), m_qr.cols()).nestByValue()); (*this, MatrixType::Identity(m_qr.rows(), m_qr.cols()).nestByValue());
} }