Skip to content

Commit

Permalink
Support Banded * Strided
Browse files Browse the repository at this point in the history
  • Loading branch information
dlfivefifty committed Nov 18, 2023
1 parent 87a1ace commit 35067c3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "BandedMatrices"
uuid = "aae01518-5342-5314-be14-df237901396f"
version = "1.2.0"
version = "1.2.1"

[deps]
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
Expand Down
4 changes: 2 additions & 2 deletions src/generic/matmul.jl
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ end

### BandedMatrix * dense matrix

function materialize!(M::MatMulMatAdd{<:BandedColumns, <:AbstractColumnMajor, <:AbstractColumnMajor})
function materialize!(M::MatMulMatAdd{<:BandedColumns, <:AbstractStridedLayout, <:AbstractStridedLayout})
checkdimensions(M)
α, β, A, B, C = M.α, M.β, M.A, M.B, M.C

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

function materialize!(M::MatMulMatAdd{<:AbstractColumnMajor, <:BandedColumns, <:AbstractColumnMajor})
function materialize!(M::MatMulMatAdd{<:AbstractStridedLayout, <:BandedColumns, <:AbstractStridedLayout})
checkdimensions(M)
α, β, A, B, C = M.α, M.β, M.A, M.B, M.C

Expand Down
13 changes: 8 additions & 5 deletions test/test_linalg.jl
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using ArrayLayouts
using BandedMatrices
using FillArrays
using LinearAlgebra
using Test
using ArrayLayouts, BandedMatrices, FillArrays, LinearAlgebra, Test

import Base.Broadcast: materialize, broadcasted
import BandedMatrices: BandedColumns, _BandedMatrix
Expand Down Expand Up @@ -106,6 +102,13 @@ ArrayLayouts.colsupport(::UnknownLayout, A::MyOneElement{<:Any,1}, _) =
@test cmp(Y, BX + ones(T, size(Y)))
end
end
@testset "Banded * strided" begin
n = 100
B = BandedMatrix{Float64}(-1=>1:n, 1=>11:n+10, 2=>21:n+19)
M = view(randn(2n+1,2n+1),1:2:2n+1,1:2:2n+1)
@test B*M Matrix(B)*M
@test M*B M*Matrix(B)
end
end

@testset "BandedMatrix * sparse" begin
Expand Down

0 comments on commit 35067c3

Please sign in to comment.