On Dec 7, 2007, at 8:48 AM, Joel B. Mohler wrote:
> > Hi, > > Here's a couple of questions that have occurred to me as I tried to > make > fraction fields of mpolynomials tolerable to work with. > > 1) In the "reduce" method in the file fraction_field_element.py > (line 72), we > call quo_rem to divide the gcd out of the numerator and > denominator. Now, by > definition the remainder should be 0 so we throw out the > remainder. However, it > seems to me that it should be faster to give the base_ring the > information that > we don't care about the remainder by using the "//" operator (which > calls > __floordiv__). > > 2) Ok, so I think #1 is obviously correct and I tried it to see if > it made a > speed difference. It did, but the wrong way -- __floordiv__ is > slow for > polynomial_integer_dense_ntl.pyx and the docstring explains that we > don't know > how this is defined. I'm not sure what David Harvey's exact > questions are, but > I think we should get it figured out. An obvious fact that I'd > believe should > hold is that: > f.quo_rem(g)[0] == f//g > That seems to remove any ambiguity. I should mention that code is only several days old; it's the result of a bug-fix from the most recent bug days; it used to segfault on e.g. division by zero or division by a non-monic polynomial that didn't happen to be an exact divisor. If the divisor is monic, then everything is okay, but if the divisor is not monic, it's not clear what the remainder should be. I took the agnostic option for the moment. (BTW something that still needs to be fixed is that the code won't work if the leading coefficient is -1, which should work.) david --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---
