Opened 7 years ago

Closed 3 years ago

#15291 closed enhancement (wontfix)

The Matroid() function should support rings that don't implement is_field()

Reported by: Stefan Owned by:
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: matroid theory Keywords: matroid
Cc: Merged in:
Authors: Reviewers: Jeroen Demeyer
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:



sage: R.<x,y> = ZZ['x','y']
sage: Q = R.quotient([x^2 - y + 1, y^3 + 3 * x - 7])
sage: A = Matrix(Q, [[1,0,1],[0,1,1]])
sage: M = Matroid(A)
Traceback (most recent call last)


Catch NotImplementedError? in a try... except block. Probably do the same for the order() test in the same line of code of sage/matroids/

Change History (9)

comment:1 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.1 to sage-6.2

comment:2 Changed 6 years ago by Rajesh_Veeranki

I'm not sure what should be written inside the except block.How do we construct a matroid from a ring which is not a field, and which function to use.Please clarify,seeing the code i've pasted!

if 'matrix' in kwds:
            if base_ring == GF(2):
                M = BinaryMatroid(groundset=kwds['groundset'], matrix=A)
            elif base_ring == GF(3):
                M = TernaryMatroid(groundset=kwds['groundset'], matrix=A)
                    if base_ring.is_field():
                            if base_ring.order() == 4:  # GF(4) can have different generators.
                                M = QuaternaryMatroid(groundset=kwds['groundset'], matrix=A)
                                M = LinearMatroid(groundset=kwds['groundset'], matrix=A, ring=base_ring)
                        except NotImplementedError:
                            raise NotImplementedError
                except NotImplementedError:
                    raise NotImplementedError

comment:3 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.2 to sage-6.3

comment:4 Changed 6 years ago by vbraun_spam

  • Milestone changed from sage-6.3 to sage-6.4

comment:5 Changed 6 years ago by slelievre

A similar discussion (try/except around is_field) took place at #10063.

Last edited 6 years ago by slelievre (previous) (diff)

comment:6 Changed 3 years ago by jdemeyer

  • Milestone changed from sage-6.4 to sage-duplicate/invalid/wontfix
  • Reviewers set to Jeroen Demeyer
  • Status changed from new to needs_review

The issue from this ticket is fixed by #23382.

However, even then the example does not work because Q is not a field. Linear matroids (defined using matrices) require linear algebra, which really means that they should be defined over a field. One might get away with integral domains by going to the fraction field (and it's not clear to me that Q really is an integral domain). In any case, Sage is unable to do non-trivial arithmetic in Q, so this example does not work.

comment:7 Changed 3 years ago by jdemeyer

  • Status changed from needs_review to positive_review

comment:8 Changed 3 years ago by Stefan

Not completely accurate. Matroid theory research includes matroids representable over "partial fields", where the entries are from a ring, and the submatrix determinants are all zero or in a multiplicative group of units from that ring. Easiest example: the ring is ZZ and the group is {-1,1}. This gives the regular matroids (they happen to have a custom implementation in Sage using the RegularMatroid? class, but other partial fields don't).

Sage's LinearMatroid? class has support for partial fields, especially through the "fundamentals=" argument to some methods. Internally everything was designed to work with such matrices. Consideration for these lead to tickets like #17692 and #15297 and #15295 .

I assume #23382 fixes the issue reported here (I'll try to review that this weekend), so I will leave this ticket as positive_review.

comment:9 Changed 3 years ago by embray

  • Resolution set to wontfix
  • Status changed from positive_review to closed

Closing tickets in the sage-duplicate/invalid/wontfix module with positive_review (i.e. someone has confirmed they should be closed).

Note: See TracTickets for help on using tickets.