Skip to content

Commit

Permalink
Jacobian multiple-dispatched for vectors
Browse files Browse the repository at this point in the history
  • Loading branch information
jkosata committed Dec 28, 2023
1 parent 5daae66 commit fd66681
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/solve_homotopy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,10 @@ Substitute the values according to `fixed_parameters` and compile into a functio
"""
function compile_matrix(matrix, variables, fixed_parameters)
J = substitute_all(matrix, fixed_parameters)
matrix = [build_function(el, variables) for el in J]
matrix = eval.(matrix)
function m(s::OrderedDict)
vals = [s[var] for var in variables]
return [ComplexF64(Base.invokelatest(el, vals)) for el in matrix]
end
matrix = build_function(J, variables)
matrix = eval(matrix[1]) # compiled allocating function, see Symbolics manual
m(vals::Vector) = matrix(vals)
m(s::OrderedDict) = m([s[var] for var in variables]) # for the UI
return m
end

Expand Down

0 comments on commit fd66681

Please sign in to comment.