#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 Rudi):

 Replying to [comment:30 tscrim]:

 > > 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).
 But then we would have 3 public methods. I'm trying to reduce that number
 to 1, if I can do so  without losing functionality.

 I think that once you have computed `self.binary_representation()`,
 computing `bool(self.binary_representation())` has nothing to do with
 `class Matroids` anymore, the user can do that themselves. I also prefer
 to avoid caching if I can do so without complicating things, since I feel
 the user should be in control of memory usage as much as possible (they
 may one day want to keep as many matroids in memory as possible, without
 having a need for all this cached information).  So to my mind, having the
 method `binary_representation` makes the method `is_binary` redundant. The
 converse is not true, so that is why I would want to replace `is_binary`
 with `binary_representation`.

 It is true that any matroid has a `local binary matroid` relative to a
 basis, but I'm not so sure if this concept appears anywhere in the
 literature under that name (or any name, it's just an intermediate
 object). What matters for the user is that they can bypass verification if
 they already know that the matroid is binary. So I could perhaps fit
 binary_representation with an optional input `verify = True`, so that if
 you set `verify = False` you skip the isomorphism testing at the end.
 Effectively, you then just get the `local_binary_matroid` passed on
 without extra work. So then I would also prefer to keep a hidden
 `_local_binary_matroid`.

 Stefan, if you are tuned to this channel, how do you feel about this? I
 think we at some point discussed a general policy of not having more than
 one public method dealing with very similar functionality in Matroid, if
 possible. But how about this particular function?

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