12 #ifndef EIGEN_GENERALIZEDEIGENSOLVER_H
13 #define EIGEN_GENERALIZEDEIGENSOLVER_H
61 template <
typename MatrixType_>
278 bool computeEigenvectors) {
290 if (computeEigenvectors) {
307 if (computeEigenvectors) {
318 if (
j > 0 && mS.coeff(
j,
j - 1) !=
Scalar(0)) {
322 .lazyProduct(
v.segment(st, sz));
324 beta * mS.template block<2, 2>(
j - 1,
j - 1) -
alpha * mT.template block<2, 2>(
j - 1,
j - 1);
325 v.template segment<2>(
j - 1) = lhs.partialPivLu().solve(rhs);
328 v.coeffRef(
j) = -
v.segment(st, sz)
330 .cwiseProduct(
beta * mS.block(
j, st, 1, sz) -
alpha * mT.block(
j, st, 1, sz))
348 RealScalar a = mT.diagonal().coeff(
i),
b = mT.diagonal().coeff(
i + 1);
360 if (computeEigenvectors) {
370 if (
j > 0 && mS.coeff(
j,
j - 1) !=
Scalar(0)) {
374 .lazyProduct(cv.segment(st, sz));
376 beta * mS.template block<2, 2>(
j - 1,
j - 1) -
alpha * mT.template block<2, 2>(
j - 1,
j - 1);
377 cv.template segment<2>(
j - 1) = lhs.partialPivLu().solve(rhs);
382 .cwiseProduct(
beta * mS.block(
j, st, 1, sz) -
alpha * mT.block(
j, st, 1, sz))
AnnoyingScalar abs(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:135
AnnoyingScalar sqrt(const AnnoyingScalar &x)
Definition: AnnoyingScalar.h:134
Array< int, Dynamic, 1 > v
Definition: Array_initializer_list_vector_cxx11.cpp:1
int i
Definition: BiCGSTAB_step_by_step.cpp:9
#define eigen_assert(x)
Definition: Macros.h:910
m block< 2, Dynamic >(1, 1, 2, 3).setZero()
#define EIGEN_STATIC_ASSERT(X, MSG)
Definition: StaticAssert.h:26
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
Definition: StaticAssert.h:74
float * p
Definition: Tutorial_Map_using.cpp:9
int rows
Definition: Tutorial_commainit_02.cpp:1
int cols
Definition: Tutorial_commainit_02.cpp:1
Scalar Scalar int size
Definition: benchVecAdd.cpp:17
Scalar * b
Definition: benchVecAdd.cpp:17
SCALAR Scalar
Definition: bench_gemm.cpp:45
MatrixXf MatrixType
Definition: benchmark-blocking-sizes.cpp:52
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition: CwiseBinaryOp.h:79
Computes the generalized eigenvalues and eigenvectors of a pair of general matrices.
Definition: GeneralizedEigenSolver.h:62
bool m_isInitialized
Definition: GeneralizedEigenSolver.h:270
CwiseBinaryOp< internal::scalar_quotient_op< ComplexScalar, Scalar >, ComplexVectorType, VectorType > EigenvalueType
Expression type for the eigenvalues as returned by eigenvalues().
Definition: GeneralizedEigenSolver.h:105
EigenvectorsType m_eivec
Definition: GeneralizedEigenSolver.h:266
EigenvectorsType eigenvectors() const
Returns the computed generalized eigenvectors.
Definition: GeneralizedEigenSolver.h:176
ComputationInfo info() const
Definition: GeneralizedEigenSolver.h:250
GeneralizedEigenSolver & compute(const MatrixType &A, const MatrixType &B, bool computeEigenvectors=true)
Computes generalized eigendecomposition of given matrix.
Definition: GeneralizedEigenSolver.h:276
ComplexVectorType m_alphas
Definition: GeneralizedEigenSolver.h:267
GeneralizedEigenSolver & setMaxIterations(Index maxIters)
Definition: GeneralizedEigenSolver.h:257
ComplexVectorType m_tmp
Definition: GeneralizedEigenSolver.h:272
std::complex< RealScalar > ComplexScalar
Complex scalar type for MatrixType.
Definition: GeneralizedEigenSolver.h:86
Matrix< ComplexScalar, ColsAtCompileTime, 1, Options &~RowMajor, MaxColsAtCompileTime, 1 > ComplexVectorType
Type for vector of complex scalar values eigenvalues as returned by alphas().
Definition: GeneralizedEigenSolver.h:100
Matrix< Scalar, ColsAtCompileTime, 1, Options &~RowMajor, MaxColsAtCompileTime, 1 > VectorType
Type for vector of real scalar values eigenvalues as returned by betas().
Definition: GeneralizedEigenSolver.h:93
const VectorType & betas() const
Definition: GeneralizedEigenSolver.h:220
bool m_computeEigenvectors
Definition: GeneralizedEigenSolver.h:269
MatrixType::Scalar Scalar
Scalar type for matrices of type MatrixType.
Definition: GeneralizedEigenSolver.h:76
GeneralizedEigenSolver()
Default constructor.
Definition: GeneralizedEigenSolver.h:123
Eigen::Index Index
Definition: GeneralizedEigenSolver.h:78
const ComplexVectorType & alphas() const
Definition: GeneralizedEigenSolver.h:210
GeneralizedEigenSolver(const MatrixType &A, const MatrixType &B, bool computeEigenvectors=true)
Constructor; computes the generalized eigendecomposition of given matrix pair.
Definition: GeneralizedEigenSolver.h:153
EigenvalueType eigenvalues() const
Returns an expression of the computed generalized eigenvalues.
Definition: GeneralizedEigenSolver.h:200
NumTraits< Scalar >::Real RealScalar
Definition: GeneralizedEigenSolver.h:77
GeneralizedEigenSolver(Index size)
Default constructor with memory preallocation.
Definition: GeneralizedEigenSolver.h:132
VectorType m_betas
Definition: GeneralizedEigenSolver.h:268
RealQZ< MatrixType > m_realQZ
Definition: GeneralizedEigenSolver.h:271
@ ColsAtCompileTime
Definition: GeneralizedEigenSolver.h:69
@ MaxColsAtCompileTime
Definition: GeneralizedEigenSolver.h:72
@ MaxRowsAtCompileTime
Definition: GeneralizedEigenSolver.h:71
@ Options
Definition: GeneralizedEigenSolver.h:70
@ RowsAtCompileTime
Definition: GeneralizedEigenSolver.h:68
Matrix< ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > EigenvectorsType
Type for matrix of eigenvectors as returned by eigenvectors().
Definition: GeneralizedEigenSolver.h:114
MatrixType_ MatrixType
Synonym for the template parameter MatrixType_.
Definition: GeneralizedEigenSolver.h:65
A matrix or vector expression mapping an existing array of data.
Definition: Map.h:96
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE Scalar & coeffRef(Index rowId, Index colId)
Definition: PlainObjectBase.h:217
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE const Scalar & coeff(Index rowId, Index colId) const
Definition: PlainObjectBase.h:198
constexpr EIGEN_DEVICE_FUNC const Scalar * data() const
Definition: PlainObjectBase.h:273
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:192
EIGEN_DEVICE_FUNC Derived & setZero(Index size)
Definition: CwiseNullaryOp.h:569
EIGEN_DEVICE_FUNC Derived & setConstant(Index size, const Scalar &val)
Definition: CwiseNullaryOp.h:365
EIGEN_DEVICE_FUNC constexpr EIGEN_STRONG_INLINE void resize(Index rows, Index cols)
Definition: PlainObjectBase.h:294
EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT
Definition: PlainObjectBase.h:191
Performs a real QZ decomposition of a pair of square matrices.
Definition: RealQZ.h:61
RealQZ & compute(const MatrixType &A, const MatrixType &B, bool computeQZ=true)
Computes QZ decomposition of given matrix.
Definition: RealQZ.h:502
RealQZ & setMaxIterations(Index maxIters)
Definition: RealQZ.h:185
ComputationInfo info() const
Reports whether previous computation was successful.
Definition: RealQZ.h:170
const MatrixType & matrixZ() const
Returns matrix Z in the QZ decomposition.
Definition: RealQZ.h:133
const MatrixType & matrixT() const
Returns matrix S in the QZ decomposition.
Definition: RealQZ.h:152
const MatrixType & matrixS() const
Returns matrix S in the QZ decomposition.
Definition: RealQZ.h:143
Definition: matrices.h:74
#define min(a, b)
Definition: datatypes.h:22
ComputationInfo
Definition: Constants.h:438
@ Success
Definition: Constants.h:440
RealScalar alpha
Definition: level1_cplx_impl.h:151
const Scalar * a
Definition: level2_cplx_impl.h:32
Scalar beta
Definition: level2_cplx_impl.h:36
Namespace containing all symbols from the Eigen library.
Definition: bench_norm.cpp:70
const AutoDiffScalar< DerType > & real(const AutoDiffScalar< DerType > &x)
Definition: AutoDiffScalar.h:486
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
Definition: Meta.h:83
const AutoDiffScalar< DerType > & conj(const AutoDiffScalar< DerType > &x)
Definition: AutoDiffScalar.h:482
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.
Definition: NumTraits.h:217
Definition: ForwardDeclarations.h:21
std::ptrdiff_t j
Definition: tut_arithmetic_redux_minmax.cpp:2