<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
hessenberg.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_HESSENBERG_HH
11#define TLAPACK_HESSENBERG_HH
12
16
17namespace tlapack {
18
21enum class HessenbergVariant : char { Level2 = '2', Blocked = 'B' };
22
24struct HessenbergOpts : public GehrdOpts {
25 HessenbergVariant variant = HessenbergVariant::Blocked;
26};
27
42template <class T, TLAPACK_SMATRIX matrix_t, TLAPACK_SVECTOR vector_t>
45 const matrix_t& A,
46 const vector_t& tau,
47 const HessenbergOpts& opts = {})
48{
49 // Call variant
50 if (opts.variant == HessenbergVariant::Level2)
51 return gehd2_worksize<T>(ilo, ihi, A, tau);
52 else
53 return gehrd_worksize<T>(ilo, ihi, A, tau, opts);
54}
55
64template <TLAPACK_SMATRIX matrix_t,
65 TLAPACK_SVECTOR vector_t,
66 TLAPACK_WORKSPACE work_t>
69 matrix_t& A,
71 work_t& work,
72 const HessenbergOpts& opts = {})
73{
74 // Call variant
75 if (opts.variant == HessenbergVariant::Level2)
76 return gehd2_work(ilo, ihi, A, tau, work);
77 else
78 return gehrd_work(ilo, ihi, A, tau, work, opts);
79}
80
121template <TLAPACK_SMATRIX matrix_t, TLAPACK_SVECTOR vector_t>
124 matrix_t& A,
125 vector_t& tau,
126 const HessenbergOpts& opts = {})
127{
128 // Call variant
129 if (opts.variant == HessenbergVariant::Level2)
130 return gehd2(ilo, ihi, A, tau);
131 else
132 return gehrd(ilo, ihi, A, tau, opts);
133}
134
135} // namespace tlapack
136
137#endif
#define TLAPACK_SVECTOR
Macro for tlapack::concepts::SliceableVector compatible with C++17.
Definition concepts.hpp:909
#define TLAPACK_SMATRIX
Macro for tlapack::concepts::SliceableMatrix compatible with C++17.
Definition concepts.hpp:899
#define TLAPACK_WORKSPACE
Macro for tlapack::concepts::Workspace compatible with C++17.
Definition concepts.hpp:912
int gehrd(size_type< matrix_t > ilo, size_type< matrix_t > ihi, matrix_t &A, vector_t &tau, const GehrdOpts &opts={})
Reduces a general square matrix to upper Hessenberg form.
Definition gehrd.hpp:222
int gehd2(size_type< matrix_t > ilo, size_type< matrix_t > ihi, matrix_t &A, vector_t &tau)
Reduces a general square matrix to upper Hessenberg form.
Definition gehd2.hpp:153
int gehrd_work(size_type< matrix_t > ilo, size_type< matrix_t > ihi, matrix_t &A, vector_t &tau, work_t &work, const GehrdOpts &opts={})
Reduces a general square matrix to upper Hessenberg form. Workspace is provided as an argument.
Definition gehrd.hpp:99
int gehd2_work(size_type< matrix_t > ilo, size_type< matrix_t > ihi, matrix_t &A, vector_t &tau, work_t &work)
Reduces a general square matrix to upper Hessenberg form. Workspace is provided as an argument.
Definition gehd2.hpp:76
int hessenberg(size_type< matrix_t > ilo, size_type< matrix_t > ihi, matrix_t &A, vector_t &tau, const HessenbergOpts &opts={})
Reduces a general square matrix to upper Hessenberg form.
Definition hessenberg.hpp:122
int hessenberg_work(size_type< matrix_t > ilo, size_type< matrix_t > ihi, matrix_t &A, vector_t &tau, work_t &work, const HessenbergOpts &opts={})
Reduces a general square matrix to upper Hessenberg form. Workspace is provided as an argument.
Definition hessenberg.hpp:67
constexpr WorkInfo hessenberg_worksize(size_type< matrix_t > ilo, size_type< matrix_t > ihi, const matrix_t &A, const vector_t &tau, const HessenbergOpts &opts={})
Workspace query of hessenberg()
Definition hessenberg.hpp:43
HessenbergVariant
Variants of the algorithm to reduce a matrix to upper Hessenberg form.
Definition hessenberg.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 gehrd.
Definition gehrd.hpp:27
Options struct for hessenberg()
Definition hessenberg.hpp:24
Output information in the workspace query.
Definition workspace.hpp:16