Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ For information on using the package,
[in-development documentation](https://docs.sciml.ai/LinearSolve/dev/) for the version of
the documentation which contains the unreleased features.


## High Level Examples

```julia
Expand Down
9 changes: 5 additions & 4 deletions test/enzyme.jl
Original file line number Diff line number Diff line change
Expand Up @@ -176,27 +176,28 @@ Enzyme.autodiff(Reverse, f3, Duplicated(copy(A), dA), Duplicated(copy(b1), db1),
=#

A = rand(n, n);
const _A = rand(n, n);
dA = zeros(n, n);
b1 = rand(n);
const _b1 = rand(n);
for alg in (
LUFactorization(),
RFLUFactorization() # KrylovJL_GMRES(), fails
)
@show alg
function fb(b)
prob = LinearProblem(A, b)
prob = LinearProblem(_A, b)

sol1 = solve(prob, alg)

sum(sol1.u)
end
fb(b1)

fd_jac = FiniteDiff.finite_difference_jacobian(fb, b1) |> vec
fd_jac = FiniteDiff.finite_difference_jacobian(fb, _b1) |> vec
@show fd_jac

en_jac = map(onehot(b1)) do db1
eres = Enzyme.autodiff(Forward, fb, Duplicated(copy(b1), db1))
eres = Enzyme.autodiff(Forward, fb, Duplicated(copy(_b1), db1))
eres[1]
end |> collect
@show en_jac
Expand Down
Loading