File tree 3 files changed +15
-2
lines changed
3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change 1
1
name = " FiniteDifferences"
2
2
uuid = " 26cc04aa-876d-5657-8c51-4c34ba976000"
3
- version = " 0.12.23 "
3
+ version = " 0.12.24 "
4
4
5
5
[deps ]
6
6
ChainRulesCore = " d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Original file line number Diff line number Diff line change @@ -287,3 +287,14 @@ function FiniteDifferences.to_vec(t::Thunk)
287
287
Thunk_from_vec = v -> @thunk (back (v))
288
288
return v, Thunk_from_vec
289
289
end
290
+
291
+ function FiniteDifferences. to_vec (t:: InplaceableThunk )
292
+ v, back = to_vec (unthunk (t))
293
+ function InplaceableThunk_from_vec (v)
294
+ return InplaceableThunk (
295
+ Δ -> Δ += back (b),
296
+ @thunk (back (v))
297
+ )
298
+ end
299
+ return v, InplaceableThunk_from_vec
300
+ end
Original file line number Diff line number Diff line change 249
249
end
250
250
251
251
@testset " Thunks" begin
252
- test_to_vec (@thunk (3.2 + 4.3 ))
252
+ t = @thunk (3.2 + 4.3 )
253
+ test_to_vec (t)
254
+ test_to_vec (InplaceableThunk (Δ -> Δ += t, t))
253
255
end
254
256
end
255
257
You can’t perform that action at this time.
0 commit comments