AndreyBychkov / QBee

Quadratization of differential equations
MIT License
7 stars 2 forks source link

Rework of polynomialization #11

Closed AndreyBychkov closed 1 year ago

AndreyBychkov commented 1 year ago

Polynomializaton is reworked to be more optimal algorithm. Computation time has increased, but not drastically due to the lower theoretical complexity compared to quadratization. Rework was made in one commit because the main changes were made in the fundumentals of the algorithm, so it is recommended to review polynomialization.py as a new file. However, the API of polynomialization remain the same except for a new optional parameter.

The integration with #10 is planned after upcoming merge.

pogudingleb commented 1 year ago

I get this when trying from qbee import *

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.9/site-packages/qbee/__init__.py", line 9, in <module>
    from .polynomialization import polynomialize, EquationSystem, Parameter
  File "/usr/local/lib/python3.9/site-packages/qbee/polynomialization.py", line 17, in <module>
    class VariablesHolder:
  File "/usr/local/lib/python3.9/site-packages/qbee/polynomialization.py", line 23, in VariablesHolder
    parameter_variables: set[sp.Symbol] | None = None,
TypeError: unsupported operand type(s) for |: 'types.GenericAlias' and 'NoneType'

Am I doing something wrong?

AndreyBychkov commented 1 year ago

Versions of Python below 3.9 will cause these errors. I can not estimate how much of a problem this is but I can downgrade typing given that Google Colab is currently 3.8.

pogudingleb commented 1 year ago

Well, I have exactly 3.9 and still get an error. Yes, it would be good to simplify things here