Cremona writes:
However, there are some things I really do not like about this implementation:
1. self.reduce() computes (if necessary) caches and returns the reduced form equivalent to
self. I would expect it to change self into the reduced form, and have a different function
self.reduced_form() to do what this function does.
2. The function is_reduced() actually reduces self and tests if the result is the same as
self. This is potentially very expensive! To test is_reduced() you should just test that the
usual inequalities are satisfied.
I have attached a patch which I believe fixes these issues. I have also altered the reduction methods to throw more enlightening exceptions when given negative definite forms and indefinite forms.
It would be nice to implement the the handling of indefinite and negative definite forms at some point in the future, however I don't think Pari can deal with negative definite forms currently.