Skip to content

Commit c9a24e7

Browse files
authored
bandwidths/isbanded based on MemoryLayout (#242)
* bandwidths/isbanded based on MemoryLayout * v0.16.11
1 parent 8030357 commit c9a24e7

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "BandedMatrices"
22
uuid = "aae01518-5342-5314-be14-df237901396f"
3-
version = "0.16.10"
3+
version = "0.16.11"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"

src/generic/AbstractBandedMatrix.jl

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ bandeddata(_, A) = error("Override bandeddata(::$(typeof(A)))")
1919
2020
Returns a tuple containing the upper and lower bandwidth of `A`.
2121
"""
22-
bandwidths(A::AbstractVecOrMat) = (size(A,1)-1 , size(A,2)-1)
22+
bandwidths(A::AbstractVecOrMat) = bandwidths(MemoryLayout(A), A)
23+
bandwidths(_, A) = (size(A,1)-1 , size(A,2)-1)
2324

2425
bandwidths(A::AdjOrTrans{T,S}) where {T,S} = reverse(bandwidths(parent(A)))
2526

@@ -94,8 +95,8 @@ bandrange(A) = -bandwidth(A,1):bandwidth(A,2)
9495
9596
returns true if a matrix implements the banded interface.
9697
"""
97-
isbanded(::AbstractBandedMatrix) = true
98-
isbanded(_) = false
98+
isbanded(A) = isbanded(MemoryLayout(A), A)
99+
isbanded(::AbstractBandedLayout, A) = true
99100

100101
# override bandwidth(A,k) for each AbstractBandedMatrix
101102
# override inbands_getindex(A,k,j)

0 commit comments

Comments
 (0)