diff --git a/faiss/IndexIVFSpectralHash.cpp b/faiss/IndexIVFSpectralHash.cpp index f0e53d36e..523ef8afb 100644 --- a/faiss/IndexIVFSpectralHash.cpp +++ b/faiss/IndexIVFSpectralHash.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -159,7 +160,7 @@ void binarize_with_freq( memset(codes, 0, (nbit + 7) / 8); for (size_t i = 0; i < nbit; i++) { float xf = (x[i] - c[i]); - int64_t xi = int64_t(floor(xf * freq)); + int64_t xi = int64_t(std::floor(xf * freq)); int64_t bit = xi & 1; codes[i >> 3] |= bit << (i & 7); } diff --git a/faiss/VectorTransform.cpp b/faiss/VectorTransform.cpp index 0f5265f43..219920e88 100644 --- a/faiss/VectorTransform.cpp +++ b/faiss/VectorTransform.cpp @@ -279,7 +279,7 @@ void LinearTransform::set_is_orthonormal() { float v = ATA[i + j * d_out]; if (i == j) v -= 1; - if (fabs(v) > eps) { + if (std::fabs(v) > eps) { is_orthonormal = false; } } @@ -773,7 +773,7 @@ void PCAMatrix::prepare_Ab() { if (eigen_power != 0) { float* ai = A.data(); for (int i = 0; i < d_out; i++) { - float factor = pow(eigenvalues[i] + epsilon, eigen_power); + float factor = std::pow(eigenvalues[i] + epsilon, eigen_power); for (int j = 0; j < d_in; j++) *ai++ *= factor; }