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();
313 Scaling::unscale_in_place(m_S, maxS, factorsS);
314 Scaling::unscale_in_place(m_T, maxT, factorsT);
318 const bool finiteInput = (numext::isfinite)(maxS) && (numext::isfinite)(maxT);
320 if (m_info ==
Success && !(finiteInput && m_S.allFinite() && m_T.allFinite())) m_info =
NumericalIssue;
324template <
typename MatrixType_>
327 m_ws.resize(2 * m_n);
328 m_hCoeffs.resize(m_n);
329 internal::householder_qr_inplace_blocked<MatrixType, Vec>::run(m_T, m_hCoeffs, 48, m_ws.data());
330 Map<Vec> workspace(m_ws.data(), m_n);
332 if (m_computeQZ) householderQ.evalTo(m_Q, workspace);
335 householderQ.adjoint().applyThisOnTheLeft(m_S, workspace);
337 m_T.template triangularView<StrictlyLower>().setZero();
339 if (m_computeQZ) m_Z = PlainMatrixType::Identity(m_n, m_n);
342 for (Index j = 0; j <= m_n - 3; j++) {
343 for (Index i = m_n - 1; i >= j + 2; i--) {
344 JacobiRotation<Scalar> G;
346 if (!numext::is_exactly_zero(m_S.coeff(i, j))) {
347 G.makeGivens(m_S.coeff(i - 1, j), m_S.coeff(i, j), &m_S.coeffRef(i - 1, j));
348 m_S.coeffRef(i, j) = Scalar(0);
349 m_T.rightCols(m_n - i + 1).applyOnTheLeft(i - 1, i, G.adjoint());
350 m_S.rightCols(m_n - j - 1).applyOnTheLeft(i - 1, i, G.adjoint());
352 if (!is_negligible(m_S(i, j)))
355 m_S(i, j) = Scalar(0);
357 if (m_computeQZ) m_Q.applyOnTheRight(i - 1, i, G);
360 if (!numext::is_exactly_zero(m_T.coeff(i, i - 1))) {
362 G.makeGivens(m_T.coeff(i, i), m_T.coeff(i, i - 1), &m_T.coeffRef(i, i));
363 m_T.topRows(i).applyOnTheRight(i - 1, i, G.adjoint());
364 m_T.coeffRef(i, i - 1) = Scalar(0);
366 m_S.applyOnTheRight(i - 1, i, G.adjoint());
368 if (m_computeQZ) m_Z.applyOnTheLeft(i - 1, i, G);
374template <
typename MatrixType>
375template <
typename SparseMatrixType_>
377 EIGEN_INTERNAL_ASSERT_SQUARE_MSG(A,
"A is not a square matrix");
378 EIGEN_INTERNAL_ASSERT_SAME_SHAPE_MSG(A, B,
"B is not a square matrix or B is not of the same size as A");
384 computeInPlace(computeQZ);
387template <
typename MatrixType_>
389 m_ws.resize(2 * m_n);
390 Index l = m_n - 1, f;
391 unsigned int local_iter = 0;
395 f = findSmallSubdiagEntry(l);
399 m_S.coeffRef(f, f - 1) = Scalar(0);
404 }
else if (f == l - 1) {
406 reduceDiagonal2x2block(f);
413 if (local_iter >= m_maxIters)
break;
414 Index z = findSmallDiagEntry(f, l);
416 push_down_zero_ST(z, l);
418 do_QZ_step(f, l, local_iter);
429template <
typename MatrixType_>
431 JacobiRotation<Scalar> J;
432 J.makeGivens(numext::conj(b(1)), numext::conj(b(0)));
434 return J.transpose();
438template <
typename MatrixType_>
440 const auto a = [p,
this](Index i, Index j) {
return m_S(p + i - 1, p + j - 1); };
441 const auto b = [p,
this](Index i, Index j) {
return m_T(p + i - 1, p + j - 1); };
442 const Index m = l - p + 1;
443 if (iter > 0 && iter % 10 == 0) {
445 const RealScalar displacement =
446 numext::abs(a(m, m - 1) / b(m - 1, m - 1)) + numext::abs(a(m - 1, m - 2) / b(m - 2, m - 2));
447 const Scalar shift = a(m, m) / b(m, m) + displacement;
449 return Vec3(a(1, 1) / b(1, 1) - shift, a(2, 1) / b(1, 1), Scalar(0));
451 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),
452 W3 = a(m, m - 1) / b(m - 1, m - 1);
454 (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) +
455 a(1, 2) / b(2, 2) - a(1, 1) / b(1, 1) * b(1, 2) / b(2, 2),
456 (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 +
457 W3 * (b(m - 1, m) / b(m, m)),
462template <
typename MatrixType_>
472 for (Index j = l - 2; j > f; --j) {
473 X = shiftColumn(j, l, iter);
474 const RealScalar scale = numext::abs(X(0)) + numext::abs(X(1)) + numext::abs(X(2));
475 if (!(numext::isfinite)(scale) || scale == RealScalar(0))
continue;
477 const RealScalar diagonal =
478 numext::abs(m_S(j - 1, j - 1)) + numext::abs(m_S(j, j)) + numext::abs(m_S(j + 1, j + 1));
479 if (numext::abs(m_S(j, j - 1)) * (numext::abs(X(1)) + numext::abs(X(2))) <=
480 NumTraits<RealScalar>::epsilon() * numext::abs(X(0)) * diagonal) {
485 if (p == f) X = shiftColumn(f, l, iter);
486 const Index m = l - p + 1;
487 Scalar x = X(0), y = X(1), z = X(2);
488 const PermutationMatrix<3, 3, int> S3(
Vector3i(2, 0, 1));
489 for (Index k = p; k < p + m - 2; k++) {
494 X.makeHouseholder(ess, tau, beta);
498 m_S.template middleRows<3>(k)
499 .rightCols((std::min)(m_n, m_n - k + 1))
500 .applyHouseholderOnTheLeft(ess, tau, m_ws.data());
501 if (k > f && k == p) {
503 m_S.coeffRef(k + 1, k - 1) = Scalar(0);
504 m_S.coeffRef(k + 2, k - 1) = Scalar(0);
506 m_T.template middleRows<3>(k).rightCols(m_n - k).applyHouseholderOnTheLeft(ess, tau, m_ws.data());
507 if (m_computeQZ) m_Q.template middleCols<3>(k).applyHouseholderOnTheRight(ess, numext::conj(tau), m_ws.data());
510 Vec3 bprime = (m_T.template block<1, 3>(k + 2, k) * S3).adjoint();
511 bprime.makeHouseholder(ess, tau, beta);
512 auto Sk = m_S.template middleCols<3>(k).topRows((std::min)(k + 4, m_n));
513 auto Tk = m_T.template middleCols<3>(k).topRows((std::min)(k + 3, m_n));
515 Sk.col(0).swap(Sk.col(2));
516 Sk.col(1).swap(Sk.col(2));
517 Sk.applyHouseholderOnTheRight(ess, numext::conj(tau), m_ws.data());
518 Sk.col(1).swap(Sk.col(2));
519 Sk.col(0).swap(Sk.col(2));
520 Tk.col(0).swap(Tk.col(2));
521 Tk.col(1).swap(Tk.col(2));
522 Tk.applyHouseholderOnTheRight(ess, numext::conj(tau), m_ws.data());
523 Tk.col(1).swap(Tk.col(2));
524 Tk.col(0).swap(Tk.col(2));
526 auto Zk = m_Z.template middleRows<3>(k);
527 Zk.row(0).swap(Zk.row(2));
528 Zk.row(1).swap(Zk.row(2));
529 Zk.applyHouseholderOnTheLeft(ess, tau, m_ws.data());
530 Zk.row(1).swap(Zk.row(2));
531 Zk.row(0).swap(Zk.row(2));
533 const JacobiRotation<Scalar> Zk2 = computeZk2(m_T.template block<1, 2>(k + 1, k));
534 m_S.template middleCols<2>(k).topRows((std::min)(k + 4, m_n)).applyOnTheRight(0, 1, Zk2);
535 m_T.template middleCols<2>(k).topRows((std::min)(k + 3, m_n)).applyOnTheRight(0, 1, Zk2);
537 if (m_computeQZ) m_Z.template middleRows<2>(k).applyOnTheLeft(0, 1, Zk2.adjoint());
547 JacobiRotation<Scalar> J;
549 m_S.template middleRows<2>(p + m - 2).applyOnTheLeft(0, 1, J.adjoint());
550 m_T.template middleRows<2>(p + m - 2).applyOnTheLeft(0, 1, J.adjoint());
552 if (m_computeQZ) m_Q.template middleCols<2>(p + m - 2).applyOnTheRight(0, 1, J);
555 const JacobiRotation<Scalar> Zn1 = computeZk2(m_T.template block<1, 2>(p + m - 1, p + m - 2));
556 m_S.template middleCols<2>(p + m - 2).applyOnTheRight(0, 1, Zn1);
557 m_T.template middleCols<2>(p + m - 2).applyOnTheRight(0, 1, Zn1);
559 if (m_computeQZ) m_Z.template middleRows<2>(p + m - 2).applyOnTheLeft(0, 1, Zn1.adjoint());
563template <
typename MatrixType_>
566 Mat2 Si = m_S.template block<2, 2>(i, i), Ti = m_T.template block<2, 2>(i, i);
567 const RealScalar tolT = m_normOfT * NumTraits<RealScalar>::epsilon();
568 if (is_negligible(Ti(0, 0), tolT)) {
571 m_S.applyOnTheLeft(i, i + 1, G.
adjoint());
572 m_T.applyOnTheLeft(i, i + 1, G.
adjoint());
574 if (m_computeQZ) m_Q.applyOnTheRight(i, i + 1, G);
576 }
else if (is_negligible(Ti(1, 1), tolT)) {
578 G.
makeGivens(m_S(i + 1, i + 1), m_S(i + 1, i));
579 m_S.applyOnTheRight(i, i + 1, G.
adjoint());
580 m_T.applyOnTheRight(i, i + 1, G.
adjoint());
581 if (m_computeQZ) m_Z.applyOnTheLeft(i, i + 1, G);
583 Scalar mu = Si(0, 0) / Ti(0, 0);
584 Scalar a12_bar = Si(0, 1) - mu * Ti(0, 1);
585 Scalar a22_bar = Si(1, 1) - mu * Ti(1, 1);
586 Scalar p = Scalar(0.5) * (a22_bar / Ti(1, 1) - Ti(0, 1) * Si(1, 0) / (Ti(0, 0) * Ti(1, 1)));
587 RealScalar sgn_p = p.real() >= RealScalar(0) ? RealScalar(1) : RealScalar(-1);
588 Scalar q = Si(1, 0) * a12_bar / (Ti(0, 0) * Ti(1, 1));
589 Scalar r = p * p + q;
590 Scalar lambda = mu + p + sgn_p * numext::sqrt(r);
591 Mat2 E = Si - lambda * Ti;
593 E.rowwise().norm().maxCoeff(&l);
594 JacobiRotation<Scalar> G;
595 G.makeGivens(E(l, 1), E(l, 0));
596 m_S.applyOnTheRight(i, i + 1, G.adjoint());
597 m_T.applyOnTheRight(i, i + 1, G.adjoint());
599 if (m_computeQZ) m_Z.applyOnTheLeft(i, i + 1, G);
603 if (numext::abs(m_T(i, i)) + numext::abs(m_T(i + 1, i)) > tolT)
604 G.makeGivens(m_T(i, i), m_T(i + 1, i));
606 G.makeGivens(m_S(i, i), m_S(i + 1, i));
607 m_S.applyOnTheLeft(i, i + 1, G.adjoint());
608 m_T.applyOnTheLeft(i, i + 1, G.adjoint());
610 if (m_computeQZ) m_Q.applyOnTheRight(i, i + 1, G);
618 const auto relativeSubdiagonal = [](
const Mat2& s) {
619 const RealScalar subdiagonal = numext::abs(s(1, 0));
620 const RealScalar diagonal = numext::abs(s(0, 0)) + numext::abs(s(1, 1));
621 return subdiagonal <= NumTraits<RealScalar>::epsilon() * diagonal ? RealScalar(0) : subdiagonal / diagonal;
623 JacobiRotation<Scalar> left[4], right[4];
624 Mat2 Sstep = m_S.template block<2, 2>(i, i), Tstep = m_T.template block<2, 2>(i, i);
625 const RealScalar tolS = m_normOfS * NumTraits<RealScalar>::epsilon();
626 RealScalar current = relativeSubdiagonal(Sstep), best = current;
627 bool bestPasses = is_negligible(Sstep(1, 0), tolS);
629 for (
int k = 0; k < 4 && current > RealScalar(0); ++k) {
630 if (is_negligible(Tstep(1, 1), tolT)) {
632 left[k] = JacobiRotation<Scalar>(Scalar(1), Scalar(0));
633 right[k].makeGivens(Sstep(1, 1), Sstep(1, 0));
634 right[k] = right[k].adjoint();
636 const Scalar shift = Sstep(1, 1) / Tstep(1, 1);
637 left[k].makeGivens(Sstep(0, 0) - shift * Tstep(0, 0), Sstep(1, 0));
638 Sstep.applyOnTheLeft(0, 1, left[k].adjoint());
639 Tstep.applyOnTheLeft(0, 1, left[k].adjoint());
640 right[k] = computeZk2(Tstep.row(1));
642 Sstep.applyOnTheRight(0, 1, right[k]);
643 Tstep.applyOnTheRight(0, 1, right[k]);
644 Tstep(1, 0) = Scalar(0);
645 current = relativeSubdiagonal(Sstep);
646 const bool passes = is_negligible(Sstep(1, 0), tolS);
647 if ((passes && !bestPasses) || (passes == bestPasses && current < best)) {
653 for (
int k = 0; k < bestSteps; ++k) {
654 m_S.rightCols(m_n - i).applyOnTheLeft(i, i + 1, left[k].adjoint());
655 m_T.rightCols(m_n - i).applyOnTheLeft(i, i + 1, left[k].adjoint());
656 if (m_computeQZ) m_Q.applyOnTheRight(i, i + 1, left[k]);
657 m_S.topRows(i + 2).applyOnTheRight(i, i + 1, right[k]);
658 m_T.topRows(i + 2).applyOnTheRight(i, i + 1, right[k]);
659 m_T(i + 1, i) = Scalar(0);
660 if (m_computeQZ) m_Z.applyOnTheLeft(i, i + 1, right[k].adjoint());
663 if (!is_negligible(m_S(i + 1, i), tolS)) {
666 m_S(i + 1, i) = Scalar(0);
667 m_T(i + 1, i) = Scalar(0);
672template <
typename MatrixType_>
674 JacobiRotation<Scalar> J;
675 for (Index j = k + 1; j <= l; j++) {
677 J.makeGivens(m_T(j - 1, j), m_T(j, j), &m_T.coeffRef(j - 1, j));
678 if (m_n - j - 1 > 0) {
679 m_T.rightCols(m_n - j - 1).applyOnTheLeft(j - 1, j, J.adjoint());
681 m_T.coeffRef(j, j) = Scalar(0);
683 m_S.applyOnTheLeft(j - 1, j, J.adjoint());
685 if (m_computeQZ) m_Q.applyOnTheRight(j - 1, j, J);
689 J.makeGivens(numext::conj(m_S(j, j - 1)), numext::conj(m_S(j, j - 2)));
690 m_S.applyOnTheRight(j - 1, j - 2, J);
691 m_S(j, j - 2) = Scalar(0);
692 m_T.applyOnTheRight(j - 1, j - 2, J);
693 if (m_computeQZ) m_Z.applyOnTheLeft(j - 1, j - 2, J.adjoint());
699 J.makeGivens(numext::conj(m_S(l, l)), numext::conj(m_S(l, l - 1)));
700 m_S.topRows(l + 1).applyOnTheRight(l, l - 1, J);
702 if (!is_negligible(m_S(l, l - 1), m_normOfS * NumTraits<Scalar>::epsilon())) {
705 m_S(l, l - 1) = Scalar(0);
707 m_T.topRows(l + 1).applyOnTheRight(l, l - 1, J);
709 if (m_computeQZ) m_Z.applyOnTheLeft(l, l - 1, J.adjoint());
712 if (!is_negligible(m_T(l, l), m_normOfT * NumTraits<RealScalar>::epsilon()) ||
713 !is_negligible(m_S(l, l - 1), m_normOfS * NumTraits<RealScalar>::epsilon())) {
716 m_T(l, l) = Scalar(0);
717 m_S(l, l - 1) = Scalar(0);
722template <
typename MatrixType_>
724 m_normOfS = internal::hessenberg_abs_sum<Upper>(m_S);
725 m_normOfT = internal::triangular_abs_sum<Upper>(m_T);
730template <
typename MatrixType_>
734 RealScalar s = numext::abs(m_S.coeff(res - 1, res - 1)) + numext::abs(m_S.coeff(res, res));
735 if (s == Scalar(0)) s = m_normOfS;
737 if (numext::abs(m_S.coeff(res, res - 1)) <= NumTraits<RealScalar>::epsilon() * s)
break;
745template <
typename MatrixType_>
749 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