Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
faiss
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
钟尚武
faiss
Commits
ed809ce1
Commit
ed809ce1
authored
Apr 20, 2018
by
Lizz
Committed by
Matthijs Douze
Apr 20, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implement remove_ids in IndexPQ (#407)
* Implement remove_ids in IndexPQ * Update IndexPQ.cpp
parent
1ae74944
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
IndexPQ.cpp
IndexPQ.cpp
+22
-0
IndexPQ.h
IndexPQ.h
+5
-0
No files found.
IndexPQ.cpp
View file @
ed809ce1
...
...
@@ -21,6 +21,7 @@
#include <algorithm>
#include "FaissAssert.h"
#include "AuxIndexStructures.h"
#include "hamming.h"
namespace
faiss
{
...
...
@@ -84,6 +85,27 @@ void IndexPQ::add (idx_t n, const float *x)
}
long
IndexPQ
::
remove_ids
(
const
IDSelector
&
sel
)
{
idx_t
j
=
0
;
for
(
idx_t
i
=
0
;
i
<
ntotal
;
i
++
)
{
if
(
sel
.
is_member
(
i
))
{
// should be removed
}
else
{
if
(
i
>
j
)
{
memmove
(
&
codes
[
pq
.
code_size
*
j
],
&
codes
[
pq
.
code_size
*
i
],
pq
.
code_size
);
}
j
++
;
}
}
long
nremove
=
ntotal
-
j
;
if
(
nremove
>
0
)
{
ntotal
=
j
;
codes
.
resize
(
ntotal
*
pq
.
code_size
);
}
return
nremove
;
}
void
IndexPQ
::
reset
()
{
...
...
IndexPQ.h
View file @
ed809ce1
...
...
@@ -83,6 +83,11 @@ struct IndexPQ: Index {
Search_type_t
search_type
;
/** remove some ids. NB that Because of the structure of the
* indexing structre, the semantics of this operation are
* different from the usual ones: the new ids are shifted */
long
remove_ids
(
const
IDSelector
&
sel
)
override
;
// just encode the sign of the components, instead of using the PQ encoder
// used only for the queries
bool
encode_signs
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment