On Oct 23, 6:24 pm, Robert Bradshaw <[EMAIL PROTECTED]>
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).

There seem to be two (documented) ways to do this:

1) mpz_sizeinbase(..., 2) gives the number of bits in the number.
This will be O(1), but has to count how many bits are used in the
highest-order word.  mpz_sizeinbase(..., 16) or mpz_sizeinbase(...,
32) may or may not be faster.

2) mpz_size(...) counts the number of words, but then you may have to
care about the difference between 32-bit and 64-bit machines.
(However, I could imagine that in this case just counting the size in
words is the right thing... maybe the cutoff should be twice as many
bits on a 64-bit processor.)

Carl


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