@@ -238,42 +238,38 @@ function (this::∂☆{N})(::ZeroBundle{N, typeof(Core._apply_iterate)}, iterate
238
238
Core. _apply_iterate (FwdIterate (iterate), this, (f,), args... )
239
239
end
240
240
241
- #= =
242
- #TODO : port this to TaylorTangent over composite structures
243
- function (this::∂☆{N})(::ZeroBundle{N, typeof(iterate)}, t::CompositeBundle{N, <:Tuple}) where {N}
244
- r = iterate(t.tup)
241
+
242
+ function (this: :∂☆ {N})(:: ZeroBundle{N, typeof(iterate)} , t:: TaylorBundle{N, <:Tuple} ) where {N}
243
+ r = iterate (destructure (t))
245
244
r === nothing && return ZeroBundle {N} (nothing )
246
245
∂vararg {N} ()(r[1 ], ZeroBundle {N} (r[2 ]))
247
246
end
248
247
249
- #TODO : port this to TaylorTangent over composite structures
250
- function (this::∂☆{N})(::ZeroBundle{N, typeof(iterate)}, t::CompositeBundle{N, <:Tuple}, a::ATB{N}, args::ATB{N}...) where {N}
251
- r = iterate(t.tup, primal(a), map(primal, args)...)
248
+ function (this: :∂☆ {N})(:: ZeroBundle{N, typeof(iterate)} , t:: TaylorBundle{N, <:Tuple} , a:: ATB{N} , args:: ATB{N} ...) where {N}
249
+ r = iterate (destructure (t), primal (a), map (primal, args)... )
252
250
r === nothing && return ZeroBundle {N} (nothing )
253
251
∂vararg {N} ()(r[1 ], ZeroBundle {N} (r[2 ]))
254
252
end
255
253
256
- #TODO : port this to TaylorTangent over composite structures
257
- function (this::∂☆{N})(::ZeroBundle{N, typeof(Base.indexed_iterate)}, t::CompositeBundle{N, <:Tuple}, i::ATB{N}) where {N}
258
- r = Base.indexed_iterate(t.tup, primal(i))
254
+ function (this: :∂☆ {N})(:: ZeroBundle{N, typeof(Base.indexed_iterate)} , t:: TaylorBundle{N, <:Tuple} , i:: ATB{N} ) where {N}
255
+ r = Base. indexed_iterate (destructure (t), primal (i))
259
256
∂vararg {N} ()(r[1 ], ZeroBundle {N} (r[2 ]))
260
257
end
261
258
262
- #TODO : port this to TaylorTangent over composite structures
263
- function (this::∂☆{N})(::ZeroBundle{N, typeof(Base.indexed_iterate)}, t::CompositeBundle{N, <:Tuple}, i::ATB{N}, st1::ATB{N}, st::ATB{N}...) where {N}
264
- r = Base.indexed_iterate(t.tup, primal(i), primal(st1), map(primal, st)...)
259
+ function (this: :∂☆ {N})(:: ZeroBundle{N, typeof(Base.indexed_iterate)} , t:: TaylorBundle{N, <:Tuple} , i:: ATB{N} , st1:: ATB{N} , st:: ATB{N} ...) where {N}
260
+ r = Base. indexed_iterate (destructure (t), primal (i), primal (st1), map (primal, st)... )
265
261
∂vararg {N} ()(r[1 ], ZeroBundle {N} (r[2 ]))
266
262
end
267
263
268
264
function (this: :∂☆ {N})(:: ZeroBundle{N, typeof(Base.indexed_iterate)} , t:: TangentBundle{N, <:Tuple} , i:: ATB{N} , st:: ATB{N} ...) where {N}
269
265
∂vararg {N} ()(this (ZeroBundle {N} (getfield), t, i), ZeroBundle {N} (primal (i) + 1 ))
270
266
end
271
267
272
- #TODO : port this to TaylorTangent over composite structures
273
- function (this::∂☆{N})(::ZeroBundle{N, typeof(getindex)}, t::CompositeBundle{N, <:Tuple}, i::ZeroBundle) where {N}
274
- t.tup[primal(i)]
268
+ function (this: :∂☆ {N})(:: ZeroBundle{N, typeof(getindex)} , t:: TaylorBundle{N, <:Tuple} , i:: ZeroBundle ) where {N}
269
+ field_ind = primal (i)
270
+ the_partials = ntuple (order_ind-> partial (t, order_ind)[field_ind], N)
271
+ TaylorBundle {N} (primal (t)[field_ind], the_partials)
275
272
end
276
- ==#
277
273
278
274
function (this: :∂☆ {N})(:: ZeroBundle{N, typeof(typeof)} , x:: ATB{N} ) where {N}
279
275
DNEBundle {N} (typeof (primal (x)))
0 commit comments