`.normalize()` fails for an empty QUBO
singular-value opened this issue · 1 comments
singular-value commented
In [38]: qv.QUBO({}).normalize()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-38-18b132978996> in <module>
----> 1 qv.QUBO({}).normalize()
~.../python3.8/site-packages/qubovert/utils/_dict_arithmetic.py in normalize(self, value)
781
782 """
--> 783 mult = value / max(abs(v) for v in self.values())
784 for k in self:
785 self[k] *= mult
ValueError: max() arg is an empty sequence
@jtiosue I'm happy to make a pull request so that this case would simply return the empty QUBO (or PCBO or whatever) back unchanged.
jtiosue commented
Thanks for finding this! It is now fixed on the dev branch. Hopefully soon I will merge dev to master and release a new version.