#18448: Add test if a matroid is binary
-------------------------------------+-------------------------------------
Reporter: Rudi | Owner: Rudi
Type: enhancement | Status: needs_review
Priority: minor | Milestone: sage-6.8
Component: matroid theory | Resolution:
Keywords: | Merged in:
Authors: Rudi Pendavingh | Reviewers: Travis Scrimshaw
Report Upstream: N/A | Work issues:
Branch: | Commit:
u/tscrim/binary_matroid-18448 | ada67429271b6cee84b18067de07648e3116ab55
Dependencies: | Stopgaps:
-------------------------------------+-------------------------------------
Comment (by tscrim):
Replying to [comment:27 Rudi]:
> About making _local_binary_matroid() public... Well now that you bring
this up, I agree that getting the actual binary representation itself may
be useful to the user too. But with this pair of methods, if the user now
wants a verified binary representation, they need to run both methods, one
repeating the work of the other. And there would be two public methods in
the interface dealing with one issue.
From my (somewhat limited) understanding, every matroid has a local binary
matroid, but it may not be isomorphic to the original matroid. So there
are separate concerns (and IMO the user should know from the documentation
to call `is_binary` if that is what they really want to check).
> Also, next up are ternary and quaternary matroids. For quaternary
matroids the situation is more subtle. Unlike `local_binary_matroid`, the
`local_quaternary_matroid` method may arrive at the conclusion that there
is no quaternary representation. My idea was to let it output `None` in
such cases. So then you would have very similar public methods behaving
slightly different.
You could either return `None` or raise an error. Both are acceptable to
me. Yet this is for a follow-up ticket.
> There may be another solution. I could rewrite `is_binary()` to a method
`binary_representation()`, which outputs a `BinaryMatroid` equal to
`self`, or `None` if no such binary matroid exists. The changes would be
minimal. The user could still do `if M.binary_representation():` if they
only care about existence.
It actually would work to have 3 methods, one for the local (if my
understanding is wrong, then we'd remove this method),
`binary_representation()` and `is_binary()`, where we cache the output of
`binary_representation()`, and `is_binary` just calls
`bool(self.binary_representation())` (or if raising an error sounds
better, a try-catch statement).
--
Ticket URL: <http://trac.sagemath.org/ticket/18448#comment:30>
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.