11#ifndef EIGEN_GENERALIZEDSELFADJOINTEIGENSOLVER_H
12#define EIGEN_GENERALIZEDSELFADJOINTEIGENSOLVER_H
14#include "./Tridiagonalization.h"
17#include "./InternalHeaderCheck.h"
50template <
typename MatrixType_>
51class GeneralizedSelfAdjointEigenSolver :
public SelfAdjointEigenSolver<MatrixType_> {
55 typedef MatrixType_ MatrixType;
108 :
Base(matA.cols()) {
158template <
typename MatrixType>
160 const MatrixType& matA,
const MatrixType& matB,
int options) {
161 eigen_assert(matA.cols() == matA.rows() && matB.rows() == matA.rows() && matB.cols() == matB.rows());
162 eigen_assert((options & ~(EigVecMask | GenEigMask)) == 0 && (options & EigVecMask) != EigVecMask &&
163 ((options & GenEigMask) == 0 || (options & GenEigMask) ==
Ax_lBx || (options & GenEigMask) ==
ABx_lx ||
164 (options & GenEigMask) ==
BAx_lx) &&
165 "invalid option parameter");
167 bool computeEigVecs = ((options & EigVecMask) == 0) || ((options & EigVecMask) ==
ComputeEigenvectors);
172 int type = (options & GenEigMask);
173 if (type == 0) type =
Ax_lBx;
177 MatrixType matC = matA.template selfadjointView<Lower>();
178 cholB.
matrixL().template solveInPlace<OnTheLeft>(matC);
179 cholB.
matrixU().template solveInPlace<OnTheRight>(matC);
184 if (computeEigVecs) cholB.
matrixU().solveInPlace(Base::m_eivec);
185 }
else if (type ==
ABx_lx) {
187 MatrixType matC = matA.template selfadjointView<Lower>();
194 if (computeEigVecs) cholB.
matrixU().solveInPlace(Base::m_eivec);
195 }
else if (type ==
BAx_lx) {
197 MatrixType matC = matA.template selfadjointView<Lower>();
204 if (computeEigVecs) Base::m_eivec = cholB.
matrixL() * Base::m_eivec;
Computes eigenvalues and eigenvectors of the generalized selfadjoint eigen problem.
Definition SelfAdjointEigenSolver.h:22
GeneralizedSelfAdjointEigenSolver()
Default constructor for fixed-size matrices.
Definition GeneralizedSelfAdjointEigenSolver.h:64
GeneralizedSelfAdjointEigenSolver(Index size)
Constructor, pre-allocates memory for dynamic-size matrices.
Definition GeneralizedSelfAdjointEigenSolver.h:78
GeneralizedSelfAdjointEigenSolver & compute(const MatrixType &matA, const MatrixType &matB, int options=ComputeEigenvectors|Ax_lBx)
Computes generalized eigendecomposition of given matrix pencil.
Definition GeneralizedSelfAdjointEigenSolver.h:159
GeneralizedSelfAdjointEigenSolver(const MatrixType &matA, const MatrixType &matB, int options=ComputeEigenvectors|Ax_lBx)
Constructor; computes generalized eigendecomposition of given matrix pencil.
Definition GeneralizedSelfAdjointEigenSolver.h:106
Standard Cholesky decomposition (LL^T) of a matrix and associated features.
Definition LLT.h:70
Traits::MatrixU matrixU() const
Definition LLT.h:117
Traits::MatrixL matrixL() const
Definition LLT.h:123
Computes eigenvalues and eigenvectors of selfadjoint matrices.
Definition SelfAdjointEigenSolver.h:82
SelfAdjointEigenSolver()
Default constructor for fixed-size matrices.
Definition SelfAdjointEigenSolver.h:128
Eigen::Index Index
Definition SelfAdjointEigenSolver.h:94
@ Ax_lBx
Definition Constants.h:406
@ ComputeEigenvectors
Definition Constants.h:401
@ BAx_lx
Definition Constants.h:412
@ ABx_lx
Definition Constants.h:409
@ EigenvaluesOnly
Definition Constants.h:398
Namespace containing all symbols from the Eigen library.
Definition Core:137