12 #ifndef EIGEN_GENERALIZEDEIGENSOLVER_H
13 #define EIGEN_GENERALIZEDEIGENSOLVER_H
302 if (computeEigenvectors)
322 if (computeEigenvectors)
336 if (
j > 0 && mS.coeff(
j,
j-1) !=
Scalar(0))
339 Matrix<Scalar, 2, 1> rhs = (alpha*mT.template
block<2,Dynamic>(
j-1,st,2,sz) - beta*mS.template
block<2,Dynamic>(
j-1,st,2,sz)) .lazyProduct(
v.segment(st,sz) );
346 v.coeffRef(
j) = -
v.segment(st,sz).transpose().cwiseProduct(beta*mS.block(
j,st,1,sz) - alpha*mT.block(
j,st,1,sz)).sum() / (beta*mS.coeffRef(
j,
j) - alpha*mT.coeffRef(
j,
j));
364 b = mT.diagonal().coeff(
i+1);
376 if (computeEigenvectors) {
381 cv.
coeffRef(
i) = -(
static_cast<Scalar>(beta*mS.coeffRef(
i,
i+1)) - alpha*mT.coeffRef(
i,
i+1))
382 / (
static_cast<Scalar>(beta*mS.coeffRef(
i,
i)) - alpha*mT.coeffRef(
i,
i));
387 if (
j > 0 && mS.coeff(
j,
j-1) !=
Scalar(0))
390 Matrix<ComplexScalar, 2, 1> rhs = (alpha*mT.template
block<2,Dynamic>(
j-1,st,2,sz) - beta*mS.template
block<2,Dynamic>(
j-1,st,2,sz)) .lazyProduct( cv.segment(st,sz) );
395 cv.
coeffRef(
j) = cv.segment(st,sz).transpose().cwiseProduct(beta*mS.block(
j,st,1,sz) - alpha*mT.block(
j,st,1,sz)).sum()
396 / (alpha*mT.coeffRef(
j,
j) -
static_cast<Scalar>(beta*mS.coeffRef(
j,
j)));
const AbsReturnType abs() const
const SqrtReturnType sqrt() const
Array< int, Dynamic, 1 > v
m block< 2, Dynamic >(1, 1, 2, 3).setZero()
#define EIGEN_STATIC_ASSERT(X, MSG)
#define EIGEN_STATIC_ASSERT_NON_INTEGER(TYPE)
Matrix< float, 1, Dynamic > MatrixType
Generic expression where a coefficient-wise binary operator is applied to two expressions.
internal::traits< Derived >::Scalar Scalar
Computes the generalized eigenvalues and eigenvectors of a pair of general matrices.
EigenvectorsType eigenvectors() const
ComputationInfo info() const
GeneralizedEigenSolver & compute(const MatrixType &A, const MatrixType &B, bool computeEigenvectors=true)
Computes generalized eigendecomposition of given matrix.
ComplexVectorType m_alphas
GeneralizedEigenSolver & setMaxIterations(Index maxIters)
std::complex< RealScalar > ComplexScalar
Complex scalar type for MatrixType.
Matrix< ComplexScalar, ColsAtCompileTime, 1, Options &~RowMajor, MaxColsAtCompileTime, 1 > ComplexVectorType
Type for vector of complex scalar values eigenvalues as returned by alphas().
Matrix< Scalar, ColsAtCompileTime, 1, Options &~RowMajor, MaxColsAtCompileTime, 1 > VectorType
Type for vector of real scalar values eigenvalues as returned by betas().
const VectorType & betas() const
CwiseBinaryOp< internal::scalar_quotient_op< ComplexScalar, Scalar >, ComplexVectorType, VectorType > EigenvalueType
Expression type for the eigenvalues as returned by eigenvalues().
bool m_computeEigenvectors
MatrixType::Scalar Scalar
Scalar type for matrices of type MatrixType.
GeneralizedEigenSolver()
Default constructor.
const ComplexVectorType & alphas() const
GeneralizedEigenSolver(const MatrixType &A, const MatrixType &B, bool computeEigenvectors=true)
Constructor; computes the generalized eigendecomposition of given matrix pair.
EigenvalueType eigenvalues() const
Returns an expression of the computed generalized eigenvalues.
NumTraits< Scalar >::Real RealScalar
GeneralizedEigenSolver(Index size)
Default constructor with memory preallocation.
RealQZ< MatrixType > m_realQZ
Matrix< ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > EigenvectorsType
Type for matrix of eigenvectors as returned by eigenvectors().
MatrixType_ MatrixType
Synonym for the template parameter MatrixType_.
A matrix or vector expression mapping an existing array of data.
const DiagonalWrapper< const Derived > asDiagonal() const
const PartialPivLU< PlainObject, PermutationIndex > partialPivLu() const
constexpr const Scalar & coeff(Index rowId, Index colId) const
Derived & setConstant(Index size, const Scalar &val)
const Scalar * data() const
Derived & setZero(Index size)
constexpr void resize(Index rows, Index cols)
constexpr Scalar & coeffRef(Index rowId, Index colId)
Performs a real QZ decomposition of a pair of square matrices.
RealQZ & compute(const MatrixType &A, const MatrixType &B, bool computeQZ=true)
Computes QZ decomposition of given matrix.
RealQZ & setMaxIterations(Index maxIters)
ComputationInfo info() const
Reports whether previous computation was successful.
const MatrixType & matrixZ() const
Returns matrix Z in the QZ decomposition.
const MatrixType & matrixT() const
Returns matrix S in the QZ decomposition.
const MatrixType & matrixS() const
Returns matrix S in the QZ decomposition.
bfloat16() min(const bfloat16 &a, const bfloat16 &b)
EIGEN_DEFAULT_DENSE_INDEX_TYPE Index
The Index type as used for the API.
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_conjugate_op< typename Derived::Scalar >, const Derived > conj(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_real_op< typename Derived::Scalar >, const Derived > real(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_abs_op< typename Derived::Scalar >, const Derived > abs(const Eigen::ArrayBase< Derived > &x)
const Eigen::CwiseUnaryOp< Eigen::internal::scalar_sqrt_op< typename Derived::Scalar >, const Derived > sqrt(const Eigen::ArrayBase< Derived > &x)
Holds information about the various numeric (i.e. scalar) types allowed by Eigen.