Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/lazy_tensor_operations.jl @ 1879:765f42559c47 refactor/lazy_tensors/elementwise_ops
Add some more docs
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 27 Jan 2025 17:11:14 +0100 |
parents | b12e28a03b2e |
children | 378002c78e86 |
comparison
equal
deleted
inserted
replaced
1878:b12e28a03b2e | 1879:765f42559c47 |
---|---|
69 | 69 |
70 | 70 |
71 """ | 71 """ |
72 TensorSum{T,R,D,...} <: LazyTensor{T,R,D} | 72 TensorSum{T,R,D,...} <: LazyTensor{T,R,D} |
73 | 73 |
74 The sum of 2 or more lazy tensors. | 74 The lazy sum of 2 or more lazy tensors. |
75 """ | 75 """ |
76 struct TensorSum{T,R,D,TT<:NTuple{N, LazyTensor{T,R,D}} where N} <: LazyTensor{T,R,D} | 76 struct TensorSum{T,R,D,TT<:NTuple{N, LazyTensor{T,R,D}} where N} <: LazyTensor{T,R,D} |
77 tms::TT | 77 tms::TT |
78 | 78 |
79 function TensorSum{T,R,D}(tms::TT) where {T,R,D, TT<:NTuple{N, LazyTensor{T,R,D}} where N} | 79 function TensorSum{T,R,D}(tms::TT) where {T,R,D, TT<:NTuple{N, LazyTensor{T,R,D}} where N} |
84 | 84 |
85 return new{T,R,D,TT}(tms) | 85 return new{T,R,D,TT}(tms) |
86 end | 86 end |
87 end | 87 end |
88 | 88 |
89 """ | |
90 TensorSum(ts::Vararg{LazyTensor}) | |
91 | |
92 The lazy sum of the tensors `ts`. | |
93 """ | |
89 function TensorSum(ts::Vararg{LazyTensor}) | 94 function TensorSum(ts::Vararg{LazyTensor}) |
90 T = eltype(ts[1]) | 95 T = eltype(ts[1]) |
91 R = range_dim(ts[1]) | 96 R = range_dim(ts[1]) |
92 D = domain_dim(ts[1]) | 97 D = domain_dim(ts[1]) |
93 return TensorSum{T,R,D}(ts) | 98 return TensorSum{T,R,D}(ts) |