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 <raft/distance/distance_types.hpp>
22 
23 #include <cusparse_v2.h>
24 
25 namespace raft {
26 class handle_t;
27 }
28 
29 namespace ML {
30 namespace Sparse {
31 
32 constexpr int DEFAULT_BATCH_SIZE = 1 << 16;
33 
34 void brute_force_knn(raft::handle_t& handle,
35  const int* idx_indptr,
36  const int* idx_indices,
37  const float* idx_data,
38  size_t idx_nnz,
39  int n_idx_rows,
40  int n_idx_cols,
41  const int* query_indptr,
42  const int* query_indices,
43  const float* query_data,
44  size_t query_nnz,
45  int n_query_rows,
46  int n_query_cols,
47  int* output_indices,
48  float* output_dists,
49  int k,
50  size_t batch_size_index = DEFAULT_BATCH_SIZE,
51  size_t batch_size_query = DEFAULT_BATCH_SIZE,
52  raft::distance::DistanceType metric = raft::distance::DistanceType::L2Expanded,
53  float metricArg = 0);
54 }; // end namespace Sparse
55 }; // 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, raft::distance::DistanceType metric=raft::distance::DistanceType::L2Expanded, float metricArg=0)
constexpr int DEFAULT_BATCH_SIZE
Definition: knn_sparse.hpp:32
Definition: dbscan.hpp:30
Definition: dbscan.hpp:26