-
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5dbd10d
commit 4d2f37a
Showing
5 changed files
with
34 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module NonlinearSolveTaylorDiffExt | ||
using NonlinearSolve: HalleyDescentCache, NonlinearFunction | ||
import NonlinearSolve: evaluate_hvvp | ||
using TaylorDiff: derivative, derivative! | ||
using FastClosures: @closure | ||
|
||
function evaluate_hvvp( | ||
hvvp, cache::HalleyDescentCache, f::NonlinearFunction{iip}, p, u, δu) where {iip} | ||
if iip | ||
binary_f = @closure (y, x) -> f(y, x, p) | ||
derivative!(hvvp, binary_f, cache.fu, u, δu, Val(2)) | ||
else | ||
unary_f = Base.Fix2(f, p) | ||
hvvp = derivative(unary_f, u, δu, Val(2)) | ||
end | ||
hvvp | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters