15#ifndef EIGEN_COMPLEX_QZ_H_
16#define EIGEN_COMPLEX_QZ_H_
19#include "./InternalHeaderCheck.h"
51template <
typename MatrixType_>
54 using MatrixType = MatrixType_;
55 using Scalar =
typename MatrixType_::Scalar;
56 using RealScalar =
typename MatrixType_::RealScalar;
59 RowsAtCompileTime = MatrixType::RowsAtCompileTime,
60 ColsAtCompileTime = MatrixType::ColsAtCompileTime,
61 Options = internal::plain_object_options<MatrixType>::value,
62 MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime,
63 MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime
68 using PlainMatrixType =
69 Matrix<Scalar, RowsAtCompileTime, ColsAtCompileTime, Options, MaxRowsAtCompileTime, MaxColsAtCompileTime>;
71 using Vec = Matrix<Scalar, Dynamic, 1>;
72 using Vec2 = Matrix<Scalar, 2, 1>;
73 using Vec3 = Matrix<Scalar, 3, 1>;
74 using Row2 = Matrix<Scalar, 1, 2>;
75 using Mat2 = Matrix<Scalar, 2, 2>;
81 const PlainMatrixType& matrixQ()
const {
82 eigen_assert(m_isInitialized &&
"ComplexQZ is not initialized.");
83 eigen_assert(m_computeQZ &&
"The matrices Q and Z have not been computed during the QZ decomposition.");
91 const PlainMatrixType& matrixZ()
const {
92 eigen_assert(m_isInitialized &&
"ComplexQZ is not initialized.");
93 eigen_assert(m_computeQZ &&
"The matrices Q and Z have not been computed during the QZ decomposition.");
101 const MatrixType& matrixS()
const {
102 eigen_assert(m_isInitialized &&
"ComplexQZ is not initialized.");
110 const MatrixType& matrixT()
const {
111 eigen_assert(m_isInitialized &&
"ComplexQZ is not initialized.");
123 ComplexQZ(Index n,
bool computeQZ =
true,
unsigned int maxIters = 400)
125 m_maxIters(maxIters),
126 m_computeQZ(computeQZ),
129 m_Q(computeQZ ? n : (MatrixType::RowsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::RowsAtCompileTime),
130 computeQZ ? n : (MatrixType::ColsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::ColsAtCompileTime)),
131 m_Z(computeQZ ? n : (MatrixType::RowsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::RowsAtCompileTime),
132 computeQZ ? n : (MatrixType::ColsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::ColsAtCompileTime)),
147 template <
typename InputTypeA,
typename InputTypeB>
148 ComplexQZ(
const EigenBase<InputTypeA>& A,
const EigenBase<InputTypeB>& B,
bool computeQZ =
true,
149 unsigned int maxIters = 400)
151 m_maxIters(maxIters),
152 m_computeQZ(computeQZ),
155 m_Q(computeQZ ? m_n : (MatrixType::RowsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::RowsAtCompileTime),
156 computeQZ ? m_n : (MatrixType::ColsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::ColsAtCompileTime)),
157 m_Z(computeQZ ? m_n : (MatrixType::RowsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::RowsAtCompileTime),
158 computeQZ ? m_n : (MatrixType::ColsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::ColsAtCompileTime)),
161 computeInPlace(computeQZ);
175 template <
typename InputTypeA,
typename InputTypeB>
176 ComplexQZ(EigenBase<InputTypeA>& A, EigenBase<InputTypeB>& B,
bool computeQZ =
true,
unsigned int maxIters = 400)
178 m_maxIters(maxIters),
179 m_computeQZ(computeQZ),
182 m_Q(computeQZ ? m_n : (MatrixType::RowsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::RowsAtCompileTime),
183 computeQZ ? m_n : (MatrixType::ColsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::ColsAtCompileTime)),
184 m_Z(computeQZ ? m_n : (MatrixType::RowsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::RowsAtCompileTime),
185 computeQZ ? m_n : (MatrixType::ColsAtCompileTime == Eigen::Dynamic ? 0 : MatrixType::ColsAtCompileTime)),
188 computeInPlace(computeQZ);
197 template <
typename InputTypeA,
typename InputTypeB>
198 void compute(
const EigenBase<InputTypeA>& A,
const EigenBase<InputTypeB>& B,
bool computeQZ =
true);
206 template <
typename SparseMatrixType_>
207 void computeSparse(
const SparseMatrixType_& A,
const SparseMatrixType_& B,
bool computeQZ =
true);
217 ComputationInfo info()
const {
218 eigen_assert(m_isInitialized &&
"ComplexQZ is not initialized.");
224 unsigned int iterations()
const {
225 eigen_assert(m_isInitialized &&
"ComplexQZ is not initialized.");
226 return m_global_iter;
231 const unsigned int m_maxIters;
232 unsigned int m_global_iter = 0;
233 bool m_isInitialized =
false;
237 PlainMatrixType m_Q, m_Z;
238 RealScalar m_normOfT, m_normOfS;
243 static bool is_negligible(
const Scalar x,
const RealScalar tol = NumTraits<RealScalar>::epsilon()) {
244 return numext::abs(x) <= tol;
247 void do_QZ_step(Index f, Index l,
unsigned int iter);
249 Vec3 shiftColumn(Index p, Index l,
unsigned int iter)
const;
251 JacobiRotation<Scalar> computeZk2(
const Row2& b);
253 void computeInPlace(
bool computeQZ);
256 void hessenbergTriangular();
260 void reduceHessenbergTriangular();
264 Index findSmallSubdiagEntry(Index l);
265 Index findSmallDiagEntry(Index f, Index l);
267 void push_down_zero_ST(Index k, Index l);
269 void reduceDiagonal2x2block(Index i);
272template <
typename MatrixType_>
273template <
typename InputTypeA,
typename InputTypeB>
275 EIGEN_INTERNAL_ASSERT_SQUARE_MSG(A,
"A is not a square matrix");
276 EIGEN_INTERNAL_ASSERT_SAME_SHAPE_MSG(A, B,
"B is not a square matrix or B is not of the same size as A");
280 computeInPlace(computeQZ);
284template <
typename MatrixType_>
286 m_computeQZ = computeQZ;
289 EIGEN_INTERNAL_ASSERT_SQUARE_MSG(m_S,
"A is not a square matrix");
290 EIGEN_INTERNAL_ASSERT_SAME_SHAPE_MSG(m_S, m_T,
"B is not a square matrix or B is not of the same size as A");
292 m_isInitialized =
true;
300 using Scaling = internal::safe_scaling<RealScalar>;
301 const RealScalar maxS = Scaling::max_abs_component(m_S);
302 const RealScalar maxT = Scaling::max_abs_component(m_T);
303 const internal::safe_scaling_factors<RealScalar> factorsS = Scaling::scale_in_place(m_S, maxS);
304 const internal::safe_scaling_factors<RealScalar> factorsT = Scaling::scale_in_place(m_T, maxT);
307 hessenbergTriangular();
311 reduceHessenbergTriangular();
318 m_S.template triangularView<StrictlyLower>().setZero();
319 m_T.template triangularView<StrictlyLower>().setZero();
322 Scaling::unscale_in_place(m_S, maxS, factorsS);
323 Scaling::unscale_in_place(m_T, maxT, factorsT);
327 const bool finiteInput = (numext::isfinite)(maxS) && (numext::isfinite)(maxT);
329 if (m_info ==
Success && !(finiteInput && m_S.allFinite() && m_T.allFinite())) m_info =
NumericalIssue;
333template <
typename MatrixType_>
336 m_ws.resize(2 * m_n);
337 m_hCoeffs.resize(m_n);
338 internal::householder_qr_inplace_blocked<MatrixType, Vec>::run(m_T, m_hCoeffs, 48, m_ws.data());
339 Map<Vec> workspace(m_ws.data(), m_n);
341 if (m_computeQZ) householderQ.evalTo(m_Q, workspace);
344 householderQ.adjoint().applyThisOnTheLeft(m_S, workspace);
346 m_T.template triangularView<StrictlyLower>().setZero();
348 if (m_computeQZ) m_Z = PlainMatrixType::Identity(m_n, m_n);
351 for (Index j = 0; j <= m_n - 3; j++) {
352 for (Index i = m_n - 1; i >= j + 2; i--) {
353 JacobiRotation<Scalar> G;
355 if (!numext::is_exactly_zero(m_S.coeff(i, j))) {
356 G.makeGivens(m_S.coeff(i - 1, j), m_S.coeff(i, j), &m_S.coeffRef(i - 1, j));
357 m_S.coeffRef(i, j) = Scalar(0);
358 m_T.rightCols(m_n - i + 1).applyOnTheLeft(i - 1, i, G.adjoint());
359 m_S.rightCols(m_n - j - 1).applyOnTheLeft(i - 1, i, G.adjoint());
361 if (!is_negligible(m_S(i, j)))
364 m_S(i, j) = Scalar(0);
366 if (m_computeQZ) m_Q.applyOnTheRight(i - 1, i, G);
369 if (!numext::is_exactly_zero(m_T.coeff(i, i - 1))) {
371 G.makeGivens(m_T.coeff(i, i), m_T.coeff(i, i - 1), &m_T.coeffRef(i, i));
372 m_T.topRows(i).applyOnTheRight(i - 1, i, G.adjoint());
373 m_T.coeffRef(i, i - 1) = Scalar(0);
375 m_S.applyOnTheRight(i - 1, i, G.adjoint());
377 if (m_computeQZ) m_Z.applyOnTheLeft(i - 1, i, G);
383template <
typename MatrixType>
384template <
typename SparseMatrixType_>
386 EIGEN_INTERNAL_ASSERT_SQUARE_MSG(A,
"A is not a square matrix");
387 EIGEN_INTERNAL_ASSERT_SAME_SHAPE_MSG(A, B,
"B is not a square matrix or B is not of the same size as A");
393 computeInPlace(computeQZ);
396template <
typename MatrixType_>
398 m_ws.resize(2 * m_n);
399 Index l = m_n - 1, f;
400 unsigned int local_iter = 0;
404 f = findSmallSubdiagEntry(l);
408 m_S.coeffRef(f, f - 1) = Scalar(0);
413 }
else if (f == l - 1) {
415 reduceDiagonal2x2block(f);
422 if (local_iter >= m_maxIters)
break;
423 Index z = findSmallDiagEntry(f, l);
425 push_down_zero_ST(z, l);
427 do_QZ_step(f, l, local_iter);
438template <
typename MatrixType_>
440 JacobiRotation<Scalar> J;
441 J.makeGivens(numext::conj(b(1)), numext::conj(b(0)));
443 return J.transpose();
447template <
typename MatrixType_>
449 const auto a = [p,
this](Index i, Index j) {
return m_S(p + i - 1, p + j - 1); };
450 const auto b = [p,
this](Index i, Index j) {
return m_T(p + i - 1, p + j - 1); };
451 const Index m = l - p + 1;
452 if (iter > 0 && iter % 10 == 0) {
454 const RealScalar displacement =
455 numext::abs(a(m, m - 1) / b(m - 1, m - 1)) + numext::abs(a(m - 1, m - 2) / b(m - 2, m - 2));
456 const Scalar shift = a(m, m) / b(m, m) + displacement;
458 return Vec3(a(1, 1) / b(1, 1) - shift, a(2, 1) / b(1, 1), Scalar(0));
460 const Scalar W1 = a(m - 1, m - 1) / b(m - 1, m - 1) - a(1, 1) / b(1, 1), W2 = a(m, m) / b(m, m) - a(1, 1) / b(1, 1),
461 W3 = a(m, m - 1) / b(m - 1, m - 1);
463 (W1 * W2 - a(m - 1, m) / b(m, m) * W3 + W3 * b(m - 1, m) / b(m, m) * a(1, 1) / b(1, 1)) * b(1, 1) / a(2, 1) +
464 a(1, 2) / b(2, 2) - a(1, 1) / b(1, 1) * b(1, 2) / b(2, 2),
465 (a(2, 2) / b(2, 2) - a(1, 1) / b(1, 1)) - a(2, 1) / b(1, 1) * b(1, 2) / b(2, 2) - W1 - W2 +
466 W3 * (b(m - 1, m) / b(m, m)),
471template <
typename MatrixType_>
481 for (Index j = l - 2; j > f; --j) {
482 X = shiftColumn(j, l, iter);
483 const RealScalar scale = numext::abs(X(0)) + numext::abs(X(1)) + numext::abs(X(2));
484 if (!(numext::isfinite)(scale) || scale == RealScalar(0))
continue;
486 const RealScalar diagonal =
487 numext::abs(m_S(j - 1, j - 1)) + numext::abs(m_S(j, j)) + numext::abs(m_S(j + 1, j + 1));
488 if (numext::abs(m_S(j, j - 1)) * (numext::abs(X(1)) + numext::abs(X(2))) <=
489 NumTraits<RealScalar>::epsilon() * numext::abs(X(0)) * diagonal) {
494 if (p == f) X = shiftColumn(f, l, iter);
495 const Index m = l - p + 1;
496 Scalar x = X(0), y = X(1), z = X(2);
497 const PermutationMatrix<3, 3, int> S3(
Vector3i(2, 0, 1));
498 for (Index k = p; k < p + m - 2; k++) {
503 X.makeHouseholder(ess, tau, beta);
507 m_S.template middleRows<3>(k)
508 .rightCols((std::min)(m_n, m_n - k + 1))
509 .applyHouseholderOnTheLeft(ess, tau, m_ws.data());
510 if (k > f && k == p) {
512 m_S.coeffRef(k + 1, k - 1) = Scalar(0);
513 m_S.coeffRef(k + 2, k - 1) = Scalar(0);
515 m_T.template middleRows<3>(k).rightCols(m_n - k).applyHouseholderOnTheLeft(ess, tau, m_ws.data());
516 if (m_computeQZ) m_Q.template middleCols<3>(k).applyHouseholderOnTheRight(ess, numext::conj(tau), m_ws.data());
519 Vec3 bprime = (m_T.template block<1, 3>(k + 2, k) * S3).adjoint();
520 bprime.makeHouseholder(ess, tau, beta);
521 auto Sk = m_S.template middleCols<3>(k).topRows((std::min)(k + 4, m_n));
522 auto Tk = m_T.template middleCols<3>(k).topRows((std::min)(k + 3, m_n));
524 Sk.col(0).swap(Sk.col(2));
525 Sk.col(1).swap(Sk.col(2));
526 Sk.applyHouseholderOnTheRight(ess, numext::conj(tau), m_ws.data());
527 Sk.col(1).swap(Sk.col(2));
528 Sk.col(0).swap(Sk.col(2));
529 Tk.col(0).swap(Tk.col(2));
530 Tk.col(1).swap(Tk.col(2));
531 Tk.applyHouseholderOnTheRight(ess, numext::conj(tau), m_ws.data());
532 Tk.col(1).swap(Tk.col(2));
533 Tk.col(0).swap(Tk.col(2));
535 auto Zk = m_Z.template middleRows<3>(k);
536 Zk.row(0).swap(Zk.row(2));
537 Zk.row(1).swap(Zk.row(2));
538 Zk.applyHouseholderOnTheLeft(ess, tau, m_ws.data());
539 Zk.row(1).swap(Zk.row(2));
540 Zk.row(0).swap(Zk.row(2));
542 const JacobiRotation<Scalar> Zk2 = computeZk2(m_T.template block<1, 2>(k + 1, k));
543 m_S.template middleCols<2>(k).topRows((std::min)(k + 4, m_n)).applyOnTheRight(0, 1, Zk2);
544 m_T.template middleCols<2>(k).topRows((std::min)(k + 3, m_n)).applyOnTheRight(0, 1, Zk2);
546 if (m_computeQZ) m_Z.template middleRows<2>(k).applyOnTheLeft(0, 1, Zk2.adjoint());
556 JacobiRotation<Scalar> J;
558 m_S.template middleRows<2>(p + m - 2).applyOnTheLeft(0, 1, J.adjoint());
559 m_T.template middleRows<2>(p + m - 2).applyOnTheLeft(0, 1, J.adjoint());
561 if (m_computeQZ) m_Q.template middleCols<2>(p + m - 2).applyOnTheRight(0, 1, J);
564 const JacobiRotation<Scalar> Zn1 = computeZk2(m_T.template block<1, 2>(p + m - 1, p + m - 2));
565 m_S.template middleCols<2>(p + m - 2).applyOnTheRight(0, 1, Zn1);
566 m_T.template middleCols<2>(p + m - 2).applyOnTheRight(0, 1, Zn1);
568 if (m_computeQZ) m_Z.template middleRows<2>(p + m - 2).applyOnTheLeft(0, 1, Zn1.adjoint());
572template <
typename MatrixType_>
575 Mat2 Si = m_S.template block<2, 2>(i, i), Ti = m_T.template block<2, 2>(i, i);
576 const RealScalar tolT = m_normOfT * NumTraits<RealScalar>::epsilon();
577 if (is_negligible(Ti(0, 0), tolT)) {
580 m_S.applyOnTheLeft(i, i + 1, G.
adjoint());
581 m_T.applyOnTheLeft(i, i + 1, G.
adjoint());
583 if (m_computeQZ) m_Q.applyOnTheRight(i, i + 1, G);
585 }
else if (is_negligible(Ti(1, 1), tolT)) {
587 G.
makeGivens(m_S(i + 1, i + 1), m_S(i + 1, i));
588 m_S.applyOnTheRight(i, i + 1, G.
adjoint());
589 m_T.applyOnTheRight(i, i + 1, G.
adjoint());
590 if (m_computeQZ) m_Z.applyOnTheLeft(i, i + 1, G);
592 Scalar mu = Si(0, 0) / Ti(0, 0);
593 Scalar a12_bar = Si(0, 1) - mu * Ti(0, 1);
594 Scalar a22_bar = Si(1, 1) - mu * Ti(1, 1);
595 Scalar p = Scalar(0.5) * (a22_bar / Ti(1, 1) - Ti(0, 1) * Si(1, 0) / (Ti(0, 0) * Ti(1, 1)));
596 RealScalar sgn_p = p.real() >= RealScalar(0) ? RealScalar(1) : RealScalar(-1);
597 Scalar q = Si(1, 0) * a12_bar / (Ti(0, 0) * Ti(1, 1));
598 Scalar r = p * p + q;
599 Scalar lambda = mu + p + sgn_p * numext::sqrt(r);
600 Mat2 E = Si - lambda * Ti;
602 E.rowwise().norm().maxCoeff(&l);
603 JacobiRotation<Scalar> G;
604 G.makeGivens(E(l, 1), E(l, 0));
605 m_S.applyOnTheRight(i, i + 1, G.adjoint());
606 m_T.applyOnTheRight(i, i + 1, G.adjoint());
608 if (m_computeQZ) m_Z.applyOnTheLeft(i, i + 1, G);
612 if (numext::abs(m_T(i, i)) + numext::abs(m_T(i + 1, i)) > tolT)
613 G.makeGivens(m_T(i, i), m_T(i + 1, i));
615 G.makeGivens(m_S(i, i), m_S(i + 1, i));
616 m_S.applyOnTheLeft(i, i + 1, G.adjoint());
617 m_T.applyOnTheLeft(i, i + 1, G.adjoint());
619 if (m_computeQZ) m_Q.applyOnTheRight(i, i + 1, G);
627 const auto relativeSubdiagonal = [](
const Mat2& s) {
628 const RealScalar subdiagonal = numext::abs(s(1, 0));
629 const RealScalar diagonal = numext::abs(s(0, 0)) + numext::abs(s(1, 1));
630 return subdiagonal <= NumTraits<RealScalar>::epsilon() * diagonal ? RealScalar(0) : subdiagonal / diagonal;
632 JacobiRotation<Scalar> left[4], right[4];
633 Mat2 Sstep = m_S.template block<2, 2>(i, i), Tstep = m_T.template block<2, 2>(i, i);
634 const RealScalar tolS = m_normOfS * NumTraits<RealScalar>::epsilon();
635 RealScalar current = relativeSubdiagonal(Sstep), best = current;
636 bool bestPasses = is_negligible(Sstep(1, 0), tolS);
638 for (
int k = 0; k < 4 && current > RealScalar(0); ++k) {
639 if (is_negligible(Tstep(1, 1), tolT)) {
641 left[k] = JacobiRotation<Scalar>(Scalar(1), Scalar(0));
642 right[k].makeGivens(Sstep(1, 1), Sstep(1, 0));
643 right[k] = right[k].adjoint();
645 const Scalar shift = Sstep(1, 1) / Tstep(1, 1);
646 left[k].makeGivens(Sstep(0, 0) - shift * Tstep(0, 0), Sstep(1, 0));
647 Sstep.applyOnTheLeft(0, 1, left[k].adjoint());
648 Tstep.applyOnTheLeft(0, 1, left[k].adjoint());
649 right[k] = computeZk2(Tstep.row(1));
651 Sstep.applyOnTheRight(0, 1, right[k]);
652 Tstep.applyOnTheRight(0, 1, right[k]);
653 Tstep(1, 0) = Scalar(0);
654 current = relativeSubdiagonal(Sstep);
655 const bool passes = is_negligible(Sstep(1, 0), tolS);
656 if ((passes && !bestPasses) || (passes == bestPasses && current < best)) {
662 for (
int k = 0; k < bestSteps; ++k) {
663 m_S.rightCols(m_n - i).applyOnTheLeft(i, i + 1, left[k].adjoint());
664 m_T.rightCols(m_n - i).applyOnTheLeft(i, i + 1, left[k].adjoint());
665 if (m_computeQZ) m_Q.applyOnTheRight(i, i + 1, left[k]);
666 m_S.topRows(i + 2).applyOnTheRight(i, i + 1, right[k]);
667 m_T.topRows(i + 2).applyOnTheRight(i, i + 1, right[k]);
668 m_T(i + 1, i) = Scalar(0);
669 if (m_computeQZ) m_Z.applyOnTheLeft(i, i + 1, right[k].adjoint());
672 if (!is_negligible(m_S(i + 1, i), tolS)) {
675 m_S(i + 1, i) = Scalar(0);
676 m_T(i + 1, i) = Scalar(0);
681template <
typename MatrixType_>
683 JacobiRotation<Scalar> J;
684 for (Index j = k + 1; j <= l; j++) {
686 J.makeGivens(m_T(j - 1, j), m_T(j, j), &m_T.coeffRef(j - 1, j));
687 if (m_n - j - 1 > 0) {
688 m_T.rightCols(m_n - j - 1).applyOnTheLeft(j - 1, j, J.adjoint());
690 m_T.coeffRef(j, j) = Scalar(0);
692 m_S.applyOnTheLeft(j - 1, j, J.adjoint());
694 if (m_computeQZ) m_Q.applyOnTheRight(j - 1, j, J);
698 J.makeGivens(numext::conj(m_S(j, j - 1)), numext::conj(m_S(j, j - 2)));
699 m_S.applyOnTheRight(j - 1, j - 2, J);
700 m_S(j, j - 2) = Scalar(0);
701 m_T.applyOnTheRight(j - 1, j - 2, J);
702 if (m_computeQZ) m_Z.applyOnTheLeft(j - 1, j - 2, J.adjoint());
708 J.makeGivens(numext::conj(m_S(l, l)), numext::conj(m_S(l, l - 1)));
709 m_S.topRows(l + 1).applyOnTheRight(l, l - 1, J);
711 if (!is_negligible(m_S(l, l - 1), m_normOfS * NumTraits<Scalar>::epsilon())) {
714 m_S(l, l - 1) = Scalar(0);
716 m_T.topRows(l + 1).applyOnTheRight(l, l - 1, J);
718 if (m_computeQZ) m_Z.applyOnTheLeft(l, l - 1, J.adjoint());
721 if (!is_negligible(m_T(l, l), m_normOfT * NumTraits<RealScalar>::epsilon()) ||
722 !is_negligible(m_S(l, l - 1), m_normOfS * NumTraits<RealScalar>::epsilon())) {
725 m_T(l, l) = Scalar(0);
726 m_S(l, l - 1) = Scalar(0);
731template <
typename MatrixType_>
733 m_normOfS = internal::hessenberg_abs_sum<Upper>(m_S);
734 m_normOfT = internal::triangular_abs_sum<Upper>(m_T);
739template <
typename MatrixType_>
743 RealScalar s = numext::abs(m_S.coeff(res - 1, res - 1)) + numext::abs(m_S.coeff(res, res));
744 if (s == Scalar(0)) s = m_normOfS;
746 if (numext::abs(m_S.coeff(res, res - 1)) <= NumTraits<RealScalar>::epsilon() * s)
break;
754template <
typename MatrixType_>
758 if (numext::abs(m_T.coeff(res, res)) <= NumTraits<RealScalar>::epsilon() * m_normOfT)
break;
Performs a QZ decomposition of a pair of matrices A, B.
Rotation given by a cosine-sine pair.
Definition Jacobi.h:39
JacobiRotation adjoint() const
Definition Jacobi.h:64
void makeGivens(const Scalar &p, const Scalar &q, Scalar *r=0)
Definition Jacobi.h:157
HouseholderSequence< VectorsType, CoeffsType > householderSequence(const VectorsType &v, const CoeffsType &h)
Convenience function for constructing a Householder sequence.
Definition HouseholderSequence.h:739
@ NumericalIssue
Definition Constants.h:459
@ InvalidInput
Definition Constants.h:464
@ Success
Definition Constants.h:457
@ NoConvergence
Definition Constants.h:461
Matrix< int, 3, 1 > Vector3i
3×1 vector of type int.
Definition Matrix.h:487