On May 16, 2008, at 5:48 PM, William Stein wrote: > > On Fri, May 16, 2008 at 5:23 PM, Robert Bradshaw > <[EMAIL PROTECTED]> wrote: >> >> On May 16, 2008, at 5:13 PM, kcrisman wrote: >> >>> I'm working on # 3212 and am running into trouble with self, I >>> think. >>> I've kept everything identical except trying to catch exception of >>> uncoercible scalar row multiplication. If I put a line 'print >>> type(self)' after the self.change_ring, it *does* show the ring has >>> changed internally, but by the time the functions outputs, I either >>> get the original self back as the result or I get None. I am sure I >>> am misunderstanding how self and copying (since .change_ring >>> yields a >>> copy) and assigning work, but after a lot of looking at both Python >>> (and Cython/Pyrex) and matrix documentation I am only quite a few >>> hours more tired. Thanks for any assistance. >> >> The problem is that you can't actually mutate self into a new type. >> The functions rescale_col/rescale_row change self, and changing the >> basering of self is not allowed (because the storage format for >> different baserings can be wildly different). >> >> Not sure how the API should work, you'd need a function that returns >> a copy of the matrix, in a new basering, with the row/col scaled. >> > > I think you should just change things so that the error message is > much much better?
The other option is to have it return a new matrix. (Should always return a copy, or only when it can't rescale in place?) > Anyway, now you see a good reason why making ZZ matrices over QQ > by default is a good idea! > > Shall the whole discussion continue then? True, but I don't think it's compelling enough... - Robert --~--~---------~--~----~------------~-------~--~----~ 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-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---
