comparison src/LazyTensors/lazy_tensor_operations.jl @ 434:648a36ebac99 feature/lazy_identity

Change name from LazyIdentity to IdentityMapping
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 19 Oct 2020 09:51:56 +0200
parents 7327a3e41df0
children 00c317c9ccfb 27e0e256e5d9
comparison
equal deleted inserted replaced
433:7327a3e41df0 434:648a36ebac99
146 apply(LazyLinearMap(llm.A, llm.domain_indicies, llm.range_indicies), v, I...) 146 apply(LazyLinearMap(llm.A, llm.domain_indicies, llm.range_indicies), v, I...)
147 end 147 end
148 148
149 149
150 """ 150 """
151 LazyIdentity{T,D} <: TensorMapping{T,D,D} 151 IdentityMapping{T,D} <: TensorMapping{T,D,D}
152 152
153 The lazy identity TensorMapping for a given size. Usefull for building up higher dimensional tensor mappings from lower 153 The lazy identity TensorMapping for a given size. Usefull for building up higher dimensional tensor mappings from lower
154 dimensional ones through outer products. Also used in the Implementation for InflatedTensorMapping. 154 dimensional ones through outer products. Also used in the Implementation for InflatedTensorMapping.
155 """ 155 """
156 struct LazyIdentity{T,D} <: TensorMapping{T,D,D} 156 struct IdentityMapping{T,D} <: TensorMapping{T,D,D}
157 size::NTuple{D,Int} 157 size::NTuple{D,Int}
158 end 158 end
159 export LazyIdentity 159 export IdentityMapping
160 160
161 LazyIdentity{T}(size::NTuple{D,Int}) where {T,D} = LazyIdentity{T,D}(size) 161 IdentityMapping{T}(size::NTuple{D,Int}) where {T,D} = IdentityMapping{T,D}(size)
162 162
163 range_size(tmi::LazyIdentity) = tmi.size 163 range_size(tmi::IdentityMapping) = tmi.size
164 domain_size(tmi::LazyIdentity) = tmi.size 164 domain_size(tmi::IdentityMapping) = tmi.size
165 165
166 apply(tmi::LazyIdentity{T,D}, v::AbstractArray{T,D}, I::Vararg{Any,D}) where {T,D} = v[I...] 166 apply(tmi::IdentityMapping{T,D}, v::AbstractArray{T,D}, I::Vararg{Any,D}) where {T,D} = v[I...]
167 apply_transpose(tmi::LazyIdentity{T,D}, v::AbstractArray{T,D}, I::Vararg{Any,D}) where {T,D} = v[I...] 167 apply_transpose(tmi::IdentityMapping{T,D}, v::AbstractArray{T,D}, I::Vararg{Any,D}) where {T,D} = v[I...]
168 168