@@ -280,16 +280,17 @@ function init_basis_matrix!(T, A, X, x, eq, Δbasis, radius, complex_plane; abst
280280 k = 1
281281 i = 1
282282
283+ eq_fun = build_function (eq, x; expression = false )
284+ Δbasis_fun = build_function .(Δbasis, x; expression = false )
285+
283286 while k <= n
284287 try
285- x₀ = test_point (complex_plane, radius)
286- X[k] = x₀
287- d = Dict (x => x₀)
288+ X[k] = test_point (complex_plane, radius)
289+ b₀ = eq_fun (X[k])
288290
289- b₀ = Complex {T} (substitute (eq, d))
290291 if is_proper (b₀)
291292 for j in 1 : n
292- A[k, j] = Complex {T} ( substitute (Δbasis [j], d) ) / b₀
293+ A[k, j] = Δbasis_fun [j](X[k] ) / b₀
293294 end
294295 if all (is_proper, A[k, :])
295296 k += 1
@@ -304,17 +305,21 @@ end
304305function modify_basis_matrix! (T, A, X, x, eq, ∂eq, Δbasis, radius; abstol = 1e-6 )
305306 n = size (A, 1 )
306307 k = 1
308+
309+ eq_fun = build_function (eq, x; expression = false )
310+ ∂eq_fun = build_function (∂eq, x; expression = false )
311+ Δbasis_fun = build_function .(Δbasis, x; expression = false )
312+
307313 for k in 1 : n
308- d = Dict (x => X[k])
309314 # One Newton iteration toward the poles
310315 # note the + sign instead of the usual - in Newton-Raphson's method. This is
311316 # because we are moving toward the poles and not zeros.
312- x₀ = X[k] + Complex {T} (substitute (eq, d)) / Complex {T} (substitute (∂eq, d))
317+
318+ x₀ = X[k] + eq_fun (X[k]) / ∂eq_fun (X[k])
313319 X[k] = x₀
314- d = Dict (x => x₀)
315- b₀ = Complex {T} (substitute (eq, d))
320+ b₀ = eq_fun (X[k])
316321 for j in 1 : n
317- A[k, j] = Complex {T} ( substitute (Δbasis [j], d) ) / b₀
322+ A[k, j] = Δbasis_fun [j](X[k] ) / b₀
318323 end
319324 end
320325end
0 commit comments