Skip to content

Commit

Permalink
remove _convert_or_zero
Browse files Browse the repository at this point in the history
  • Loading branch information
oameye committed Nov 18, 2024
1 parent f0f991f commit cf31dcd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 12 deletions.
4 changes: 2 additions & 2 deletions src/solve_homotopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,8 @@ function pad_solutions(solutions::Array{Vector{Vector{ComplexF64}}}; padding_val
end

function newton(prob::Problem, soln::OrderedDict)
vars = _convert_or_zero.(substitute_all(prob.variables, soln))
pars = _convert_or_zero.(substitute_all(prob.parameters, soln))
vars = substitute_all(prob.variables, soln)
pars = substitute_all(prob.parameters, soln)

return HC.newton(prob.system, vars, pars)
end
Expand Down
11 changes: 1 addition & 10 deletions src/utils.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
is_real(x) = abs(imag(x)) / abs(real(x)) < IM_TOL::Float64 || abs(x) < 1e-70
is_real(x) = abs(imag(x)) / abs(real(x)) < IM_TOL || abs(x) < 1e-70
is_real(x::Array) = is_real.(x)

flatten(a) = collect(Iterators.flatten(a))
Expand All @@ -9,12 +9,3 @@ _symidx(sym::Num, args...) = findfirst(x -> isequal(x, sym), _free_symbols(args.
tuple_to_vector(t::Tuple) = [i for i in t]
_str_to_vec(s::Vector) = s
_str_to_vec(s) = [s]

function _convert_or_zero(x, t=ComplexF64)
try
convert(t, x)
catch ArgumentError
@warn string(x) * " not supplied: setting to zero"
return 0
end
end

0 comments on commit cf31dcd

Please sign in to comment.