-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
504 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
#include <faiss/impl/IDDeduper.h> | ||
|
||
namespace faiss { | ||
|
||
/*********************************************************************** | ||
* IDDeduperMap | ||
***********************************************************************/ | ||
IDDeduperMap::IDDeduperMap(std::unordered_map<idx_t, idx_t>* m) : m(m) {} | ||
|
||
idx_t IDDeduperMap::group_id(idx_t id) const { | ||
return m->at(id); | ||
} | ||
|
||
} // namespace faiss |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <unordered_map> | ||
#include <vector> | ||
|
||
#include <faiss/MetricType.h> | ||
|
||
/** IDDeduper is intended to define a group of vectors to dedupe */ | ||
|
||
namespace faiss { | ||
|
||
/** Encapsulates a set of id groups to handle. */ | ||
struct IDDeduper { | ||
virtual idx_t group_id(idx_t id) const = 0; | ||
virtual ~IDDeduper() {} | ||
}; | ||
|
||
/** id to group id mapping */ | ||
struct IDDeduperMap : IDDeduper { | ||
std::unordered_map<idx_t, idx_t>* m; | ||
|
||
IDDeduperMap(std::unordered_map<idx_t, idx_t>* m); | ||
|
||
idx_t group_id(idx_t id) const final; | ||
|
||
~IDDeduperMap() override {} | ||
}; | ||
|
||
} // namespace faiss |
Oops, something went wrong.