1
1
/*
2
- * Copyright (c) 2023, NVIDIA CORPORATION.
2
+ * Copyright (c) 2023-2024 , NVIDIA CORPORATION.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -32,13 +32,14 @@ namespace raft::neighbors::cagra {
32
32
*
33
33
* @code{.cpp}
34
34
* #include <raft/core/resources.hpp>
35
+ * #include <raft/neighbors/cagra_serialize.hpp>
35
36
*
36
37
* raft::resources handle;
37
38
*
38
39
* // create an output stream
39
40
* std::ostream os(std::cout.rdbuf());
40
- * // create an index with `auto index = cagra::build(...);`
41
- * raft::serialize(handle, os, index);
41
+ * // create an index with `auto index = raft:: cagra::build(...);`
42
+ * raft::cagra:: serialize(handle, os, index);
42
43
* @endcode
43
44
*
44
45
* @tparam T data element type
@@ -66,13 +67,14 @@ void serialize(raft::resources const& handle,
66
67
*
67
68
* @code{.cpp}
68
69
* #include <raft/core/resources.hpp>
70
+ * #include <raft/neighbors/cagra_serialize.hpp>
69
71
*
70
72
* raft::resources handle;
71
73
*
72
74
* // create a string with a filepath
73
75
* std::string filename("/path/to/index");
74
- * // create an index with `auto index = cagra::build(...);`
75
- * raft::serialize(handle, filename, index);
76
+ * // create an index with `auto index = raft:: cagra::build(...);`
77
+ * raft::cagra:: serialize(handle, filename, index);
76
78
* @endcode
77
79
*
78
80
* @tparam T data element type
@@ -100,13 +102,14 @@ void serialize(raft::resources const& handle,
100
102
*
101
103
* @code{.cpp}
102
104
* #include <raft/core/resources.hpp>
105
+ * #include <raft/neighbors/cagra_serialize.hpp>
103
106
*
104
107
* raft::resources handle;
105
108
*
106
109
* // create an output stream
107
110
* std::ostream os(std::cout.rdbuf());
108
- * // create an index with `auto index = cagra::build(...);`
109
- * raft::serialize_to_hnswlib(handle, os, index);
111
+ * // create an index with `auto index = raft:: cagra::build(...);`
112
+ * raft::cagra:: serialize_to_hnswlib(handle, os, index);
110
113
* @endcode
111
114
*
112
115
* @tparam T data element type
@@ -120,25 +123,26 @@ void serialize(raft::resources const& handle,
120
123
template <typename T, typename IdxT>
121
124
void serialize_to_hnswlib (raft::resources const & handle,
122
125
std::ostream& os,
123
- const index<T, IdxT>& index)
126
+ const raft::neighbors::cagra:: index<T, IdxT>& index)
124
127
{
125
128
detail::serialize_to_hnswlib<T, IdxT>(handle, os, index );
126
129
}
127
130
128
131
/* *
129
- * Write the CAGRA built index as a base layer HNSW index to file
132
+ * Save a CAGRA build index in hnswlib base- layer-only serialized format
130
133
*
131
134
* Experimental, both the API and the serialization format are subject to change.
132
135
*
133
136
* @code{.cpp}
134
137
* #include <raft/core/resources.hpp>
138
+ * #include <raft/neighbors/cagra_serialize.hpp>
135
139
*
136
140
* raft::resources handle;
137
141
*
138
142
* // create a string with a filepath
139
143
* std::string filename("/path/to/index");
140
- * // create an index with `auto index = cagra::build(...);`
141
- * raft::serialize_to_hnswlib(handle, filename, index);
144
+ * // create an index with `auto index = raft:: cagra::build(...);`
145
+ * raft::cagra:: serialize_to_hnswlib(handle, filename, index);
142
146
* @endcode
143
147
*
144
148
* @tparam T data element type
@@ -152,7 +156,7 @@ void serialize_to_hnswlib(raft::resources const& handle,
152
156
template <typename T, typename IdxT>
153
157
void serialize_to_hnswlib (raft::resources const & handle,
154
158
const std::string& filename,
155
- const index<T, IdxT>& index)
159
+ const raft::neighbors::cagra:: index<T, IdxT>& index)
156
160
{
157
161
detail::serialize_to_hnswlib<T, IdxT>(handle, filename, index );
158
162
}
@@ -164,14 +168,15 @@ void serialize_to_hnswlib(raft::resources const& handle,
164
168
*
165
169
* @code{.cpp}
166
170
* #include <raft/core/resources.hpp>
171
+ * #include <raft/neighbors/cagra_serialize.hpp>
167
172
*
168
173
* raft::resources handle;
169
174
*
170
175
* // create an input stream
171
176
* std::istream is(std::cin.rdbuf());
172
177
* using T = float; // data element type
173
178
* using IdxT = int; // type of the index
174
- * auto index = raft::deserialize<T, IdxT>(handle, is);
179
+ * auto index = raft::cagra:: deserialize<T, IdxT>(handle, is);
175
180
* @endcode
176
181
*
177
182
* @tparam T data element type
@@ -195,14 +200,15 @@ index<T, IdxT> deserialize(raft::resources const& handle, std::istream& is)
195
200
*
196
201
* @code{.cpp}
197
202
* #include <raft/core/resources.hpp>
203
+ * #include <raft/neighbors/cagra_serialize.hpp>
198
204
*
199
205
* raft::resources handle;
200
206
*
201
207
* // create a string with a filepath
202
208
* std::string filename("/path/to/index");
203
209
* using T = float; // data element type
204
210
* using IdxT = int; // type of the index
205
- * auto index = raft::deserialize<T, IdxT>(handle, filename);
211
+ * auto index = raft::cagra:: deserialize<T, IdxT>(handle, filename);
206
212
* @endcode
207
213
*
208
214
* @tparam T data element type
0 commit comments