#18720: Change diagram algebra basis set partitions from list to generator
-------------------------------------+-------------------------------------
Reporter: ghseeli | Owner:
Type: enhancement | Status: new
Priority: minor | Milestone: sage-6.8
Component: algebra | Resolution:
Keywords: days65, partition | Merged in:
algebra, diagram algebra | Reviewers:
Authors: ghseeli | Work issues:
Report Upstream: N/A | Commit:
Branch: | c179733742da1d36d3ca7bd8e856be902cb5f30e
u/ghseeli/change_diagram_algebra_basis_set_partitions_from_list_to_generator|
Stopgaps:
Dependencies: |
-------------------------------------+-------------------------------------
Comment (by tscrim):
It looks a lot better. Considering how you're going to be using them, I
would instead make the iter methods return simple tuple of pairs (where
each pair is a tuple) as you don't seem to need the full weight of a
`SetPartition` object. This might require some other changes to the code,
but I doubt it will be that much.
I would also make the `AbstractPartitionDiagram` class compare equals with
`SetPartition` and lists/tuples/sets of lists/tuples/sets. This will make
it easier on the user to interact with the basis elements. I would also
just make one `AbstractPartitionDiagrams` class which takes a name (which
gets used in the `_repr_`), function, order, and category input as these
other classes seem useless (but perhaps you have plans for them). You
should also
{{{
Element = AbstractPartitionDiagram # Make this at the class level
(so de-indent it one level)
self.element_class = Element # Remove this, done automatically by
the category framework
}}}
I'd also change the `__iter__` to this:
{{{#!python
def __iter__(self):
for i in self.diagram_func(self.order):
yield self.element_class(self, i)
}}}
On a closer look/second thought, the `*_diagram` methods are not imported
into the public namespace, so it's okay to change the output to be
iterators. Just make sure to change the documentation appropriately.
On an unrelated to this ticket note, you can get rid of those (IMO)
annoying extra `[]` brackets in the element repr by passing
`bracket=False` (I believe, maybe it was `bracket=None`) in the
`CombinatorialFreeModule.__init__`.
--
Ticket URL: <http://trac.sagemath.org/ticket/18720#comment:6>
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.