<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
unmql.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_UNMQL_HH
12#define TLAPACK_UNMQL_HH
13
16
17namespace tlapack {
18
22struct UnmqlOpts {
23 size_t nb = 32;
24};
25
69template <class T,
77 const matrixA_t& A,
78 const tau_t& tau,
79 const matrixC_t& C,
80 const UnmqlOpts& opts = {})
81{
82 using idx_t = size_type<matrixC_t>;
83 using matrixT_t = matrix_type<matrixA_t, tau_t>;
84 using range = pair<idx_t, idx_t>;
85
86 // Constants
87 const idx_t k = size(tau);
88 const idx_t nb = min<idx_t>(opts.nb, k);
89
90 // Local workspace sizes
91 WorkInfo workinfo =
92 (is_same_v<T, type_t<matrixT_t>>) ? WorkInfo(nb, nb) : WorkInfo(0);
93
94 // larfb:
95 {
96 // Constants
97 const idx_t m = nrows(C);
98 const idx_t n = ncols(C);
99 const idx_t nA = (side == Side::Left) ? m : n;
100
101 // Empty matrices
102 auto&& V = slice(A, range{0, nA}, range{0, nb});
103 auto&& matrixT = slice(A, range{0, nb}, range{0, nb});
104
105 // Internal workspace queries
106 workinfo += larfb_worksize<T>(side, trans, BACKWARD, COLUMNWISE_STORAGE,
107 V, matrixT, C);
108 }
109
110 return workinfo;
111}
112
166template <TLAPACK_SMATRIX matrixA_t,
167 TLAPACK_SMATRIX matrixC_t,
168 TLAPACK_SVECTOR tau_t,
169 TLAPACK_SIDE side_t,
170 TLAPACK_OP trans_t>
173 const matrixA_t& A,
174 const tau_t& tau,
175 matrixC_t& C,
176 const UnmqlOpts& opts = {})
177{
178 return unmq(side, trans, BACKWARD, COLUMNWISE_STORAGE, A, tau, C,
179 UnmqOpts{opts.nb});
180}
181
182} // namespace tlapack
183
184#endif // TLAPACK_UNMQL_HH
#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 unmql(side_t side, trans_t trans, const matrixA_t &A, const tau_t &tau, matrixC_t &C, const UnmqlOpts &opts={})
Applies orthogonal matrix op(Q) to a matrix C using a blocked code.
Definition unmql.hpp:171
constexpr WorkInfo unmql_worksize(side_t side, trans_t trans, const matrixA_t &A, const tau_t &tau, const matrixC_t &C, const UnmqlOpts &opts={})
Applies unitary matrix Q from an QL factorization to a matrix C.
Definition unmql.hpp:75
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 unmql.
Definition unmql.hpp:22
size_t nb
Block size.
Definition unmql.hpp:23
Output information in the workspace query.
Definition workspace.hpp:16