On Jul 10, 2007, at 3:12 PM, William Stein wrote:

> On 7/10/07, Justin C. Walker <[EMAIL PROTECTED]> wrote:
>> On Jul 10, 2007, at 2:45 PM, Robert Bradshaw wrote:
[snip]
>>> If you are writing an method that goes through each (or many)  
>>> entries
>>> of a matrix, it is the thing to use if you can. For instance, if one
>>> is doing "for i from 0 <= i < M._ncols" then it is a waste to do
>>> bounds checking on the i every time. Magnitude(s) faster than M 
>>> [i,j].
>>
>> That's for me!
> You can write a Python wrapper for get_unsafe, e.g., I just tried
> this by adding this to matrix0.pyx (try the attached patch).
> Note that it's actually *not* faster -- it's slower in some cases --
> I think this is because calling __getitem__ goes through "slots",
> but the Python method that wraps get_unsafe doesn't.

Tried this, and my brief testing shows the pyrex version to be about  
half the speed of plain ol' python (called from python).  I think  
I'll just put this away for the nonce.

Thanks for the discussion.

Justin

--
Justin C. Walker, Curmudgeon-At-Large
Director
Institute for the Enhancement of the Director's Income
--------
"Weaseling out of things is what separates us from the animals.
  Well, except the weasel."
       - Homer J Simpson
--------



--~--~---------~--~----~------------~-------~--~----~
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/
-~----------~----~----~----~------~----~------~--~---

Reply via email to