Mercurial > repos > public > sbplib_julia
comparison LazyTensors/src/lazy_operations.jl @ 204:9d9f7b0e514b boundary_conditions
Modify the implementation of elementwise operations to be more direct and add a few tests
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 24 Jun 2019 14:04:38 +0200 |
parents | b5c9be7f391c |
children | 70e1f3401d82 |
comparison
equal
deleted
inserted
replaced
198:b5c9be7f391c | 204:9d9f7b0e514b |
---|---|
96 @inline -̃(a::AbstractArray{T,D},b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:-}(a,b) | 96 @inline -̃(a::AbstractArray{T,D},b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:-}(a,b) |
97 @inline *̃(a::AbstractArray{T,D},b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:*}(a,b) | 97 @inline *̃(a::AbstractArray{T,D},b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:*}(a,b) |
98 @inline /̃(a::AbstractArray{T,D},b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:/}(a,b) | 98 @inline /̃(a::AbstractArray{T,D},b::AbstractArray{T,D}) where {T,D} = LazyElementwiseOperation{T,D,:/}(a,b) |
99 | 99 |
100 | 100 |
101 Base.:+(a::LazyArray{T,D},b::AbstractArray{T,D}) where {T,D} = a +̃ b | 101 # NOTE: Är det knas att vi har till exempel * istället för .* ?? |
102 Base.:+(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = b + a | 102 # Oklart om det ens går att lösa.. |
103 Base.:-(a::LazyArray{T,D},b::AbstractArray{T,D}) where {T,D} = a -̃ b | 103 Base.:+(a::LazyArray{T,D}, b::LazyArray{T,D}) where {T,D} = a +̃ b |
104 Base.:+(a::LazyArray{T,D}, b::AbstractArray{T,D}) where {T,D} = a +̃ b | |
105 Base.:+(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = a +̃ b | |
106 | |
107 Base.:-(a::LazyArray{T,D}, b::LazyArray{T,D}) where {T,D} = a -̃ b | |
108 Base.:-(a::LazyArray{T,D}, b::AbstractArray{T,D}) where {T,D} = a -̃ b | |
104 Base.:-(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = a -̃ b | 109 Base.:-(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = a -̃ b |
105 Base.:*(a::LazyArray{T,D},b::AbstractArray{T,D}) where {T,D} = a *̃ b | 110 |
106 Base.:*(a::AbstractArray{T,D},b::LazyArray{T,D}) where {T,D} = b * a | 111 Base.:*(a::LazyArray{T,D}, b::LazyArray{T,D}) where {T,D} = a *̃ b |
112 Base.:*(a::LazyArray{T,D}, b::AbstractArray{T,D}) where {T,D} = a *̃ b | |
113 Base.:*(a::AbstractArray{T,D}, b::LazyArray{T,D}) where {T,D} = a *̃ b | |
114 | |
107 # TODO: / seems to be ambiguous | 115 # TODO: / seems to be ambiguous |
108 # Base.:/(a::LazyArray{T,D},b::AbstractArray{T,D}) where {T,D} = a /̃ b | 116 # Base.:/(a::LazyArray{T,D},b::AbstractArray{T,D}) where {T,D} = a /̃ b |
109 # Base.:/(a::AbstractArray{T,D},b::LazyArray{T,D}) where {T,D} = a /̃ b | 117 # Base.:/(a::AbstractArray{T,D},b::LazyArray{T,D}) where {T,D} = a /̃ b |
110 | 118 |
111 export +̃, -̃, *̃, /̃ | 119 export +̃, -̃, *̃, /̃ |