1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
#ifndef HPC_MATVEC_SWAP_H
#define HPC_MATVEC_SWAP_H 1

#include <cassert>
#include <type_traits>
#include <hpc/ulmblas/swap.h>
#include <hpc/matvec/isdensevector.h>

namespace hpc { namespace matvec {

template <typename VX, typename VY>
typename std::enable_if<IsDenseVector<VX>::value && IsDenseVector<VY>::value,
         void>::type
swap(VX &&x, VY &&y)
{
    assert(x.length==y.length);

    return ulmblas::swap(x.length, x.data, x.inc, y.data, y.inc);
}

} } // namespace matvec, hpc

#endif // HPC_MATVEC_SWAP_H