Mercurial > repos > public > sbplib_julia
diff src/LazyTensors/lazy_tensor_operations.jl @ 942:7829c09f8137 feature/tensormapping_application_promotion
Add promotion calculation of element type for LazyTensorMappingApplication
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Thu, 10 Mar 2022 11:13:34 +0100 |
parents | 76e5682d0e52 |
children | fb060e98ac0a |
line wrap: on
line diff
--- a/src/LazyTensors/lazy_tensor_operations.jl Mon Feb 21 10:38:19 2022 +0100 +++ b/src/LazyTensors/lazy_tensor_operations.jl Thu Mar 10 11:13:34 2022 +0100 @@ -7,9 +7,14 @@ With a mapping `m` and a vector `v` the LazyTensorMappingApplication object can be created by `m*v`. The actual result will be calcualted when indexing into `m*v`. """ -struct LazyTensorMappingApplication{T,R,D, TM<:TensorMapping{T,R,D}, AA<:AbstractArray{T,D}} <: LazyArray{T,R} +struct LazyTensorMappingApplication{T,R,D, TM<:TensorMapping{<:Any,R,D}, AA<:AbstractArray{<:Any,D}} <: LazyArray{T,R} t::TM o::AA + + function LazyTensorMappingApplication(t::TensorMapping{<:Any,R,D}, o::AbstractArray{<:Any,D}) where {R,D} + T = promote_type(eltype(t), eltype(o)) + return new{T,R,D,typeof(t), typeof(o)}(t,o) + end end # TODO: Do boundschecking on creation! export LazyTensorMappingApplication