<T>LAPACK 0.1.1
C++ Template Linear Algebra PACKage
Loading...
Searching...
No Matches
copy.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_COPY_HH
12#define TLAPACK_BLAS_COPY_HH
13
15
16namespace tlapack {
17
26template <
27 TLAPACK_VECTOR vectorX_t,
28 TLAPACK_VECTOR vectorY_t,
29 class T = type_t<vectorY_t>,
30 disable_if_allow_optblas_t<pair<vectorX_t, T>, pair<vectorY_t, T> > = 0>
31void copy(const vectorX_t& x, vectorY_t& y)
32{
33 using idx_t = size_type<vectorX_t>;
34
35 // constants
36 const idx_t n = size(x);
37
38 // check arguments
39 tlapack_check_false((idx_t)size(y) < n);
40
41 for (idx_t i = 0; i < n; ++i)
42 y[i] = x[i];
43}
44
45#ifdef TLAPACK_USE_LAPACKPP
46
47template <
48 TLAPACK_LEGACY_VECTOR vectorX_t,
49 TLAPACK_LEGACY_VECTOR vectorY_t,
50 class T = type_t<vectorY_t>,
51 enable_if_allow_optblas_t<pair<vectorX_t, T>, pair<vectorY_t, T> > = 0>
52void copy(const vectorX_t& x, vectorY_t& y)
53{
54 // Legacy objects
55 auto x_ = legacy_vector(x);
56 auto y_ = legacy_vector(y);
57
58 // Constants to forward
59 const auto& n = x_.n;
60
61 return ::blas::copy(n, x_.ptr, x_.inc, y_.ptr, y_.inc);
62}
63
64#endif
65
66} // namespace tlapack
67
68#endif // #ifndef TLAPACK_BLAS_COPY_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
void copy(const vectorX_t &x, vectorY_t &y)
Copy vector, .
Definition copy.hpp:31
#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