Mercurial > repos > public > sbplib_julia
diff src/LazyTensors/lazy_array.jl @ 1854:654a2b7e6824 tooling/benchmarks
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Sat, 11 Jan 2025 10:19:47 +0100 |
parents | dfb43fdac9fc |
children |
line wrap: on
line diff
--- a/src/LazyTensors/lazy_array.jl Wed May 31 08:59:34 2023 +0200 +++ b/src/LazyTensors/lazy_array.jl Sat Jan 11 10:19:47 2025 +0100 @@ -1,12 +1,11 @@ """ LazyArray{T,D} <: AbstractArray{T,D} -Array which is calcualted lazily when indexing. +Array which is calculated lazily when indexing. A subtype of `LazyArray` will use lazy version of `+`, `-`, `*`, `/`. """ abstract type LazyArray{T,D} <: AbstractArray{T,D} end -export LazyArray struct LazyConstantArray{T,D} <: LazyArray{T,D} val::T @@ -25,7 +24,6 @@ f::F size::NTuple{D,Int} end -export LazyFunctionArray function LazyFunctionArray(f::F, size::NTuple{D,Int}) where {F<:Function,D} T = typeof(f(ones(Int, D)...)) @@ -42,7 +40,7 @@ """ LazyElementwiseOperation{T,D,Op} <: LazyArray{T,D} -Struct allowing for lazy evaluation of elementwise operations on `AbstractArray`s. +Struct allowing for lazy evaluation of element-wise operations on `AbstractArray`s. A `LazyElementwiseOperation` contains two arrays together with an operation. The operations are carried out when the `LazyElementwiseOperation` is indexed. @@ -110,5 +108,3 @@ Base.@propagate_inbounds Base.:+(a::T, b::LazyArray{T,D}) where {T,D} = a +̃ b Base.@propagate_inbounds Base.:-(a::T, b::LazyArray{T,D}) where {T,D} = a -̃ b - -export +̃, -̃, *̃, /̃