Skip to content

Commit 8302093

Browse files
committed
2 parents e83034d + 693d527 commit 8302093

File tree

4 files changed

+35
-5
lines changed

4 files changed

+35
-5
lines changed

src/BlockBandedMatrices.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import BandedMatrices: isbanded, bandwidths, bandwidth, banded_getindex, colrang
1515
BandedColumnMajor,
1616
BandedSubBandedMatrix, bandeddata, tribandeddata,
1717
_BandedMatrix, colstart, colstop, rowstart, rowstop,
18-
BandedStyle,
18+
BandedStyle, _fill_lmul!,
1919
_banded_colval, _banded_rowval, _banded_nzval # for sparse
2020

2121
import Base: getindex, setindex!, checkbounds, @propagate_inbounds, convert,

src/linalg.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ function materialize!(M::MatMulVecAdd{<:AbstractBlockBandedLayout,<:AbstractStri
4040
y = PseudoBlockArray(y_in, BlockSizes((cumulsizes(blocksizes(A),1),)))
4141
x = PseudoBlockArray(x_in, BlockSizes((cumulsizes(blocksizes(A),2),)))
4242

43-
lmul!(β, y)
43+
_fill_lmul!(β, y)
4444

4545
for J = Block.(1:nblocks(A,2))
4646
for K = blockcolrange(A,J)
@@ -52,7 +52,7 @@ end
5252

5353
function materialize!(M::MatMulMatAdd{<:AbstractBlockBandedLayout,<:AbstractBlockBandedLayout,<:AbstractBlockBandedLayout})
5454
α, A, X, β, Y = M.α, M.A, M.B, M.β, M.C
55-
lmul!(β, Y)
55+
_fill_lmul!(β, Y)
5656
for J=Block(1):Block(nblocks(X,2)),
5757
N=blockcolrange(X,J), K=blockcolrange(A,N)
5858
view(Y,K,J) .= α .* Mul( view(A,K,N), view(X,N,J)) .+ view(Y,K,J)
@@ -62,7 +62,7 @@ end
6262

6363
function materialize!(M::MatMulMatAdd{<:AbstractBlockBandedLayout,<:AbstractColumnMajor,<:AbstractColumnMajor})
6464
α, A, X_in, β, Y_in = M.α, M.A, M.B, M.β, M.C
65-
lmul!(β, Y_in)
65+
_fill_lmul!(β, Y_in)
6666
X = PseudoBlockArray(X_in, BlockSizes((cumulsizes(blocksizes(A),2),[1,size(X_in,2)+1])))
6767
Y = PseudoBlockArray(Y_in, BlockSizes((cumulsizes(blocksizes(A),1), [1,size(Y_in,2)+1])))
6868
for N=Block.(1:nblocks(X,1)), K=blockcolrange(A,N)
@@ -73,7 +73,7 @@ end
7373

7474
function materialize!(M::MatMulMatAdd{<:AbstractColumnMajor,<:AbstractBlockBandedLayout,<:AbstractColumnMajor})
7575
α, A_in, X, β, Y_in = M.α, M.A, M.B, M.β, M.C
76-
lmul!(β, Y_in)
76+
_fill_lmul!(β, Y_in)
7777
A = PseudoBlockArray(A_in, BlockSizes(([1,size(A_in,1)+1],cumulsizes(blocksizes(X),1))))
7878
Y = PseudoBlockArray(Y_in, BlockSizes(([1,size(Y_in,1)+1],cumulsizes(blocksizes(X),2))))
7979
for J=Block(1):Block(nblocks(X,2)), N=blockcolrange(X,J)

test/runtests.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using BlockBandedMatrices, Test, LinearAlgebra
22

33
include("test_blockbanded.jl")
4+
include("test_blockskyline.jl")
45
include("test_bandedblockbanded.jl")
56
include("test_broadcasting.jl")
67
include("test_linalg.jl")

test/test_blockskyline.jl

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
2+
using LazyArrays, BlockBandedMatrices, LinearAlgebra, Random, Test
3+
4+
Random.seed!(0)
5+
6+
@testset "BlockSkylineMatrix" begin
7+
8+
@testset "@jagot lmul! bug" begin
9+
rows = rand(1:10, 5)
10+
l = rand(-2:2, 5)
11+
u = rand(-2:2, 5)
12+
13+
m = sum(rows)
14+
15+
A = BlockSkylineMatrix(Zeros(m,m), (rows,rows), (l,u))
16+
A.data .= rand(size(A.data)...)
17+
18+
V = zeros(m,2)
19+
V[:,1] .= rand(m)
20+
reference = A*V[:,1]
21+
22+
@view(V[:,2]) .= Mul(A, @view(V[:,1]))
23+
@test V[:,2] reference
24+
25+
V[:,2] .= NaN
26+
@view(V[:,2]) .= Mul(A, @view(V[:,1]))
27+
@test V[:,2] reference
28+
end
29+
end

0 commit comments

Comments
 (0)