Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Fix complex infinity when lambdifying functions #267

merged 10 commits into from Mar 29, 2020


Copy link

@bocklund bocklund commented Mar 28, 2020

SymPy graphs that contain complex infinities cannot be built by SymEngine's Lambdify, raising with the error below. Here I converted all the complex infinity to just infinity, as we had in the codebase before switching to SymEngine.

This PR also addS a test that failed before applying this fix to the test suite.

~/Projects/pycalphad/pycalphad/codegen/ in build_functions(sympy_graph, variables, parameters, wrt, include_obj, include_grad, include_hess, func_options, grad_options, hess_options)
    111     graph = sympify(sympy_graph)
    112     # TODO: did not replace zoo with oo
--> 113     func = lambdify(inp, [graph], **_get_lambidfy_options(func_options))
    114     if include_grad or include_hess:
    115         grad_graphs = list(graph.diff(w) for w in wrt)

~/anaconda3/envs/calphad-dev-2/lib/python3.7/site-packages/symengine/ in lambdify(args, exprs, **kwargs)
     34     def lambdify(args, exprs, **kwargs):
---> 35         return Lambdify(args, *exprs, **kwargs)

symengine_wrapper.pyx in symengine.lib.symengine_wrapper.Lambdify()

symengine_wrapper.pyx in symengine.lib.symengine_wrapper._Lambdify.__init__()

symengine_wrapper.pyx in symengine.lib.symengine_wrapper.LLVMDouble._init()

RuntimeError: LLVMDouble can only represent real valued infinity

@bocklund bocklund requested a review from richardotis Mar 28, 2020
Copy link
Collaborator Author

@bocklund bocklund commented Mar 28, 2020

This issue was reported by Chris McGuire on Google Groups!msg/pycalphad/BmGyu6X1Q7s/UJjokFISAQAJ

@bocklund bocklund merged commit 6bcedd8 into develop Mar 29, 2020
5 checks passed
@bocklund bocklund deleted the fix-complex-inf branch Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants