|
16 | 16 | from arraykit import array_deepcopy
|
17 | 17 | from arraykit import isna_element
|
18 | 18 | from arraykit import dtype_from_element
|
19 |
| -from performance.reference.util import get_new_indexers_and_screen_ak |
| 19 | +from performance.reference.util import get_new_indexers_and_screen_ak as get_new_indexers_and_screen_full |
| 20 | +from arraykit import get_new_indexers_and_screen |
20 | 21 |
|
21 | 22 | from performance.reference.util import mloc as mloc_ref
|
22 | 23 |
|
@@ -384,50 +385,50 @@ def test_dtype_from_element_str_and_bytes_dtypes(self) -> None:
|
384 | 385 |
|
385 | 386 | def test_get_new_indexers_and_screen_a(self) -> None:
|
386 | 387 | indexersA = np.array([9, 9, 9, 9, 0, 0, 1, 4, 5, 0, 0, 0, 1], dtype=np.int64)
|
387 |
| - postA = get_new_indexers_and_screen_ak(indexersA, np.arange(10, dtype=np.int64)) |
| 388 | + postA = get_new_indexers_and_screen_full(indexersA, np.arange(10, dtype=np.int64)) |
388 | 389 | assert indexersA.flags.c_contiguous
|
389 | 390 | assert indexersA.flags.f_contiguous
|
390 | 391 | assert tuple(map(list, postA)) == (
|
391 |
| - [0, 0, 0, 0, 1, 1, 2, 3, 4, 1, 1, 1, 2], |
392 | 392 | [9, 0, 1, 4, 5],
|
| 393 | + [0, 0, 0, 0, 1, 1, 2, 3, 4, 1, 1, 1, 2], |
393 | 394 | )
|
394 | 395 |
|
395 | 396 | # Prove we can handle non-continuous arrays
|
396 | 397 | indexersB = np.full((len(indexersA), 3), -1, dtype=np.int64)
|
397 | 398 | indexersB[:,1] = indexersA.copy()
|
398 | 399 | assert not indexersB[:,1].flags.c_contiguous
|
399 | 400 | assert not indexersB[:,1].flags.f_contiguous
|
400 |
| - postB = get_new_indexers_and_screen_ak(indexersB[:,1], np.arange(10, dtype=np.int64)) |
| 401 | + postB = get_new_indexers_and_screen_full(indexersB[:,1], np.arange(10, dtype=np.int64)) |
401 | 402 | assert tuple(map(list, postA)) == tuple(map(list, postB))
|
402 | 403 |
|
403 | 404 | indexersC = np.array([9, 9, 9, 9, 0, 0, 1, 4, 5, 0, 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10], dtype=np.int64)
|
404 |
| - postC = get_new_indexers_and_screen_ak(indexersC, positions=np.arange(15, dtype=np.int64)) |
| 405 | + postC = get_new_indexers_and_screen_full(indexersC, positions=np.arange(15, dtype=np.int64)) |
405 | 406 | assert tuple(map(list, postC)) == (
|
406 |
| - [0, 0, 0, 0, 1, 1, 2, 3, 4, 1, 1, 1, 2, 5, 6, 3, 4,7, 8, 9, 0, 10], |
407 | 407 | [9, 0, 1, 4, 5, 2, 3, 6, 7, 8, 10],
|
| 408 | + [0, 0, 0, 0, 1, 1, 2, 3, 4, 1, 1, 1, 2, 5, 6, 3, 4,7, 8, 9, 0, 10], |
408 | 409 | )
|
409 | 410 |
|
410 | 411 | indexersD = np.array([2, 1, 0, 2, 0, 1, 1, 2, 0], dtype=np.int64)
|
411 |
| - postD = get_new_indexers_and_screen_ak(indexers=indexersD, positions=np.arange(3, dtype=np.int64)) |
| 412 | + postD = get_new_indexers_and_screen_full(indexers=indexersD, positions=np.arange(3, dtype=np.int64)) |
412 | 413 | assert tuple(map(list, postD)) == (
|
413 |
| - [2, 1, 0, 2, 0, 1, 1, 2, 0], |
414 | 414 | [0, 1, 2],
|
| 415 | + [2, 1, 0, 2, 0, 1, 1, 2, 0], |
415 | 416 | )
|
416 | 417 |
|
417 | 418 | def test_get_new_indexers_and_screen_b(self) -> None:
|
418 | 419 | indexersA = np.array([5], dtype=np.int64)
|
419 | 420 |
|
420 | 421 | with self.assertRaises(ValueError):
|
421 |
| - get_new_indexers_and_screen_ak(indexersA, np.arange(6, dtype=np.int64)) |
| 422 | + get_new_indexers_and_screen(indexersA, np.arange(6, dtype=np.int64)) |
422 | 423 |
|
423 | 424 | with self.assertRaises(ValueError):
|
424 |
| - get_new_indexers_and_screen_ak(indexersA, np.arange(106, dtype=np.int64)) |
| 425 | + get_new_indexers_and_screen(indexersA, np.arange(106, dtype=np.int64)) |
425 | 426 |
|
426 | 427 | with self.assertRaises(ValueError):
|
427 |
| - get_new_indexers_and_screen_ak(indexersA.astype(np.int32), np.arange(5)) |
| 428 | + get_new_indexers_and_screen(indexersA.astype(np.int32), np.arange(5)) |
428 | 429 |
|
429 | 430 | indexersB = np.arange(25, dtype=np.int64)
|
430 |
| - postB = get_new_indexers_and_screen_ak(indexersB, indexersB) |
| 431 | + postB = get_new_indexers_and_screen(indexersB, indexersB) |
431 | 432 | assert tuple(map(list, postB)) == (list(indexersB), list(indexersB))
|
432 | 433 |
|
433 | 434 |
|
|
0 commit comments