comparison src/LazyTensors/lazy_array.jl @ 386:895ec483d741 feature/lazy_array/isapprox

Implement isapprox between LazyArray and scalars.
author Jonatan Werpers <jonatan@werpers.com>
date Thu, 01 Oct 2020 07:44:39 +0200
parents f65809a26a17
children
comparison
equal deleted inserted replaced
382:5c10cd0ed1fe 386:895ec483d741
5 5
6 A subtype of `LazyArray` will use lazy version of `+`, `-`, `*`, `/`. 6 A subtype of `LazyArray` will use lazy version of `+`, `-`, `*`, `/`.
7 """ 7 """
8 abstract type LazyArray{T,D} <: AbstractArray{T,D} end 8 abstract type LazyArray{T,D} <: AbstractArray{T,D} end
9 export LazyArray 9 export LazyArray
10
11 Base.isapprox(x::LazyArray, y::Number; kwargs...) = isapprox(x, LazyConstantArray(y, size(x)); kwargs...)
12 Base.isapprox(x::Number, y::LazyArray; kwargs...) = isapprox(y,x; kwargs...)
10 13
11 struct LazyConstantArray{T,D} <: LazyArray{T,D} 14 struct LazyConstantArray{T,D} <: LazyArray{T,D}
12 val::T 15 val::T
13 size::NTuple{D,Int} 16 size::NTuple{D,Int}
14 end 17 end