comparison LazyTensors/src/lazy_operations.jl @ 202:9e737d19fcfe boundary_conditions

Fix formatting
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Mon, 24 Jun 2019 09:21:03 +0200
parents a22b419bbdf0
children 19e579a5031f
comparison
equal deleted inserted replaced
201:6b7019f2cd41 202:9e737d19fcfe
96 return leo.a[I...] / leo.b[I...] 96 return leo.a[I...] / leo.b[I...]
97 end 97 end
98 98
99 # Define lazy operations for AbstractArrays. Operations constructs a LazyElementwiseOperation which 99 # Define lazy operations for AbstractArrays. Operations constructs a LazyElementwiseOperation which
100 # can later be indexed into. Lazy operations are denoted by the usual operator followed by a tilde 100 # can later be indexed into. Lazy operations are denoted by the usual operator followed by a tilde
101 Base.@propagate_inbounds +̃(a::AbstractArray{T,D},b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:+}(a,b) 101 Base.@propagate_inbounds +̃(a::AbstractArray{T,D}, b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:+}(a,b)
102 Base.@propagate_inbounds -̃(a::AbstractArray{T,D},b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:-}(a,b) 102 Base.@propagate_inbounds -̃(a::AbstractArray{T,D}, b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:-}(a,b)
103 Base.@propagate_inbounds *̃(a::AbstractArray{T,D},b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:*}(a,b) 103 Base.@propagate_inbounds *̃(a::AbstractArray{T,D}, b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:*}(a,b)
104 Base.@propagate_inbounds /̃(a::AbstractArray{T,D},b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:/}(a,b) 104 Base.@propagate_inbounds /̃(a::AbstractArray{T,D}, b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:/}(a,b)
105 105
106 Base.@propagate_inbounds Base.:+(a::LazyArray{T,D},b::AbstractArray{T,D}) where {T,D} = a +̃ b 106 Base.@propagate_inbounds Base.:+(a::LazyArray{T,D}, b::AbstractArray{T,D}) where {T,D} = a +̃ b
107 Base.@propagate_inbounds Base.:+(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = b + a 107 Base.@propagate_inbounds Base.:+(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = b + a
108 Base.@propagate_inbounds Base.:-(a::LazyArray{T,D},b::AbstractArray{T,D}) where {T,D} = a -̃ b 108 Base.@propagate_inbounds Base.:-(a::LazyArray{T,D}, b::AbstractArray{T,D}) where {T,D} = a -̃ b
109 Base.@propagate_inbounds Base.:-(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = a -̃ b 109 Base.@propagate_inbounds Base.:-(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = a -̃ b
110 Base.@propagate_inbounds Base.:*(a::LazyArray{T,D},b::AbstractArray{T,D}) where {T,D} = a *̃ b 110 Base.@propagate_inbounds Base.:*(a::LazyArray{T,D}, b::AbstractArray{T,D}) where {T,D} = a *̃ b
111 Base.@propagate_inbounds Base.:*(a::AbstractArray{T,D},b::LazyArray{T,D}) where {T,D} = b * a 111 Base.@propagate_inbounds Base.:*(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = b * a
112 # TODO: / seems to be ambiguous 112 # TODO: / seems to be ambiguous
113 # Base.:/(a::LazyArray{T,D},b::AbstractArray{T,D}) where {T,D} = a /̃ b 113 # Base.:/(a::LazyArray{T,D},b::AbstractArray{T,D}) where {T,D} = a /̃ b
114 # Base.:/(a::AbstractArray{T,D},b::LazyArray{T,D}) where {T,D} = a /̃ b 114 # Base.:/(a::AbstractArray{T,D},b::LazyArray{T,D}) where {T,D} = a /̃ b
115 115
116 export +̃, -̃, *̃, /̃ 116 export +̃, -̃, *̃, /̃