I am using SageMath 10.4. m = matrix(GF(11), [[1,5,0,0], [5,1,9,0], [0,9,1,5], [0,0,5,1]]) qf = QuadraticForm(m) Q, T = qf.rational_diagonal_form(return_matrix=True) T == identity_matrix(GF(11), 4) # True
The transformation T is computed as the identity matrix, which is clearly wrong. I think the problem is in QuadraticForm._rational_diagonal_form_and_transformation, because the matrix m is singular, so it triggers this section: except ZeroDivisionError: # Singular case is not fully supported by PARI pass and proceeds to the general case. However, Q has already been modified. Indeed, we can skip the PARI special case altogether by setting: setattr(qf, "__pari__", lambda: 1/0) # raises an exception before computing the rational diagonal form. This gives the correct T. Thanks. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/7997d8b1-9973-4a69-8341-89ecf53207ccn%40googlegroups.com.