12#ifndef TLAPACK_SCHUR_SWAP_HH
13#define TLAPACK_SCHUR_SWAP_HH
65 const idx_t n = ncols(
A);
77 const idx_t
j1 =
j0 + 1;
78 const idx_t
j2 =
j0 + 2;
79 const idx_t
j3 =
j0 + 3;
152 const T
sum =
B(0, 1) +
v1[1] *
B(1, 1) +
v1[2] *
B(2, 1);
163 for (idx_t j =
j0; j < n; ++j) {
174 for (idx_t j = 0; j <
j3; ++j) {
186 for (idx_t j = 0; j < n; ++j) {
220 const T
sum =
B(0, 1) +
v1[1] *
B(1, 1) +
v1[2] *
B(2, 1);
231 for (idx_t j =
j0; j < n; ++j) {
242 for (idx_t j = 0; j <
j3; ++j) {
254 for (idx_t j = 0; j < n; ++j) {
302 V(0, 1) +
v1[1] *
V(1, 1) +
v1[2] *
V(2, 1) +
v1[3] *
V(3, 1);
310 for (idx_t j = 0; j < 4; ++j) {
312 D(0, j) +
v1[1] *
D(1, j) +
v1[2] *
D(2, j) +
v1[3] *
D(3, j);
318 sum =
D(1, j) +
v2[1] *
D(2, j) +
v2[2] *
D(3, j);
323 for (idx_t j = 0; j < 4; ++j) {
325 D(j, 0) +
v1[1] *
D(j, 1) +
v1[2] *
D(j, 2) +
v1[3] *
D(j, 3);
331 sum =
D(j, 1) +
v2[1] *
D(j, 2) +
v2[2] *
D(j, 3);
337 if (max(max(abs(
D(2, 0)), abs(
D(2, 1))),
338 max(abs(
D(3, 0)), abs(
D(3, 1)))) >
thresh)
342 for (idx_t j =
j0; j < n; ++j) {
356 for (idx_t j = 0; j <
j0 + 4; ++j) {
371 for (idx_t j = 0; j < n; ++j) {
396 lahqr_schur22(
A(
j0,
j0),
A(
j0,
j1),
A(
j1,
j0),
A(
j1,
j1),
s1,
s2,
cs,
465 const idx_t n = ncols(
A);
474 const idx_t
j1 =
j0 + 1;
475 const idx_t
j2 =
j0 + 2;
#define TLAPACK_CSMATRIX
Macro for tlapack::concepts::ConstructableAndSliceableMatrix compatible with C++17.
Definition concepts.hpp:961
auto lange(norm_t normType, const matrix_t &A)
Calculates the norm of a matrix.
Definition lange.hpp:38
int schur_swap(bool want_q, matrix_t &A, matrix_t &Q, 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 schur_swap.hpp:49
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 lahqr_schur22(T &a, T &b, T &c, T &d, complex_type< T > &s1, complex_type< T > &s2, T &cs, T &sn)
Computes the Schur factorization of a 2x2 matrix A.
Definition lahqr_schur22.hpp:44
void lacpy(uplo_t uplo, const matrixA_t &A, matrixB_t &B)
Copies a matrix from A to B.
Definition lacpy.hpp:38
int lasy2(Op trans_l, Op trans_r, int isign, const matrixT_t &TL, const matrixT_t &TR, const matrixB_t &B, type_t< matrixX_t > &scale, matrixX_t &X, type_t< matrixX_t > &xnorm)
lasy2 solves the Sylvester matrix equation where the matrices are of order 1 or 2.
Definition lasy2.hpp:42
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
#define tlapack_check(cond)
Throw an error if cond is false.
Definition exceptionHandling.hpp:98
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::MaxNorm MAX_NORM
max norm
Definition types.hpp:339
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::GeneralAccess GENERAL
General access.
Definition types.hpp:180
constexpr internal::ColumnwiseStorage COLUMNWISE_STORAGE
Columnwise storage.
Definition types.hpp:414
constexpr internal::NoTranspose NO_TRANS
no transpose
Definition types.hpp:260