Skip to content

Commit 67f5c08

Browse files
authored
mul! for SubArrays of LayoutMatrix (#145)
* merge * add tests
1 parent a7786a0 commit 67f5c08

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
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 = "1.0.8"
4+
version = "1.0.9"
55

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

src/mul.jl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,12 @@ end
310310
*(x::TransposeAbsVec{<:Any,<:Zeros{<:Any,1}}, D::Diagonal, y::LayoutVector) = FillArrays._triple_zeromul(x, D, y)
311311

312312

313+
# mul! for subarray of layout matrix
314+
LinearAlgebra.mul!(C::SubArray{<:Any,2,<:LayoutMatrix}, A::SubArray{<:Any,2,<:LayoutMatrix}, B::SubArray{<:Any,2,<:LayoutMatrix}, α::Number, β::Number) =
315+
ArrayLayouts.mul!(C, A, B, α, β)
316+
LinearAlgebra.mul!(C::AbstractMatrix, A::SubArray{<:Any,2,<:LayoutMatrix}, B::SubArray{<:Any,2,<:LayoutMatrix}, α::Number, β::Number) =
317+
ArrayLayouts.mul!(C, A, B, α, β)
318+
313319

314320
###
315321
# Dot

test/test_layoutarray.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ MemoryLayout(::Type{MyVector}) = DenseColumnMajor()
188188

189189
@test mul!(copy(B), A, Diagonal(Bin), 2, 3) 2A*Diagonal(Bin) + 3B
190190
@test mul!(copy(B), Diagonal(Bin), A, 2, 3) 2Diagonal(Bin)*A + 3B
191+
192+
@test mul!(view(copy(B), 1:3, 1:3), view(A, 1:3, 1:3), view(B, 1:3, 1:3)) A[1:3,1:3]*B[1:3,1:3]
193+
@test mul!(Matrix{Float64}(undef, 3, 3), view(A, 1:3, 1:3), view(B, 1:3, 1:3)) A[1:3,1:3]*B[1:3,1:3]
194+
@test mul!(MyMatrix(Matrix{Float64}(undef, 3, 3)), view(A, 1:3, 1:3), view(B, 1:3, 1:3)) A[1:3,1:3]*B[1:3,1:3]
191195
end
192196

193197
@testset "generic_blasmul!" begin

0 commit comments

Comments
 (0)