On Oct 23, 2007, at 9:24 PM, Robert Bradshaw wrote:

> Is there a way to get the size of an integer (really fast, like a
> macro getting the number of words)? One could perhaps override
> _strassen_default_cutoff (though I don't know how much overhead this
> would be for matrices with smallish entries).

I believe mpz_size() is implemented as a macro (at least in the  
current GMP release), and it returns the number of words.

> One can always enforce it by doing M._multiply_strassen(N)

Ah.... yes that works nicely:

sage: M1 = matrix(4, 4, [ZZ.random_element(2^3000000) for _ in range 
(16)])
sage: M2 = matrix(4, 4, [ZZ.random_element(2^3000000) for _ in range 
(16)])
sage: time M3 = M1 * M2
CPU times: user 8.68 s, sys: 0.31 s, total: 8.99 s
Wall time: 9.00
sage: time M3 = M1._multiply_strassen(M2, 1)
CPU times: user 6.84 s, sys: 0.39 s, total: 7.23 s
Wall time: 7.32

> For huge Z, I wonder if it's still trying to do multi-modular? That
> would probably be bad. I'm also not sure how much of the dispatching
> is done in Linbox vs. Sage.

Multimodular would be terrible. You don't get any of the benefits of  
strassen, since the tiny multiplies are way below the strassen  
cutoff. So basically it would end up looking like doing *integer*  
multiplication with a multi-modular algorithm, which isn't such a  
good idea :-)

david


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