comparison LazyTensors/src/lazy_operations.jl @ 209:7db145ce6e4d boundary_conditions

Remove comment about @boundscheck causing allocation
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 25 Jun 2019 16:37:35 +0200
parents f85a0b38f3ff
children 2aa33d0eef90
comparison
equal deleted inserted replaced
208:992969237359 209:7db145ce6e4d
52 struct LazyElementwiseOperation{T,D,Op, T1<:AbstractArray{T,D}, T2 <: AbstractArray{T,D}} <: LazyArray{T,D} 52 struct LazyElementwiseOperation{T,D,Op, T1<:AbstractArray{T,D}, T2 <: AbstractArray{T,D}} <: LazyArray{T,D}
53 a::T1 53 a::T1
54 b::T2 54 b::T2
55 55
56 @inline function LazyElementwiseOperation{T,D,Op}(a::T1,b::T2) where {T,D,Op, T1<:AbstractArray{T,D}, T2<:AbstractArray{T,D}} 56 @inline function LazyElementwiseOperation{T,D,Op}(a::T1,b::T2) where {T,D,Op, T1<:AbstractArray{T,D}, T2<:AbstractArray{T,D}}
57 # NOTE: Seems like adding the boundscheck introduces allocations. Can this
58 # be fixed? Since boundscheck is removed when inlined into inbounds this
59 # should not in practise effect performance.
60 @boundscheck if size(a) != size(b) 57 @boundscheck if size(a) != size(b)
61 throw(DimensionMismatch("dimensions must match")) 58 throw(DimensionMismatch("dimensions must match"))
62 end 59 end
63 return new{T,D,Op,T1,T2}(a,b) 60 return new{T,D,Op,T1,T2}(a,b)
64 end 61 end