Skip to content

Commit f747785

Browse files
committed
Format
1 parent 42413dd commit f747785

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/kroneckerarray.jl

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,15 +168,19 @@ function Base.getindex(a::KroneckerArray{<:Any,N}, I::Vararg{Integer,N}) where {
168168
end
169169

170170
# Indexing logic.
171-
function Base.to_indices(a::KroneckerArray, inds, I::Tuple{Union{CartesianPair,CartesianProduct},Vararg})
171+
function Base.to_indices(
172+
a::KroneckerArray, inds, I::Tuple{Union{CartesianPair,CartesianProduct},Vararg}
173+
)
172174
I1 = to_indices(arg1(a), arg1.(inds), arg1.(I))
173175
I2 = to_indices(arg2(a), arg2.(inds), arg2.(I))
174176
return I1 I2
175177
end
176178

177179
# Allow customizing for `FillArrays.Eye`.
178180
_getindex(a::AbstractArray, I...) = a[I...]
179-
function Base.getindex(a::KroneckerArray{<:Any,N}, I::Vararg{Union{CartesianPair,CartesianProduct},N}) where {N}
181+
function Base.getindex(
182+
a::KroneckerArray{<:Any,N}, I::Vararg{Union{CartesianPair,CartesianProduct},N}
183+
) where {N}
180184
I′ = to_indices(a, I)
181185
return _getindex(arg1(a), arg1.(I′)...) _getindex(arg2(a), arg2.(I′)...)
182186
end

test/test_blocksparsearrays.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ arrayts = (Array, JLArray)
4848
@test a[Block(2, 2)[(2:3) × (2:3), (2:3) × (2:3)]] ==
4949
a[Block(2, 2)][(2:3) × (2:3), (2:3) × (2:3)]
5050
@test a[Block(2, 2)[(:) × (2:3), (:) × (2:3)]] == a[Block(2, 2)][(:) × (2:3), (:) × (2:3)]
51-
@test a[Block(2, 2)[(1:2) × (2:3), (:) × (2:3)]] == a[Block(2, 2)][(1:2) × (2:3), (:) × (2:3)]
51+
@test a[Block(2, 2)[(1:2) × (2:3), (:) × (2:3)]] ==
52+
a[Block(2, 2)][(1:2) × (2:3), (:) × (2:3)]
5253

5354
# Blockwise slicing, shows up in truncated block sparse matrix factorizations.
5455
I1 = BlockIndexVector(Block(1), Base.Slice(Base.OneTo(2)) × [1])
@@ -169,7 +170,8 @@ end
169170
@test a[Block(2, 2)[(2:3) × (2:3), (2:3) × (2:3)]] ==
170171
a[Block(2, 2)][(2:3) × (2:3), (2:3) × (2:3)]
171172
@test a[Block(2, 2)[(:) × (2:3), (:) × (2:3)]] == a[Block(2, 2)][(:) × (2:3), (:) × (2:3)]
172-
@test a[Block(2, 2)[(1:2) × (2:3), (:) × (2:3)]] == a[Block(2, 2)][(1:2) × (2:3), (:) × (2:3)]
173+
@test a[Block(2, 2)[(1:2) × (2:3), (:) × (2:3)]] ==
174+
a[Block(2, 2)][(1:2) × (2:3), (:) × (2:3)]
173175

174176
# Blockwise slicing, shows up in truncated block sparse matrix factorizations.
175177
I1 = BlockIndexVector(Block(1), Base.Slice(Base.OneTo(2)) × [1])

0 commit comments

Comments
 (0)