#19332: Add discrete_complementarity_set() method for cones
-------------------------------------+-------------------------------------
Reporter: mjo | Owner:
Type: enhancement | Status: needs_review
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 | 872932952e7db998d013637636ca82124ace544e
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by novoselt):
It does work correctly if you take into account `orthogonal_sublattice`
mentioned earlier, I was just too lazy to write the combination, but how
about
{{{
sage: self = Cone([(1,0)])
sage: dcs = [(r, n) for f, n in zip(self.facets(), self.facet_normals())
for r in f]
sage: dcs.extend((r, n) for r in self for n in
self.orthogonal_sublattice().basis())
sage: dcs.extend((r, -n) for r in self for n in
self.orthogonal_sublattice().basis())
sage: dcs
[(N(1, 0), M(0, 1)), (N(1, 0), M(0, -1))]
sage: self = Cone([(1,0),(0,1)])
sage: dcs = [(r, n) for f, n in zip(self.facets(), self.facet_normals())
for r in f]
sage: dcs.extend((r, n) for r in self for n in
self.orthogonal_sublattice().basis())
sage: dcs.extend((r, -n) for r in self for n in
self.orthogonal_sublattice().basis())
sage: dcs
[(N(1, 0), M(0, 1)), (N(0, 1), M(1, 0))]
}}}
Note that some rays here will be immutable while others not, so perhaps
the actual implementation should be
{{{
#!python
@cached_method
def discrete_complementarity_set(self):
dcs = [(r, n) for f, n in zip(self.facets(), self.facet_normals()) for
r in f]
# Extra elements for non-full-dimensional cones
orthogonal_generators = list(self.orthogonal_sublattice().gens())
orthogonal_generators += [-g for g in orthogonal_generators]
[g.set_immutable() for g in orthogonal_generators]
dcs.extend((r, g) for r in self for g in orthogonal_generators)
return tuple(dcs)
}}}
with doc fixes that a tuple is returned.
If your tests for large cones show that it is indeed faster, let's use
this one. I am quite positive that it will be faster on its own, but if
you take constructing the face lattice into account it is not so obvious
anymore.
The graphs was more of a joke, typical use would probably be iterating
over edges and that's exactly what your function is returning directly.
--
Ticket URL: <http://trac.sagemath.org/ticket/19332#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.