You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: DifferentiationInterface/ext/DifferentiationInterfaceFastDifferentiationExt/DifferentiationInterfaceFastDifferentiationExt.jl
Copy file name to clipboardExpand all lines: DifferentiationInterface/ext/DifferentiationInterfaceSparseConnectivityTracerExt/DifferentiationInterfaceSparseConnectivityTracerExt.jl
+11-14Lines changed: 11 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -5,26 +5,23 @@ import DifferentiationInterface as DI
@@ -78,7 +77,7 @@ The initial values present inside the cache do not matter.
78
77
For some backends, preparation allocates the required memory for `Cache` contexts with the right element type, similar to [PreallocationTools.jl](https://github.com/SciML/PreallocationTools.jl).
79
78
80
79
!!! warning
81
-
Most backends require any `Cache` context to be an `AbstractArray`.
80
+
Some backends require any `Cache` context to be an `AbstractArray or a (named) tuple of `AbstractArray`s.
Copy file name to clipboardExpand all lines: DifferentiationInterfaceTest/src/scenarios/modify.jl
+10-6Lines changed: 10 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -147,7 +147,7 @@ end
147
147
"""
148
148
constantify(scen::Scenario)
149
149
150
-
Return a new `Scenario` identical to `scen` except for the function `f`, which is made to accept an additional constant argument `a` by which the output is multiplied.
150
+
Return a new `Scenario` identical to `scen` except for the function `f`, which is made to accept an additional constant argument by which the output is multiplied.
151
151
The output and result fields are updated accordingly.
152
152
"""
153
153
functionconstantify(scen::Scenario{op,pl_op,pl_fun}) where {op,pl_op,pl_fun}
@@ -189,7 +190,8 @@ function (sc::StoreInCache{:out})(x, y_cache)
189
190
end
190
191
end
191
192
192
-
function (sc::StoreInCache{:in})(y, x, y_cache)
193
+
function (sc::StoreInCache{:in})(y, x, y_cache_tup)
194
+
y_cache = y_cache_tup.cache
193
195
sc.f(y_cache, x)
194
196
copyto!(y, y_cache)
195
197
returnnothing
@@ -198,16 +200,18 @@ end
198
200
"""
199
201
cachify(scen::Scenario)
200
202
201
-
Return a new `Scenario` identical to `scen` except for the function `f`, which is made to accept an additional cache argument `a` to store the result before it is returned.
203
+
Return a new `Scenario` identical to `scen` except for the function `f`, which is made to accept an additional cache argument to store the result before it is returned.
204
+
205
+
If `tup=true` the cache is a tuple of arrays, otherwise just an array.
202
206
"""
203
207
functioncachify(scen::Scenario{op,pl_op,pl_fun}) where {op,pl_op,pl_fun}
0 commit comments