4#ifndef TETL_LINALG_BLAS1_ADD_HPP
5#define TETL_LINALG_BLAS1_ADD_HPP
7#include <etl/_contracts/check.hpp>
8#include <etl/_linalg/exposition.hpp>
13template <in_object InObj1, in_object InObj2, out_object OutObj>
14 requires(InObj1::rank() == OutObj::rank()
and InObj2::rank() == OutObj::rank())
15constexpr auto add(InObj1 x, InObj2 y, OutObj z) ->
void
17 static_assert(detail::possibly_addable<InObj1, InObj2, OutObj>());
18 TETL_PRECONDITION(detail::addable(x, y, z));
20 using index_type = detail::common_index_type_t<InObj1, InObj2, OutObj>;
22 if constexpr (OutObj::rank() == 1) {
23 for (index_type row{0}; row < x.extent(0); ++row) {
24 z(row) = x(row) + y(row);
27 static_assert(OutObj::rank() == 2);
28 for (index_type row{0}; row < x.extent(0); ++row) {
29 for (index_type col{0}; col < x.extent(1); ++col) {
30 z(row, col) = x(row, col) + y(row, col);
constexpr auto add(InObj1 x, InObj2 y, OutObj z) -> void
Definition blas1_add.hpp:15
Definition accessor_conjugate.hpp:13
Definition adjacent_find.hpp:9