tetl
0.1.0
Embedded Template Library
Loading...
Searching...
No Matches
blas1_copy.hpp
Go to the documentation of this file.
1
// SPDX-License-Identifier: BSL-1.0
2
3
#ifndef TETL_LINALG_BLAS1_COPY_HPP
4
#define TETL_LINALG_BLAS1_COPY_HPP
5
6
#include <
etl/_contracts/check.hpp
>
7
#include <
etl/_linalg/concepts.hpp
>
8
#include <
etl/_utility/cmp_less.hpp
>
9
10
namespace
etl::linalg
{
11
13
template
<in_
object
InObj, out_
object
OutObj>
14
requires
(InObj::rank() == OutObj::rank())
15
constexpr
auto
copy
(InObj x, OutObj y) ->
void
16
{
17
TETL_PRECONDITION
(x.extents() == y.extents());
18
19
using
size_type = detail::common_size_type_t<InObj, OutObj>;
20
21
if
constexpr
(InObj::rank() == 1) {
22
for
(size_type i{0};
etl::cmp_less
(i, x.extent(0)); ++i) {
23
y(i) = x(i);
24
}
25
}
else
{
26
static_assert
(InObj::rank() == 2);
27
for
(size_type i{0};
etl::cmp_less
(i, x.extent(0)); ++i) {
28
for
(size_type j{0};
etl::cmp_less
(j, x.extent(1)); ++j) {
29
y(i, j) = x(i, j);
30
}
31
}
32
}
33
}
34
35
}
// namespace etl::linalg
36
37
#endif
// TETL_LINALG_BLAS1_COPY_HPP
concepts.hpp
check.hpp
TETL_PRECONDITION
#define TETL_PRECONDITION(...)
Definition
check.hpp:16
cmp_less.hpp
etl::linalg::copy
constexpr auto copy(InObj x, OutObj y) -> void
Definition
blas1_copy.hpp:15
etl::cmp_less
constexpr auto cmp_less(T t, U u) noexcept -> bool
Compare the values of two integers t and u. Unlike builtin comparison operators, negative signed inte...
Definition
cmp_less.hpp:21
etl::linalg
Definition
accessor_conjugate.hpp:12
include
etl
_linalg
blas1_copy.hpp
Generated on Sat Mar 8 2025 16:19:59 for tetl by
1.14.0