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>
{
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 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)
{ return ei_llt_inplace<LowerTriangular>::blocked(m); }
};
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;
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; }
static bool inplace_decomposition(MatrixType& 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, SizeMinusOne, 1> SubDiagonalType;
typedef typename NestByValue<Diagonal<MatrixType,0> >::RealReturnType DiagonalReturnType;
typedef typename Diagonal<MatrixType,0>::RealReturnType DiagonalReturnType;
typedef typename NestByValue<Diagonal<
NestByValue<Block<MatrixType,SizeMinusOne,SizeMinusOne> >,0 > >::RealReturnType SubDiagonalReturnType;
typedef typename Diagonal<
Block<MatrixType,SizeMinusOne,SizeMinusOne>,0 >::RealReturnType SubDiagonalReturnType;
/** This constructor initializes a HessenbergDecomposition object for
* further use with HessenbergDecomposition::compute()

View File

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

View File

@ -351,11 +351,11 @@ template<typename _MatrixType> class FullPivLU
*
* \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_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());
}

View File

@ -143,10 +143,10 @@ template<typename _MatrixType> class PartialPivLU
*
* \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.");
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());
}

View File

@ -214,11 +214,11 @@ template<typename _MatrixType> class ColPivHouseholderQR
* Use isInvertible() to first determine whether this matrix is invertible.
*/
inline const
ei_solve_retval<ColPivHouseholderQR, NestByValue<typename MatrixType::IdentityReturnType> >
ei_solve_retval<ColPivHouseholderQR, typename MatrixType::IdentityReturnType>
inverse() const
{
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());
}

View File

@ -216,11 +216,11 @@ template<typename _MatrixType> class FullPivHouseholderQR
* \note If this matrix is not invertible, the returned matrix has undefined coefficients.
* Use isInvertible() to first determine whether this matrix is invertible.
*/ inline const
ei_solve_retval<FullPivHouseholderQR, NestByValue<typename MatrixType::IdentityReturnType> >
ei_solve_retval<FullPivHouseholderQR, typename MatrixType::IdentityReturnType>
inverse() const
{
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());
}