<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
bidiag.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_BIDIAG_HH
11#define TLAPACK_BIDIAG_HH
12
16
17namespace tlapack {
18
20enum class BidiagVariant : char { Level2 = '2', Blocked = 'B' };
21
23struct BidiagOpts : public GebrdOpts {
24 BidiagVariant variant = BidiagVariant::Blocked;
25};
26
42template <class T, TLAPACK_SMATRIX matrix_t, TLAPACK_SVECTOR vector_t>
44 const vector_t& tauv,
45 const vector_t& tauw,
46 const BidiagOpts& opts = {})
47{
48 // Call variant
49 if (opts.variant == BidiagVariant::Level2)
50 return gebd2_worksize<T>(A, tauv, tauw);
51 else
52 return gebrd_worksize<T>(A, tauv, tauw, opts);
53}
54
63template <TLAPACK_SMATRIX matrix_t,
64 TLAPACK_SVECTOR vector_t,
65 TLAPACK_WORKSPACE work_t>
69 work_t& work,
70 const BidiagOpts& opts = {})
71{
72 // Call variant
73 if (opts.variant == BidiagVariant::Level2)
74 return gebd2_work(A, tauv, tauw, work);
75 else
76 return gebrd_work(A, tauv, tauw, work, opts);
77}
78
133template <TLAPACK_SMATRIX matrix_t, TLAPACK_SVECTOR vector_t>
135 vector_t& tauv,
136 vector_t& tauw,
137 const BidiagOpts& opts = {})
138{
139 // Call variant
140 if (opts.variant == BidiagVariant::Level2)
141 return gebd2(A, tauv, tauw);
142 else
143 return gebrd(A, tauv, tauw, opts);
144}
145
146} // namespace tlapack
147
148#endif // TLAPACK_BIDIAG_HH
BidiagVariant
Variant of the bidiagonal reduction algorithm.
Definition bidiag.hpp:20
#define TLAPACK_SVECTOR
Macro for tlapack::concepts::SliceableVector compatible with C++17.
Definition concepts.hpp:909
#define TLAPACK_SMATRIX
Macro for tlapack::concepts::SliceableMatrix compatible with C++17.
Definition concepts.hpp:899
#define TLAPACK_WORKSPACE
Macro for tlapack::concepts::Workspace compatible with C++17.
Definition concepts.hpp:912
int gebrd(matrix_t &A, vector_t &tauv, vector_t &tauw, const GebrdOpts &opts={})
Reduces a general m by n matrix A to an upper real bidiagonal form B by a unitary transformation:
Definition gebrd.hpp:202
int gebd2(matrix_t &A, vector_t &tauv, vector_t &tauw)
Reduces a general m by n matrix A to an upper real bidiagonal form B by a unitary transformation:
Definition gebd2.hpp:210
int gebd2_work(matrix_t &A, vector_t &tauv, vector_t &tauw, work_t &work)
Reduces a general m by n matrix A to an upper real bidiagonal form B by a unitary transformation: W...
Definition gebd2.hpp:76
int gebrd_work(matrix_t &A, vector_t &tauv, vector_t &tauw, work_t &work, const GebrdOpts &opts={})
Reduces a general m by n matrix A to an upper real bidiagonal form B by a unitary transformation: W...
Definition gebrd.hpp:76
int bidiag_work(matrix_t &A, vector_t &tauv, vector_t &tauw, work_t &work, const BidiagOpts &opts={})
Reduces a general m by n matrix A to an upper real bidiagonal form B by a unitary transformation: W...
Definition bidiag.hpp:66
int bidiag(matrix_t &A, vector_t &tauv, vector_t &tauw, const BidiagOpts &opts={})
Reduces a general m by n matrix A to an upper real bidiagonal form B by a unitary transformation:
Definition bidiag.hpp:134
constexpr WorkInfo bidiag_worksize(const matrix_t &A, const vector_t &tauv, const vector_t &tauw, const BidiagOpts &opts={})
Worspace query of bidiag()
Definition bidiag.hpp:43
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 bidiag()
Definition bidiag.hpp:23
Options struct for gebrd()
Definition gebrd.hpp:24
Output information in the workspace query.
Definition workspace.hpp:16