<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
dotu.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_BLAS_DOTU_HH
12#define TLAPACK_BLAS_DOTU_HH
13
15
16namespace tlapack {
17
27template <
28 TLAPACK_VECTOR vectorX_t,
29 TLAPACK_VECTOR vectorY_t,
30 class T = type_t<vectorY_t>,
31 disable_if_allow_optblas_t<pair<vectorX_t, T>, pair<vectorY_t, T> > = 0>
32auto dotu(const vectorX_t& x, const vectorY_t& y)
33{
35 using idx_t = size_type<vectorX_t>;
36
37 // constants
38 const idx_t n = size(x);
39
40 // check arguments
41 tlapack_check_false(size(y) != n);
42
44 for (idx_t i = 0; i < n; ++i)
45 result += x[i] * y[i];
46
47 return result;
48}
49
50#ifdef TLAPACK_USE_LAPACKPP
51
52template <
53 TLAPACK_LEGACY_VECTOR vectorX_t,
54 TLAPACK_LEGACY_VECTOR vectorY_t,
55 class T = type_t<vectorY_t>,
56 enable_if_allow_optblas_t<pair<vectorX_t, T>, pair<vectorY_t, T> > = 0>
57auto dotu(const vectorX_t& x, const vectorY_t& y)
58{
59 // Legacy objects
60 auto x_ = legacy_vector(x);
61 auto y_ = legacy_vector(y);
62
63 // Constants to forward
64 const auto& n = x_.n;
65
66 return ::blas::dotu(n, x_.ptr, x_.inc, y_.ptr, y_.inc);
67}
68
69#endif
70
71} // namespace tlapack
72
73#endif // #ifndef TLAPACK_BLAS_DOTU_HH
#define TLAPACK_LEGACY_VECTOR
Macro for tlapack::concepts::LegacyVector compatible with C++17.
Definition concepts.hpp:954
#define TLAPACK_VECTOR
Macro for tlapack::concepts::Vector compatible with C++17.
Definition concepts.hpp:906
auto dotu(const vectorX_t &x, const vectorY_t &y)
Definition dotu.hpp:32
#define tlapack_check_false(cond)
Throw an error if cond is true.
Definition exceptionHandling.hpp:113
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