Skip to content

Commit

Permalink
Update FAQ.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisRackauckas authored Aug 28, 2022
1 parent 33b01a9 commit b5db038
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions docs/src/basics/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,21 @@ IterativeSolvers.jl computes the norm after the application of the left precondt
`Pl`. Thus in order to use a vector tolerance `weights`, one can mathematically
hack the system via the following formulation:

```@example FAQ1
```@example FAQPrec
using LinearSolve, LinearAlgebra
n = 4
weights = rand(n)
Pl = LinearSolve.InvPreconditioner(Diagonal(weights))
Pr = Diagonal(weights)
n = 2
A = rand(n,n)
b = rand(n)
weights = [1e-1, 1]
Pl = LinearSolve.InvPreconditioner(Diagonal(weights))
Pr = Diagonal(weights)
prob = LinearProblem(A,b)
sol = solve(prob,IterativeSolversJL_GMRES(),Pl=Pl,Pr=Pr)
sol.u
```

Expand All @@ -59,15 +63,16 @@ of the weights like as follows:

```@example FAQ2
using LinearSolve, LinearAlgebra
n = 4
A = rand(n,n)
b = rand(n)
weights = rand(n)
realprec = rand(n)
realprec = lu(rand(n,n)) # some random preconditioner
Pl = LinearSolve.ComposePreconditioner(LinearSolve.InvPreconditioner(Diagonal(weights)),realprec)
Pr = Diagonal(weights)
A = rand(n,n)
b = rand(n)
prob = LinearProblem(A,b)
sol = solve(prob,IterativeSolversJL_GMRES(),Pl=Pl,Pr=Pr)
```

0 comments on commit b5db038

Please sign in to comment.