11 #ifndef EIGEN_HESSENBERGDECOMPOSITION_H 12 #define EIGEN_HESSENBERGDECOMPOSITION_H 19 template<
typename MatrixType>
65 Size = MatrixType::RowsAtCompileTime,
67 Options = MatrixType::Options,
68 MaxSize = MatrixType::MaxRowsAtCompileTime,
103 m_isInitialized(false)
106 m_hCoeffs.resize(
size-1);
118 template<
typename InputType>
120 : m_matrix(matrix.derived()),
121 m_temp(matrix.
rows()),
122 m_isInitialized(false)
126 m_isInitialized =
true;
129 m_hCoeffs.resize(matrix.
rows()-1,1);
130 _compute(m_matrix, m_hCoeffs, m_temp);
131 m_isInitialized =
true;
151 template<
typename InputType>
157 m_isInitialized =
true;
160 m_hCoeffs.resize(matrix.
rows()-1,1);
161 _compute(m_matrix, m_hCoeffs, m_temp);
162 m_isInitialized =
true;
181 eigen_assert(m_isInitialized &&
"HessenbergDecomposition is not initialized.");
216 eigen_assert(m_isInitialized &&
"HessenbergDecomposition is not initialized.");
236 eigen_assert(m_isInitialized &&
"HessenbergDecomposition is not initialized.");
237 return HouseholderSequenceType(m_matrix, m_hCoeffs.conjugate())
238 .setLength(m_matrix.rows() - 1)
264 eigen_assert(m_isInitialized &&
"HessenbergDecomposition is not initialized.");
265 return MatrixHReturnType(*
this);
272 static void _compute(MatrixType&
matA, CoeffVectorType& hCoeffs, VectorType& temp);
293 template<
typename MatrixType>
302 Index remainingSize = n-
i-1;
305 matA.col(i).tail(remainingSize).makeHouseholderInPlace(h, beta);
306 matA.col(i).coeffRef(i+1) = beta;
313 matA.bottomRightCorner(remainingSize, remainingSize)
314 .applyHouseholderOnTheLeft(matA.col(i).tail(remainingSize-1),
h, &temp.
coeffRef(0));
317 matA.rightCols(remainingSize)
318 .applyHouseholderOnTheRight(matA.col(i).tail(remainingSize-1).conjugate(),
numext::conj(h), &temp.
coeffRef(0));
339 template<
typename MatrixType>
struct HessenbergDecompositionMatrixHReturnType
340 :
public ReturnByValue<HessenbergDecompositionMatrixHReturnType<MatrixType> >
354 template <
typename ResultType>
357 result = m_hess.packedMatrix();
363 Index rows()
const {
return m_hess.packedMatrix().rows(); }
364 Index cols()
const {
return m_hess.packedMatrix().cols(); }
374 #endif // EIGEN_HESSENBERGDECOMPOSITION_H
const MatrixType & packedMatrix() const
Returns the internal representation of the decomposition.
HouseholderSequenceType matrixQ() const
Reconstructs the orthogonal matrix Q in the decomposition.
MatrixHReturnType matrixH() const
Constructs the Hessenberg matrix H in the decomposition.
static void _compute(MatrixType &matA, CoeffVectorType &hCoeffs, VectorType &temp)
CoeffVectorType m_hCoeffs
Namespace containing all symbols from the Eigen library.
Holds information about the various numeric (i.e. scalar) types allowed by Eigen. ...
internal::HessenbergDecompositionMatrixHReturnType< MatrixType > MatrixHReturnType
_MatrixType MatrixType
Synonym for the template parameter _MatrixType.
MatrixType::Scalar Scalar
Scalar type for matrices of type MatrixType.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
Sequence of Householder reflections acting on subspaces with decreasing size.
Matrix< Scalar, 1, Size, Options|RowMajor, 1, MaxSize > VectorType
HessenbergDecomposition & compute(const EigenBase< InputType > &matrix)
Computes Hessenberg decomposition of given matrix.
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
void evalTo(ResultType &result) const
Hessenberg matrix in decomposition.
NumTraits< Scalar >::Real RealScalar
HessenbergDecompositionMatrixHReturnType(const HessenbergDecomposition< MatrixType > &hess)
Constructor.
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const HessenbergDecomposition< MatrixType > & m_hess
HessenbergDecomposition(const EigenBase< InputType > &matrix)
Constructor; computes Hessenberg decomposition of given matrix.
Expression type for return value of HessenbergDecomposition::matrixH()
HessenbergDecomposition(Index size=Size==Dynamic?2:Size)
Default constructor; the decomposition will be computed later.
A triangularView< Lower >().adjoint().solveInPlace(B)
Reduces a square matrix to Hessenberg form by an orthogonal similarity transformation.
EIGEN_DEVICE_FUNC Index rows() const
HouseholderSequence< MatrixType, typename internal::remove_all< typename CoeffVectorType::ConjugateReturnType >::type > HouseholderSequenceType
Return type of matrixQ()
Map< Matrix< T, Dynamic, Dynamic, ColMajor >, 0, OuterStride<> > matrix(T *data, int rows, int cols, int stride)
Matrix< Scalar, SizeMinusOne, 1, Options &~RowMajor, MaxSizeMinusOne, 1 > CoeffVectorType
Type for vector of Householder coefficients.
EIGEN_DEVICE_FUNC Derived & derived()
const CoeffVectorType & householderCoefficients() const
Returns the Householder coefficients.
ScalarWithExceptions conj(const ScalarWithExceptions &x)