#19603: Quotient of incompatible lattices
-------------------------------------+-------------------------------------
       Reporter:  mjo                |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-6.10
      Component:  geometry           |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Andrey             |    Reviewers:  Michael Orlitzky
  Novoseltsev                        |  Work issues:
Report Upstream:  N/A                |       Commit:
         Branch:                     |  3c1cb53843a3582a6dc5808c89c81bb30011c960
  u/mjo/ticket/19603                 |     Stopgaps:
   Dependencies:                     |
-------------------------------------+-------------------------------------
Changes (by mjo):

 * reviewer:   => Michael Orlitzky
 * branch:  u/novoselt/quotient_of_incompatible_lattices =>
             u/mjo/ticket/19603
 * commit:  399bc7383ab3ac9edbffd4f21f5dd9cb3fd9b86c =>
     3c1cb53843a3582a6dc5808c89c81bb30011c960


Comment:

 I added some tests/examples to the `quotient` method but noticed something
 strange when I went to do the same for the `ToricLattice_quotient` class.
 The code in the class calls `submodule()` which is where the error is
 expected to occur:

 {{{
 if check:
     try:
         W = V.submodule(W)
     except (TypeError, ArithmeticError):
         raise ArithmeticError("W must be a sublattice of V")
 }}}

 But the `submodule()` method isn't throwing one of those two errors --
 it's throwing a `ValueError`. The result is that the user sees the
 exception thrown from `submodule()` and not the (nicer) error from the
 quotient class:

 {{{
 sage: from sage.geometry.toric_lattice import ToricLattice_quotient
 sage: N = ToricLattice(3)
 sage: M = ToricLattice(3, name='M')
 sage: ToricLattice_quotient(N,M)
 ...
 ValueError: M(1, 0, 0) can not generate a sublattice of 3-d lattice N
 }}}

 For the wishlist, it might help to report something other than the
 variable names in the `ToricLattice_quotient` error message. So instead
 of,

 {{{
 ArithmeticError: W must be a sublattice of V
 }}}

 it could be,

 {{{
 ArithmeticError: 3-d lattice M must be a sublattice of 3-d lattice N
 }}}

 but I realize that's hard to do if the user passes in weirder objects. We
 could get part of the way there by checking that `V` is in fact a lattice
 before doing the `submodule()` check. That way `V` will print nicely, and
 even if the user passes in something stupid it would read alright:

 {{{
 ArithmeticError: Petersen graph: Graph on 10 vertices is not a sublattice
 of 3-d lattice N
 }}}
 ----
 New commits:
 
||[http://git.sagemath.org/sage.git/commit/?id=399bc7383ab3ac9edbffd4f21f5dd9cb3fd9b86c
 399bc73]||{{{Improve checks for toric lattice span and quotient.}}}||
 
||[http://git.sagemath.org/sage.git/commit/?id=5f62fd8c978aa67c8de7c554dda4aa1d7644fed9
 5f62fd8]||{{{Trac #19603: remove trailing whitespace (review).}}}||
 
||[http://git.sagemath.org/sage.git/commit/?id=3c1cb53843a3582a6dc5808c89c81bb30011c960
 3c1cb53]||{{{Trac #19603: add a few more examples and tests for lattice
 quotients (review).}}}||

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