4#ifndef TETL_LINALG_BLAS1_SWAP_ELEMENTS_HPP
5#define TETL_LINALG_BLAS1_SWAP_ELEMENTS_HPP
7#include <etl/_contracts/check.hpp>
8#include <etl/_linalg/exposition.hpp>
9#include <etl/_utility/swap.hpp>
14template <inout_object InOutObj1, inout_object InOutObj2>
15 requires(InOutObj1::rank() == InOutObj1::rank())
18 TETL_PRECONDITION(x.extents() == y.extents());
20 using index_type = detail::common_index_type_t<InOutObj1, InOutObj2>;
22 if constexpr (InOutObj1::rank() == 1) {
23 static_assert(detail::compatible_static_extents<InOutObj1, InOutObj2>(0, 0));
25 for (index_type i{0}; i <
static_cast<index_type>(x.extent(0)); ++i) {
30 static_assert(InOutObj1::rank() == 2);
31 static_assert(detail::compatible_static_extents<InOutObj1, InOutObj2>(0, 0));
32 static_assert(detail::compatible_static_extents<InOutObj1, InOutObj2>(1, 1));
34 for (index_type i{0}; i <
static_cast<index_type>(x.extent(0)); ++i) {
35 for (index_type j{0}; j <
static_cast<index_type>(x.extent(1)); ++j) {
37 swap(x(i, j), y(i, j));
constexpr auto swap_elements(InOutObj1 x, InOutObj2 y) -> void
Definition blas1_swap_elements.hpp:16
Definition accessor_conjugate.hpp:13
Definition adjacent_find.hpp:9