comparison src/LazyTensors/lazy_tensor_operations.jl @ 378:946516954c85

Use concrete types in LazyTensorApplication
author Jonatan Werpers <jonatan@werpers.com>
date Wed, 30 Sep 2020 21:25:50 +0200
parents ba46a952a450
children de4746d6d126
comparison
equal deleted inserted replaced
376:f65809a26a17 378:946516954c85
5 5
6 Allows the result of a `TensorMapping` applied to a vector to be treated as an `AbstractArray`. 6 Allows the result of a `TensorMapping` applied to a vector to be treated as an `AbstractArray`.
7 With a mapping `m` and a vector `v` the LazyTensorMappingApplication object can be created by `m*v`. 7 With a mapping `m` and a vector `v` the LazyTensorMappingApplication object can be created by `m*v`.
8 The actual result will be calcualted when indexing into `m*v`. 8 The actual result will be calcualted when indexing into `m*v`.
9 """ 9 """
10 struct LazyTensorMappingApplication{T,R,D} <: LazyArray{T,R} 10 struct LazyTensorMappingApplication{T,R,D, TM<:TensorMapping{T,R,D}, AA<:AbstractArray{T,D}} <: LazyArray{T,R}
11 t::TensorMapping{T,R,D} 11 t::TM
12 o::AbstractArray{T,D} 12 o::AA
13 end 13 end
14 # TODO: Do boundschecking on creation! 14 # TODO: Do boundschecking on creation!
15 export LazyTensorMappingApplication 15 export LazyTensorMappingApplication
16 16
17 Base.:*(tm::TensorMapping{T,R,D}, o::AbstractArray{T,D}) where {T,R,D} = LazyTensorMappingApplication(tm,o) 17 Base.:*(tm::TensorMapping{T,R,D}, o::AbstractArray{T,D}) where {T,R,D} = LazyTensorMappingApplication(tm,o)