Skip to content

Commit 75902b3

Browse files
committed
fill special cases
1 parent e08f229 commit 75902b3

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/mul.jl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,8 @@ macro layoutmul(Typ)
182182
Base.:*(A::AbstractMatrix, B::$Typ) = ArrayLayouts.mul(A,B)
183183
Base.:*(A::LinearAlgebra.AdjointAbsVec, B::$Typ) = ArrayLayouts.mul(A,B)
184184
Base.:*(A::LinearAlgebra.TransposeAbsVec, B::$Typ) = ArrayLayouts.mul(A,B)
185+
Base.:*(A::LinearAlgebra.AdjointAbsVec{<:Any,<:Zeros{<:Any,1}}, B::$Typ) = ArrayLayouts.mul(A,B)
186+
Base.:*(A::LinearAlgebra.TransposeAbsVec{<:Any,<:Zeros{<:Any,1}}, B::$Typ) = ArrayLayouts.mul(A,B)
185187

186188
Base.:*(A::LinearAlgebra.AbstractQ, B::$Typ) = ArrayLayouts.mul(A,B)
187189
Base.:*(A::$Typ, B::LinearAlgebra.AbstractQ) = ArrayLayouts.mul(A,B)
@@ -224,6 +226,7 @@ macro layoutmul(Typ)
224226
Base.:*(A::LinearAlgebra.TransposeAbsVec, B::$Mod{<:Any,<:$Typ}) = ArrayLayouts.mul(A,B)
225227
Base.:*(A::$Mod{<:Any,<:$Typ}, B::AbstractVector) = ArrayLayouts.mul(A,B)
226228
Base.:*(A::$Mod{<:Any,<:$Typ}, B::ArrayLayouts.LayoutVector) = ArrayLayouts.mul(A,B)
229+
Base.:*(A::$Mod{<:Any,<:$Typ}, B::Zeros{<:Any,1}) = ArrayLayouts.mul(A,B)
227230

228231
Base.:*(A::$Mod{<:Any,<:$Typ}, B::$Typ) = ArrayLayouts.mul(A,B)
229232
Base.:*(A::$Typ, B::$Mod{<:Any,<:$Typ}) = ArrayLayouts.mul(A,B)
@@ -267,6 +270,8 @@ dot(a, b) = materialize(Dot(a, b))
267270
@inline LinearAlgebra.dot(a::LayoutArray, b::LayoutArray) = dot(a,b)
268271
@inline LinearAlgebra.dot(a::LayoutArray, b::AbstractArray) = dot(a,b)
269272
@inline LinearAlgebra.dot(a::AbstractArray, b::LayoutArray) = dot(a,b)
273+
@inline LinearAlgebra.dot(a::LayoutVector, b::AbstractFill{<:Any,1}) = FillArrays._fill_dot(a,b)
274+
@inline LinearAlgebra.dot(a::AbstractFill{<:Any,1}, b::LayoutVector) = FillArrays._fill_dot(a,b)
270275
@inline LinearAlgebra.dot(a::LayoutArray{<:Number}, b::SparseArrays.SparseVectorUnion{<:Number}) = dot(a,b)
271276
@inline LinearAlgebra.dot(a::SparseArrays.SparseVectorUnion{<:Number}, b::LayoutArray{<:Number}) = dot(a,b)
272277

src/muladd.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,4 +412,9 @@ function similar(M::MulAdd{<:Any,<:DualLayout,ZerosLayout}, ::Type{T}, (x,y)) wh
412412
@assert length(x) == 1
413413
trans = transtype(M.B)
414414
trans(similar(trans(M.B), T, y))
415-
end
415+
end
416+
417+
const ZerosLayouts = Union{ZerosLayout,DualLayout{ZerosLayout}}
418+
copy(M::MulAdd{<:ZerosLayouts, <:ZerosLayouts, <:ZerosLayouts}) = M.C
419+
copy(M::MulAdd{<:ZerosLayouts, <:Any, <:ZerosLayouts}) = M.C
420+
copy(M::MulAdd{<:Any, <:ZerosLayouts, <:ZerosLayouts}) = M.C

0 commit comments

Comments
 (0)