@@ -100,8 +100,8 @@ class IndexIVFFlat {
100100 for (auto && c : *config) {
101101 auto key = c.first ;
102102 auto value = c.second ;
103- if (key == " nlist " ) {
104- nlist_ = std::stol (value);
103+ if (key == " partitions " ) {
104+ partitions_ = std::stol (value);
105105 } else if (key == " dimensions" ) {
106106 dimensions_ = std::stol (value);
107107 } else if (key == " max_iter" ) {
@@ -255,12 +255,12 @@ class IndexIVFFlat {
255255 " != " + std::to_string (index_->dimensions ()));
256256 }
257257 dimensions_ = index_->dimensions ();
258- if (nlist_ != 0 && nlist_ != index_->num_partitions ()) {
258+ if (partitions_ != 0 && partitions_ != index_->num_partitions ()) {
259259 throw std::runtime_error (
260- " nlist mismatch: " + std::to_string (nlist_ ) +
260+ " partitions mismatch: " + std::to_string (partitions_ ) +
261261 " != " + std::to_string (index_->num_partitions ()));
262262 }
263- nlist_ = index_->num_partitions ();
263+ partitions_ = index_->num_partitions ();
264264 }
265265
266266 /* *
@@ -292,49 +292,49 @@ class IndexIVFFlat {
292292 px_datatype_ == TILEDB_UINT32 ) {
293293 index_ = std::make_unique<
294294 index_impl<ivf_flat_index<uint8_t , uint32_t , uint32_t >>>(
295- nlist_ , max_iterations_, tolerance_, num_threads_);
295+ partitions_ , max_iterations_, tolerance_, num_threads_);
296296 } else if (
297297 feature_datatype_ == TILEDB_FLOAT32 && id_datatype_ == TILEDB_UINT32 &&
298298 px_datatype_ == TILEDB_UINT32 ) {
299299 index_ = std::make_unique<
300300 index_impl<ivf_flat_index<float , uint32_t , uint32_t >>>(
301- nlist_ , max_iterations_, tolerance_, num_threads_);
301+ partitions_ , max_iterations_, tolerance_, num_threads_);
302302 } else if (
303303 feature_datatype_ == TILEDB_UINT8 && id_datatype_ == TILEDB_UINT32 &&
304304 px_datatype_ == TILEDB_UINT64 ) {
305305 index_ = std::make_unique<
306306 index_impl<ivf_flat_index<uint8_t , uint32_t , uint64_t >>>(
307- nlist_ , max_iterations_, tolerance_, num_threads_);
307+ partitions_ , max_iterations_, tolerance_, num_threads_);
308308 } else if (
309309 feature_datatype_ == TILEDB_FLOAT32 && id_datatype_ == TILEDB_UINT32 &&
310310 px_datatype_ == TILEDB_UINT64 ) {
311311 index_ = std::make_unique<
312312 index_impl<ivf_flat_index<float , uint32_t , uint64_t >>>(
313- nlist_ , max_iterations_, tolerance_, num_threads_);
313+ partitions_ , max_iterations_, tolerance_, num_threads_);
314314 } else if (
315315 feature_datatype_ == TILEDB_UINT8 && id_datatype_ == TILEDB_UINT64 &&
316316 px_datatype_ == TILEDB_UINT32 ) {
317317 index_ = std::make_unique<
318318 index_impl<ivf_flat_index<uint8_t , uint64_t , uint32_t >>>(
319- nlist_ , max_iterations_, tolerance_, num_threads_);
319+ partitions_ , max_iterations_, tolerance_, num_threads_);
320320 } else if (
321321 feature_datatype_ == TILEDB_FLOAT32 && id_datatype_ == TILEDB_UINT64 &&
322322 px_datatype_ == TILEDB_UINT32 ) {
323323 index_ = std::make_unique<
324324 index_impl<ivf_flat_index<float , uint64_t , uint32_t >>>(
325- nlist_ , max_iterations_, tolerance_, num_threads_);
325+ partitions_ , max_iterations_, tolerance_, num_threads_);
326326 } else if (
327327 feature_datatype_ == TILEDB_UINT8 && id_datatype_ == TILEDB_UINT64 &&
328328 px_datatype_ == TILEDB_UINT64 ) {
329329 index_ = std::make_unique<
330330 index_impl<ivf_flat_index<uint8_t , uint64_t , uint64_t >>>(
331- nlist_ , max_iterations_, tolerance_, num_threads_);
331+ partitions_ , max_iterations_, tolerance_, num_threads_);
332332 } else if (
333333 feature_datatype_ == TILEDB_FLOAT32 && id_datatype_ == TILEDB_UINT64 &&
334334 px_datatype_ == TILEDB_UINT64 ) {
335335 index_ = std::make_unique<
336336 index_impl<ivf_flat_index<float , uint64_t , uint64_t >>>(
337- nlist_ , max_iterations_, tolerance_, num_threads_);
337+ partitions_ , max_iterations_, tolerance_, num_threads_);
338338 }
339339
340340 index_->train (training_set, init);
@@ -346,12 +346,12 @@ class IndexIVFFlat {
346346 }
347347 dimensions_ = index_->dimensions ();
348348
349- if (nlist_ != 0 && nlist_ != index_->num_partitions ()) {
349+ if (partitions_ != 0 && partitions_ != index_->num_partitions ()) {
350350 throw std::runtime_error (
351- " nlist mismatch: " + std::to_string (nlist_ ) +
351+ " partitions mismatch: " + std::to_string (partitions_ ) +
352352 " != " + std::to_string (index_->num_partitions ()));
353353 }
354- nlist_ = index_->num_partitions ();
354+ partitions_ = index_->num_partitions ();
355355 }
356356
357357 /* *
@@ -440,7 +440,7 @@ class IndexIVFFlat {
440440 }
441441
442442 constexpr auto num_partitions () const {
443- return nlist_ ;
443+ return partitions_ ;
444444 }
445445
446446 constexpr tiledb_datatype_t feature_type () const {
@@ -523,11 +523,11 @@ class IndexIVFFlat {
523523 }
524524
525525 index_impl (
526- size_t nlist ,
526+ size_t partitions ,
527527 size_t max_iter,
528528 float tolerance,
529529 std::optional<size_t > num_threads)
530- : impl_index_(nlist , max_iter, tolerance) {
530+ : impl_index_(partitions , max_iter, tolerance) {
531531 }
532532
533533 index_impl (
@@ -717,7 +717,7 @@ class IndexIVFFlat {
717717 };
718718
719719 uint64_t dimensions_ = 0 ;
720- size_t nlist_ = 0 ;
720+ size_t partitions_ = 0 ;
721721 uint32_t max_iterations_ = 2 ;
722722 float tolerance_ = 1e-4 ;
723723 std::optional<size_t > num_threads_ = std::nullopt ;
0 commit comments