Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/lazy_tensor_operations.jl @ 1089:2278730f9cee refactor/sbpoperators/inflation
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 10 May 2022 20:24:20 +0200 |
parents | 62f321caa964 2e606d4c0ab1 |
children | 6f51160c7ca7 f1c2a4fa0ee1 |
comparison
equal
deleted
inserted
replaced
1088:62f321caa964 | 1089:2278730f9cee |
---|---|
96 | 96 |
97 function apply_transpose(c::TensorComposition{T,R,K,D}, v::AbstractArray{<:Any,R}, I::Vararg{Any,D}) where {T,R,K,D} | 97 function apply_transpose(c::TensorComposition{T,R,K,D}, v::AbstractArray{<:Any,R}, I::Vararg{Any,D}) where {T,R,K,D} |
98 apply_transpose(c.t2, c.t1'*v, I...) | 98 apply_transpose(c.t2, c.t1'*v, I...) |
99 end | 99 end |
100 | 100 |
101 | |
102 """ | 101 """ |
103 TensorComposition(tm, tmi::IdentityTensor) | 102 TensorComposition(tm, tmi::IdentityTensor) |
104 TensorComposition(tmi::IdentityTensor, tm) | 103 TensorComposition(tmi::IdentityTensor, tm) |
105 | 104 |
106 Composes a `Tensormapping` `tm` with an `IdentityTensor` `tmi`, by returning `tm` | 105 Composes a `Tensormapping` `tm` with an `IdentityTensor` `tmi`, by returning `tm` |
118 function TensorComposition(tm::IdentityTensor{T,D}, tmi::IdentityTensor{T,D}) where {T,D} | 117 function TensorComposition(tm::IdentityTensor{T,D}, tmi::IdentityTensor{T,D}) where {T,D} |
119 @boundscheck check_domain_size(tm, range_size(tmi)) | 118 @boundscheck check_domain_size(tm, range_size(tmi)) |
120 return tmi | 119 return tmi |
121 end | 120 end |
122 | 121 |
122 Base.:*(a::T, tm::LazyTensor{T}) where T = TensorComposition(ScalingTensor{T,range_dim(tm)}(a,range_size(tm)), tm) | |
123 Base.:*(tm::LazyTensor{T}, a::T) where T = a*tm | |
123 | 124 |
124 """ | 125 """ |
125 InflatedTensor{T,R,D} <: LazyTensor{T,R,D} | 126 InflatedTensor{T,R,D} <: LazyTensor{T,R,D} |
126 | 127 |
127 An inflated `LazyTensor` with dimensions added before and afer its actual dimensions. | 128 An inflated `LazyTensor` with dimensions added before and afer its actual dimensions. |