Skip to content

Commit 0570de6

Browse files
authored
Scalar l/rmul! fallbacks (#33)
* Scalar l/rmul! fallbacks * Update runtests.jl
1 parent aba1cc1 commit 0570de6

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-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 = "0.4.0"
4+
version = "0.4.1"
55

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

src/lmul.jl

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ copyto!(dest::AbstractArray, M::Rmul) = _rmul_copyto!(dest, M)
7070
materialize!(M::Lmul) = LinearAlgebra.lmul!(M.A,M.B)
7171
materialize!(M::Rmul) = LinearAlgebra.rmul!(M.A,M.B)
7272

73+
materialize!(M::Lmul{ScalarLayout}) = Base.invoke(LinearAlgebra.lmul!, Tuple{Number,AbstractArray}, M.A, M.B)
74+
materialize!(M::Rmul{<:Any,ScalarLayout}) = Base.invoke(LinearAlgebra.rmul!, Tuple{AbstractArray,Number}, M.A, M.B)
75+
7376

7477

7578
macro _layoutlmul(Typ)

test/runtests.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ MemoryLayout(::Type{MyVector}) = DenseColumnMajor()
127127
@test A\MyMatrix(X) A\X
128128
end
129129
end
130+
131+
@testset "l/rmul!" begin
132+
b = randn(5)
133+
@test ArrayLayouts.lmul!(2, MyVector(copy(b))) == ArrayLayouts.rmul!(MyVector(copy(b)), 2) == 2b
134+
end
130135
end
131136

132137
struct MyUpperTriangular{T} <: AbstractMatrix{T}

0 commit comments

Comments
 (0)