#19332: Add discrete_complementarity_set() method for cones
-------------------------------------+-------------------------------------
       Reporter:  mjo                |        Owner:
           Type:  enhancement        |       Status:  needs_work
       Priority:  major              |    Milestone:  sage-6.9
      Component:  geometry           |   Resolution:
       Keywords:                     |    Merged in:
        Authors:  Michael Orlitzky   |    Reviewers:
Report Upstream:  N/A                |  Work issues:
         Branch:                     |       Commit:
  u/mjo/ticket/19332                 |  88b74bba339c1ff53063ebe43819b222fd478f1b
   Dependencies:                     |     Stopgaps:
-------------------------------------+-------------------------------------
Changes (by novoselt):

 * status:  needs_review => needs_work


Comment:

 I do not like the implementation at all, why do we need to do
 {{{
 sage: self = Cone([(1,0),(0,1)])
 sage: V = self.lattice().vector_space()
 sage: G1 = [ V(x) for x in self.rays() ]
 sage: G2 = [ V(s) for s in self.dual().rays() ]
 sage: [ (x,s) for x in G1 for s in G2 if x.inner_product(s) == 0 ]
 [((1, 0), (0, 1)), ((0, 1), (1, 0))]
 }}}
 when exactly the same is achieved with
 {{{
 sage: [(x, s) for x in self for s in self.dual() if x * s == 0]
 [(N(1, 0), M(0, 1)), (N(0, 1), M(1, 0))]
 }}}
 which uses only memory for tuples (but not their elements) and can be
 cached???

 Products work just fine between rays of dual cones and to big extent the
 whole point of introducing toric lattices was to allow only "correct" ways
 of mixing them, i.e. you cannot multiply rays that live in the same
 lattice. If the user is not happy with the type of the above output and
 wants to do illegal products, that user is welcome to do explicit
 conversion.

 Note also that the result can be achieved using
 {{{
 sage: [[(r, n) for r in f] for f, n in zip(self.facets(),
 self.facet_normals())]
 [[(N(1, 0), M(0, 1))], [(N(0, 1), M(1, 0))]]
 sage: self.orthogonal_sublattice()
 Sublattice <>
 }}}
 which will not be as short of a code and above, but may be faster if face
 lattice is used (and thus computed/cached) for something else. Not sure if
 there is any point in using it for the implementation, but perhaps the
 relation can be mentioned in the documentation (and I definitely like your
 detailed docstrings!).

 A bipartite graph also seems to be a natural structure for the output ;-)

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