Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/lazy_tensor_operations.jl @ 1840:cb3a8450ed44 refactor/lazy_tensors/elementwise_ops
Add some docstring
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Fri, 10 Jan 2025 19:45:11 +0100 |
parents | e1077273eda5 |
children | 21e5fe1545c0 |
comparison
equal
deleted
inserted
replaced
1839:e1077273eda5 | 1840:cb3a8450ed44 |
---|---|
49 apply_transpose(tmt::TensorTranspose{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D} = apply(tmt.tm, v, I...) | 49 apply_transpose(tmt::TensorTranspose{T,R,D}, v::AbstractArray{<:Any,D}, I::Vararg{Any,R}) where {T,R,D} = apply(tmt.tm, v, I...) |
50 | 50 |
51 range_size(tmt::TensorTranspose) = domain_size(tmt.tm) | 51 range_size(tmt::TensorTranspose) = domain_size(tmt.tm) |
52 domain_size(tmt::TensorTranspose) = range_size(tmt.tm) | 52 domain_size(tmt::TensorTranspose) = range_size(tmt.tm) |
53 | 53 |
54 struct TensorNegation{T,R,D, TM<:LazyTensor{T,R,D}} <: LazyTensor{T,R,D} | 54 |
55 """ | |
56 TensorNegation{T,R,D,...} <: LazyTensor{T,R,D} | |
57 | |
58 The negation of a LazyTensor. | |
59 """ | |
60 struct TensorNegation{T,R,D,TM<:LazyTensor{T,R,D}} <: LazyTensor{T,R,D} | |
55 tm::TM | 61 tm::TM |
56 end | 62 end |
57 | 63 |
58 apply(tm::TensorNegation, v, I...) = -apply(tm.tm, v, I...) | 64 apply(tm::TensorNegation, v, I...) = -apply(tm.tm, v, I...) |
59 apply_transpose(tm::TensorNegation, v, I...) = -apply_transpose(tm.tm, v, I...) | 65 apply_transpose(tm::TensorNegation, v, I...) = -apply_transpose(tm.tm, v, I...) |
60 | 66 |
61 range_size(tm::TensorNegation) = range_size(tm.tm) | 67 range_size(tm::TensorNegation) = range_size(tm.tm) |
62 domain_size(tm::TensorNegation) = domain_size(tm.tm) | 68 domain_size(tm::TensorNegation) = domain_size(tm.tm) |
63 | 69 |
64 | 70 """ |
71 TensorSum{T,R,D,...} <: LazyTensor{T,R,D} | |
72 | |
73 The sum of 2 or more lazy tensors. | |
74 """ | |
65 struct TensorSum{T,R,D,TT<:NTuple{N, LazyTensor{T,R,D}} where N} <: LazyTensor{T,R,D} | 75 struct TensorSum{T,R,D,TT<:NTuple{N, LazyTensor{T,R,D}} where N} <: LazyTensor{T,R,D} |
66 tms::TT | 76 tms::TT |
67 | 77 |
68 function TensorSum{T,R,D}(tms::TT) where {T,R,D, TT<:NTuple{N, LazyTensor{T,R,D}} where N} | 78 function TensorSum{T,R,D}(tms::TT) where {T,R,D, TT<:NTuple{N, LazyTensor{T,R,D}} where N} |
69 @boundscheck map(tms) do tm | 79 @boundscheck map(tms) do tm |