knn_sparse.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2019-2024, NVIDIA CORPORATION.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <cuml/neighbors/knn.hpp>
20 
21 #include <cusparse_v2.h>
22 #include <cuvs/distance/distance.hpp>
23 
24 namespace raft {
25 class handle_t;
26 }
27 
28 namespace ML {
29 namespace Sparse {
30 
31 constexpr int DEFAULT_BATCH_SIZE = 1 << 16;
32 
33 void brute_force_knn(raft::handle_t& handle,
34  const int* idx_indptr,
35  const int* idx_indices,
36  const float* idx_data,
37  size_t idx_nnz,
38  int n_idx_rows,
39  int n_idx_cols,
40  const int* query_indptr,
41  const int* query_indices,
42  const float* query_data,
43  size_t query_nnz,
44  int n_query_rows,
45  int n_query_cols,
46  int* output_indices,
47  float* output_dists,
48  int k,
49  size_t batch_size_index = DEFAULT_BATCH_SIZE,
50  size_t batch_size_query = DEFAULT_BATCH_SIZE,
51  cuvs::distance::DistanceType metric = cuvs::distance::DistanceType::L2Expanded,
52  float metricArg = 0);
53 }; // end namespace Sparse
54 }; // end namespace ML
void brute_force_knn(raft::handle_t &handle, const int *idx_indptr, const int *idx_indices, const float *idx_data, size_t idx_nnz, int n_idx_rows, int n_idx_cols, const int *query_indptr, const int *query_indices, const float *query_data, size_t query_nnz, int n_query_rows, int n_query_cols, int *output_indices, float *output_dists, int k, size_t batch_size_index=DEFAULT_BATCH_SIZE, size_t batch_size_query=DEFAULT_BATCH_SIZE, cuvs::distance::DistanceType metric=cuvs::distance::DistanceType::L2Expanded, float metricArg=0)
constexpr int DEFAULT_BATCH_SIZE
Definition: knn_sparse.hpp:31
Definition: dbscan.hpp:30
Definition: dbscan.hpp:26