Skip to content
Snippets Groups Projects
Verified Commit 9498a6f6 authored by Anton Akhmerov's avatar Anton Akhmerov
Browse files

take over sympy compatibility fixes from Kwant; closes #42

parent 1f24857b
No related branches found
No related tags found
No related merge requests found
Pipeline #114457 passed
......@@ -206,7 +206,11 @@ def sympify(expr, locals=None):
"identifiers and may not be keywords".format(repr(k)))
# sympify values of locals before updating it with extra_ns
locals = {k: sympify(v) for k, v in locals.items()}
# Cast numpy array values in locals to sympy matrices to make sure they have
# correct format
locals = {k: (sympy.Matrix(v) if isinstance(v, np.ndarray) else sympify(v))
for k, v in locals.items()}
for k, v in extra_ns.items():
locals.setdefault(k, v)
try:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment