4#ifndef TETL_LINALG_BLAS1_ADD_HPP
5#define TETL_LINALG_BLAS1_ADD_HPP
7#include <etl/_contracts/check.hpp>
8#include <etl/_linalg/concepts.hpp>
9#include <etl/_utility/cmp_less.hpp>
14template <in_object InObj1, in_object InObj2, out_object OutObj>
15 requires(InObj1::rank() == OutObj::rank()
and InObj2::rank() == OutObj::rank())
16constexpr auto add(InObj1 x, InObj2 y, OutObj z) ->
void
18 TETL_PRECONDITION(x.extents() == y.extents());
19 TETL_PRECONDITION(x.extents() == z.extents());
21 using size_type = detail::common_size_type_t<InObj1, InObj2, OutObj>;
23 if constexpr (OutObj::rank() == 1) {
24 for (size_type row{0};
etl::cmp_less(row, x.extent(0)); ++row) {
25 z(row) = x(row) + y(row);
28 static_assert(OutObj::rank() == 2);
29 for (size_type row{0};
etl::cmp_less(row, x.extent(0)); ++row) {
30 for (size_type col{0};
etl::cmp_less(col, x.extent(1)); ++col) {
31 z(row, col) = x(row, col) + y(row, col);
constexpr auto add(InObj1 x, InObj2 y, OutObj z) -> void
Definition blas1_add.hpp:16
Definition accessor_conjugate.hpp:13
Definition adjacent_find.hpp:9