From 7e308e77fd4b4c60906772b61351d326605ae753 Mon Sep 17 00:00:00 2001 From: Dhairya Gandhi Date: Wed, 4 Mar 2020 17:57:16 +0530 Subject: [PATCH] rm unneccesary fns --- src/utils.jl | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/utils.jl b/src/utils.jl index dbf85c95..6ad410b3 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -256,18 +256,6 @@ end +(a::Zeros, b::AbstractArray) = b + a -(a::Zeros, b::AbstractArray) = -b + a -function *(a::AbstractArray{S,2}, b::Zeros{T,2}) where {T,S} - @assert size(a,2) == size(b,1) throw(DimensionMismatch("A has dimensions $(size(a)) but B has dimensions $(size(b))")) - res = similar(a, size(a,1), size(b,2)) - res .= zero(S) -end - -function *(a::Zeros{T,2}, b::AbstractArray{S,2}) where {T,S} - @assert size(a,2) == size(b,1) throw(DimensionMismatch("A has dimensions $(size(a)) but B has dimensions $(size(b))")) - res = similar(b, size(a,1), size(b,2)) - res .= zero(S) -end - Base.copy(xs::Zeros{T,N}) where {T,N} = xs # Define broadcasting behaviour @@ -282,8 +270,7 @@ broadcasted(::typeof(+), a::Zeros, b::AbstractArray) = broadcasted(+, b, a) broadcasted(::typeof(-), a::Zeros, b::AbstractArray) = broadcasted(+, -b, a) function broadcasted(::typeof(*), a::AbstractArray, b::Zeros) - sz = similar(a, Broadcast.broadcast_shape(size(a), size(b))) - sz .= zero(a) + Zeros(Broadcast.broadcast_shape(size(a), size(b))...) end broadcasted(::typeof(*), a::Zeros, b::AbstractArray) = broadcasted(*, b, a)