|
@@ 286-296 (lines=11) @@
|
| 283 |
|
swig_ptr(labels)) |
| 284 |
|
return distances, labels |
| 285 |
|
|
| 286 |
|
def replacement_range_search(self, x, thresh): |
| 287 |
|
n, d = x.shape |
| 288 |
|
assert d * 8 == self.d |
| 289 |
|
res = RangeSearchResult(n) |
| 290 |
|
self.range_search_c(n, swig_ptr(x), thresh, res) |
| 291 |
|
# get pointers and copy them |
| 292 |
|
lims = rev_swig_ptr(res.lims, n + 1).copy() |
| 293 |
|
nd = int(lims[-1]) |
| 294 |
|
D = rev_swig_ptr(res.distances, nd).copy() |
| 295 |
|
I = rev_swig_ptr(res.labels, nd).copy() |
| 296 |
|
return lims, D, I |
| 297 |
|
|
| 298 |
|
def replacement_remove_ids(self, x): |
| 299 |
|
if isinstance(x, IDSelector): |
|
@@ 209-219 (lines=11) @@
|
| 206 |
|
assert x.shape == (n, self.d) |
| 207 |
|
self.update_vectors_c(n, swig_ptr(keys), swig_ptr(x)) |
| 208 |
|
|
| 209 |
|
def replacement_range_search(self, x, thresh): |
| 210 |
|
n, d = x.shape |
| 211 |
|
assert d == self.d |
| 212 |
|
res = RangeSearchResult(n) |
| 213 |
|
self.range_search_c(n, swig_ptr(x), thresh, res) |
| 214 |
|
# get pointers and copy them |
| 215 |
|
lims = rev_swig_ptr(res.lims, n + 1).copy() |
| 216 |
|
nd = int(lims[-1]) |
| 217 |
|
D = rev_swig_ptr(res.distances, nd).copy() |
| 218 |
|
I = rev_swig_ptr(res.labels, nd).copy() |
| 219 |
|
return lims, D, I |
| 220 |
|
|
| 221 |
|
def replacement_sa_encode(self, x): |
| 222 |
|
n, d = x.shape |