@@ -22,8 +22,9 @@ For a given array `A`, potentially return an optimized "ref array" representatio
22
22
original array, which can allow for faster comparison and sorting.
23
23
24
24
The default definition just returns the input array. This function is useful for custom
25
- array types which already store a "hashed"-like representation of elements where comparison
26
- can be much faster than the original scalar value, like pooled arrays.
25
+ array types which already store a "hashed"-like representation of elements where testing
26
+ equality or permuting elements in place can be much faster than the original scalar value,
27
+ like pooled arrays.
27
28
28
29
This generic function is owned by DataAPI.jl itself, which is the sole provider of the
29
30
default definition.
@@ -35,7 +36,7 @@ refarray(A::AbstractArray) = A
35
36
refvalue(A, x)
36
37
37
38
For the *original* array `A`, and a "ref value" `x` taken from `refarray(A)`, return the
38
- appropriate *original* value.
39
+ appropriate *original* value. `refvalue(A, refarray(A)[I...])` must be equal to `A[I...]`.
39
40
40
41
By default, `refvalue(A, x)` returns `x` (since `refarray(A)` returns `A` by default).
41
42
This allows recovering an original array element after operating on the "ref values".
@@ -46,6 +47,22 @@ default definition.
46
47
function refvalue end
47
48
refvalue (A:: AbstractArray , x) = x
48
49
50
+ """
51
+ refpool(A)
52
+
53
+ Whenever available, return an indexable object `pool` such that, given the *original* array `A` and
54
+ a "ref value" `x` taken from `refarray(A)`, `pool[x]` is the appropriate *original* value. Return
55
+ `nothing` i such object is not available. If `refpool(A)` is not `nothing`, then
56
+ `refpool(A)[refarray(A)[I...]]` must be equal to `A[I...]`.
57
+
58
+ By default, `refpool(A)` returns `nothing`.
59
+
60
+ This generic function is owned by DataAPI.jl itself, which is the sole provider of the
61
+ default definition.
62
+ """
63
+ function refpool end
64
+ refpool (A:: AbstractArray ) = nothing
65
+
49
66
"""
50
67
nondatavaluetype(T)
51
68
0 commit comments