12#ifndef TLAPACK_LARF_HH
13#define TLAPACK_LARF_HH
47 enable_if_t<std::is_convertible_v<storage_t, StoreV>,
int> = 0>
63 const idx_t
k = size(
C0);
64 const idx_t m = nrows(
C1);
65 const idx_t n = ncols(
C1);
74 if (m == 0 || n == 0) {
75 for (idx_t i = 0; i <
k; ++i)
83 if (
side == Side::Left) {
86 for (idx_t i = 0; i <
k; ++i)
94 for (idx_t i = 0; i <
k; ++i)
99 for (idx_t i = 0; i <
k; ++i)
104 for (idx_t j = 0; j < n; ++j)
105 for (idx_t i = 0; i < m; ++i)
109 for (idx_t i = 0; i <
k; ++i)
116 for (idx_t i = 0; i <
k; ++i)
124 for (idx_t i = 0; i <
k; ++i)
129 for (idx_t i = 0; i <
k; ++i)
131 for (idx_t j = 0; j < n; ++j)
132 for (idx_t i = 0; i < m; ++i)
139 for (idx_t i = 0; i <
k; ++i)
179 enable_if_t<std::is_convertible_v<storage_t, StoreV>,
int> = 0>
191 const idx_t m = nrows(
C1);
192 const idx_t n = ncols(
C1);
195 return (m > 0 && n > 0) ?
WorkInfo((
side == Side::Left) ? n : m)
260 enable_if_t<std::is_convertible_v<storage_t, StoreV>,
int> = 0>
277 const idx_t
k = size(
C0);
278 const idx_t m = nrows(
C1);
279 const idx_t n = ncols(
C1);
288 if (m == 0 || n == 0) {
289 for (idx_t i = 0; i <
k; ++i)
296 std::vector<T>
work_;
327 enable_if_t<std::is_convertible_v<direction_t, Direction>,
int> = 0>
340 const idx_t m = nrows(
C);
341 const idx_t n = ncols(
C);
346 direction == Direction::Forward);
352 if (m == 0 || n == 0)
return;
368 if (
side == Side::Left) {
369 auto C0 = (direction == Direction::Forward) ? row(
C, 0) : row(
C, m - 1);
370 auto C1 = (direction == Direction::Forward) ? rows(
C,
range{1, m})
371 : rows(
C,
range{0, m - 1});
372 auto x = (direction == Direction::Forward) ? slice(
v,
range{1, m})
373 : slice(
v,
range{0, m - 1});
377 auto C0 = (direction == Direction::Forward) ? col(
C, 0) : col(
C, n - 1);
378 auto C1 = (direction == Direction::Forward) ? cols(
C,
range{1, n})
379 : cols(
C,
range{0, n - 1});
380 auto x = (direction == Direction::Forward) ? slice(
v,
range{1, n})
381 : slice(
v,
range{0, n - 1});
421 enable_if_t<std::is_convertible_v<direction_t, Direction>,
int> = 0>
433 const idx_t m = nrows(
C);
434 const idx_t n = ncols(
C);
436 if (
side == Side::Left && m > 0) {
437 auto&&
C0 = row(
C, 0);
439 auto&&
x = slice(
v,
range{1, m});
442 else if (
side == Side::Right && n > 0) {
443 auto&&
C0 = col(
C, 0);
445 auto&&
x = slice(
v,
range{1, n});
495 enable_if_t<std::is_convertible_v<direction_t, Direction>,
int> = 0>
512 const idx_t m = nrows(
C);
513 const idx_t n = ncols(
C);
518 direction == Direction::Forward);
524 if (m == 0 || n == 0)
return;
528 std::vector<T>
work_;
constexpr internal::RightSide RIGHT_SIDE
right side
Definition types.hpp:296
constexpr internal::Transpose TRANSPOSE
transpose
Definition types.hpp:262
constexpr internal::ConjTranspose CONJ_TRANS
conjugate transpose
Definition types.hpp:264
constexpr internal::NoTranspose NO_TRANS
no transpose
Definition types.hpp:260
constexpr internal::LeftSide LEFT_SIDE
left side
Definition types.hpp:294
constexpr T conj(const T &x) noexcept
Extends std::conj() to real datatypes.
Definition utils.hpp:100
#define TLAPACK_SVECTOR
Macro for tlapack::concepts::SliceableVector compatible with C++17.
Definition concepts.hpp:909
#define TLAPACK_SCALAR
Macro for tlapack::concepts::Scalar compatible with C++17.
Definition concepts.hpp:915
#define TLAPACK_STOREV
Macro for tlapack::concepts::StoreV compatible with C++17.
Definition concepts.hpp:936
#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_DIRECTION
Macro for tlapack::concepts::Direction compatible with C++17.
Definition concepts.hpp:930
#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
void larf(side_t side, storage_t storeMode, vector_t const &x, const tau_t &tau, vectorC0_t &C0, matrixC1_t &C1)
Applies an elementary reflector defined by tau and v to a m-by-n matrix C decomposed into C0 and C1.
Definition larf.hpp:261
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
void gemv(Op trans, const alpha_t &alpha, const matrixA_t &A, const vectorX_t &x, const beta_t &beta, vectorY_t &y)
General matrix-vector multiply:
Definition gemv.hpp:57
void ger(const alpha_t &alpha, const vectorX_t &x, const vectorY_t &y, matrixA_t &A)
General matrix rank-1 update:
Definition ger.hpp:42
void geru(const alpha_t &alpha, const vectorX_t &x, const vectorY_t &y, matrixA_t &A)
General matrix rank-1 update:
Definition geru.hpp:43
#define tlapack_check(cond)
Throw an error if cond is false.
Definition exceptionHandling.hpp:98
constexpr WorkInfo larf_worksize(side_t side, storage_t storeMode, vector_t const &x, const tau_t &tau, const vectorC0_t &C0, const matrixC1_t &C1)
Worspace query of larf().
Definition larf.hpp:180
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
Output information in the workspace query.
Definition workspace.hpp:16