On Nov 2, 2007, at 12:22 PM, Carl Witty wrote: > On Nov 2, 11:25 am, Robert Bradshaw <[EMAIL PROTECTED]> > wrote: >> :-(, but I have to concede to your logic. The line to change is 148 >> of coerce.pxi. Setting this value to 0 will turn them completely off. >> Other than numpy, (and the builtin libraries), do we use any other >> extension types? If there is a finite list of things for which it >> won't work, it would be possible to disable it just for those. > > Another possibility is to figure out where in Sage it's safe to use > and particularly helpful, and explicitly enable it for those sections > of code.
We could definitely make a use_inplace_operations context object and use it in some places (e.g. Coleman integration, and the sum() and prod() functions) but the fact is that it is useful almost everywhere. The two most common cases are doing a loop with some iterative increment/evaluation, (e.g. newton iteration or counter variables) and in any arithmetic expression with more than one operation (e.g. evaluating a polynomial, or even constructing a polynomial, or something like a*b+c.) This is all over the place... > And another possibility, which restores the in-place optimization to > (some) Cython code but not Python code, is to change Cython so that if > it knows the things it's adding/multiplying/etc. are of subtypes of > sage.structure.element.Element, then it bypasses PyNumber_Add and > calls a method on the objects directly. This method could use the in- > place optimization. (Plus, we might gain a tiny bit of speed by > skipping PyNumber_Add anyway.) My impression is that this would require rewriting a huge portion of Cython code to explicitly declare types (and, consequently, disallowing native types like int or float), and probably a lot of SAGE-specific things in the Cython codebase. - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com 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/ -~----------~----~----~----~------~----~------~--~---