Skip to content

Commit efa8ba2

Browse files
authored
Fix scaling bug in default_blasmul!, AbstractTridiagonalLayout <: AbstractBandedLayout (#22)
1 parent 28ef321 commit efa8ba2

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ArrayLayouts"
22
uuid = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
33
authors = ["Sheehan Olver <[email protected]>"]
4-
version = "0.3.2"
4+
version = "0.3.3"
55

66
[deps]
77
FillArrays = "1a297f60-69ca-5386-bcde-b61e274b549b"

src/memorylayout.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,7 @@ triangulardata(A::SubArray{<:Any,2,<:Any,<:Tuple{<:Union{Slice,Base.OneTo},<:Uni
497497

498498

499499
abstract type AbstractBandedLayout <: MemoryLayout end
500-
abstract type AbstractTridiagonalLayout <: MemoryLayout end
500+
abstract type AbstractTridiagonalLayout <: AbstractBandedLayout end
501501

502502
struct DiagonalLayout{ML} <: AbstractBandedLayout end
503503
struct SymTridiagonalLayout{ML} <: AbstractTridiagonalLayout end

src/muladd.jl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,16 +178,18 @@ function default_blasmul!(α, A::AbstractMatrix, B::AbstractMatrix, β, C::Abstr
178178
nA == mB || throw(DimensionMismatch("Dimensions must match"))
179179
size(C) == (mA, nB) || throw(DimensionMismatch("Dimensions must match"))
180180

181+
lmul!(β, C)
182+
181183
(iszero(mA) || iszero(nB)) && return C
182-
iszero(nA) && return lmul!(β, C)
184+
iszero(nA) && return C
183185

184186
@inbounds for k in colsupport(A), j in rowsupport(B,rowsupport(A,k))
185187
z2 = zero(A[k, 1]*B[1, j] + A[k, 1]*B[1, j])
186188
Ctmp = convert(promote_type(eltype(C), typeof(z2)), z2)
187189
@simd for ν = rowsupport(A,k) colsupport(B,j)
188190
Ctmp = muladd(A[k, ν],B[ν, j],Ctmp)
189191
end
190-
C[k,j] = muladd(α,Ctmp, β*C[k,j])
192+
C[k,j] = muladd(α,Ctmp, C[k,j])
191193
end
192194
C
193195
end

0 commit comments

Comments
 (0)