KokkosBlas::swap ################ Defined in header: :code:`KokkosBlas1_swap.hpp` .. code:: c++ template void swap(execution_space const& space, XVector const& x, YVector const& y); template void swap(const XVector& x, const YVector& y); Exchanges the values of `x` with corresponding values of `y`. 1. iterates over the extents of ``x``, exchange entries of ``x`` and ``y`` on the ``space`` instance 2. iterates over the extents of ``x``, exchange entries of ``x`` and ``y`` on the default instance of ``typename XVector::execution_space`` The function will throw a runtime exception if ``x.extent(0) != y.extent(0) || x.extent(1) != y.extent(1)`` Parameters ========== :space: execution space instance :x: vector(s) to swap with ``y`` :y: vector(s) to sawp with ``x`` Type Requirements ----------------- - `execution_space` must be a Kokkos `execution space `_ - `XVector` must be a Kokkos `View `_ of rank 1 that satisfies - ``std::is_same_v::accessible == true`` - `YVector` must be a Kokkos `View `_ of rank 1 that satisfies - ``std::is_same_v::accessible == true`` Example ======= .. literalinclude:: ../../../../example/docs/blas/KokkosBlas1_docs_swap.cpp :language: c++ output: .. code:: orignal values: x: {0, 1, 2, 3, 4} y: {9, 8, 7, 6, 5} final values: x: {9, 8, 7, 6, 5} y: {0, 1, 2, 3, 4}