comparison LazyTensors/src/lazy_operations.jl @ 206:7b0650021b36 boundary_conditions

Remove implementations of elementwise operation for * and /
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 24 Jun 2019 14:57:17 +0200
parents 70e1f3401d82
children f85a0b38f3ff
comparison
equal deleted inserted replaced
205:70e1f3401d82 206:7b0650021b36
111 111
112 Base.@propagate_inbounds Base.:-(a::LazyArray{T,D}, b::LazyArray{T,D}) where {T,D} = a -̃ b 112 Base.@propagate_inbounds Base.:-(a::LazyArray{T,D}, b::LazyArray{T,D}) where {T,D} = a -̃ b
113 Base.@propagate_inbounds Base.:-(a::LazyArray{T,D}, b::AbstractArray{T,D}) where {T,D} = a -̃ b 113 Base.@propagate_inbounds Base.:-(a::LazyArray{T,D}, b::AbstractArray{T,D}) where {T,D} = a -̃ b
114 Base.@propagate_inbounds Base.:-(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = a -̃ b 114 Base.@propagate_inbounds Base.:-(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = a -̃ b
115 115
116 Base.@propagate_inbounds Base.:*(a::LazyArray{T,D}, b::LazyArray{T,D}) where {T,D} = a *̃ b 116 # Element wise operation for `*` and `\` are not overloaded due to conflicts with the behavior
117 Base.@propagate_inbounds Base.:*(a::LazyArray{T,D}, b::AbstractArray{T,D}) where {T,D} = a *̃ b 117 # of regular `*` and `/` for AbstractArrays. Use tilde versions instead.
118 Base.@propagate_inbounds Base.:*(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = a *̃ b
119
120 # TODO: / seems to be ambiguous
121 Base.@propagate_inbounds Base.:/(a::LazyArray{T,D}, b::LazyArray{T,D}) where {T,D} = a /̃ b
122 Base.@propagate_inbounds Base.:/(a::LazyArray{T,D}, b::AbstractArray{T,D}) where {T,D} = a /̃ b
123 Base.@propagate_inbounds Base.:/(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = a /̃ b
124
125 # NOTE: Need to define (/) for AbstractVectorOrMat and Union of LazyArrays in order to avoid ambiguities
126 # with (/) in the LinearAlgebra package. Not sure if it actually could be usefull.
127 Base.@propagate_inbounds Base.:/(a::AbstractVecOrMat, b::Union{LazyArray{T,1}, LazyArray{T,2}}) where {T} = a /̃ b
128 Base.@propagate_inbounds Base.:/(a::Union{LazyArray{T,1}, LazyArray{T,2}}, b::AbstractVecOrMat) where {T} = a /̃ b
129 118
130 export +̃, -̃, *̃, /̃ 119 export +̃, -̃, *̃, /̃
131 120
132 121
133 122