12#ifndef TLAPACK_GENERALIZED_SCHUR_SWAP_HH
13#define TLAPACK_GENERALIZED_SCHUR_SWAP_HH
75 const idx_t n = ncols(
A);
86 const idx_t
j1 =
j0 + 1;
87 const idx_t
j2 =
j0 + 2;
88 const idx_t
j3 =
j0 + 3;
141 auto z1 = col(
Z,
j0);
142 auto z2 = col(
Z,
j1);
166 auto q1 = col(
Q,
j0);
167 auto q2 = col(
Q,
j1);
206 for (idx_t j =
j0; j < n; ++j) {
212 for (idx_t j =
j0; j < n; ++j) {
218 for (idx_t j = 0; j < n; ++j) {
239 for (idx_t j = 0; j <
j3; ++j) {
245 for (idx_t j = 0; j <
j3; ++j) {
251 for (idx_t j = 0; j < n; ++j) {
293 for (idx_t j = 0; j <
j3; ++j) {
299 for (idx_t j = 0; j <
j3; ++j) {
305 for (idx_t j = 0; j < n; ++j) {
325 for (idx_t j =
j0; j < n; ++j) {
331 for (idx_t j =
j0; j < n; ++j) {
337 for (idx_t j = 0; j < n; ++j) {
356 std::vector<idx_t>
piv(8);
358 for (idx_t j = 0; j < 8; ++j)
359 for (idx_t i = 0; i < 8; ++i)
410 if (
ierr != 0)
return 1;
412 for (idx_t i = 0; i < 8; ++i) {
413 if (i !=
piv[i]) std::swap(
x[i],
x[
piv[i]]);
490 auto a0 = row(
AA, 0);
491 auto a1 = row(
AA, 1);
492 auto a2 = row(
AA, 2);
493 auto a3 = row(
AA, 3);
499 auto b0 = row(
BB, 0);
500 auto b1 = row(
BB, 1);
501 auto b2 = row(
BB, 2);
502 auto b3 = row(
BB, 3);
510 auto a0 = col(
AA, 0);
511 auto a1 = col(
AA, 1);
512 auto a2 = col(
AA, 2);
513 auto a3 = col(
AA, 3);
519 auto b0 = col(
BB, 0);
520 auto b1 = col(
BB, 1);
521 auto b2 = col(
BB, 2);
522 auto b3 = col(
BB, 3);
559 auto q0 = col(
Q,
j0);
560 auto q1 = col(
Q,
j1);
561 auto q2 = col(
Q,
j2);
562 auto q3 = col(
Q,
j3);
589 auto z0 = col(
Z,
j0);
590 auto z1 = col(
Z,
j1);
591 auto z2 = col(
Z,
j2);
592 auto z3 = col(
Z,
j3);
623 svd22(
B(
j0,
j0),
B(
j0,
j1),
B(
j1,
j1),
ssmin,
ssmax,
cl2,
sl2,
cr,
sr);
645 auto q0 = col(
Q,
j0);
646 auto q1 = col(
Q,
j1);
657 auto z0 = col(
Z,
j0);
658 auto z1 = col(
Z,
j1);
741 const idx_t n = ncols(
A);
750 const idx_t
j1 =
j0 + 1;
782 auto z1 = col(
Z,
j0);
783 auto z2 = col(
Z,
j1);
807 auto q1 = col(
Q,
j0);
808 auto q2 = col(
Q,
j1);
#define TLAPACK_CSMATRIX
Macro for tlapack::concepts::ConstructableAndSliceableMatrix compatible with C++17.
Definition concepts.hpp:961
int generalized_schur_swap(bool want_q, bool want_z, matrix_t &A, matrix_t &B, matrix_t &Q, matrix_t &Z, const size_type< matrix_t > &j0, const size_type< matrix_t > &n1, const size_type< matrix_t > &n2)
schur_swap, swaps 2 eigenvalues of A.
Definition generalized_schur_swap.hpp:58
auto lange(norm_t normType, const matrix_t &A)
Calculates the norm of a matrix.
Definition lange.hpp:38
void svd22(const T &f, const T &g, const T &h, T &ssmin, T &ssmax, T &csl, T &snl, T &csr, T &snr)
Computes the singular value decomposition of a 2-by-2 real triangular matrix.
Definition svd22.hpp:55
void larfg(storage_t storeMode, type_t< vector_t > &alpha, vector_t &x, type_t< vector_t > &tau)
Generates a elementary Householder reflection.
Definition larfg.hpp:73
void lacpy(uplo_t uplo, const matrixA_t &A, matrixB_t &B)
Copies a matrix from A to B.
Definition lacpy.hpp:38
void inv_house3(const matrix_t &A, vector_t &v, type_t< vector_t > &tau)
Inv_house calculates a reflector to reduce the first column in a 2x3 matrix A from the right to zero.
Definition inv_house3.hpp:44
void rotg(T &a, T &b, T &c, T &s)
Construct plane rotation that eliminates b, such that:
Definition rotg.hpp:39
void rot(vectorX_t &x, vectorY_t &y, const c_type &c, const s_type &s)
Apply plane rotation:
Definition rot.hpp:44
void trsv(Uplo uplo, Op trans, Diag diag, const matrixA_t &A, vectorX_t &x)
Solve the triangular matrix-vector equation.
Definition trsv.hpp:64
void syr(Uplo uplo, const alpha_t &alpha, const vectorX_t &x, matrixA_t &A)
Symmetric matrix rank-1 update:
Definition syr.hpp:45
#define tlapack_check(cond)
Throw an error if cond is false.
Definition exceptionHandling.hpp:98
int getrf(matrix_t &A, piv_t &piv, const GetrfOpts &opts={})
getrf computes an LU factorization of a general m-by-n matrix A.
Definition getrf.hpp:64
Sort the numbers in D in increasing order (if ID = 'I') or in decreasing order (if ID = 'D' ).
Definition arrayTraits.hpp:15
typename traits::real_type_traits< Types..., int >::type real_type
The common real type of the list of types.
Definition scalar_type_traits.hpp:113
constexpr internal::FrobNorm FROB_NORM
Frobenius norm of matrices.
Definition types.hpp:347
constexpr internal::LowerTriangle LOWER_TRIANGLE
Lower Triangle access.
Definition types.hpp:188
constexpr internal::UpperTriangle UPPER_TRIANGLE
Upper Triangle access.
Definition types.hpp:186
constexpr T conj(const T &x) noexcept
Extends std::conj() to real datatypes.
Definition utils.hpp:100
constexpr internal::Forward FORWARD
Forward direction.
Definition types.hpp:381
constexpr internal::UnitDiagonal UNIT_DIAG
The main diagonal is assumed to consist of 1's.
Definition types.hpp:222
constexpr internal::GeneralAccess GENERAL
General access.
Definition types.hpp:180
constexpr internal::NonUnitDiagonal NON_UNIT_DIAG
The main diagonal is not assumed to consist of 1's.
Definition types.hpp:220
constexpr internal::ColumnwiseStorage COLUMNWISE_STORAGE
Columnwise storage.
Definition types.hpp:414
constexpr internal::NoTranspose NO_TRANS
no transpose
Definition types.hpp:260
void lahqz_eig22(const A_t &A, const B_t &B, complex_type< T > &alpha1, complex_type< T > &alpha2, T &beta1, T &beta2)
Computes the generalized eigenvalues of a 2x2 pencil (A,B) with B upper triangular.
Definition lahqz_eig22.hpp:35