12#ifndef TLAPACK_GGHRD_HH
13#define TLAPACK_GGHRD_HH
56 const idx_t n = ncols(
A);
73 for (idx_t j = 0; j < n; ++j)
74 for (idx_t i = j + 1; i < n; ++i)
77 for (idx_t j =
ilo; j + 2 <
ihi; ++j) {
79 for (idx_t i =
ihi - 1; i > j + 1; --i) {
85 rotg(
A(i - 1, j),
A(i, j), c,
s);
88 auto a1 = slice(
A, i - 1,
range(j + 1, n));
89 auto a2 = slice(
A, i,
range(j + 1, n));
93 auto b1 = slice(
B, i - 1,
range(i - 1, n));
94 auto b2 = slice(
B, i,
range(i - 1, n));
98 auto q1 = slice(
Q,
range(0, n), i - 1);
105 rotg(
B(i, i),
B(i, i - 1), c,
s);
114 auto b2 = slice(
B,
range(0, i), i - 1);
119 auto z2 = slice(
Z,
range(0, n), i - 1);
constexpr T conj(const T &x) noexcept
Extends std::conj() to real datatypes.
Definition utils.hpp:100
#define TLAPACK_SMATRIX
Macro for tlapack::concepts::SliceableMatrix compatible with C++17.
Definition concepts.hpp:899
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
int gghrd(bool wantq, bool wantz, size_type< A_t > ilo, size_type< A_t > ihi, A_t &A, B_t &B, Q_t &Q, Z_t &Z)
Reduces a pair of real square matrices (A, B) to generalized upper Hessenberg form using unitary tran...
Definition gghrd.hpp:42
#define tlapack_check(cond)
Throw an error if cond is false.
Definition exceptionHandling.hpp:98
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