Attention

The vector search and clustering algorithms in RAFT are being migrated to a new library dedicated to vector search called cuVS. We will continue to support the vector search algorithms in RAFT during this move, but will no longer update them after the RAPIDS 24.06 (June) release. We plan to complete the migration by RAPIDS 24.08 (August) release.

Mathematical Functions#

The math functions APIs guarantee both CUDA and CPU compatibility, making it more straightforward to write __host__ __device__ functions without being concerned whether the underlying intrinsics will build and work.

#include <raft/core/math.hpp>

namespace raft::core

template<typename T>
RAFT_INLINE_FUNCTION auto abs(T x) -> std::enable_if_t<std::is_same_v<float, T> || std::is_same_v<double, T> || std::is_same_v<int, T> || std::is_same_v<long int, T> || std::is_same_v<long long int, T>, T>#