Mercurial > repos > public > sbplib_julia
comparison src/LazyTensors/lazy_tensor_operations.jl @ 981:df562695b1b5 feature/variable_derivatives
Merge feature/tensormapping_application_promotion
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 15 Mar 2022 21:40:31 +0100 |
parents | e79debd10f7d 043d13ef8898 |
children | 3bb94ce74697 |
comparison
equal
deleted
inserted
replaced
980:f885e1de6dc4 | 981:df562695b1b5 |
---|---|
1 using Sbplib.RegionIndices | 1 using Sbplib.RegionIndices |
2 | |
3 export LazyTensorMappingApplication | |
4 export LazyTensorMappingTranspose | |
5 export TensorMappingComposition | |
6 export LazyLinearMap | |
7 export IdentityMapping | |
8 export InflatedTensorMapping | |
9 export LazyOuterProduct | |
10 export ⊗ | |
11 export SizeMismatch | |
12 | 2 |
13 """ | 3 """ |
14 LazyTensorMappingApplication{T,R,D} <: LazyArray{T,R} | 4 LazyTensorMappingApplication{T,R,D} <: LazyArray{T,R} |
15 | 5 |
16 Struct for lazy application of a TensorMapping. Created using `*`. | 6 Struct for lazy application of a TensorMapping. Created using `*`. |
22 struct LazyTensorMappingApplication{T,R,D, TM<:TensorMapping{<:Any,R,D}, AA<:AbstractArray{<:Any,D}} <: LazyArray{T,R} | 12 struct LazyTensorMappingApplication{T,R,D, TM<:TensorMapping{<:Any,R,D}, AA<:AbstractArray{<:Any,D}} <: LazyArray{T,R} |
23 t::TM | 13 t::TM |
24 o::AA | 14 o::AA |
25 | 15 |
26 function LazyTensorMappingApplication(t::TensorMapping{<:Any,R,D}, o::AbstractArray{<:Any,D}) where {R,D} | 16 function LazyTensorMappingApplication(t::TensorMapping{<:Any,R,D}, o::AbstractArray{<:Any,D}) where {R,D} |
27 T = promote_type(eltype(t), eltype(o)) | 17 I = ntuple(i->1, range_dim(t)) |
18 T = typeof(apply(t,o,I...)) | |
28 return new{T,R,D,typeof(t), typeof(o)}(t,o) | 19 return new{T,R,D,typeof(t), typeof(o)}(t,o) |
29 end | 20 end |
30 end | 21 end |
31 # TODO: Do boundschecking on creation! | 22 # TODO: Do boundschecking on creation! |
32 | 23 |