@@ -174,6 +174,9 @@ function expand(coefs::AbstractArray{T,N}, vweights::Tuple{}, ixs::Tuple{}, iexp
174
174
@inbounds coefs[iexpanded... ] # @inbounds is safe because we checked in the original call
175
175
end
176
176
177
+ const HasNoInterp{N} = NTuple{N,Tuple{Vararg{<: Union{Number,NoInterp} }}}
178
+ expand (coefs:: AbstractArray , vweights:: HasNoInterp , ixs:: Indexes , iexpanded:: Vararg{Integer,M} ) where {M} = NoInterp ()
179
+
177
180
# _expand1 handles the expansion of a single dimension weight list (of length L)
178
181
@inline _expand1 (coefs, w1, ix1, wrest, ixrest, iexpanded) =
179
182
w1[1 ] * expand (coefs, wrest, ixrest, iexpanded... , ix1[1 ]) +
@@ -182,14 +185,17 @@ end
182
185
w1[1 ] * expand (coefs, wrest, ixrest, iexpanded... , ix1[1 ])
183
186
184
187
# Expansion of the gradient
185
- function expand (coefs, (vweights, gweights):: Tuple{Weights {N},Weights {N}} , ixs:: Indexes{N} ) where N
188
+ function expand (coefs, (vweights, gweights):: Tuple{HasNoInterp {N},HasNoInterp {N}} , ixs:: Indexes{N} ) where N
186
189
# We swap in one gradient dimension per call to expand
187
- SVector (ntuple (d-> expand (coefs, substitute (vweights, d, gweights), ixs), Val (N)))
190
+ SVector (skip_nointerp ( ntuple (d-> expand (coefs, substitute (vweights, d, gweights), ixs), Val (N)) ... ))
188
191
end
189
- function expand! (dest, coefs, (vweights, gweights):: Tuple{Weights {N},Weights {N}} , ixs:: Indexes{N} ) where N
192
+ function expand! (dest, coefs, (vweights, gweights):: Tuple{HasNoInterp {N},HasNoInterp {N}} , ixs:: Indexes{N} ) where N
190
193
# We swap in one gradient dimension per call to expand
194
+ i = 0
191
195
for d = 1 : N
192
- dest[d] = expand (coefs, substitute (vweights, d, gweights), ixs)
196
+ w = substitute (vweights, d, gweights)
197
+ w isa Weights || continue # must have a NoInterp in it
198
+ dest[i+= 1 ] = expand (coefs, w, ixs)
193
199
end
194
200
dest
195
201
end
0 commit comments