References

FunctionIndices.FunctionIndexType
FunctionIndex{F} <: AbstractFunctionIndex
FI

A implementation of function index, which make indexing with function possible. 1-d indexing A[FI(f)] is equivalent to A[map(f, begin:end)], multi-dimensional indexing A[FI(f1), ..., FI(fn)] is equivalent to A[map(FI(f1), axes(A, 1)), ..., map(FI(fn), axes(A, n))].

FunctionIndices.NotIndexType
NotIndex{T} <: AbstractNotIndex{T}

The default implementation of not. There are some optimization for NotIndex(x) comparing to FI(!in(x)). For large arrays, this implementation may be faster. but for small arrays this implementation may be slower. See performance comparing for more details.

FunctionIndices.indextypeMethod
indextype([A::AbstractArray,] I::AbstractFunctionIndex)
indextype([::Type{TA},] ::Type{TI})

Determine the index type which the function index type TI will be converted to by Base.to_indices for array type TA. By default, it's AbstractArray.

Note

If you define a methods indextype(::Type{TA}, ::Type{TI}) = T, while to_index(::Type{T}, inds, I::TI) is not defined, the to_indices will not convert a index of type TI to a T, but a Base.LogicalIndex, the default return type of to_index.

FunctionIndices.notMethod
not(x)

Create a NotIndex with given x, which is similar to Not of InvertedIndices. In most cases, not is much faster than Not. See performance comparing for more details.

Main differences between not and Not

For CartesianIndex, A[not(CartesianIndex(i, j,..., n))] is equivalent to A[not(i), not(j), ..., not(n)] and will return a array with same dimension, but A[Not(CartesianIndex(i, j,..., n))] will convert the CartesianIndex to a linear index and return a vector:

julia> A = reshape(1:12, 3, 4)
3×4 reshape(::UnitRange{Int64}, 3, 4) with eltype Int64:
 0  3  6   9
 1  4  7  10
 2  5  8  11

julia> A[not(CartesianIndex(1, 2))] # equivalent to A[not(1), not(2)]
2×3 Matrix{Int64}:
 1  7  10
 2  8  11

julia> A[Not(CartesianIndex(1, 2))] # equivalent to A[Not(3)]
11-element Vector{Int64}:
  0
  1
  2
  4
  5
  ⋮
  8
  9
 10
 11

Besides, for index like A[4, 5] which is out of bounds, A[not(4), not(5)] is equivalent to A[:, :], because inbounds indices are always not equal to the given value, while A[Not[4], Not(5)] causes an error.

FunctionIndices.notinMethod
notin(item, collection)
notin(collection)

The same as !in, used in the default to_function for AbstractNotIndex.

FunctionIndices.to_functionFunction
to_function(I::AbstractFunctionIndex)

Converts a AbstractFunctionIndex to a Function. By default, to_function(I::AbstractNotIndex) returns notin(parent(I)).

FunctionIndices.to_indexMethod
FunctionIndices.to_index(::Type{T<:AbstractArray}, A, ind, i)

Convert a AbstractFunctionIndex i to a array index of type T for A with ind. By default, to_index(::AbstractArray, ind, i) will return a Base.LogicalIndex{Bool, ReadonlyMappedArray{Bool...}}.