26 #ifndef EIGEN_HESSENBERGDECOMPOSITION_H
27 #define EIGEN_HESSENBERGDECOMPOSITION_H
33 template<
typename MatrixType>
struct HessenbergDecompositionMatrixHReturnType;
34 template<
typename MatrixType>
35 struct traits<HessenbergDecompositionMatrixHReturnType<MatrixType> >
37 typedef MatrixType ReturnType;
80 Size = MatrixType::RowsAtCompileTime,
83 MaxSize = MatrixType::MaxRowsAtCompileTime,
88 typedef typename MatrixType::Scalar
Scalar;
89 typedef typename MatrixType::Index
Index;
306 template<
typename MatrixType>
309 assert(matA.rows()==matA.cols());
310 Index n = matA.rows();
312 for (Index i = 0; i<n-1; ++i)
315 Index remainingSize = n-i-1;
318 matA.col(i).tail(remainingSize).makeHouseholderInPlace(h, beta);
319 matA.col(i).coeffRef(i+1) = beta;
320 hCoeffs.coeffRef(i) = h;
326 matA.bottomRightCorner(remainingSize, remainingSize)
327 .applyHouseholderOnTheLeft(matA.col(i).tail(remainingSize-1), h, &temp.coeffRef(0));
330 matA.rightCols(remainingSize)
331 .applyHouseholderOnTheRight(matA.col(i).tail(remainingSize-1).conjugate(),
internal::conj(h), &temp.coeffRef(0));
352 template<
typename MatrixType>
struct HessenbergDecompositionMatrixHReturnType
353 :
public ReturnByValue<HessenbergDecompositionMatrixHReturnType<MatrixType> >
355 typedef typename MatrixType::Index Index;
361 HessenbergDecompositionMatrixHReturnType(
const HessenbergDecomposition<MatrixType>& hess) : m_hess(hess) { }
368 template <
typename ResultType>
369 inline void evalTo(ResultType& result)
const
371 result = m_hess.packedMatrix();
372 Index n = result.rows();
374 result.bottomLeftCorner(n-2, n-2).template triangularView<Lower>().setZero();
377 Index rows()
const {
return m_hess.packedMatrix().rows(); }
378 Index cols()
const {
return m_hess.packedMatrix().cols(); }
381 const HessenbergDecomposition<MatrixType>& m_hess;
388 #endif // EIGEN_HESSENBERGDECOMPOSITION_H