#19112: Add a function "isometry" to the quadratic forms package.
-------------------------------------+-------------------------------------
       Reporter:  tgaona             |        Owner:
           Type:  enhancement        |       Status:  needs_work
       Priority:  minor              |    Milestone:  sage-6.10
      Component:  quadratic forms    |   Resolution:
       Keywords:  isometry           |    Merged in:
        Authors:  Tyler Gaona        |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/tgaona/ticket/19112              |  582ae4500eb3652446c6f829310298953f8dbd02
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------

Comment (by tgaona):

 Replying to [comment:23 jdemeyer]:
 > Why does the final term need to be a special case? I don't like special
 cases unless they are justified.

 It was originally necessary because the `short_vector_list_up_to_length()`
 function didn't work for 1-dimensional quadratic forms, and the final
 iteration of the algorithm operates on two 1-dimensional forms. However,
 since that's been replaced by the PARI method, it's no longer necessary to
 have it as a special case, so thanks for pointing that out.

 > Are you sure it's worth to check `is_diagonal`? Is there significant
 gain?

 I suppose not, and simplifies the code to remove it, so I will.

 > Are you sure it's worth to check `is_rationally_isometric`?

 I believe this is necessary. The loop that looks for two vectors such that
 the modified bases including them will be non-singular will try vectors
 indefinitely until it finds a satisfactory pair. If the forms aren't
 equivalent there's no guarantee such a pair will be found.

 > Do you really need the `copy` in the function `isometry`?

 Nope. That's a relic from an early version when `isometry` and
 `diagonal_isometry` were one function. I'll remove it, thanks for catching
 that.

 > Can you explain this block of code:
 {{{
 +            # Find a vector w such that Q(v) = F(w) where v = [1, ..., 0]
 +            # v, w = vectors_of_common_length_dev(Q, F, q_basis, f_basis,
 i)
 +            v = vector([0] * (n - i))
 +            index = 0;
 +            while True:
 +                v[index] = v[index] + 1
 +                index = (index + 1) % (n - i)
 +                c = Q(v)
 +                try:
 +                    w = F.solve(c)
 +                    #print("Find vectors {0} and {1} such that Q(v) =
 F(w)".format(v, w))
 +                    if not zero_row(f_basis, w, i) and not
 zero_row(q_basis, v, i):
 +                        break
 +                except ArithmeticError:
 +                    # No solution found, try another vector.
 +                    pass
 }}}

 This block finds a pair of vectors `v` and `w` such that `Q(v) == F(v)`.
 These vectors will represent a linear combination of the vectors in the
 basis for each quadratic form. It's necessary that modifying the bases to
 include these vectors not produce a basis whose matrix is singular. So
 essentially this loop just looks for a pair of vectors satsifying these
 properties. It starts with `v = [1, 0, 0]` (for a 3-dimensional form) and
 finds `w` by calling `F.solve(Q(v))`. If this pair doesn't work, it finds
 a new `v` and starts over. I get new `v`'s by incrementing each term in
 the vector so the first few vectors that are generated are: `[1, 0, 0],
 [1, 1, 0], [1, 1, 1], [2, 1, 1]...`

 Also, I realized that matrices have an `is_singular` function, so I'm
 getting rid of the `zero_row` function.
 ----
 New commits:
 
||[http://git.sagemath.org/sage.git/commit/?id=582ae4500eb3652446c6f829310298953f8dbd02
 582ae45]||{{{Minor bugfixes/refactoring on isometry}}}||

--
Ticket URL: <http://trac.sagemath.org/ticket/19112#comment:31>
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