<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
unmrq.hpp
Go to the documentation of this file.
1
4//
5// Copyright (c) 2021-2023, University of Colorado Denver. All rights reserved.
6//
7// This file is part of <T>LAPACK.
8// <T>LAPACK is free software: you can redistribute it and/or modify it under
9// the terms of the BSD 3-Clause license. See the accompanying LICENSE file.
10
11#ifndef TLAPACK_UNMRQ_HH
12#define TLAPACK_UNMRQ_HH
13
16
17namespace tlapack {
18
22struct UnmrqOpts {
23 size_t nb = 32;
24};
25
56template <class T,
64 const matrixA_t& A,
65 const tau_t& tau,
66 const matrixC_t& C,
67 const UnmrqOpts& opts = {})
68{
69 using idx_t = size_type<matrixC_t>;
70 using matrixT_t = matrix_type<matrixA_t, tau_t>;
71 using range = pair<idx_t, idx_t>;
72
73 // Constants
74 const idx_t k = size(tau);
75 const idx_t nb = min<idx_t>(opts.nb, k);
76
77 // Local workspace sizes
78 WorkInfo workinfo =
79 (is_same_v<T, type_t<matrixT_t>>) ? WorkInfo(nb, nb) : WorkInfo(0);
80
81 // larfb:
82 {
83 // Constants
84 const idx_t m = nrows(C);
85 const idx_t n = ncols(C);
86 const idx_t nA = (side == Side::Left) ? m : n;
87
88 // Empty matrices
89 auto&& V = slice(A, range{0, nb}, range{0, nA});
90 auto&& matrixT = slice(A, range{0, nb}, range{0, nb});
91
92 // Internal workspace queries
93 workinfo += larfb_worksize<T>(
94 side, (trans == Op::NoTrans) ? Op::ConjTrans : Op::NoTrans,
95 BACKWARD, ROWWISE_STORAGE, V, matrixT, C);
96 }
97
98 return workinfo;
99}
100
154template <TLAPACK_SMATRIX matrixA_t,
155 TLAPACK_SMATRIX matrixC_t,
156 TLAPACK_SVECTOR tau_t,
157 TLAPACK_SIDE side_t,
158 TLAPACK_OP trans_t>
161 const matrixA_t& A,
162 const tau_t& tau,
163 matrixC_t& C,
164 const UnmrqOpts& opts = {})
165{
166 return unmq(side, trans, BACKWARD, ROWWISE_STORAGE, A, tau, C,
167 UnmqOpts{opts.nb});
168}
169
170} // namespace tlapack
171
172#endif // TLAPACK_UNMRQ_HH
constexpr internal::Backward BACKWARD
Backward direction.
Definition types.hpp:378
constexpr internal::RowwiseStorage ROWWISE_STORAGE
Rowwise storage.
Definition types.hpp:411
@ NoTrans
no transpose
#define TLAPACK_SVECTOR
Macro for tlapack::concepts::SliceableVector compatible with C++17.
Definition concepts.hpp:909
#define TLAPACK_SIDE
Macro for tlapack::concepts::Side compatible with C++17.
Definition concepts.hpp:927
#define TLAPACK_SMATRIX
Macro for tlapack::concepts::SliceableMatrix compatible with C++17.
Definition concepts.hpp:899
#define TLAPACK_OP
Macro for tlapack::concepts::Op compatible with C++17.
Definition concepts.hpp:933
int unmq(side_t side, trans_t trans, direction_t direction, storage_t storeMode, const matrixV_t &V, const vector_t &tau, matrixC_t &C, const UnmqOpts &opts={})
Applies unitary matrix Q to a matrix C.
Definition unmq.hpp:282
int unmrq(side_t side, trans_t trans, const matrixA_t &A, const tau_t &tau, matrixC_t &C, const UnmrqOpts &opts={})
Applies orthogonal matrix op(Q) to a matrix C using a blocked code.
Definition unmrq.hpp:159
constexpr WorkInfo unmrq_worksize(side_t side, trans_t trans, const matrixA_t &A, const tau_t &tau, const matrixC_t &C, const UnmrqOpts &opts={})
Worspace query of unmrq()
Definition unmrq.hpp:62
Concept for types that represent tlapack::Op.
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 unmrq.
Definition unmrq.hpp:22
size_t nb
Block size.
Definition unmrq.hpp:23
Output information in the workspace query.
Definition workspace.hpp:16