If that is actually the bottleneck then the relevant matrices just need to override add_multiple_of_row_c with a specialized version instead of using the generic one from matrix0.
It seems that renaming Sage's add_multiple_of_row() into row_add() etc. in your code is just making it unnecessarily difficult to switch to Sage matrices. On Saturday, May 25, 2013 4:40:40 PM UTC+1, Stefan wrote: > > 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 > px = self._prow[x] > py = self._prow[y] > piv = self._A.get_unsafe(px, py) > pivi = piv ** (-1) > self._A.row_scale(px, pivi) > self._A.set_unsafe(px, py, pivi + self._one) # pivoting > without column scaling. Add extra so column does not need adjusting > for r in xrange(self._A.nrows()): # if A and A' are the > matrices before and after pivoting, then > a = self._A.get_unsafe(r, py) # ker[I A] equals ker[I > A'] except for the labelling of the columns > if a and r != px: > self._A.row_add(r, px, -a) > self._A.set_unsafe(px, py, pivi) > self._prow[y] = px > self._prow[x] = py > BasisExchangeMatroid.__exchange(self, x, y) > > --Stefan. > -- 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+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@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.