#18669: Use PARI to compute rational_diagonal_form()
-------------------------------------+-------------------------------------
       Reporter:  jdemeyer           |        Owner:
           Type:  enhancement        |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.8
      Component:  quadratic forms    |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Jeroen Demeyer     |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/jdemeyer/use_pari_to_compute_rational_diagonal_form__|  
3ee588dd37871a4a28e7db768e66ab4a44dacd3e
   Dependencies:  #18656             |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by mmarco):

 Are you sure it always works as expected?

 BEfore your changes, we have:

 {{{
 sage: Q = matrix(QQ,[[0,1],[1,0]])
 sage: F = QuadraticForm(Q)
 sage: F.rational_diagonal_form()
 Quadratic form in 2 variables over Rational Field with coefficients:
 [ 1 0 ]
 [ * -1/4 ]
 }}}

 But if we try to do what you propose:

 {{{
 sage: Q = matrix(QQ,[[0,1],[1,0]])
 sage: F = QuadraticForm(Q)
 sage: F.rational_diagonal_form()
 Quadratic form in 2 variables over Rational Field with coefficients:
 [ 1 0 ]
 [ * -1/4 ]
 sage: F._pari_()
 [0, 1; 1, 0]
 sage: F._pari_().qfgaussred()
 [1/2, 1; -1, -1/2]
 sage: MS = MatrixSpace(QQ,2,2)
 sage: D = MS()
 sage: D[0,0] = R[0,0]
 sage: D[1,1] = R[1,1]
 sage: Q.parent()(D)
 [ 1/2    0]
 [   0 -1/2]

 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/18669#comment:5>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to