2019-11-19 18:36:44 +08:00
|
|
|
/**
|
|
|
|
* 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++ -*-
|
|
|
|
// I/O code for indexes
|
|
|
|
|
|
|
|
#include "clone_index_c.h"
|
2021-02-25 20:44:50 +08:00
|
|
|
#include <faiss/clone_index.h>
|
2019-11-19 18:36:44 +08:00
|
|
|
#include "macros_impl.h"
|
|
|
|
|
|
|
|
using faiss::Index;
|
|
|
|
|
2021-02-25 20:44:50 +08:00
|
|
|
int faiss_clone_index(const FaissIndex* idx, FaissIndex** p_out) {
|
2019-11-19 18:36:44 +08:00
|
|
|
try {
|
|
|
|
auto out = faiss::clone_index(reinterpret_cast<const Index*>(idx));
|
|
|
|
*p_out = reinterpret_cast<FaissIndex*>(out);
|
2021-02-25 20:44:50 +08:00
|
|
|
}
|
|
|
|
CATCH_AND_HANDLE
|
2021-02-16 04:40:02 +08:00
|
|
|
}
|