Skip to content

Commit cda2ff2

Browse files
committed
rename
1 parent 10c3a9c commit cda2ff2

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

lib/ArrayInterfaceCore/src/ArrayInterfaceCore.jl

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -540,29 +540,29 @@ ndims_index(T::DataType) = 1
540540
ndims_index(@nospecialize(i)) = ndims_index(typeof(i))
541541

542542
"""
543-
safeivdepeltype(::Type{T}) -> Bool
543+
instances_do_not_alias(::Type{T}) -> Bool
544544
545545
Is it safe to `ivdep` arrays containing elements of type `T`?
546546
That is, would it be safe to write to an array full of `T` in parallel?
547547
This is not true for `mutable struct`s in general, where editing one index
548548
could edit other indices.
549549
That is, it is not safe when different instances may alias the same memory.
550550
"""
551-
safeivdepeltype(::Type{T}) where {T} = Base.isbitstype(T)
551+
instances_do_not_alias(::Type{T}) where {T} = Base.isbitstype(T)
552552

553553
"""
554-
safeivdep(::Type{T<:AbstractArray}) -> Bool
554+
indices_do_not_alias(::Type{T<:AbstractArray}) -> Bool
555555
556556
Is it safe to `ivdep` arrays of type `T`?
557557
That is, would it be safe to write to an array of type `T` in parallel?
558558
Examples where this is not true are `BitArray`s or `view(rand(6), [1,2,3,1,2,3])`.
559559
That is, it is not safe whenever different indices may alias the same memory.
560560
"""
561-
safeivdep(::Type) = false
562-
safeivdep(::Type{A}) where {T, A<:Base.StridedArray{T}} = safeivdepeltype(T)
563-
safeivdep(::Type{Adjoint{T,A}}) where {T, A <: AbstractArray{T}} = safeivdep(A)
564-
safeivdep(::Type{Transpose{T,A}}) where {T, A <: AbstractArray{T}} = safeivdep(A)
565-
safeivdep(::Type{<:SubArray{<:Any,<:Any,A,I}}) where {
566-
A,I<:Tuple{Vararg{Union{Base.RangeIndex, Base.ReshapedUnitRange, Base.AbstractCartesianIndex}}}} = safeivdep(A)
561+
indices_do_not_alias(::Type) = false
562+
indices_do_not_alias(::Type{A}) where {T, A<:Base.StridedArray{T}} = instances_do_not_alias(T)
563+
indices_do_not_alias(::Type{Adjoint{T,A}}) where {T, A <: AbstractArray{T}} = indices_do_not_alias(A)
564+
indices_do_not_alias(::Type{Transpose{T,A}}) where {T, A <: AbstractArray{T}} = indices_do_not_alias(A)
565+
indices_do_not_alias(::Type{<:SubArray{<:Any,<:Any,A,I}}) where {
566+
A,I<:Tuple{Vararg{Union{Base.RangeIndex, Base.ReshapedUnitRange, Base.AbstractCartesianIndex}}}} = indices_do_not_alias(A)
567567

568568
end # module

lib/ArrayInterfaceCore/test/runtests.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -268,18 +268,18 @@ end
268268
@test @inferred(ArrayInterfaceCore.ndims_index(1)) == 1
269269
end
270270

271-
@testset "safeivdep" begin
272-
@test ArrayInterfaceCore.safeivdepeltype(Float64)
273-
@test !ArrayInterfaceCore.safeivdepeltype(Matrix{Float64})
274-
@test ArrayInterfaceCore.safeivdep(Matrix{Float64})
275-
@test !ArrayInterfaceCore.safeivdep(BitMatrix)
276-
@test !ArrayInterfaceCore.safeivdep(Matrix{Matrix{Float64}})
277-
@test ArrayInterfaceCore.safeivdep(Adjoint{Float64,Matrix{Float64}})
278-
@test ArrayInterfaceCore.safeivdep(Transpose{Float64,Matrix{Float64}})
279-
@test ArrayInterfaceCore.safeivdep(typeof(view(rand(4,4)', 2:3, 1:2)))
280-
@test !ArrayInterfaceCore.safeivdep(typeof(view(rand(7),ones(Int,7))))
281-
@test !ArrayInterfaceCore.safeivdep(Adjoint{Matrix{Float64},Matrix{Matrix{Float64}}})
282-
@test !ArrayInterfaceCore.safeivdep(Transpose{Matrix{Float64},Matrix{Matrix{Float64}}})
283-
@test !ArrayInterfaceCore.safeivdep(typeof(view(fill(rand(4,4),4,4)', 2:3, 1:2)))
271+
@testset "indices_do_not_alias" begin
272+
@test ArrayInterfaceCore.instances_do_not_alias(Float64)
273+
@test !ArrayInterfaceCore.instances_do_not_alias(Matrix{Float64})
274+
@test ArrayInterfaceCore.indices_do_not_alias(Matrix{Float64})
275+
@test !ArrayInterfaceCore.indices_do_not_alias(BitMatrix)
276+
@test !ArrayInterfaceCore.indices_do_not_alias(Matrix{Matrix{Float64}})
277+
@test ArrayInterfaceCore.indices_do_not_alias(Adjoint{Float64,Matrix{Float64}})
278+
@test ArrayInterfaceCore.indices_do_not_alias(Transpose{Float64,Matrix{Float64}})
279+
@test ArrayInterfaceCore.indices_do_not_alias(typeof(view(rand(4,4)', 2:3, 1:2)))
280+
@test !ArrayInterfaceCore.indices_do_not_alias(typeof(view(rand(7),ones(Int,7))))
281+
@test !ArrayInterfaceCore.indices_do_not_alias(Adjoint{Matrix{Float64},Matrix{Matrix{Float64}}})
282+
@test !ArrayInterfaceCore.indices_do_not_alias(Transpose{Matrix{Float64},Matrix{Matrix{Float64}}})
283+
@test !ArrayInterfaceCore.indices_do_not_alias(typeof(view(fill(rand(4,4),4,4)', 2:3, 1:2)))
284284
end
285285

0 commit comments

Comments
 (0)