Skip to content

Commit de39926

Browse files
fix CanonicalInt usage
1 parent aa3a82c commit de39926

File tree

5 files changed

+16
-6
lines changed

5 files changed

+16
-6
lines changed

lib/ArrayInterfaceBandedMatrices/src/ArrayInterfaceBandedMatrices.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ module ArrayInterfaceBandedMatrices
33
using ArrayInterfaceCore
44
using BandedMatrices
55

6+
const CanonicalInt = Union{Int,StaticInt}
7+
68
struct BandedMatrixIndex <: ArrayInterfaceCore.MatrixIndex
79
count::Int
810
rowsize::Int

lib/ArrayInterfaceBlockBandedMatrices/src/ArrayInterfaceBlockBandedMatrices.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ using ArrayInterfaceBandedMatrices
55
using BlockArrays
66
using BlockBandedMatrices
77

8+
const CanonicalInt = Union{Int,StaticInt}
9+
810
struct BlockBandedMatrixIndex <: ArrayInterfaceCore.MatrixIndex
911
count::Int
1012
refinds::Array{Int,1}
@@ -19,9 +21,9 @@ function BlockBandedMatrixIndex(nrowblock, ncolblock, rowsizes, colsizes, l, u)
1921
blockcolind = ArrayInterfaceBandedMatrices.BandedMatrixIndex(nrowblock, ncolblock, l, u, false)
2022
sortedinds = sort(
2123
[(blockrowind[i], blockcolind[i]) for i = 1:length(blockrowind)],
22-
by = x -> x[1],
24+
by=x -> x[1],
2325
)
24-
sort!(sortedinds, by = x -> x[2], alg = InsertionSort)# stable sort keeps the second index in order
26+
sort!(sortedinds, by=x -> x[2], alg=InsertionSort)# stable sort keeps the second index in order
2527
refinds = Array{Int,1}()
2628
refrowcoords = Array{Int,1}()
2729
refcolcoords = Array{Int,1}()
@@ -132,9 +134,9 @@ function BandedBlockBandedMatrixIndex(
132134
blockcolind = ArrayInterfaceBandedMatrices.BandedMatrixIndex(nrowblock, ncolblock, l, u, false)
133135
sortedinds = sort(
134136
[(blockrowind[i], blockcolind[i]) for i = 1:length(blockrowind)],
135-
by = x -> x[1],
137+
by=x -> x[1],
136138
)
137-
sort!(sortedinds, by = x -> x[2], alg = InsertionSort)# stable sort keeps the second index in order
139+
sort!(sortedinds, by=x -> x[2], alg=InsertionSort)# stable sort keeps the second index in order
138140
rowheights = pushfirst!(copy(rowsizes), 1)
139141
cumsum!(rowheights, rowheights)
140142
colwidths = pushfirst!(copy(colsizes), 1)
@@ -218,7 +220,7 @@ function ArrayInterfaceCore.matrix_colors(A::BlockBandedMatrices.BlockBandedMatr
218220
(startinds[blockcolors[i]]:endinds[blockcolors[i]])[1:cols[i]]
219221
for i = 1:nblock
220222
]
221-
return reduce(vcat,colors)
223+
return reduce(vcat, colors)
222224
end
223225

224226
function ArrayInterfaceCore.matrix_colors(A::BlockBandedMatrices.BandedBlockBandedMatrix)

lib/ArrayInterfaceCUDA/src/ArrayInterfaceCUDA.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ using Adapt
44
using ArrayInterfaceCore
55
using CUDA
66

7+
const CanonicalInt = Union{Int,StaticInt}
8+
79
ArrayInterfaceCore.fast_scalar_indexing(::Type{<:CUDA.CuArray}) = false
810
@inline ArrayInterfaceCore.allowed_getindex(x::CUDA.CuArray, i...) = CUDA.@allowscalar(x[i...])
911
@inline ArrayInterfaceCore.allowed_setindex!(x::CUDA.CuArray, v, i...) = (CUDA.@allowscalar(x[i...] = v))

lib/ArrayInterfaceOffsetArrays/src/ArrayInterfaceOffsetArrays.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ using ArrayInterfaceCore
44
using OffsetArrays
55
using Static
66

7+
const CanonicalInt = Union{Int,StaticInt}
8+
79
relative_offsets(r::OffsetArrays.IdOffsetRange) = (getfield(r, :offset),)
810
relative_offsets(A::OffsetArrays.OffsetArray) = getfield(A, :offsets)
911
function relative_offsets(A::OffsetArrays.OffsetArray, ::StaticInt{dim}) where {dim}

lib/ArrayInterfaceStaticArrays/src/ArrayInterfaceStaticArrays.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ using LinearAlgebra
66
using StaticArrays
77
using Static
88

9+
const CanonicalInt = Union{Int,StaticInt}
10+
911
ArrayInterfaceCore.ismutable(::Type{<:StaticArrays.StaticArray}) = false
1012
ArrayInterfaceCore.ismutable(::Type{<:StaticArrays.MArray}) = true
1113
ArrayInterfaceCore.ismutable(::Type{<:StaticArrays.SizedArray}) = true
@@ -30,7 +32,7 @@ ArrayInterfaceCore.known_first(::Type{<:StaticArrays.SOneTo}) = 1
3032
ArrayInterfaceCore.known_last(::Type{StaticArrays.SOneTo{N}}) where {N} = N
3133
ArrayInterfaceCore.known_length(::Type{StaticArrays.SOneTo{N}}) where {N} = N
3234
ArrayInterfaceCore.known_length(::Type{StaticArrays.Length{L}}) where {L} = L
33-
function ArrayInterfaceCore.known_length(::Type{A}) where {A <: StaticArrays.StaticArray}
35+
function ArrayInterfaceCore.known_length(::Type{A}) where {A<:StaticArrays.StaticArray}
3436
ArrayInterfaceCore.known_length(StaticArrays.Length(A))
3537
end
3638

0 commit comments

Comments
 (0)