11 #ifndef EIGEN_HESSENBERGDECOMPOSITION_H 12 #define EIGEN_HESSENBERGDECOMPOSITION_H 19 template<
typename MatrixType>
65 Size = MatrixType::RowsAtCompileTime,
68 MaxSize = MatrixType::MaxRowsAtCompileTime,
74 typedef typename MatrixType::Index Index;
103 m_isInitialized(false)
106 m_hCoeffs.resize(
size-1);
120 m_temp(matrix.rows()),
121 m_isInitialized(false)
125 m_isInitialized =
true;
128 m_hCoeffs.resize(matrix.rows()-1,1);
129 _compute(m_matrix, m_hCoeffs, m_temp);
130 m_isInitialized =
true;
155 m_isInitialized =
true;
158 m_hCoeffs.resize(matrix.rows()-1,1);
159 _compute(m_matrix, m_hCoeffs, m_temp);
160 m_isInitialized =
true;
179 eigen_assert(m_isInitialized &&
"HessenbergDecomposition is not initialized.");
214 eigen_assert(m_isInitialized &&
"HessenbergDecomposition is not initialized.");
234 eigen_assert(m_isInitialized &&
"HessenbergDecomposition is not initialized.");
235 return HouseholderSequenceType(m_matrix, m_hCoeffs.conjugate())
236 .setLength(m_matrix.rows() - 1)
262 eigen_assert(m_isInitialized &&
"HessenbergDecomposition is not initialized.");
263 return MatrixHReturnType(*
this);
270 static void _compute(MatrixType& matA, CoeffVectorType& hCoeffs, VectorType& temp);
274 CoeffVectorType m_hCoeffs;
276 bool m_isInitialized;
291 template<
typename MatrixType>
294 eigen_assert(matA.rows()==matA.cols());
295 Index n = matA.rows();
297 for (Index i = 0; i<n-1; ++i)
300 Index remainingSize = n-i-1;
303 matA.col(i).tail(remainingSize).makeHouseholderInPlace(h, beta);
304 matA.col(i).coeffRef(i+1) = beta;
305 hCoeffs.coeffRef(i) = h;
311 matA.bottomRightCorner(remainingSize, remainingSize)
312 .applyHouseholderOnTheLeft(matA.col(i).tail(remainingSize-1), h, &temp.coeffRef(0));
315 matA.rightCols(remainingSize)
316 .applyHouseholderOnTheRight(matA.col(i).tail(remainingSize-1).conjugate(), numext::conj(h), &temp.coeffRef(0));
337 template<
typename MatrixType>
struct HessenbergDecompositionMatrixHReturnType
338 :
public ReturnByValue<HessenbergDecompositionMatrixHReturnType<MatrixType> >
340 typedef typename MatrixType::Index Index;
353 template <
typename ResultType>
354 inline void evalTo(ResultType& result)
const 356 result = m_hess.packedMatrix();
357 Index n = result.rows();
359 result.bottomLeftCorner(n-2, n-2).template triangularView<Lower>().setZero();
362 Index rows()
const {
return m_hess.packedMatrix().rows(); }
363 Index cols()
const {
return m_hess.packedMatrix().cols(); }
373 #endif // EIGEN_HESSENBERGDECOMPOSITION_H const MatrixType & packedMatrix() const
Returns the internal representation of the decomposition.
Definition: HessenbergDecomposition.h:212
iterative scaling algorithm to equilibrate rows and column norms in matrices
Definition: TestIMU_Common.h:87
Holds information about the various numeric (i.e.
Definition: NumTraits.h:88
_MatrixType MatrixType
Synonym for the template parameter _MatrixType.
Definition: HessenbergDecomposition.h:62
MatrixType::Scalar Scalar
Scalar type for matrices of type MatrixType.
Definition: HessenbergDecomposition.h:73
void evalTo(ResultType &result) const
Hessenberg matrix in decomposition.
Definition: HessenbergDecomposition.h:354
Definition: ReturnByValue.h:50
Definition: ForwardDeclarations.h:227
detail::size< coerce_list< Ts... >> size
Get the size of a list (number of elements.)
Definition: Size.h:56
MatrixHReturnType matrixH() const
Constructs the Hessenberg matrix H in the decomposition.
Definition: HessenbergDecomposition.h:260
HessenbergDecomposition & compute(const MatrixType &matrix)
Computes Hessenberg decomposition of given matrix.
Definition: HessenbergDecomposition.h:150
HessenbergDecompositionMatrixHReturnType(const HessenbergDecomposition< MatrixType > &hess)
Constructor.
Definition: HessenbergDecomposition.h:346
EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols)
Resizes *this to a rows x cols matrix.
Definition: PlainObjectBase.h:235
HessenbergDecomposition(const MatrixType &matrix)
Constructor; computes Hessenberg decomposition of given matrix.
Definition: HessenbergDecomposition.h:118
Definition: HessenbergDecomposition.h:18
HessenbergDecomposition(Index size=Size==Dynamic ? 2 :Size)
Default constructor; the decomposition will be computed later.
Definition: HessenbergDecomposition.h:100
Definition: BandTriangularSolver.h:13
Definition: HessenbergDecomposition.h:57
HouseholderSequenceType matrixQ() const
Reconstructs the orthogonal matrix Q in the decomposition.
Definition: HessenbergDecomposition.h:232
const CoeffVectorType & householderCoefficients() const
Returns the Householder coefficients.
Definition: HessenbergDecomposition.h:177
const int Dynamic
This value means that a positive quantity (e.g., a size) is not known at compile-time, and that instead the value is stored in some runtime variable.
Definition: Constants.h:21
HouseholderSequence< MatrixType, typename internal::remove_all< typename CoeffVectorType::ConjugateReturnType >::type > HouseholderSequenceType
Return type of matrixQ()
Definition: HessenbergDecomposition.h:85
Matrix< Scalar, SizeMinusOne, 1, Options &~RowMajor, MaxSizeMinusOne, 1 > CoeffVectorType
Type for vector of Householder coefficients.
Definition: HessenbergDecomposition.h:82
Definition: ForwardDeclarations.h:17
Definition: osvr_print_tree.cpp:52
double Scalar
Common scalar type.
Definition: FlexibleKalmanBase.h:48