Faiss
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Types | Public Member Functions | Public Attributes | List of all members
faiss::HeapArray< C > Struct Template Reference

#include <Heap.h>

Public Types

typedef C::TI TI
 
typedef C::T T
 

Public Member Functions

T * get_val (size_t key)
 Return the list of values for a heap.
 
TI * get_ids (size_t key)
 Correspponding identifiers.
 
void heapify ()
 prepare all the heaps before adding
 
void addn (size_t nj, const T *vin, TI j0=0, size_t i0=0, long ni=-1)
 
void addn_with_ids (size_t nj, const T *vin, const TI *id_in=nullptr, long id_stride=0, size_t i0=0, long ni=-1)
 
void reorder ()
 reorder all the heaps
 
void per_line_extrema (T *vals_out, TI *idx_out) const
 

Public Attributes

size_t nh
 number of heaps
 
size_t k
 allocated size per heap
 
TI * ids
 identifiers (size nh * k)
 
T * val
 values (distances or similarities), size nh * k
 

Detailed Description

template<typename C>
struct faiss::HeapArray< C >

a template structure for a set of [min|max]-heaps it is tailored so that the actual data of the heaps can just live in compact arrays.

Definition at line 350 of file Heap.h.

Member Function Documentation

template<typename C >
void faiss::HeapArray< C >::addn ( size_t  nj,
const T *  vin,
TI  j0 = 0,
size_t  i0 = 0,
long  ni = -1 
)

add nj elements to heaps i0:i0+ni, with sequential ids

Parameters
njnb of elements to add to each heap
vinelements to add, size ni * nj
j0add this to the ids that are added
i0first heap to update
ninb of elements to update (-1 = use nh)

Definition at line 42 of file Heap.cpp.

template<typename C >
void faiss::HeapArray< C >::addn_with_ids ( size_t  nj,
const T *  vin,
const TI *  id_in = nullptr,
long  id_stride = 0,
size_t  i0 = 0,
long  ni = -1 
)

same as addn

Parameters
id_inids of the elements to add, size ni * nj
id_stridestride for id_in

Definition at line 64 of file Heap.cpp.

template<typename C >
void faiss::HeapArray< C >::per_line_extrema ( T *  vals_out,
TI *  idx_out 
) const

this is not really a heap function. It just finds the per-line extrema of each line of array D

Parameters
vals_outextreme value of each line (size nh, or NULL)
idx_outindex of extreme value (size nh or NULL)

Definition at line 92 of file Heap.cpp.


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