Commit 21475fb2 authored by cyy's avatar cyy Committed by Lucas Hosseini

Use explicit numeric limits + add missing header (#644)

parent 70616997
...@@ -387,7 +387,7 @@ void ParameterSpace::initialize (const Index * index) ...@@ -387,7 +387,7 @@ void ParameterSpace::initialize (const Index * index)
for (int i = 8; i < 20; i++) { for (int i = 8; i < 20; i++) {
pr_max_codes.values.push_back (1 << i); pr_max_codes.values.push_back (1 << i);
} }
pr_max_codes.values.push_back (1.0 / 0.0); pr_max_codes.values.push_back (std::numeric_limits<double>::infinity());
} }
} }
if (DC (IndexIVFPQR)) { if (DC (IndexIVFPQR)) {
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include "IndexFlat.h" #include "IndexFlat.h"
#include <cstring> #include <cstring>
#include <limits>
#include "utils.h" #include "utils.h"
#include "Heap.h" #include "Heap.h"
...@@ -371,7 +372,7 @@ void IndexFlat1D::search ( ...@@ -371,7 +372,7 @@ void IndexFlat1D::search (
I[wp] = perm[i1]; I[wp] = perm[i1];
i1++; i1++;
} else { } else {
D[wp] = 1.0 / 0.0; D[wp] = std::numeric_limits<float>::infinity();
I[wp] = -1; I[wp] = -1;
} }
wp++; wp++;
...@@ -386,7 +387,7 @@ void IndexFlat1D::search ( ...@@ -386,7 +387,7 @@ void IndexFlat1D::search (
I[wp] = perm[i0]; I[wp] = perm[i0];
i0--; i0--;
} else { } else {
D[wp] = 1.0 / 0.0; D[wp] = std::numeric_limits<float>::infinity();
I[wp] = -1; I[wp] = -1;
} }
wp++; wp++;
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "../utils/BlockSelectKernel.cuh" #include "../utils/BlockSelectKernel.cuh"
#include <memory> #include <memory>
#include <algorithm>
#include <thrust/fill.h> #include <thrust/fill.h>
#include <thrust/for_each.h> #include <thrust/for_each.h>
#include <thrust/device_ptr.h> #include <thrust/device_ptr.h>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment