changeset 1000:1091ac8c69ad refactor/lazy_tensors

Rename another struct
author Jonatan Werpers <jonatan@werpers.com>
date Fri, 18 Mar 2022 21:54:01 +0100
parents 20cb83efb3f1
children a3df203861d3
files src/LazyTensors/LazyTensors.jl src/LazyTensors/lazy_tensor_operations.jl
diffstat 2 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/LazyTensors/LazyTensors.jl	Fri Mar 18 21:43:38 2022 +0100
+++ b/src/LazyTensors/LazyTensors.jl	Fri Mar 18 21:54:01 2022 +0100
@@ -22,8 +22,8 @@
 Base.:*(a::LazyTensor, args::Union{LazyTensor, AbstractArray}...) = foldr(*,(a,args...))
 
 # Addition and subtraction of lazy tensors
-Base.:+(tm1::LazyTensor{T,R,D}, tm2::LazyTensor{T,R,D}) where {T,R,D} = LazyLazyTensorBinaryOperation{:+,T,R,D}(tm1,tm2)
-Base.:-(tm1::LazyTensor{T,R,D}, tm2::LazyTensor{T,R,D}) where {T,R,D} = LazyLazyTensorBinaryOperation{:-,T,R,D}(tm1,tm2)
+Base.:+(tm1::LazyTensor{T,R,D}, tm2::LazyTensor{T,R,D}) where {T,R,D} = LazyTensorBinaryOperation{:+,T,R,D}(tm1,tm2)
+Base.:-(tm1::LazyTensor{T,R,D}, tm2::LazyTensor{T,R,D}) where {T,R,D} = LazyTensorBinaryOperation{:-,T,R,D}(tm1,tm2)
 
 # Composing lazy tensors
 Base.:∘(s::LazyTensor, t::LazyTensor) = LazyTensorComposition(s,t)
--- a/src/LazyTensors/lazy_tensor_operations.jl	Fri Mar 18 21:43:38 2022 +0100
+++ b/src/LazyTensors/lazy_tensor_operations.jl	Fri Mar 18 21:54:01 2022 +0100
@@ -54,21 +54,21 @@
 domain_size(tmt::LazyTensorTranspose) = range_size(tmt.tm)
 
 # TODO: Rename this
-struct LazyLazyTensorBinaryOperation{Op,T,R,D,T1<:LazyTensor{T,R,D},T2<:LazyTensor{T,R,D}} <: LazyTensor{T,D,R}
+struct LazyTensorBinaryOperation{Op,T,R,D,T1<:LazyTensor{T,R,D},T2<:LazyTensor{T,R,D}} <: LazyTensor{T,D,R}
     tm1::T1
     tm2::T2
 
-    @inline function LazyLazyTensorBinaryOperation{Op,T,R,D}(tm1::T1,tm2::T2) where {Op,T,R,D, T1<:LazyTensor{T,R,D},T2<:LazyTensor{T,R,D}}
+    @inline function LazyTensorBinaryOperation{Op,T,R,D}(tm1::T1,tm2::T2) where {Op,T,R,D, T1<:LazyTensor{T,R,D},T2<:LazyTensor{T,R,D}}
         return new{Op,T,R,D,T1,T2}(tm1,tm2)
     end
 end
 # TODO: Boundschecking in constructor.
 
-apply(tmBinOp::LazyLazyTensorBinaryOperation{:+,T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D} = apply(tmBinOp.tm1, v, I...) + apply(tmBinOp.tm2, v, I...)
-apply(tmBinOp::LazyLazyTensorBinaryOperation{:-,T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D} = apply(tmBinOp.tm1, v, I...) - apply(tmBinOp.tm2, v, I...)
+apply(tmBinOp::LazyTensorBinaryOperation{:+,T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D} = apply(tmBinOp.tm1, v, I...) + apply(tmBinOp.tm2, v, I...)
+apply(tmBinOp::LazyTensorBinaryOperation{:-,T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D} = apply(tmBinOp.tm1, v, I...) - apply(tmBinOp.tm2, v, I...)
 
-range_size(tmBinOp::LazyLazyTensorBinaryOperation) = range_size(tmBinOp.tm1)
-domain_size(tmBinOp::LazyLazyTensorBinaryOperation) = domain_size(tmBinOp.tm1)
+range_size(tmBinOp::LazyTensorBinaryOperation) = range_size(tmBinOp.tm1)
+domain_size(tmBinOp::LazyTensorBinaryOperation) = domain_size(tmBinOp.tm1)
 
 
 """