<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
qr_iteration.hpp
Go to the documentation of this file.
1
3//
4// Copyright (c) 2021-2023, University of Colorado Denver. All rights reserved.
5//
6// This file is part of <T>LAPACK.
7// <T>LAPACK is free software: you can redistribute it and/or modify it under
8// the terms of the BSD 3-Clause license. See the accompanying LICENSE file.
9
10#ifndef TLAPACK_QR_ITERATION_HH
11#define TLAPACK_QR_ITERATION_HH
12
16
17namespace tlapack {
18
21enum class QRIterationVariant : char { MultiShift = 'M', DoubleShift = 'D' };
22
25 QRIterationVariant variant = QRIterationVariant::MultiShift;
26};
27
49template <class T,
54 bool want_z,
57 const matrix_t& A,
58 const vector_t& w,
59 const matrix_t& Z,
60 const QRIterationOpts& opts = {})
61{
62 // Call variant
63 if (opts.variant == QRIterationVariant::MultiShift)
64 return multishift_qr_worksize<T>(want_t, want_z, ilo, ihi, A, w, Z,
65 opts);
66 else
67 return WorkInfo(0);
68}
69
78template <TLAPACK_MATRIX matrix_t,
79 TLAPACK_VECTOR vector_t,
80 TLAPACK_WORKSPACE work_t,
81 enable_if_t<is_complex<type_t<vector_t> >, int> = 0>
83 bool want_z,
86 matrix_t& A,
87 vector_t& w,
88 matrix_t& Z,
89 work_t& work,
91{
92 // Call variant
93 if (opts.variant == QRIterationVariant::MultiShift)
95 opts);
96 else
97 return lahqr(want_t, want_z, ilo, ihi, A, w, Z);
98}
99
138template <TLAPACK_MATRIX matrix_t,
139 TLAPACK_VECTOR vector_t,
140 enable_if_t<is_complex<type_t<vector_t> >, int> = 0>
142 bool want_z,
145 matrix_t& A,
146 vector_t& w,
147 matrix_t& Z,
149{
150 // Call variant
151 if (opts.variant == QRIterationVariant::MultiShift)
152 return multishift_qr(want_t, want_z, ilo, ihi, A, w, Z, opts);
153 else
154 return lahqr(want_t, want_z, ilo, ihi, A, w, Z);
155}
156
157} // namespace tlapack
158
159#endif
#define TLAPACK_WORKSPACE
Macro for tlapack::concepts::Workspace compatible with C++17.
Definition concepts.hpp:912
#define TLAPACK_VECTOR
Macro for tlapack::concepts::Vector compatible with C++17.
Definition concepts.hpp:906
#define TLAPACK_MATRIX
Macro for tlapack::concepts::Matrix compatible with C++17.
Definition concepts.hpp:896
int multishift_qr(bool want_t, bool want_z, size_type< matrix_t > ilo, size_type< matrix_t > ihi, matrix_t &A, vector_t &w, matrix_t &Z, FrancisOpts &opts)
multishift_qr computes the eigenvalues and optionally the Schur factorization of an upper Hessenberg ...
Definition multishift_qr.hpp:447
int lahqr(bool want_t, bool want_z, size_type< matrix_t > ilo, size_type< matrix_t > ihi, matrix_t &A, vector_t &w, matrix_t &Z)
lahqr computes the eigenvalues and optionally the Schur factorization of an upper Hessenberg matrix,...
Definition lahqr.hpp:73
int multishift_qr_work(bool want_t, bool want_z, size_type< matrix_t > ilo, size_type< matrix_t > ihi, matrix_t &A, vector_t &w, matrix_t &Z, work_t &work, FrancisOpts &opts)
multishift_qr computes the eigenvalues and optionally the Schur factorization of an upper Hessenberg ...
Definition multishift_qr.hpp:114
int qr_iteration_work(bool want_t, bool want_z, size_type< matrix_t > ilo, size_type< matrix_t > ihi, matrix_t &A, vector_t &w, matrix_t &Z, work_t &work, QRIterationOpts &opts)
Computes the eigenvalues and optionally the Schur factorization of an upper Hessenberg matrix....
Definition qr_iteration.hpp:82
int qr_iteration(bool want_t, bool want_z, size_type< matrix_t > ilo, size_type< matrix_t > ihi, matrix_t &A, vector_t &w, matrix_t &Z, QRIterationOpts &opts)
Computes the eigenvalues and optionally the Schur factorization of an upper Hessenberg matrix.
Definition qr_iteration.hpp:141
constexpr WorkInfo qr_iteration_worksize(bool want_t, bool want_z, size_type< matrix_t > ilo, size_type< matrix_t > ihi, const matrix_t &A, const vector_t &w, const matrix_t &Z, const QRIterationOpts &opts={})
Worspace query of qr_iteration()
Definition qr_iteration.hpp:53
QRIterationVariant
Variant of the algorithm that performs QR iterations on an upper Hessenberg matrix.
Definition qr_iteration.hpp:21
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
Options struct for multishift_qr().
Definition FrancisOpts.hpp:23
Options struct for qr_iteration()
Definition qr_iteration.hpp:24
Output information in the workspace query.
Definition workspace.hpp:16