@@ -45,7 +45,7 @@ function idrs!(x, A, b;
45
45
history = ConvergenceHistory (partial= ! log)
46
46
history[:tol ] = tol
47
47
reserve! (history,:resnorm , maxiter)
48
- idrs_method! (history, x, linsys_op, (A,) , b, s, tol, maxiter; kwargs... )
48
+ idrs_method! (history, x, A , b, s, tol, maxiter; kwargs... )
49
49
log && shrink! (history)
50
50
log ? (x, history) : x
51
51
end
67
67
om
68
68
end
69
69
70
- @inline linsys_op (x, A) = A* x
71
-
72
- function idrs_method! (log:: ConvergenceHistory , X, op, args, C:: T ,
70
+ function idrs_method! (log:: ConvergenceHistory , X, A, C:: T ,
73
71
s:: Number , tol:: Number , maxiter:: Number ; smoothing:: Bool = false , verbose:: Bool = false
74
72
) where {T}
75
73
76
74
verbose && @printf (" === idrs ===\n %4s\t %7s\n " ," iter" ," resnorm" )
77
- R = C - op (X, args ... ) :: T
75
+ R = C - A * X
78
76
normR = vecnorm (R)
79
77
iter = 1
80
78
@@ -123,7 +121,7 @@ function idrs_method!(log::ConvergenceHistory, X, op, args, C::T,
123
121
V .= R .- V
124
122
125
123
U[k] .= Q .+ om .* V
126
- G[k] = op ( U[k], args ... )
124
+ A_mul_B! ( G[k], A, U[k])
127
125
128
126
# Bi-orthogonalise the new basis vectors
129
127
@@ -164,15 +162,15 @@ function idrs_method!(log::ConvergenceHistory, X, op, args, C::T,
164
162
return X
165
163
end
166
164
if k < s
167
- f[k+ 1 : s] = f[k + 1 : s] - beta* M[k+ 1 : s,k]
165
+ f[k+ 1 : s] .- = beta* M[k+ 1 : s,k]
168
166
end
169
167
iter += 1
170
168
end
171
169
172
170
# Now we have sufficient vectors in G_j to compute residual in G_j+1
173
171
# Note: r is already perpendicular to P so v = r
174
172
copy! (V, R)
175
- Q = op (V, args ... ) :: T
173
+ A_mul_B! (Q, A, V)
176
174
om = omega (Q, R)
177
175
R .- = om .* Q
178
176
X .+ = om .* V
0 commit comments