Numpy, uint64 and Big O notation.

Skip Montanaro skip.montanaro at gmail.com
Thu Oct 9 17:39:56 CEST 2014


On Thu, Oct 9, 2014 at 8:08 AM,  <marksabbath at gmail.com> wrote:

> I'm trying to find out the best way to multiply an uint64 (numpy). Could someone help me find the best way to achieve that and where can I find the time and space complexity in a Big O notation?

Multiply it by what? This works fine for me:

>>> import numpy
>>> x = numpy.uint64(57)
>>> x
57
>>> type(x)
<type 'numpy.uint64'>
>>> xx = x * x
>>> type(xx)
<type 'numpy.uint64'>
>>> xx
3249
>>> xxx = xx * xx
>>> xxx
10556001
>>> xxxx = xxx * xxx
>>> xxxx
111429157112001
>>> type(xxxx)
<type 'numpy.uint64'>
>>> xxxxx = xxxx * xxxx
>>> type(xxxxx)
<type 'numpy.uint64'>
>>> xxxxx
12238449225650938241

I assume under the covers there must be a Python long somewhere:

>>> int(xxxxx)
12238449225650938241L

I think your question needs to be more concrete.

Skip



More information about the Python-list mailing list