<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
hemv.hpp
Go to the documentation of this file.
1
3//
4// Copyright (c) 2017-2021, University of Tennessee. All rights reserved.
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_LEGACY_HEMV_HH
12#define TLAPACK_LEGACY_HEMV_HH
13
14#include "tlapack/blas/hemv.hpp"
17
18namespace tlapack {
19namespace legacy {
20
73 template <typename TA, typename TX, typename TY>
74 void hemv(Layout layout,
75 Uplo uplo,
76 idx_t n,
78 TA const* A,
79 idx_t lda,
80 TX const* x,
81 int_t incx,
83 TY* y,
84 int_t incy)
85 {
86 using internal::create_matrix;
87 using internal::create_rowmajor_matrix;
89
90 // check arguments
91 tlapack_check_false(layout != Layout::ColMajor &&
92 layout != Layout::RowMajor);
93 tlapack_check_false(uplo != Uplo::Lower && uplo != Uplo::Upper);
98
99 // quick return
100 if (n == 0 || ((alpha == scalar_t(0)) && (beta == scalar_t(1)))) return;
101
102 if (alpha == scalar_t(0)) {
104 y_, TY, n, y, incy,
105 if (beta == scalar_t(0)) for (idx_t i = 0; i < n; ++i) y_[i] =
106 TY(0);
107 else for (idx_t i = 0; i < n; ++i) y_[i] *= beta);
108 }
109 else {
111 x_, TX, n, x, incx, y_, TY, n, y, incy,
112 if (beta ==
113 scalar_t(
114 0)) if (layout ==
115 Layout::ColMajor) return hemv(uplo, alpha,
117 (TA*)A, n, n,
118 lda),
119 x_, y_);
120 else return hemv(uplo, alpha,
122 x_, y_);
123 else if (layout == Layout::ColMajor) return hemv(
124 uplo, alpha, create_matrix<TA>((TA*)A, n, n, lda), x_, beta,
125 y_);
126 else return hemv(uplo, alpha,
128 x_, beta, y_));
129 }
130 }
131
132} // namespace legacy
133} // namespace tlapack
134
135#endif // #ifndef TLAPACK_LEGACY_HEMV_HH
constexpr Layout layout
Layout of a matrix or vector.
Definition arrayTraits.hpp:232
Uplo
Definition types.hpp:45
Layout
Definition types.hpp:24
#define tlapack_check_false(cond)
Throw an error if cond is true.
Definition exceptionHandling.hpp:113
void hemv(Layout layout, Uplo uplo, idx_t n, scalar_type< TA, TX, TY > alpha, TA const *A, idx_t lda, TX const *x, int_t incx, scalar_type< TA, TX, TY > beta, TY *y, int_t incy)
Hermitian matrix-vector multiply:
Definition hemv.hpp:74
#define tlapack_expr_with_vector(x, TX, n, X, incx, expr)
Creates a vector object and executes an expression with it.
Definition utils.hpp:68
#define tlapack_expr_with_2vectors(x, TX, n, X, incx, y, TY, m, Y, incy, expr)
Creates two vector objects and executes an expression with them.
Definition utils.hpp:33
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