mirror of
https://github.com/facebookresearch/faiss.git
synced 2025-06-03 21:54:02 +08:00
Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/1802 Reviewed By: beauby Differential Revision: D27706399 Pulled By: mdouze fbshipit-source-id: 61ac99f61e9e44b2fca8e3de45357ee4c0a0b9d7
45 lines
1.2 KiB
C++
45 lines
1.2 KiB
C++
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
// Copyright 2004-present Facebook. All Rights Reserved.
|
|
// -*- c++ -*-
|
|
|
|
#include "IndexScalarQuantizer_c.h"
|
|
#include <faiss/IndexScalarQuantizer.h>
|
|
#include <faiss/impl/ScalarQuantizer.h>
|
|
#include "macros_impl.h"
|
|
|
|
using faiss::Index;
|
|
using faiss::IndexScalarQuantizer;
|
|
|
|
DEFINE_DESTRUCTOR(IndexScalarQuantizer)
|
|
DEFINE_INDEX_DOWNCAST(IndexScalarQuantizer)
|
|
|
|
int faiss_IndexScalarQuantizer_new(FaissIndexScalarQuantizer** p_index) {
|
|
try {
|
|
*p_index = reinterpret_cast<FaissIndexScalarQuantizer*>(
|
|
new IndexScalarQuantizer());
|
|
}
|
|
CATCH_AND_HANDLE
|
|
}
|
|
|
|
int faiss_IndexScalarQuantizer_new_with(
|
|
FaissIndexScalarQuantizer** p_index,
|
|
idx_t d,
|
|
FaissQuantizerType qt,
|
|
FaissMetricType metric) {
|
|
try {
|
|
IndexScalarQuantizer* index = new IndexScalarQuantizer(
|
|
d,
|
|
static_cast<faiss::ScalarQuantizer::QuantizerType>(qt),
|
|
static_cast<faiss::MetricType>(metric));
|
|
*p_index = reinterpret_cast<FaissIndexScalarQuantizer*>(index);
|
|
return 0;
|
|
}
|
|
CATCH_AND_HANDLE
|
|
}
|