Problems implementing Matroid Union, Ticket 14667

55 views
Skip to first unread message

Rajesh Veeranki

unread,
Feb 15, 2014, 10:45:18 AM2/15/14
to sage-m...@googlegroups.com
Hi,

I have tried implementing the Matroid Union function, ticket 14667.
It works fine when run as a stand alone file.But when i include it in the matroids module,and make, and call the function,
i get NotImplementedError: subclasses need to implement this.The stack-trace can be found here

Here is the matroid_union.py file that i added.
And here is the stand alone file that works.

Please let me know what i'm missing, as i'm new to the dev process.Also can you give me more test-cases to verify my implementation.

Thanks,
Rajesh Veeranki

Rudi Pendavingh

unread,
Feb 15, 2014, 1:13:52 PM2/15/14
to sage-m...@googlegroups.com
Hi Rajeesh,

welcome, and thanks for your work on the matroid code.

I'm fairly new to Sage's development process myself, we developed the matroid package outside Sage for a long time. 

So let me first point you to the pages where Sage's process is described:

Briefly, to work on this ticket you first have to create a local branch of Sage on your machine by the command
sage -dev checkout --ticket 14667
Then after modifying the code, you compile by
sage -b
Once you're satisfied, you commit your changes by
sage --dev commit
Then you upload your changes to Sage by
sage --dev push
Your changes then become available to others in this thread:
(I see you already were there). Other people then can review your submission.

Best,

Rudi
--
 
---
You received this message because you are subscribed to the Google Groups "sage-matroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-matroid...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Stefan van Zwam

unread,
Feb 15, 2014, 3:23:31 PM2/15/14
to sage-m...@googlegroups.com
Hi,

In answer to your question on where matroid union should go, maybe we need a submenu "constructions" inside "matroids"? So we'd get

sage: matroids.constructions.MatroidUnion(M1,M2,M3)

As input I'd suggest allowing a list of matroids (like above) and an iterator, as in

sage: S = set([M1,M2,M3])
sage: matroids.constructions.MatroidUnion(S)

But that's just my opinion, I welcome other input.

--Stefan.

Rajesh Veeranki

unread,
Feb 15, 2014, 10:19:33 PM2/15/14
to sage-m...@googlegroups.com
Hi,

Thanks Prof.Rudi and Prof.Stefan for the suggestions.
I think i found out the reason.As per my understanding, the sage runtime expects the return value of a function to be of Sage class and it should implement some necessary functions.
So when i changed the return value to BasisMatroid(a class) from Matroid (which is not a class), it showed no errors.I've pushed the branch, and set the status to needs-review.

You may want to have a look and provide further suggestions,as my implementation may not be clean and the algo (which is a fairly straight-forward one) may be improved.

Thanks
Rajesh Veeranki
Final year,B.Tech C.S.E,IIT Bombay





--


Rajesh Veeranki | Senior Undergraduate | C.S.E | IIT Bombay

Reply all
Reply to author
Forward
0 new messages