Skip to content

Commit

Permalink
move fvec_madd_* functions declarations to a right header (#3054)
Browse files Browse the repository at this point in the history
Summary:
The implementations for `fvec_madd` and `fvec_madd_and_argmin` are in `utils/distances.cpp`, so I moved the declarations from `utils/utils.h` to `utils/distances.h`

Pull Request resolved: #3054

Reviewed By: mlomeli1

Differential Revision: D49687725

Pulled By: mdouze

fbshipit-source-id: b98c13f5710f06daba479767a7aab8d62d6e6ddf
  • Loading branch information
alexanderguzhva authored and facebook-github-bot committed Sep 28, 2023
1 parent 0780a28 commit 56b1087
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
23 changes: 23 additions & 0 deletions faiss/utils/distances.h
Original file line number Diff line number Diff line change
Expand Up @@ -434,4 +434,27 @@ void compute_PQ_dis_tables_dsub2(
* Templatized versions of distance functions
***************************************************************************/

/***************************************************************************
* Misc matrix and vector manipulation functions
***************************************************************************/

/** compute c := a + bf * b for a, b and c tables
*
* @param n size of the tables
* @param a size n
* @param b size n
* @param c restult table, size n
*/
void fvec_madd(size_t n, const float* a, float bf, const float* b, float* c);

/** same as fvec_madd, also return index of the min of the result table
* @return index of the min of table c
*/
int fvec_madd_and_argmin(
size_t n,
const float* a,
float bf,
const float* b,
float* c);

} // namespace faiss
19 changes: 0 additions & 19 deletions faiss/utils/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,25 +49,6 @@ uint64_t get_cycles();
* Misc matrix and vector manipulation functions
***************************************************************************/

/** compute c := a + bf * b for a, b and c tables
*
* @param n size of the tables
* @param a size n
* @param b size n
* @param c restult table, size n
*/
void fvec_madd(size_t n, const float* a, float bf, const float* b, float* c);

/** same as fvec_madd, also return index of the min of the result table
* @return index of the min of table c
*/
int fvec_madd_and_argmin(
size_t n,
const float* a,
float bf,
const float* b,
float* c);

/* perform a reflection (not an efficient implementation, just for test ) */
void reflection(const float* u, float* x, size_t n, size_t d, size_t nu);

Expand Down

0 comments on commit 56b1087

Please sign in to comment.