Faiss
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
faiss::InvertedLists Struct Referenceabstract

#include <InvertedLists.h>

Inheritance diagram for faiss::InvertedLists:
faiss::ArrayInvertedLists faiss::OnDiskInvertedLists faiss::ReadOnlyInvertedLists faiss::HStackInvertedLists faiss::MaskedInvertedLists faiss::SliceInvertedLists faiss::VStackInvertedLists

Classes

struct  ScopedCodes
 
struct  ScopedIds
 

Public Types

typedef Index::idx_t idx_t
 

Public Member Functions

 InvertedLists (size_t nlist, size_t code_size)
 
virtual size_t list_size (size_t list_no) const =0
 get the size of a list
 
virtual const uint8_t * get_codes (size_t list_no) const =0
 
virtual const idx_t * get_ids (size_t list_no) const =0
 
virtual void release_codes (size_t list_no, const uint8_t *codes) const
 release codes returned by get_codes (default implementation is nop
 
virtual void release_ids (size_t list_no, const idx_t *ids) const
 release ids returned by get_ids
 
virtual idx_t get_single_id (size_t list_no, size_t offset) const
 
virtual const uint8_t * get_single_code (size_t list_no, size_t offset) const
 
virtual void prefetch_lists (const idx_t *list_nos, int nlist) const
 
virtual size_t add_entry (size_t list_no, idx_t theid, const uint8_t *code)
 add one entry to an inverted list
 
virtual size_t add_entries (size_t list_no, size_t n_entry, const idx_t *ids, const uint8_t *code)=0
 
virtual void update_entry (size_t list_no, size_t offset, idx_t id, const uint8_t *code)
 
virtual void update_entries (size_t list_no, size_t offset, size_t n_entry, const idx_t *ids, const uint8_t *code)=0
 
virtual void resize (size_t list_no, size_t new_size)=0
 
virtual void reset ()
 
void merge_from (InvertedLists *oivf, size_t add_id)
 move all entries from oivf (empty on output)
 
double imbalance_factor () const
 1= perfectly balanced, >1: imbalanced
 
void print_stats () const
 display some stats about the inverted lists
 
size_t compute_ntotal () const
 sum up list sizes
 

Public Attributes

size_t nlist
 number of possible key values
 
size_t code_size
 code size per vector in bytes
 

Detailed Description

Table of inverted lists multithreading rules:

Definition at line 31 of file InvertedLists.h.

Member Function Documentation

virtual const uint8_t* faiss::InvertedLists::get_codes ( size_t  list_no) const
pure virtual

get the codes for an inverted list must be released by release_codes

Returns
codes size list_size * code_size

Implemented in faiss::MaskedInvertedLists, faiss::VStackInvertedLists, faiss::SliceInvertedLists, faiss::HStackInvertedLists, faiss::ArrayInvertedLists, and faiss::OnDiskInvertedLists.

virtual const idx_t* faiss::InvertedLists::get_ids ( size_t  list_no) const
pure virtual

get the ids for an inverted list must be released by release_ids

Returns
ids size list_size

Implemented in faiss::MaskedInvertedLists, faiss::VStackInvertedLists, faiss::SliceInvertedLists, faiss::HStackInvertedLists, faiss::ArrayInvertedLists, and faiss::OnDiskInvertedLists.

const uint8_t * faiss::InvertedLists::get_single_code ( size_t  list_no,
size_t  offset 
) const
virtual
Returns
a single code in an inverted list (should be deallocated with release_codes)

Reimplemented in faiss::MaskedInvertedLists, faiss::VStackInvertedLists, faiss::SliceInvertedLists, and faiss::HStackInvertedLists.

Definition at line 52 of file InvertedLists.cpp.

InvertedLists::idx_t faiss::InvertedLists::get_single_id ( size_t  list_no,
size_t  offset 
) const
virtual
Returns
a single id in an inverted list

Reimplemented in faiss::MaskedInvertedLists, faiss::VStackInvertedLists, faiss::SliceInvertedLists, and faiss::HStackInvertedLists.

Definition at line 35 of file InvertedLists.cpp.

void faiss::InvertedLists::prefetch_lists ( const idx_t *  list_nos,
int  nlist 
) const
virtual

prepare the following lists (default does nothing) a list can be -1 hence the signed long

Reimplemented in faiss::MaskedInvertedLists, faiss::VStackInvertedLists, faiss::SliceInvertedLists, faiss::HStackInvertedLists, and faiss::OnDiskInvertedLists.

Definition at line 49 of file InvertedLists.cpp.


The documentation for this struct was generated from the following files: