@@ -63,7 +63,8 @@ weightedindexes(i::Vararg{Int,N}) where N = i # the all-NoInterp case
63
63
64
64
const PositionCoefs{P,C} = NamedTuple{(:position ,:coefs ),Tuple{P,C}}
65
65
const ValueParts{P,W} = PositionCoefs{P,Tuple{W}}
66
- @inline weightedindexes (parts:: Vararg{Union{Int,ValueParts},N} ) where N = maybe_weightedindex .(positions .(parts), valuecoefs .(parts))
66
+ @inline weightedindexes (parts:: Vararg{Union{Int,ValueParts},N} ) where N =
67
+ map (maybe_weightedindex, map (positions, parts), map (valuecoefs, parts))
67
68
maybe_weightedindex (i:: Integer , _:: Integer ) = Int (i)
68
69
maybe_weightedindex (pos, coefs:: Tuple ) = WeightedIndex (pos, coefs)
69
70
@@ -86,13 +87,13 @@ function weightedindexes(parts::Vararg{Union{Int,GradParts},N}) where N
86
87
# i2 is the integer index along dimension 2
87
88
# These will result in a 2-vector gradient.
88
89
# TODO : check whether this is inferrable
89
- slot_substitute (parts, positions .( parts), valuecoefs .( parts), gradcoefs .( parts))
90
+ slot_substitute (parts, map (positions, parts), map (valuecoefs, parts), map (gradcoefs, parts))
90
91
end
91
92
92
93
# Skip over NoInterp dimensions
93
94
slot_substitute (kind:: Tuple{Int,Vararg{Any}} , p, v, g) = slot_substitute (Base. tail (kind), p, v, g)
94
95
# Substitute the dth dimension's gradient coefs for the remaining coefs
95
- slot_substitute (kind, p, v, g) = (maybe_weightedindex .( p, substitute_ruled (v, kind, g)), slot_substitute (Base. tail (kind), p, v, g)... )
96
+ slot_substitute (kind, p, v, g) = (map (maybe_weightedindex, p, substitute_ruled (v, kind, g)), slot_substitute (Base. tail (kind), p, v, g)... )
96
97
# Termination
97
98
slot_substitute (kind:: Tuple{} , p, v, g) = ()
98
99
@@ -109,7 +110,7 @@ function weightedindexes(parts::Vararg{Union{Int,HessParts},N}) where N
109
110
# hc1 = coefs[hwi1, i2, wi3]
110
111
# hc2 = coefs[gwi1, i2, gwi3]
111
112
# hc3 = coefs[wi1, i2, hwi3]
112
- slot_substitute (parts, parts, positions .( parts), valuecoefs .( parts), gradcoefs .( parts), hesscoefs .( parts))
113
+ slot_substitute (parts, parts, map (positions, parts), map (valuecoefs, parts), map (gradcoefs, parts), map (hesscoefs, parts))
113
114
end
114
115
115
116
# Skip over NoInterp dimensions
0 commit comments