Faiss

- Main Page
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends
Public Member Functions | Public Attributes | List of all members
faiss::Score3Computer< Ttab, Taccu > Struct Template Reference
Inheritance diagram for faiss::Score3Computer< Ttab, Taccu >:

## Public Member Functions
Taccu | compute (const int *perm) const
Taccu | compute_update (const int *perm, int iw, int jw) const
Taccu | update_i (const int *perm, int iw, int jw, int ip0, int ip, const Ttab *n_gt_i) const
Taccu | update_i_plane (const int *perm, int iw, int jw, int ip0, int ip, const Ttab *n_gt_i) const
Taccu | update_k (const int *perm, int iw, int jw, int ip0, int ip, int jp0, int jp, int k, const Ttab *n_gt_ij) const
| used for the 8 cells were the 3 indices are swapped
Taccu | update_j_line (const int *perm, int iw, int jw, int ip0, int ip, int jp0, int jp, const Ttab *n_gt_ij) const
| compute update on a line of k's, where i and j are swapped
Taccu | update_i_cross (const int *perm, int iw, int jw, int ip0, int ip, const Ttab *n_gt_i) const
| considers the 2 pairs of crossing lines j=iw or jw and k = iw or kw
virtual double | compute_cost (const int *perm) const
virtual double | cost_update (const int *perm, int iw, int jw) const

## Public Attributes
int | nc
std::vector< Ttab > | n_gt
Public Attributes inherited from faiss::PermutationObjective
int | n

## Detailed Description

### template<typename Ttab, typename Taccu>
struct faiss::Score3Computer< Ttab, Taccu >

Maintains a 3D table of elementary costs. Accumulates elements based on Hamming distance comparisons

Definition at line 452 of file PolysemousTraining.cpp.

## Member Function Documentation

template<typename Ttab, typename Taccu>

Taccu faiss::Score3Computer< Ttab, Taccu >::compute | ( | const int * | perm | ) | const
| inline

the cost is a triple loop on the nc * nc * nc matrix of entries.

Definition at line 464 of file PolysemousTraining.cpp.

template<typename Ttab, typename Taccu>

virtual double faiss::Score3Computer< Ttab, Taccu >::compute_cost | ( | const int * | perm | ) | const
| inlinevirtual

PermutationObjective implementeation (just negates the scores for minimization)

Implements faiss::PermutationObjective.

Definition at line 640 of file PolysemousTraining.cpp.

template<typename Ttab, typename Taccu>

Taccu faiss::Score3Computer< Ttab, Taccu >::compute_update | ( | const int * | perm,
|  | int | iw,
|  | int | jw
| ) |  | const
| inline

cost update if entries iw and jw of the permutation would be swapped.

The computation is optimized by avoiding elements in the nc*nc*nc cube that are known not to change. For nc=256, this reduces the nb of cells to visit to about 6/256 th of the cells. Practical speedup is about 8x, and the code is quite complex :-/

Definition at line 495 of file PolysemousTraining.cpp.

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

- /data/users/matthijs/github_faiss/faiss/PolysemousTraining.cpp