Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/memorylayout.jl
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ gives an iterator containing the possible non-zero entries in the k-th row of A.
"""
rowsupport(A, k) = rowsupport(MemoryLayout(A), A, k)
rowsupport(A) = rowsupport(A, axes(A,1))
rowsupport(A, k::CartesianIndex{2}) = rowsupport(A, k[1])

colsupport(_, A, j) = axes(A,1)

Expand All @@ -656,6 +657,7 @@ gives an iterator containing the possible non-zero entries in the j-th column of
"""
colsupport(A, j) = colsupport(MemoryLayout(A), A, j)
colsupport(A) = colsupport(A, axes(A,2))
colsupport(A, k::CartesianIndex{2}) = rowsupport(A, k[2])

# TODO: generalise to other subarrays
function colsupport(A::SubArray{<:Any,N,<:Any,<:Tuple{Slice,AbstractVector}}, j) where N
Expand Down
2 changes: 1 addition & 1 deletion test/test_layouts.jl
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ struct FooNumber <: Number end
subdiagonaldata(Bl) == supdiagonaldata(Adjoint(Bl)) == supdiagonaldata(Transpose(Bl)) ==
T.dl

@test colsupport(T,3) == rowsupport(T,3) == colsupport(S,3) == rowsupport(S,3) == 2:4
@test colsupport(T,3) == rowsupport(T,3) == colsupport(S,3) == rowsupport(S,3) == rowsupport(T,CartesianIndex(3,2)) == colsupport(T,CartesianIndex(2,3)) == 2:4
@test colsupport(T,3:6) == rowsupport(T,3:6) == colsupport(S,3:6) == rowsupport(S,3:6) == 2:6
@test colsupport(Bl,3) == rowsupport(Bu,3) == rowsupport(Adjoint(Bl),3) == 3:4
@test rowsupport(Bl,3) == colsupport(Bu,3) == colsupport(Adjoint(Bl),3) == 2:3
Expand Down