File tree Expand file tree Collapse file tree 1 file changed +14
-9
lines changed
Expand file tree Collapse file tree 1 file changed +14
-9
lines changed Original file line number Diff line number Diff 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
4040hack the system via the following formulation:
4141
42- ``` @example FAQ1
42+ ``` @example FAQPrec
4343using LinearSolve, LinearAlgebra
44- n = 4
45- weights = rand(n)
46- Pl = LinearSolve.InvPreconditioner(Diagonal(weights))
47- Pr = Diagonal(weights)
44+
45+ n = 2
4846A = rand(n,n)
4947b = rand(n)
5048
49+ weights = [1e-1, 1]
50+ Pl = LinearSolve.InvPreconditioner(Diagonal(weights))
51+ Pr = Diagonal(weights)
52+
53+
5154prob = LinearProblem(A,b)
5255sol = solve(prob,IterativeSolversJL_GMRES(),Pl=Pl,Pr=Pr)
56+
5357sol.u
5458```
5559
@@ -59,15 +63,16 @@ of the weights like as follows:
5963
6064``` @example FAQ2
6165using LinearSolve, LinearAlgebra
66+
6267n = 4
68+ A = rand(n,n)
69+ b = rand(n)
70+
6371weights = rand(n)
64- realprec = rand(n)
72+ realprec = lu( rand(n,n)) # some random preconditioner
6573Pl = LinearSolve.ComposePreconditioner(LinearSolve.InvPreconditioner(Diagonal(weights)),realprec)
6674Pr = Diagonal(weights)
6775
68- A = rand(n,n)
69- b = rand(n)
70-
7176prob = LinearProblem(A,b)
7277sol = solve(prob,IterativeSolversJL_GMRES(),Pl=Pl,Pr=Pr)
7378```
You can’t perform that action at this time.
0 commit comments