comparison src/LazyTensors/lazy_tensor_operations.jl @ 441:552189707fbe feature/lazy_identity

Add convenience constructor
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 19 Oct 2020 21:23:12 +0200
parents 00c317c9ccfb
children e70e47fbfa7c
comparison
equal deleted inserted replaced
440:a57b71343aeb 441:552189707fbe
159 size::NTuple{D,Int} 159 size::NTuple{D,Int}
160 end 160 end
161 export IdentityMapping 161 export IdentityMapping
162 162
163 IdentityMapping{T}(size::NTuple{D,Int}) where {T,D} = IdentityMapping{T,D}(size) 163 IdentityMapping{T}(size::NTuple{D,Int}) where {T,D} = IdentityMapping{T,D}(size)
164 IdentityMapping{T}(size::Vararg{Int,D}) where {T,D} = IdentityMapping{T,D}(size)
164 165
165 range_size(tmi::IdentityMapping) = tmi.size 166 range_size(tmi::IdentityMapping) = tmi.size
166 domain_size(tmi::IdentityMapping) = tmi.size 167 domain_size(tmi::IdentityMapping) = tmi.size
167 168
168 apply(tmi::IdentityMapping{T,D}, v::AbstractArray{T,D}, I::Vararg{Any,D}) where {T,D} = v[I...] 169 apply(tmi::IdentityMapping{T,D}, v::AbstractArray{T,D}, I::Vararg{Any,D}) where {T,D} = v[I...]