Skip to content

Commit

Permalink
ENH: move data arguments to front for partial
Browse files Browse the repository at this point in the history
This is required for defining a gradient over the parameters
  • Loading branch information
redeboer committed May 16, 2023
1 parent d156026 commit 64963c0
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/tensorwaves/function/sympy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,10 @@ def create_parametrized_function(
[0.0, 0.0, 0.0, 0.0, 0.0]
"""
free_symbols = _get_free_symbols(expression)
sorted_symbols = sorted(free_symbols, key=lambda s: s.name)
parameter_set = set(parameters)
parameter_symbols = sorted(free_symbols & parameter_set, key=lambda s: s.name)
data_symbols = sorted(free_symbols - parameter_set, key=lambda s: s.name)
sorted_symbols = tuple(data_symbols + parameter_symbols) # for partial+gradient
lambdified_function = _lambdify_normal_or_fast(
expression=expression,
symbols=sorted_symbols,
Expand Down

0 comments on commit 64963c0

Please sign in to comment.