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
Fix Enzyme extension and add new broken test (#151)
* Fix Enzyme extension and add new test
* Adapt to latest version
* No function annotation
* Test broken
* Fix tests
* Mode
* Const
* Bump version and move constructor doc
Copy file name to clipboardExpand all lines: src/implicit_function.jl
+23-18Lines changed: 23 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -60,6 +60,26 @@ The value of `lazy` must be chosen together with the `linear_solver`, see below.
60
60
- `conditions_x_backend`: how the conditions will be differentiated w.r.t. the first argument `x`
61
61
- `conditions_y_backend`: how the conditions will be differentiated w.r.t. the second argument `y`
62
62
63
+
# Constructors
64
+
65
+
ImplicitFunction(
66
+
forward, conditions;
67
+
linear_solver=KrylovLinearSolver(),
68
+
conditions_x_backend=nothing,
69
+
conditions_x_backend=nothing,
70
+
)
71
+
72
+
Picks the `lazy` parameter automatically based on the `linear_solver`, using the following heuristic: `lazy = linear_solver != \\`.
73
+
74
+
ImplicitFunction{lazy}(
75
+
forward, conditions;
76
+
linear_solver=lazy ? KrylovLinearSolver() : \\,
77
+
conditions_x_backend=nothing,
78
+
conditions_y_backend=nothing,
79
+
)
80
+
81
+
Picks the `linear_solver` automatically based on the `lazy` parameter.
82
+
63
83
# Function signatures
64
84
65
85
There are two possible signatures for `forward` and `conditions`, which must be consistent with one another:
@@ -87,8 +107,10 @@ Typically, direct solvers work best with dense Jacobians (`lazy = false`) while
87
107
# Condition backends
88
108
89
109
The provided `conditions_x_backend` and `conditions_y_backend` can be either:
110
+
- `nothing` (the default), in which case the outer backend (the one differentiating through the `ImplicitFunction`) is used.
90
111
- an object subtyping `AbstractADType` from [ADTypes.jl](https://github.com/SciML/ADTypes.jl);
91
-
- `nothing`, in which case the outer backend (the one differentiating through the `ImplicitFunction`) is used.
112
+
113
+
When differentiating with Enzyme as an outer backend, the default setting assumes that `conditions` does not contain writeable data involved in derivatives.
Constructor for an [`ImplicitFunction`](@ref) which picks the `linear_solver` automatically based on the `lazy` parameter.
112
127
"""
113
128
functionImplicitFunction{lazy}(
114
129
forward::F,
@@ -126,16 +141,6 @@ function ImplicitFunction{lazy}(
126
141
)
127
142
end
128
143
129
-
"""
130
-
ImplicitFunction(
131
-
forward, conditions;
132
-
linear_solver=KrylovLinearSolver(),
133
-
conditions_x_backend=nothing,
134
-
conditions_x_backend=nothing,
135
-
)
136
-
137
-
Constructor for an [`ImplicitFunction`](@ref) which picks the `lazy` parameter automatically based on the `linear_solver`, using the following heuristic: `lazy = linear_solver != \\`.
0 commit comments