Skip to content

Commit

Permalink
doxygen fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
benfred committed Sep 25, 2023
1 parent 578588f commit ea9b1df
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
23 changes: 13 additions & 10 deletions cpp/include/raft/neighbors/brute_force-ext.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#include <raft/core/resources.hpp> // raft::resources
#include <raft/distance/distance_types.hpp> // raft::distance::DistanceType
#include <raft/neighbors/brute_force_types.hpp>
#include <raft/util/raft_explicit.hpp> // RAFT_EXPLICIT
#include <raft/util/raft_explicit.hpp> // RAFT_EXPLICIT

#ifdef RAFT_EXPLICIT_INSTANTIATE_ONLY

Expand All @@ -44,8 +44,8 @@ template <typename T,
host_device_accessor<std::experimental::default_accessor<T>, memory_type::host>>
index<T> build(raft::resources const& res,
mdspan<const T, matrix_extent<int64_t>, row_major, Accessor> dataset,
raft::distance::DistanceType metric,
T metric_arg = 0.0) RAFT_EXPLICIT;
raft::distance::DistanceType metric = distance::DistanceType::L2Unexpanded,
T metric_arg = 0.0) RAFT_EXPLICIT;

template <typename T, typename IdxT>
void search(raft::resources const& res,
Expand Down Expand Up @@ -109,25 +109,28 @@ instantiate_raft_neighbors_brute_force_knn(

#undef instantiate_raft_neighbors_brute_force_knn

extern template void raft::neighbors::brute_force::search<float, int>(
namespace raft::neighbors::brute_force {

extern template void search<float, int>(
raft::resources const& res,
const raft::neighbors::brute_force::index<float>& idx,
raft::device_matrix_view<const float, int64_t, row_major> queries,
raft::device_matrix_view<int, int64_t, row_major> neighbors,
raft::device_matrix_view<float, int64_t, row_major> distances);

extern template void raft::neighbors::brute_force::search<float, int64_t>(
extern template void search<float, int64_t>(
raft::resources const& res,
const raft::neighbors::brute_force::index<float>& idx,
raft::device_matrix_view<const float, int64_t, row_major> queries,
raft::device_matrix_view<int64_t, int64_t, row_major> neighbors,
raft::device_matrix_view<float, int64_t, row_major> distances);

extern template raft::neighbors::brute_force::index<float> raft::neighbors::brute_force::build<
float>(raft::resources const& res,
raft::device_matrix_view<const float, int64_t, row_major> dataset,
raft::distance::DistanceType metric,
float metric_arg);
extern template raft::neighbors::brute_force::index<float> build<float>(
raft::resources const& res,
raft::device_matrix_view<const float, int64_t, row_major> dataset,
raft::distance::DistanceType metric,
float metric_arg);
} // namespace raft::neighbors::brute_force

#define instantiate_raft_neighbors_brute_force_fused_l2_knn( \
value_t, idx_t, idx_layout, query_layout) \
Expand Down
19 changes: 10 additions & 9 deletions cpp/include/raft/neighbors/brute_force-inl.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,10 @@ void fused_l2_knn(raft::resources const& handle,
* @tparam T data element type
*
* @param[in] res
* @param[in] params parameters for building the index
* @param[in] dataset a matrix view (host or device) to a row-major matrix [n_rows, dim]
* @param[in] metric: distance metric to use. Euclidean (L2) is used by default
* @param[in] metric_arg: the value of `p` for Minkowski (l-p) distances. This
* is ignored if the metric_type is not Minkowski.
*
* @return the constructed brute force index
*/
Expand All @@ -297,8 +299,8 @@ template <typename T,
host_device_accessor<std::experimental::default_accessor<T>, memory_type::host>>
index<T> build(raft::resources const& res,
mdspan<const T, matrix_extent<int64_t>, row_major, Accessor> dataset,
raft::distance::DistanceType metric,
T metric_arg = 0.0)
raft::distance::DistanceType metric = = distance::DistanceType::L2Unexpanded,
T metric_arg = 0.0)
{
auto ret = index<T>(res, dataset, metric, metric_arg);

Expand Down Expand Up @@ -336,7 +338,6 @@ index<T> build(raft::resources const& res,
* @tparam IdxT type of the indices
*
* @param[in] res raft resources
* @param[in] params configure the search
* @param[in] idx brute force index
* @param[in] queries a device matrix view to a row-major matrix [n_queries, index->dim()]
* @param[out] neighbors a device matrix view to the indices of the neighbors in the source dataset
Expand All @@ -347,13 +348,13 @@ index<T> build(raft::resources const& res,
template <typename T, typename IdxT>
void search(raft::resources const& res,
const index<T>& idx,
raft::device_matrix_view<const T, int64_t, row_major> query,
raft::device_matrix_view<const T, int64_t, row_major> queries,
raft::device_matrix_view<IdxT, int64_t, row_major> neighbors,
raft::device_matrix_view<float, int64_t, row_major> distances)
{
RAFT_EXPECTS(neighbors.extent(1) == distances.extent(1), "Value of k must match for outputs");
RAFT_EXPECTS(idx.dataset().extent(1) == query.extent(1),
"Number of columns in query must match brute force index");
RAFT_EXPECTS(idx.dataset().extent(1) == queries.extent(1),
"Number of columns in queries must match brute force index");

auto k = neighbors.extent(1);
auto d = idx.dataset().extent(1);
Expand All @@ -367,8 +368,8 @@ void search(raft::resources const& res,
dataset,
sizes,
d,
const_cast<T*>(query.data_handle()),
query.extent(0),
const_cast<T*>(queries.data_handle()),
queries.extent(0),
neighbors.data_handle(),
distances.data_handle(),
k,
Expand Down

0 comments on commit ea9b1df

Please sign in to comment.