Skip to content

Commit b3978a9

Browse files
authored
Support Banded * Strided (#408)
1 parent 87a1ace commit b3978a9

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "BandedMatrices"
22
uuid = "aae01518-5342-5314-be14-df237901396f"
3-
version = "1.2.0"
3+
version = "1.2.1"
44

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

src/generic/matmul.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ end
239239

240240
### BandedMatrix * dense matrix
241241

242-
function materialize!(M::MatMulMatAdd{<:BandedColumns, <:AbstractColumnMajor, <:AbstractColumnMajor})
242+
function materialize!(M::MatMulMatAdd{<:BandedColumns, <:AbstractStridedLayout, <:AbstractStridedLayout})
243243
checkdimensions(M)
244244
α, β, A, B, C = M.α, M.β, M.A, M.B, M.C
245245

@@ -254,7 +254,7 @@ function materialize!(M::MatMulMatAdd{<:BandedColumns, <:AbstractColumnMajor, <:
254254
return C
255255
end
256256

257-
function materialize!(M::MatMulMatAdd{<:AbstractColumnMajor, <:BandedColumns, <:AbstractColumnMajor})
257+
function materialize!(M::MatMulMatAdd{<:AbstractStridedLayout, <:BandedColumns, <:AbstractStridedLayout})
258258
checkdimensions(M)
259259
α, β, A, B, C = M.α, M.β, M.A, M.B, M.C
260260

test/test_linalg.jl

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
using ArrayLayouts
2-
using BandedMatrices
3-
using FillArrays
4-
using LinearAlgebra
5-
using Test
1+
using ArrayLayouts, BandedMatrices, FillArrays, LinearAlgebra, Test
62

73
import Base.Broadcast: materialize, broadcasted
84
import BandedMatrices: BandedColumns, _BandedMatrix
@@ -106,6 +102,13 @@ ArrayLayouts.colsupport(::UnknownLayout, A::MyOneElement{<:Any,1}, _) =
106102
@test cmp(Y, BX + ones(T, size(Y)))
107103
end
108104
end
105+
@testset "Banded * strided" begin
106+
n = 100
107+
B = BandedMatrix{Float64}(-1=>1:n, 1=>11:n+10, 2=>21:n+19)
108+
M = view(randn(2n+1,2n+1),1:2:2n+1,1:2:2n+1)
109+
@test B*M Matrix(B)*M
110+
@test M*B M*Matrix(B)
111+
end
109112
end
110113

111114
@testset "BandedMatrix * sparse" begin

0 commit comments

Comments
 (0)