ecboghiu / inflation

Implementations of the Inflation Technique for Causal Inference.
GNU General Public License v3.0
22 stars 3 forks source link

Add symengine support #116

Open apozas opened 1 year ago

apozas commented 1 year ago

In a project I am using symengine for symbolic manipulation, which is so much faster than sympy. However, max_within_feasible does not admit symengine symbols, because of some incompatibilities between symengine and evalf. In fact, this is the exact error that I am getting, namely

  File "/export/anaconda3/envs/apozas/lib/python3.9/site-packages/inflation/sdp/quantum_tools.py", line 626, in make_numerical
    numeric_values[k] = float(v.evalf(subs=symbols_to_values))
  File "symengine_wrapper.pyx", line 979, in symengine.lib.symengine_wrapper.Basic.n
TypeError: n() got an unexpected keyword argument 'subs'

It would be nice to have support for both, symengine and sympy, so the user does not need to care about which symbolic library they are using.