Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/lazy_tensor_operations.jl @ 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 |
comparison
equal
deleted
inserted
replaced
999:20cb83efb3f1 | 1000:1091ac8c69ad |
---|---|
52 | 52 |
53 range_size(tmt::LazyTensorTranspose) = domain_size(tmt.tm) | 53 range_size(tmt::LazyTensorTranspose) = domain_size(tmt.tm) |
54 domain_size(tmt::LazyTensorTranspose) = range_size(tmt.tm) | 54 domain_size(tmt::LazyTensorTranspose) = range_size(tmt.tm) |
55 | 55 |
56 # TODO: Rename this | 56 # TODO: Rename this |
57 struct LazyLazyTensorBinaryOperation{Op,T,R,D,T1<:LazyTensor{T,R,D},T2<:LazyTensor{T,R,D}} <: LazyTensor{T,D,R} | 57 struct LazyTensorBinaryOperation{Op,T,R,D,T1<:LazyTensor{T,R,D},T2<:LazyTensor{T,R,D}} <: LazyTensor{T,D,R} |
58 tm1::T1 | 58 tm1::T1 |
59 tm2::T2 | 59 tm2::T2 |
60 | 60 |
61 @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}} | 61 @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}} |
62 return new{Op,T,R,D,T1,T2}(tm1,tm2) | 62 return new{Op,T,R,D,T1,T2}(tm1,tm2) |
63 end | 63 end |
64 end | 64 end |
65 # TODO: Boundschecking in constructor. | 65 # TODO: Boundschecking in constructor. |
66 | 66 |
67 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...) | 67 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...) |
68 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...) | 68 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...) |
69 | 69 |
70 range_size(tmBinOp::LazyLazyTensorBinaryOperation) = range_size(tmBinOp.tm1) | 70 range_size(tmBinOp::LazyTensorBinaryOperation) = range_size(tmBinOp.tm1) |
71 domain_size(tmBinOp::LazyLazyTensorBinaryOperation) = domain_size(tmBinOp.tm1) | 71 domain_size(tmBinOp::LazyTensorBinaryOperation) = domain_size(tmBinOp.tm1) |
72 | 72 |
73 | 73 |
74 """ | 74 """ |
75 LazyTensorComposition{T,R,K,D} | 75 LazyTensorComposition{T,R,K,D} |
76 | 76 |