@@ -127,41 +127,35 @@ end
127
127
end
128
128
129
129
@testset " Preconditioners" begin
130
- @testset " ScaleVector " begin
130
+ @testset " scaling_preconditioner " begin
131
131
s = rand ()
132
- α = rand ()
133
- β = rand ()
134
132
135
133
x = rand (n,n)
136
134
y = rand (n,n)
137
135
138
- Pl = LinearSolve. default_preconditioner (s, true )
139
- Pr = LinearSolve. default_preconditioner (s, false )
136
+ Pl = LinearSolve. scaling_preconditioner (s, true )
137
+ Pr = LinearSolve. scaling_preconditioner (s, false )
140
138
141
- mul! (y, Pl, x)
142
- mul! (y, Pr, x)
139
+ mul! (y, Pl, x); @test y ≈ s * x
140
+ mul! (y, Pr, x); @test y ≈ s \ x
143
141
144
- mul! (y, Pl, x, α, β)
145
- mul! (y, Pr, x, α, β)
142
+ y . = x; ldiv! (Pl, x); @test x ≈ s \ y
143
+ y . = x; ldiv! (Pr, x); @test x ≈ s * y
146
144
147
- ldiv! (Pl, x)
148
- ldiv! (Pr, x)
149
-
150
- ldiv! (y, Pl, x)
151
- ldiv! (y, Pr, x)
145
+ ldiv! (y, Pl, x); @test y ≈ s \ x
146
+ ldiv! (y, Pr, x); @test y ≈ s * x
152
147
153
148
end
154
149
155
150
@testset " ComposePreconditioenr" begin
156
- s = rand ()
157
- α = rand ()
158
- β = rand ()
151
+ s1 = rand ()
152
+ s2 = rand ()
159
153
160
154
x = rand (n,n)
161
155
y = rand (n,n)
162
156
163
- P1 = LinearSolve. default_preconditioner (s , true )
164
- P2 = LinearSolve. default_preconditioner (s, false )
157
+ P1 = LinearSolve. scaling_preconditioner (s1 , true )
158
+ P2 = LinearSolve. scaling_preconditioner (s2, true )
165
159
166
160
P = LinearSolve. ComposePreconditioner (P1,P2)
167
161
Pi = LinearSolve. InvComposePreconditioner (P)
@@ -172,11 +166,11 @@ end
172
166
@test Pi' == inv (P' )
173
167
174
168
# ComposePreconditioner
175
- ldiv! (P, x)
176
- ldiv! (y, P, x)
169
+ ldiv! (y, P, x); @test y ≈ ldiv! (P2, ldiv! (P1, x) )
170
+ y . = x; ldiv! (P, x); @test x ≈ ldiv! (P2, ldiv! (P1, y) )
177
171
178
172
# InvComposePreconditioner
179
- mul! (y, Pi, x)
173
+ mul! (y, Pi, x); @test y ≈ ldiv! (P2, ldiv! (P1, x))
180
174
181
175
end
182
176
end
0 commit comments