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
39
39
` Pl ` . Thus in order to use a vector tolerance ` weights ` , one can mathematically
40
40
hack the system via the following formulation:
41
41
42
- ``` @example FAQ1
42
+ ``` @example FAQPrec
43
43
using LinearSolve, LinearAlgebra
44
- n = 4
45
- weights = rand(n)
46
- Pl = LinearSolve.InvPreconditioner(Diagonal(weights))
47
- Pr = Diagonal(weights)
44
+
45
+ n = 2
48
46
A = rand(n,n)
49
47
b = rand(n)
50
48
49
+ weights = [1e-1, 1]
50
+ Pl = LinearSolve.InvPreconditioner(Diagonal(weights))
51
+ Pr = Diagonal(weights)
52
+
53
+
51
54
prob = LinearProblem(A,b)
52
55
sol = solve(prob,IterativeSolversJL_GMRES(),Pl=Pl,Pr=Pr)
56
+
53
57
sol.u
54
58
```
55
59
@@ -59,15 +63,16 @@ of the weights like as follows:
59
63
60
64
``` @example FAQ2
61
65
using LinearSolve, LinearAlgebra
66
+
62
67
n = 4
68
+ A = rand(n,n)
69
+ b = rand(n)
70
+
63
71
weights = rand(n)
64
- realprec = rand(n)
72
+ realprec = lu( rand(n,n)) # some random preconditioner
65
73
Pl = LinearSolve.ComposePreconditioner(LinearSolve.InvPreconditioner(Diagonal(weights)),realprec)
66
74
Pr = Diagonal(weights)
67
75
68
- A = rand(n,n)
69
- b = rand(n)
70
-
71
76
prob = LinearProblem(A,b)
72
77
sol = solve(prob,IterativeSolversJL_GMRES(),Pl=Pl,Pr=Pr)
73
78
```
You can’t perform that action at this time.
0 commit comments