<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
householder_qr.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_HOUSEHOLDER_QR_HH
11#define TLAPACK_HOUSEHOLDER_QR_HH
12
16
17namespace tlapack {
18
20enum class HouseholderQRVariant : char { Level2 = '2', Blocked = 'B' };
21
24 HouseholderQRVariant variant = HouseholderQRVariant::Blocked;
25};
26
40template <class T, TLAPACK_MATRIX matrix_t, TLAPACK_VECTOR vector_t>
42 const vector_t& tau,
43 const HouseholderQROpts& opts = {})
44{
45 // Call variant
46 if (opts.variant == HouseholderQRVariant::Level2)
47 return geqr2_worksize<T>(A, tau);
48 else
49 return geqrf_worksize<T>(A, tau, opts);
50}
51
60template <TLAPACK_MATRIX matrix_t,
61 TLAPACK_VECTOR vector_t,
62 TLAPACK_WORKSPACE workspace_t>
66 const HouseholderQROpts& opts = {})
67{
68 // Call variant
69 if (opts.variant == HouseholderQRVariant::Level2)
70 return geqr2_work(A, tau, work);
71 else
72 return geqrf_work(A, tau, work, opts);
73}
74
108template <TLAPACK_MATRIX matrix_t, TLAPACK_VECTOR vector_t>
110 vector_t& tau,
111 const HouseholderQROpts& opts = {})
112{
113 // Call variant
114 if (opts.variant == HouseholderQRVariant::Level2)
115 return geqr2(A, tau);
116 else
117 return geqrf(A, tau, opts);
118}
119
120} // namespace tlapack
121
122#endif // TLAPACK_HOUSEHOLDER_QR_HH
#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 geqr2(matrix_t &A, vector_t &tau)
Computes a QR factorization of a matrix A.
Definition geqr2.hpp:132
int geqrf(A_t &A, tau_t &tau, const GeqrfOpts &opts={})
Computes a QR factorization of an m-by-n matrix A using a blocked algorithm.
Definition geqrf.hpp:158
int geqrf_work(A_t &A, tau_t &tau, work_t &work, const GeqrfOpts &opts={})
Computes a QR factorization of an m-by-n matrix A using a blocked algorithm. Workspace is provided ...
Definition geqrf.hpp:80
int geqr2_work(matrix_t &A, vector_t &tau, work_t &work)
Computes a QR factorization of a matrix A. Workspace is provided as an argument.
Definition geqr2.hpp:60
int householder_qr_work(matrix_t &A, vector_t &tau, workspace_t &work, const HouseholderQROpts &opts={})
Computes a QR factorization of an m-by-n matrix A. Workspace is provided as an argument.
Definition householder_qr.hpp:63
int householder_qr(matrix_t &A, vector_t &tau, const HouseholderQROpts &opts={})
Computes a QR factorization of an m-by-n matrix A.
Definition householder_qr.hpp:109
constexpr WorkInfo householder_qr_worksize(const matrix_t &A, const vector_t &tau, const HouseholderQROpts &opts={})
Worspace query of householder_qr()
Definition householder_qr.hpp:41
HouseholderQRVariant
Variants of the algorithm to compute the QR factorization.
Definition householder_qr.hpp:20
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 geqrf.
Definition geqrf.hpp:24
Options struct for householder_qr()
Definition householder_qr.hpp:23
Output information in the workspace query.
Definition workspace.hpp:16