11#ifndef TLAPACK_BLAS_TRSV_HH
12#define TLAPACK_BLAS_TRSV_HH
62 class T = type_t<vectorX_t>,
63 disable_if_allow_optblas_t<pair<matrixA_t, T>, pair<vectorX_t, T> > = 0>
72 const idx_t n = nrows(
A);
83 if (
trans == Op::NoTrans) {
85 if (
uplo == Uplo::Upper) {
87 for (idx_t j = n - 1; j != idx_t(-1); --j) {
93 for (idx_t i = j - 1; i != idx_t(-1); --i) {
94 x[i] -=
x[j] *
A(i, j);
100 for (idx_t j = 0; j < n; ++j) {
105 for (idx_t i = j + 1; i < n; ++i) {
106 x[i] -=
x[j] *
A(i, j);
111 else if (
trans == Op::Conj) {
113 if (
uplo == Uplo::Upper) {
115 for (idx_t j = n - 1; j != idx_t(-1); --j) {
121 for (idx_t i = j - 1; i != idx_t(-1); --i) {
128 for (idx_t j = 0; j < n; ++j) {
133 for (idx_t i = j + 1; i < n; ++i) {
139 else if (
trans == Op::Trans) {
144 if (
uplo == Uplo::Upper) {
146 for (idx_t j = 0; j < n; ++j) {
148 for (idx_t i = 0; i < j; ++i) {
149 tmp -=
A(i, j) *
x[i];
159 for (idx_t j = n - 1; j != idx_t(-1); --j) {
161 for (idx_t i = j + 1; i < n; ++i) {
162 tmp -=
A(i, j) *
x[i];
177 if (
uplo == Uplo::Upper) {
179 for (idx_t j = 0; j < n; ++j) {
181 for (idx_t i = 0; i < j; ++i) {
192 for (idx_t j = n - 1; j != idx_t(-1); --j) {
194 for (idx_t i = j + 1; i < n; ++i) {
206#ifdef TLAPACK_USE_LAPACKPP
211 class T = type_t<vectorX_t>,
212 enable_if_allow_optblas_t<pair<matrixA_t, T>, pair<vectorX_t, T> > = 0>
213void trsv(
Uplo uplo,
Op trans,
Diag diag,
const matrixA_t& A, vectorX_t& x)
216 auto A_ = legacy_matrix(A);
217 auto x_ = legacy_vector(x);
220 constexpr Layout L = layout<matrixA_t>;
221 const auto& n = A_.n;
223 if (trans != Op::Conj)
224 ::blas::trsv((::blas::Layout)L, (::blas::Uplo)uplo, (::blas::Op)trans,
225 (::blas::Diag)diag, n, A_.ptr, A_.ldim, x_.ptr, x_.inc);
228 ::blas::trsv((::blas::Layout)L, (::blas::Uplo)uplo, ::blas::Op::NoTrans,
229 (::blas::Diag)diag, n, A_.ptr, A_.ldim, x_.ptr, x_.inc);
Diag
Definition types.hpp:197
Op
Definition types.hpp:227
Uplo
Definition types.hpp:50
constexpr T conj(const T &x) noexcept
Extends std::conj() to real datatypes.
Definition utils.hpp:100
#define TLAPACK_LEGACY_VECTOR
Macro for tlapack::concepts::LegacyVector compatible with C++17.
Definition concepts.hpp:954
#define TLAPACK_LEGACY_MATRIX
Macro for tlapack::concepts::LegacyMatrix compatible with C++17.
Definition concepts.hpp:951
#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
constexpr auto diag(T &A, int diagIdx=0) noexcept
Get the Diagonal of an Eigen Matrix.
Definition eigen.hpp:576
void conjugate(vector_t &x)
Conjugates a vector.
Definition conjugate.hpp:24
void trsv(Uplo uplo, Op trans, Diag diag, const matrixA_t &A, vectorX_t &x)
Solve the triangular matrix-vector equation.
Definition trsv.hpp:64
#define tlapack_check_false(cond)
Throw an error if cond is true.
Definition exceptionHandling.hpp:113
Concept for types that represent tlapack::Diag.
Concept for types that represent tlapack::Op.
Concept for types that represent tlapack::Uplo.
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