Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
utkarsh530 committed Oct 9, 2023
1 parent 33e9387 commit 923ad7c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
14 changes: 7 additions & 7 deletions docs/src/tutorials/advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -278,12 +278,12 @@ For more information on the preconditioner interface, see the

## Speed up Jacobian computation with sparsity exploitation and matrix coloring

To cut down the of Jacobian building overhead, we can choose to exploit the sparsity pattern and deploy matrix coloring during Jacobian construction. With NonlinearSolve.jl, we can simply use ```autodiff=AutoSparseForwardDiff()``` to automatically exploit the sparsity pattern of Jacobian matrices:
To cut down the of Jacobian building overhead, we can choose to exploit the sparsity pattern and deploy matrix coloring during Jacobian construction. With NonlinearSolve.jl, we can simply use `autodiff=AutoSparseForwardDiff()` to automatically exploit the sparsity pattern of Jacobian matrices:

```@example ill_conditioned_nlprob
@benchmark solve(prob_brusselator_2d,
NewtonRaphson(linsolve=KrylovJL_GMRES(), precs=incompletelu, concrete_jac=true,
autodiff=AutoSparseForwardDiff()));
NewtonRaphson(linsolve = KrylovJL_GMRES(), precs = incompletelu, concrete_jac = true,
autodiff = AutoSparseForwardDiff()));
nothing # hide
```

Expand All @@ -292,11 +292,11 @@ To setup matrix coloring for the jacobian sparsity pattern, we can simply get th
```@example ill_conditioned_nlprob
using ArrayInterface
colorvec = ArrayInterface.matrix_colors(jac_sparsity)
ff = NonlinearFunction(brusselator_2d_loop; jac_prototype=float.(jac_sparsity), colorvec)
ff = NonlinearFunction(brusselator_2d_loop; jac_prototype = float.(jac_sparsity), colorvec)
prob_brusselator_2d_sparse = NonlinearProblem(ff, u0, p)
@benchmark solve(prob_brusselator_2d_sparse,
NewtonRaphson(linsolve=KrylovJL_GMRES(), precs=incompletelu, concrete_jac=true,
autodiff=AutoSparseForwardDiff()));
NewtonRaphson(linsolve = KrylovJL_GMRES(), precs = incompletelu, concrete_jac = true,
autodiff = AutoSparseForwardDiff()));
nothing # hide
```
```
1 change: 0 additions & 1 deletion test/basictests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ end
@test (@ballocated solve!($cache)) < 200
end


precs = [
NonlinearSolve.DEFAULT_PRECS,
(args...) -> (Diagonal(rand!(similar(u0))), nothing),
Expand Down

0 comments on commit 923ad7c

Please sign in to comment.