-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Description
It seems like there is currently no specialised implementation of issubset for CartesianIndices, while there is one for AbstractUnitRange. This means that what could be a constant-time task (check if lower/upper bounds of potential subset are greater/less than lower/upper bounds of potential superset) instead checks every value individually and even allocates.
I think something like this could solve this issue quite easily:
function issubset(l::CartesianIndices{N, <: NTuple{N, AbstractUnitRange{Int}}}, r::CartesianIndices{N, <: NTuple{N, AbstractUnitRange{Int}}}) where N
all(issubset.(l.indices, r.indices))
endMetadata
Metadata
Assignees
Labels
No labels