comparison TensorMappings.jl @ 156:ef3e6c70b6f9 boundary_conditions

Add missing type parameter to application operator
author Jonatan Werpers <jonatan@werpers.com>
date Mon, 29 Apr 2019 11:40:22 +0200
parents 9fdbae11dd77
children 63b495d5dbc7
comparison
equal deleted inserted replaced
155:9fdbae11dd77 156:ef3e6c70b6f9
44 Base.size(ta::TensorApplication) = range_size(ta.t,size(ta.o)) 44 Base.size(ta::TensorApplication) = range_size(ta.t,size(ta.o))
45 ## What else is needed so that we have a proper AbstractArray? 45 ## What else is needed so that we have a proper AbstractArray?
46 46
47 Base.getindex(tm::TensorApplication, I::Vararg) = apply(tm.t, tm.o, I...) 47 Base.getindex(tm::TensorApplication, I::Vararg) = apply(tm.t, tm.o, I...)
48 48
49 →(t::TensorMapping{R,D}, o::AbstractArray{T,D}) where {T,R,D} = TensorApplication(t,o) 49 →(t::TensorMapping{T,R,D}, o::AbstractArray{T,D}) where {T,R,D} = TensorApplication(t,o)
50 # Should we overload some other infix binary operator? 50 # Should we overload some other infix binary operator?
51 # * has the wrong parsing properties... a*b*c is parsed to (a*b)*c (through a*b*c = *(a,b,c)) 51 # * has the wrong parsing properties... a*b*c is parsed to (a*b)*c (through a*b*c = *(a,b,c))
52 # while a→b→c is parsed as a→(b→c) 52 # while a→b→c is parsed as a→(b→c)
53 # The associativity of the operators might be fixed somehow... (rfold/lfold?) 53 # The associativity of the operators might be fixed somehow... (rfold/lfold?)
54 # ∘ also is an option but that has the same problem as * (but is not n-ary) (or is this best used for composition of Mappings?) 54 # ∘ also is an option but that has the same problem as * (but is not n-ary) (or is this best used for composition of Mappings?)
55
56 55
57 struct TensorMappingComposition{T,R,K,D} <: TensorMapping{T,R,D} 56 struct TensorMappingComposition{T,R,K,D} <: TensorMapping{T,R,D}
58 t1::TensorMapping{T,R,K} 57 t1::TensorMapping{T,R,K}
59 t2::TensorMapping{T,K,D} 58 t2::TensorMapping{T,K,D}
60 end 59 end