Skip to content

Commit b5db038

Browse files
Update FAQ.md
1 parent 33b01a9 commit b5db038

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

docs/src/basics/FAQ.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,21 @@ IterativeSolvers.jl computes the norm after the application of the left precondt
3939
`Pl`. Thus in order to use a vector tolerance `weights`, one can mathematically
4040
hack the system via the following formulation:
4141

42-
```@example FAQ1
42+
```@example FAQPrec
4343
using LinearSolve, LinearAlgebra
44-
n = 4
45-
weights = rand(n)
46-
Pl = LinearSolve.InvPreconditioner(Diagonal(weights))
47-
Pr = Diagonal(weights)
44+
45+
n = 2
4846
A = rand(n,n)
4947
b = rand(n)
5048
49+
weights = [1e-1, 1]
50+
Pl = LinearSolve.InvPreconditioner(Diagonal(weights))
51+
Pr = Diagonal(weights)
52+
53+
5154
prob = LinearProblem(A,b)
5255
sol = solve(prob,IterativeSolversJL_GMRES(),Pl=Pl,Pr=Pr)
56+
5357
sol.u
5458
```
5559

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

6064
```@example FAQ2
6165
using LinearSolve, LinearAlgebra
66+
6267
n = 4
68+
A = rand(n,n)
69+
b = rand(n)
70+
6371
weights = rand(n)
64-
realprec = rand(n)
72+
realprec = lu(rand(n,n)) # some random preconditioner
6573
Pl = LinearSolve.ComposePreconditioner(LinearSolve.InvPreconditioner(Diagonal(weights)),realprec)
6674
Pr = Diagonal(weights)
6775
68-
A = rand(n,n)
69-
b = rand(n)
70-
7176
prob = LinearProblem(A,b)
7277
sol = solve(prob,IterativeSolversJL_GMRES(),Pl=Pl,Pr=Pr)
7378
```

0 commit comments

Comments
 (0)