Eigen  5.0.1-dev+master
 
Loading...
Searching...
No Matches
GeneralizedEigenSolver.h
1// This file is part of Eigen, a lightweight C++ template library
2// for linear algebra.
3//
4// Copyright (C) 2012-2016 Gael Guennebaud <gael.guennebaud@inria.fr>
5// Copyright (C) 2010,2012 Jitse Niesen <jitse@maths.leeds.ac.uk>
6// Copyright (C) 2016 Tobias Wood <tobias@spinicist.org.uk>
7//
8// This Source Code Form is subject to the terms of the Mozilla
9// Public License v. 2.0. If a copy of the MPL was not distributed
10// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
11// SPDX-License-Identifier: MPL-2.0
12
13#ifndef EIGEN_GENERALIZEDEIGENSOLVER_H
14#define EIGEN_GENERALIZEDEIGENSOLVER_H
15
16#include "./RealQZ.h"
17
18// IWYU pragma: private
19#include "./InternalHeaderCheck.h"
20
21namespace Eigen {
22
23namespace internal {
24
25// T_i = diag(a, b) = s diag(a', b') with |a'|, |b'| <= 1, for a complex pair; returns beta = (s a') b' = a b'. float
26// and double take s = 2^e, the power of two at or above max(|a|, |b|), through the representation, so a' and b' are
27// exact and s need not be representable. Other scalars need not provide frexp or ldexp: s = max(|a|, |b|).
28template <typename RealScalar>
29RealScalar generalized_eigen_split_pair_diagonal(const RealScalar& a, const RealScalar& b, RealScalar& aScaled,
30 RealScalar& bScaled, true_type) {
31 int e = 0;
32 const RealScalar maxT = max_preserving_subnormals(abs_preserving_subnormals(a), abs_preserving_subnormals(b));
33 if (numext::equal_strict(frexp_preserving_subnormals(maxT, e), RealScalar(0.5))) --e;
34 aScaled = ldexp_preserving_subnormals(a, -e);
35 bScaled = ldexp_preserving_subnormals(b, -e);
36 return ldexp_preserving_subnormals(aScaled, e) * bScaled;
37}
38template <typename RealScalar>
39RealScalar generalized_eigen_split_pair_diagonal(const RealScalar& a, const RealScalar& b, RealScalar& aScaled,
40 RealScalar& bScaled, false_type) {
41 const RealScalar maxT = numext::maxi(numext::abs(a), numext::abs(b));
42 aScaled = a;
43 bScaled = b;
44 if (!numext::is_exactly_zero(maxT)) {
45 aScaled /= maxT;
46 bScaled /= maxT;
47 }
48 return a * bScaled;
49}
50
51} // namespace internal
52
92template <typename MatrixType_>
94 public:
96 using MatrixType = MatrixType_;
97
98 enum {
99 RowsAtCompileTime = MatrixType::RowsAtCompileTime,
100 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
101 Options = internal::plain_object_options<MatrixType>::value,
102 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
103 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
104 };
105
107 using Scalar = typename MatrixType::Scalar;
108 using RealScalar = typename NumTraits<Scalar>::Real;
109 using Index = Eigen::Index;
110
117 using ComplexScalar = internal::make_complex_t<Scalar>;
118
125
132
137
145
154 : m_eivec(), m_alphas(), m_betas(), m_computeEigenvectors(false), m_isInitialized(false), m_realQZ() {}
155
163 : m_eivec(size, size),
164 m_alphas(size),
165 m_betas(size),
166 m_computeEigenvectors(false),
167 m_isInitialized(false),
168 m_realQZ(size),
169 m_tmp(size) {}
170
183 template <typename InputTypeA, typename InputTypeB>
185 bool computeEigenvectors = true)
186 : m_eivec(A.rows(), A.cols()),
187 m_alphas(A.cols()),
188 m_betas(A.cols()),
189 m_computeEigenvectors(false),
190 m_isInitialized(false),
191 m_realQZ(A.derived(), B.derived(), computeEigenvectors),
192 m_tmp(A.cols()) {
193 computeFromQZ(computeEigenvectors);
194 }
195
207 template <typename InputTypeA, typename InputTypeB>
209 : m_eivec(A.rows(), A.cols()),
210 m_alphas(A.cols()),
211 m_betas(A.cols()),
212 m_computeEigenvectors(false),
213 m_isInitialized(false),
214 m_realQZ(A.derived(), B.derived(), computeEigenvectors),
215 m_tmp(A.cols()) {
216 computeFromQZ(computeEigenvectors);
217 }
218
232 eigen_assert(info() == Success && "GeneralizedEigenSolver failed to compute eigenvectors");
233 eigen_assert(m_computeEigenvectors && "Eigenvectors for GeneralizedEigenSolver were not calculated");
234 return m_eivec;
235 }
236
256 eigen_assert(info() == Success && "GeneralizedEigenSolver failed to compute eigenvalues.");
257 return EigenvalueType(m_alphas, m_betas);
258 }
259
265 const ComplexVectorType& alphas() const {
266 eigen_assert(info() == Success && "GeneralizedEigenSolver failed to compute alphas.");
267 return m_alphas;
268 }
269
275 const VectorType& betas() const {
276 eigen_assert(info() == Success && "GeneralizedEigenSolver failed to compute betas.");
277 return m_betas;
278 }
279
303 template <typename InputTypeA, typename InputTypeB>
305 bool computeEigenvectors = true);
306
307 ComputationInfo info() const {
308 eigen_assert(m_isInitialized && "EigenSolver is not initialized.");
309 return m_realQZ.info();
310 }
311
315 m_realQZ.setMaxIterations(maxIters);
316 return *this;
317 }
318
319 protected:
320 EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar)
321 EIGEN_STATIC_ASSERT(!NumTraits<Scalar>::IsComplex, NUMERIC_TYPE_MUST_BE_REAL)
322
323 EigenvectorsType m_eivec;
324 ComplexVectorType m_alphas;
325 VectorType m_betas;
326 bool m_computeEigenvectors;
327 bool m_isInitialized;
328 RealQZ<MatrixType> m_realQZ;
329 ComplexVectorType m_tmp;
330
331 private:
332 GeneralizedEigenSolver& computeFromQZ(bool computeEigenvectors);
333
334 // Solves m x = r with complete pivoting, replacing a pivot of modulus below smin by smin, after LAPACK's xLALN2.
335 template <typename T>
336 static Matrix<T, 2, 1> solveWithPerturbedPivots(const Matrix<T, 2, 2>& m, const Matrix<T, 2, 1>& r,
337 const RealScalar& smin) {
338 Index row, col;
339 m.cwiseAbs().maxCoeff(&row, &col);
340 const Index otherRow = 1 - row, otherCol = 1 - col;
341 T pivot = m.coeff(row, col);
342 if (numext::abs(pivot) < smin) pivot = T(smin);
343 const T multiplier = m.coeff(otherRow, col) / pivot;
344 T otherPivot = m.coeff(otherRow, otherCol) - multiplier * m.coeff(row, otherCol);
345 if (numext::abs(otherPivot) < smin) otherPivot = T(smin);
347 x.coeffRef(otherCol) = (r.coeff(otherRow) - multiplier * r.coeff(row)) / otherPivot;
348 x.coeffRef(col) = (r.coeff(row) - m.coeff(row, otherCol) * x.coeff(otherCol)) / pivot;
349 return x;
350 }
351};
352
353template <typename MatrixType>
354template <typename InputTypeA, typename InputTypeB>
356 const EigenBase<InputTypeB>& B,
357 bool computeEigenvectors) {
358 EIGEN_INTERNAL_ASSERT_SQUARE(A);
359 EIGEN_INTERNAL_ASSERT_SAME_SHAPE(A, B);
360 // Reduce to generalized real Schur form:
361 // A = Q S Z and B = Q T Z
362 m_realQZ.compute(A.derived(), B.derived(), computeEigenvectors);
363 return computeFromQZ(computeEigenvectors);
364}
365
368template <typename MatrixType>
369GeneralizedEigenSolver<MatrixType>& GeneralizedEigenSolver<MatrixType>::computeFromQZ(bool computeEigenvectors) {
370 const Index size = m_realQZ.matrixS().cols();
371 if (m_realQZ.info() == Success) {
372 // Resize storage
373 m_alphas.resize(size);
374 m_betas.resize(size);
375 if (computeEigenvectors) {
376 m_eivec.resize(size, size);
377 m_tmp.resize(size);
378 }
379
380 // Aliases:
381 Map<VectorType> v(reinterpret_cast<Scalar*>(m_tmp.data()), size);
382 ComplexVectorType& cv = m_tmp;
383 const MatrixType& mS = m_realQZ.matrixS();
384 const MatrixType& mT = m_realQZ.matrixT();
385 // The back substitutions follow LAPACK's xTGEVC, with
386 // (alpha, beta) -> (alpha / (t max|S|) * r / max|T|, beta / (t max|T|) * r / max|S|),
387 // t = max(|beta| / max|T|, |alpha| / max|S|, min),
388 // r = max(1, min(max(max|S|, max|T|) min / eps, min(max|S|, max|T|) highest / 2)),
389 // so that |beta| |S(j, k)| <= r and |alpha| |T(j, k)| <= r. With r = 1, 1 / max|S| is subnormal for max|S| > 1 /
390 // min and flushes to 0 under FTZ. r / max|S| and r / max|T| are at most highest / 2 and, unless max|S| / max|T| or
391 // max|T| / max|S| exceeds highest eps / (2 min), at least min / eps, so the scaled beta underflows only where
392 // |beta| / (t max|T|) < eps, and likewise alpha. A pivot beta S(j, j) - alpha T(j, j) of modulus below
393 // smin_j = max(eps sum_k (|beta| |S(j, k)| + |alpha| |T(j, k)|), min), k over the columns of the solve,
394 // the larger of its two rows' for a 2x2 block, is replaced by smin_j: it is 0 where eigenvalue j repeats eigenvalue
395 // i, or for beta = 0 = T(j, j). Unlike xTGEVC's floor eps ||.||, the row sums leave accurate small 1x1 pivots of a
396 // graded pencil alone, down to a scaled pivot of min. Row j's numerator is at most max |v| smin_j / eps, so a step
397 // multiplies max |v| by at most 3 / eps (solveWithPerturbedPivots for a 2x2 block), and v is divided by max |v|
398 // once that exceeds 1 / eps, which keeps it finite.
399 const RealScalar eps = NumTraits<RealScalar>::epsilon();
400 const RealScalar big = RealScalar(1) / eps;
401 const RealScalar smallestNormal = RealScalar((std::numeric_limits<RealScalar>::min)());
402 const RealScalar maxS = computeEigenvectors && size > 0
403 ? numext::maxi(RealScalar(mS.cwiseAbs().maxCoeff()), smallestNormal)
404 : smallestNormal;
405 const RealScalar maxT = computeEigenvectors && size > 0
406 ? numext::maxi(RealScalar(mT.cwiseAbs().maxCoeff()), smallestNormal)
407 : smallestNormal;
408 // Compares against wanted / halfHighest rather than forming min(max|S|, max|T|) highest / 2, which overflows.
409 const RealScalar wanted = numext::maxi(maxS, maxT) * (smallestNormal / eps);
410 const RealScalar halfHighest = NumTraits<RealScalar>::highest() / RealScalar(2);
411 const RealScalar smaller = numext::mini(maxS, maxT);
412 const RealScalar bound =
413 numext::maxi(RealScalar(1), smaller < wanted / halfHighest ? RealScalar(smaller * halfHighest) : wanted);
414 const RealScalar scaleS = bound / maxS, scaleT = bound / maxT;
415 const auto scaleDivisor = [&](const RealScalar& absAlpha, const RealScalar& absBeta) {
416 return numext::maxi(numext::maxi(RealScalar(absBeta / maxT), RealScalar(absAlpha / maxS)), smallestNormal);
417 };
418 const auto pivotFloor = [&](Index row, Index first, Index last, const RealScalar& absAlpha,
419 const RealScalar& absBeta) {
420 const Index count = last - first + 1;
421 return numext::maxi(RealScalar(eps * (absBeta * mS.row(row).segment(first, count).cwiseAbs() +
422 absAlpha * mT.row(row).segment(first, count).cwiseAbs())
423 .sum()),
424 smallestNormal);
425 };
426
427 Index i = 0;
428 while (i < size) {
429 if (i == size - 1 || mS.coeff(i + 1, i) == Scalar(0)) {
430 // Real eigenvalue
431 m_alphas.coeffRef(i) = mS.diagonal().coeff(i);
432 m_betas.coeffRef(i) = mT.diagonal().coeff(i);
433 if (computeEigenvectors) {
434 v.setConstant(Scalar(0.0));
435 v.coeffRef(i) = Scalar(1.0);
436 const Scalar alpha = numext::real(m_alphas.coeffRef(i)), beta = m_betas.coeffRef(i);
437 const RealScalar divisor = scaleDivisor(numext::abs(alpha), numext::abs(beta));
438 const Scalar scaledAlpha = alpha / divisor / maxS * scaleT, scaledBeta = beta / divisor / maxT * scaleS;
439 const RealScalar absAlpha = numext::abs(scaledAlpha), absBeta = numext::abs(scaledBeta);
440 for (Index j = i - 1; j >= 0; j--) {
441 const Index st = j + 1;
442 const Index sz = i - j;
443 RealScalar largest;
444 if (j > 0 && mS.coeff(j, j - 1) != Scalar(0)) {
445 // 2x2 block
446 Matrix<Scalar, 2, 1> rhs = (scaledAlpha * mT.template block<2, Dynamic>(j - 1, st, 2, sz) -
447 scaledBeta * mS.template block<2, Dynamic>(j - 1, st, 2, sz))
448 .lazyProduct(v.segment(st, sz));
449 Matrix<Scalar, 2, 2> lhs = scaledBeta * mS.template block<2, 2>(j - 1, j - 1) -
450 scaledAlpha * mT.template block<2, 2>(j - 1, j - 1);
451 const RealScalar smin = numext::maxi(pivotFloor(j - 1, j - 1, i, absAlpha, absBeta),
452 pivotFloor(j, j - 1, i, absAlpha, absBeta));
453 v.template segment<2>(j - 1) = solveWithPerturbedPivots(lhs, rhs, smin);
454 largest = v.template segment<2>(j - 1).cwiseAbs().maxCoeff();
455 j--;
456 } else {
457 Scalar pivot = scaledBeta * mS.coeff(j, j) - scaledAlpha * mT.coeff(j, j);
458 const RealScalar smin = pivotFloor(j, j, i, absAlpha, absBeta);
459 if (numext::abs(pivot) < smin) pivot = Scalar(smin);
460 v.coeffRef(j) =
461 -v.segment(st, sz)
462 .transpose()
463 .cwiseProduct(scaledBeta * mS.block(j, st, 1, sz) - scaledAlpha * mT.block(j, st, 1, sz))
464 .sum() /
465 pivot;
466 largest = numext::abs(v.coeff(j));
467 }
468 if (largest > big) v /= largest;
469 }
470 m_eivec.col(i).real().noalias() = m_realQZ.matrixZ().transpose() * v;
471 m_eivec.col(i).real().normalize();
472 m_eivec.col(i).imag().setConstant(0);
473 }
474 ++i;
475 } else {
476 // The 2x2 pencil (S_i, T_i), T_i = diag(a, b), has the eigenvalues eig(S_i diag(b, a)) / (a b). With
477 // T_i = s diag(a', b'), s >= max(|a|, |b|) (see generalized_eigen_split_pair_diagonal()),
478 // alpha = eig(M), M = S_i diag(b', a'), beta = (s a') b' = a b',
479 // so |a'|, |b'| <= 1, |M| <= |S_i|, |alpha| ~ |S_i| and |beta| ~ min(|a|, |b|), as alpha = S(i, i) and
480 // beta = T(i, i) for a real eigenvalue; a b over- or underflows with |T_i|^2. The discriminant p^2 + m01 m10
481 // is formed relative to its largest term, as in LAPACK's xLANV2. For a complex pair p^2 and m01 m10 have
482 // opposite signs, so p, z and m11 + p are at most |S_i|, and alpha is finite whenever S_i is.
483 // NOTE: using diagonal() instead of coeff(i,i) works around an MSVC bug.
484 const RealScalar a = mT.diagonal().coeff(i), b = mT.diagonal().coeff(i + 1);
485 RealScalar aScaled, bScaled;
486 const RealScalar beta = m_betas.coeffRef(i) = m_betas.coeffRef(i + 1) =
487 internal::generalized_eigen_split_pair_diagonal(
488 a, b, aScaled, bScaled,
489 internal::bool_constant<internal::use_subnormal_preserving_scaling<RealScalar, RealScalar>::value>());
490
492 mS.template block<2, 2>(i, i) * Matrix<RealScalar, 2, 1>(bScaled, aScaled).asDiagonal();
493 const RealScalar p = RealScalar(0.5) * M.coeff(0, 0) - RealScalar(0.5) * M.coeff(1, 1);
494 const RealScalar m01 = M.coeff(0, 1), m10 = M.coeff(1, 0);
495 const RealScalar bcMax = numext::maxi(numext::abs(m01), numext::abs(m10));
496 const RealScalar bcMin = numext::mini(numext::abs(m01), numext::abs(m10));
497 const RealScalar scale = numext::maxi(numext::abs(p), bcMax);
498 RealScalar z(0);
499 if (!numext::is_exactly_zero(scale)) {
500 const RealScalar bcMinSigned = ((m01 < RealScalar(0)) == (m10 < RealScalar(0))) ? bcMin : -bcMin;
501 z = numext::sqrt(scale) * numext::sqrt(numext::abs((p / scale) * p + (bcMax / scale) * bcMinSigned));
502 }
503 const ComplexScalar alpha = ComplexScalar(M.coeff(1, 1) + p, (beta > 0) ? z : -z);
504 m_alphas.coeffRef(i) = numext::conj(alpha);
505 m_alphas.coeffRef(i + 1) = alpha;
506
507 if (computeEigenvectors) {
508 // Compute eigenvector in position (i+1) and then position (i) is just the conjugate
509 cv.setZero();
510 cv.coeffRef(i + 1) = Scalar(1.0);
511 const RealScalar divisor = scaleDivisor(numext::abs(alpha), numext::abs(beta));
512 const ComplexScalar scaledAlpha = alpha / divisor / maxS * scaleT;
513 const RealScalar scaledBeta = beta / divisor / maxT * scaleS;
514 const RealScalar absAlpha = numext::abs(scaledAlpha), absBeta = numext::abs(scaledBeta);
515 // here, the "static_cast" works around expression template issues.
516 cv.coeffRef(i) =
517 -(static_cast<Scalar>(scaledBeta * mS.coeffRef(i, i + 1)) - scaledAlpha * mT.coeffRef(i, i + 1)) /
518 (static_cast<Scalar>(scaledBeta * mS.coeffRef(i, i)) - scaledAlpha * mT.coeffRef(i, i));
519 if (numext::abs(cv.coeff(i)) > big) cv /= numext::abs(cv.coeff(i));
520 for (Index j = i - 1; j >= 0; j--) {
521 const Index st = j + 1;
522 const Index sz = i + 1 - j;
523 RealScalar largest;
524 if (j > 0 && mS.coeff(j, j - 1) != Scalar(0)) {
525 // 2x2 block
526 Matrix<ComplexScalar, 2, 1> rhs = (scaledAlpha * mT.template block<2, Dynamic>(j - 1, st, 2, sz) -
527 scaledBeta * mS.template block<2, Dynamic>(j - 1, st, 2, sz))
528 .lazyProduct(cv.segment(st, sz));
529 Matrix<ComplexScalar, 2, 2> lhs = scaledBeta * mS.template block<2, 2>(j - 1, j - 1) -
530 scaledAlpha * mT.template block<2, 2>(j - 1, j - 1);
531 const RealScalar smin = numext::maxi(pivotFloor(j - 1, j - 1, i + 1, absAlpha, absBeta),
532 pivotFloor(j, j - 1, i + 1, absAlpha, absBeta));
533 cv.template segment<2>(j - 1) = solveWithPerturbedPivots(lhs, rhs, smin);
534 largest = cv.template segment<2>(j - 1).cwiseAbs().maxCoeff();
535 j--;
536 } else {
537 ComplexScalar pivot = scaledAlpha * mT.coeff(j, j) - static_cast<Scalar>(scaledBeta * mS.coeff(j, j));
538 const RealScalar smin = pivotFloor(j, j, i + 1, absAlpha, absBeta);
539 if (numext::abs(pivot) < smin) pivot = ComplexScalar(smin);
540 cv.coeffRef(j) =
541 cv.segment(st, sz)
542 .transpose()
543 .cwiseProduct(scaledBeta * mS.block(j, st, 1, sz) - scaledAlpha * mT.block(j, st, 1, sz))
544 .sum() /
545 pivot;
546 largest = numext::abs(cv.coeff(j));
547 }
548 if (largest > big) cv /= largest;
549 }
550 m_eivec.col(i + 1).noalias() = m_realQZ.matrixZ().transpose() * cv;
551 m_eivec.col(i + 1).normalize();
552 m_eivec.col(i) = m_eivec.col(i + 1).conjugate();
553 }
554 i += 2;
555 }
556 }
557 }
558 m_computeEigenvectors = computeEigenvectors;
559 m_isInitialized = true;
560 return *this;
561}
562
563} // end namespace Eigen
564
565#endif // EIGEN_GENERALIZEDEIGENSOLVER_H
Generic expression where a coefficient-wise binary operator is applied to two expressions.
Definition CwiseBinaryOp.h:91
Computes the generalized eigenvalues and eigenvectors of a pair of general matrices.
Definition GeneralizedEigenSolver.h:93
GeneralizedEigenSolver(EigenBase< InputTypeA > &A, EigenBase< InputTypeB > &B, bool computeEigenvectors=true)
Constructor for inplace decomposition .
Definition GeneralizedEigenSolver.h:208
internal::make_complex_t< Scalar > ComplexScalar
Complex scalar type for MatrixType.
Definition GeneralizedEigenSolver.h:117
Eigen::Index Index
Definition GeneralizedEigenSolver.h:109
EigenvectorsType eigenvectors() const
Returns the computed generalized eigenvectors.
Definition GeneralizedEigenSolver.h:231
Matrix< Scalar, ColsAtCompileTime, 1, Options &~RowMajor, MaxColsAtCompileTime, 1 > VectorType
Type for vector of real scalar values eigenvalues as returned by betas().
Definition GeneralizedEigenSolver.h:124
typename MatrixType::Scalar Scalar
Scalar type for matrices of type MatrixType.
Definition GeneralizedEigenSolver.h:107
MatrixType_ MatrixType
Synonym for the template parameter MatrixType_.
Definition GeneralizedEigenSolver.h:96
const VectorType & betas() const
Definition GeneralizedEigenSolver.h:275
CwiseBinaryOp< internal::scalar_quotient_op< ComplexScalar, Scalar >, ComplexVectorType, VectorType > EigenvalueType
Expression type for the eigenvalues as returned by eigenvalues().
Definition GeneralizedEigenSolver.h:135
GeneralizedEigenSolver()
Default constructor.
Definition GeneralizedEigenSolver.h:153
const ComplexVectorType & alphas() const
Definition GeneralizedEigenSolver.h:265
Matrix< ComplexScalar, ColsAtCompileTime, 1, Options &~RowMajor, MaxColsAtCompileTime, 1 > ComplexVectorType
Type for vector of complex scalar values eigenvalues as returned by alphas().
Definition GeneralizedEigenSolver.h:131
GeneralizedEigenSolver(const EigenBase< InputTypeA > &A, const EigenBase< InputTypeB > &B, bool computeEigenvectors=true)
Constructor; computes the generalized eigendecomposition of given matrix pair.
Definition GeneralizedEigenSolver.h:184
Matrix< ComplexScalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime > EigenvectorsType
Type for matrix of eigenvectors as returned by eigenvectors().
Definition GeneralizedEigenSolver.h:143
EigenvalueType eigenvalues() const
Returns an expression of the computed generalized eigenvalues.
Definition GeneralizedEigenSolver.h:255
GeneralizedEigenSolver(Index size)
Default constructor with memory preallocation.
Definition GeneralizedEigenSolver.h:162
GeneralizedEigenSolver & setMaxIterations(Index maxIters)
Definition GeneralizedEigenSolver.h:314
GeneralizedEigenSolver & compute(const EigenBase< InputTypeA > &A, const EigenBase< InputTypeB > &B, bool computeEigenvectors=true)
Computes generalized eigendecomposition of given matrix.
A matrix or vector expression mapping an existing array of data.
Definition Map.h:97
The matrix class, also used for vectors and row-vectors.
Definition Matrix.h:188
constexpr const Scalar & coeff(Index rowId, Index colId) const
Definition PlainObjectBase.h:187
Derived & setConstant(Index size, const Scalar &val)
Definition CwiseNullaryOp.h:349
Performs a real QZ decomposition of a pair of square matrices.
Definition RealQZ.h:62
const MatrixType & matrixT() const
Returns matrix S in the QZ decomposition.
Definition RealQZ.h:185
const MatrixType & matrixS() const
Returns matrix S in the QZ decomposition.
Definition RealQZ.h:176
ComputationInfo info() const
Reports whether previous computation was successful.
Definition RealQZ.h:206
const PlainMatrixType & matrixZ() const
Returns matrix Z in the QZ decomposition.
Definition RealQZ.h:166
RealQZ & compute(const EigenBase< InputTypeA > &A, const EigenBase< InputTypeB > &B, bool computeQZ=true)
Computes QZ decomposition of given matrix.
ComputationInfo
Definition Constants.h:455
@ Success
Definition Constants.h:457
Definition EigenBase.h:34