Dear Sage developers,Over the past two years I've been working with several people on bringing Matroid Theory to Sage. We wanted this to be research-level code that will remain relevant for a long time, so we decided to have the design mature for a while before integrating it with Sage. By now we have test-driven the code (it produces output consistent with the theory and with computations carried out by other software for matroid theory), and it is already in use by people in the matroid theory community who install it separately on top of Sage.The code has now been submitted, seeThere are about 21,000 lines of code, and 500 functions with docstrings. While it is doable to check that it plays nice with the
rest of Sage and follows all coding conventions (I'm sure it does), a full code review sounds like a hard task. So I write you to solicit opinions on how to proceed. Four suggestions have been made on the ticket:1) Treat it as if it were an spkg, and accept with only a cursory review
2) Try to assemble a team of reviewers, each responsible for part of the code3) Chop it up into separate, smaller pieces and have those submitted as separate tickets4) Get the authors of the package to review each others' codeOptions (3) and (4) are not very feasible. The core part of the code has close links all over the place, and I think I can't get it much below 9,000 lines of code without a lot of extra work. It would also mean rewriting all docstrings since we can't use the catalog of matroids for our examples. As for (4), Rudi Pendavingh and I are responsible for the bulk of this code, and each of us has had a hand in pretty much every part of it.That leaves (1) and (2). I hope to get the other users/developers to review parts of it, but so far I have not heard of any commitments, and I fear it would still take a long time to get it accepted. I'd rather see that time spent building a user base and ironing out any bugs uncovered in actual use.What do you all think?Regards,Stefan.P.S. The impact on the rest of Sage is the following:* add a directory sage.matroids* lazy_import two items, a function "Matroid" and a package "matroids", on startup* add an entry "Matroid theory" to the reference manual.
--
You received this message because you are subscribed to the Google Groups "sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+...@googlegroups.com.
To post to this group, send email to sage-...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
How easy/feasible would it be to create an spkg and propose it to be added as an optional package?Is that another possibility?
Finally, thanks to the sage-matroid group for all their hard work on this. It is going to be another jewel in Sage's crown.
So I would be in favor of accepting this en masse if it had a knowledgeable review for fitting into Sage, as Nathann and Volcker propose.
So I would be in favor of accepting this en masse if it had a knowledgeable review for fitting into Sage, as Nathann and Volcker propose.
And it has 100% doctest coverage. (It does, right?)
> ..
>
> >
> > Rob
I think the following needs to be addressed:* segmentation faults due to recent changes in Sage* either replace the private reimplementation of matrices or give a good reason for why it is necessaryThen it is imho ready for inclusion.
* either replace the private reimplementation of matrices or give a good reason for why it is necessary
Wasn't the second point addressed in http://trac.sagemath.org/14627, so shouldn't the matrices be replaced?
PS - the extra c in Volcker makes your name sound ckooler :P
On Saturday, May 25, 2013 2:39:36 AM UTC+1, Travis Scrimshaw wrote:* either replace the private reimplementation of matrices or give a good reason for why it is necessaryWasn't the second point addressed in http://trac.sagemath.org/14627, so shouldn't the matrices be replaced?Well I hope so but there might be another performance bottleneck that the matroid code hits. Maybe one of the authors can tell us more about it?
I'd have to check carefully. There's likely to be some performance loss even when all obvious bottlenecks are accounted for, because for our special classes BinaryMatrix, TernaryMatrix, QuaternaryMatrix we use inline get() and set() methods that bypass the Sage finite field elements. We want this code to push the limits of matroid computation, so we'd hate to incur even a 10% speed loss.
There's likely to be some performance loss even when all obvious bottlenecks are accounted for, because for our special classes BinaryMatrix, TernaryMatrix, QuaternaryMatrix we use inline get() and set() methods that bypass the Sage finite field elements.
cdef bint __exchange(self, long x, long y):
"""
Put element indexed by ``x`` into basis, taking out element ``y``. Assumptions are that this is a valid basis exchange.
.. NOTE::
Safe for noncommutative rings.
"""
cdef long px, py,
r
cdef LeanMatrix A = self._A
px = self._prow[x]
py = self._prow[y]
piv = A.get_unsafe(px, py)
pivi = piv ** (-1)
# This would be a simple modification of the previous, removing the for loop
#a = pivi + self._one
#A.row_scale(px, pivi)
#A.set_unsafe(px, py, a) # pivoting without column scaling. Add extra so column does not need adjusting
# if A and A' are the matrices before and after pivoting, then
# ker[I A] equals ker[I A'] except for the labelling of the columns
#if a:
# A.row_add(px, px, -a)
#A.set_unsafe(px, py, pivi)
# This is with some other (possible) (micro) optimizations
if pivi + self._one != 0: A.row_scale(px, -pivi * pivi) else:
A.row_scale(px, pivi)
A.set_unsafe(px, py, pivi)
self._prow[y] = px
self._prow[x] = py
BasisExchangeMatroid.__exchange(self, x, y)
Also, did you try implementing this using numpy arrays?
Also, if you're not really using matrices, such as doing a significant number of multiplications/using category model/etc., but instead as a nice data structure, I'd be more inclined to say to strip out the non speed-essential methods, making it as lightweight and specific as possible and converting to proper matrices when needed, and include it into sage (after perhaps changing the name). How does this sound to everyone?