<T>LAPACK 0.1.2
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
trge_qr2.hpp
Go to the documentation of this file.
1
4// Copyright (c) 2025, 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_TRGE_QR2_HH
11#define TLAPACK_TRGE_QR2_HH
12
14
15using namespace tlapack;
16
17template <TLAPACK_SMATRIX matrix_t, TLAPACK_VECTOR vector_t>
18void trge_qr2(matrix_t& A, vector_t& tau)
19{
21 using idx_t = size_type<matrix_t>;
23 using T = type_t<matrix_t>;
24
25 // Functors for creating new matrices
27
28 idx_t n = ncols(A);
29 idx_t m = nrows(A) - n;
30
31 // Generate a workspace
32 std::vector<T> work_;
33 auto work = new_matrix(work_, m + n, 1);
34
35 for (idx_t i = 0; i < n - 1; ++i) {
36 auto v = slice(A, range{n, m + n}, i);
37
38 larfg(COLUMNWISE_STORAGE, A(i, i), v, tau[i]);
39
40 v = slice(A, range{n, m + n}, i);
41 auto C0 = slice(A, i, range{i + 1, n});
42 auto C1 = slice(A, range{n, m + n}, range{i + 1, n});
43
45 }
46
47 auto v = slice(A, range{n, m + n}, n - 1);
48
49 larfg(COLUMNWISE_STORAGE, A(n - 1, n - 1), v, tau[n - 1]);
50}
51#endif // TLAPACK_TRGE_QR2_HH
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 larf_work(side_t side, storage_t storeMode, vector_t const &x, const tau_t &tau, vectorC0_t &C0, matrixC1_t &C1, work_t &work)
Applies an elementary reflector defined by tau and v to a m-by-n matrix C decomposed into C0 and C1....
Definition larf.hpp:48
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 T conj(const T &x) noexcept
Extends std::conj() to real datatypes.
Definition utils.hpp:100
constexpr internal::ColumnwiseStorage COLUMNWISE_STORAGE
Columnwise storage.
Definition types.hpp:414
constexpr internal::LeftSide LEFT_SIDE
left side
Definition types.hpp:294