Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #78891 > unrolled thread
| Started by | marksabbath@gmail.com |
|---|---|
| First post | 2014-10-09 06:08 -0700 |
| Last post | 2014-10-09 11:31 -0500 |
| Articles | 3 — 2 participants |
Back to article view | Back to comp.lang.python
Numpy, uint64 and Big O notation. marksabbath@gmail.com - 2014-10-09 06:08 -0700
Re: Numpy, uint64 and Big O notation. Skip Montanaro <skip.montanaro@gmail.com> - 2014-10-09 10:39 -0500
Re: Numpy, uint64 and Big O notation. Skip Montanaro <skip.montanaro@gmail.com> - 2014-10-09 11:31 -0500
| From | marksabbath@gmail.com |
|---|---|
| Date | 2014-10-09 06:08 -0700 |
| Subject | Numpy, uint64 and Big O notation. |
| Message-ID | <4fca2ff7-ad35-4514-b142-d4330c137fdb@googlegroups.com> |
Hey all! 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?
[toc] | [next] | [standalone]
| From | Skip Montanaro <skip.montanaro@gmail.com> |
|---|---|
| Date | 2014-10-09 10:39 -0500 |
| Message-ID | <mailman.14718.1412869199.18130.python-list@python.org> |
| In reply to | #78891 |
On Thu, Oct 9, 2014 at 8:08 AM, <marksabbath@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
[toc] | [prev] | [next] | [standalone]
| From | Skip Montanaro <skip.montanaro@gmail.com> |
|---|---|
| Date | 2014-10-09 11:31 -0500 |
| Message-ID | <mailman.14723.1412872322.18130.python-list@python.org> |
| In reply to | #78891 |
[Multipart message — attachments visible in raw view] — view raw
(For future reference, when responding to answers, it's worthwhile to continue to cc python-list.) On Thu, Oct 9, 2014 at 11:12 AM, Marcos Schratzenstaller < marksabbath@gmail.com> wrote: > The numpy has a function which manipulate 64 bits integers, but I couldn't > find a specific method to multiplicate this kind of objects can not be > manipulated as the same way, so if python is using the correct function > (assuning python is detecting the object, calling the correct function) it > is not a problem, but, where can I find this deep information? Marcos, Yes, the builtin help() function serves as reasonable documentation in this case: >>> help(numpy.int64) Help on class int64 in module numpy: class int64(signedinteger, __builtin__.int) | 64-bit integer. Character code 'l'. Python int compatible. | | Method resolution order: | int64 | signedinteger | integer | number | generic | __builtin__.int | __builtin__.object | | Methods defined here: ... | Methods inherited from generic: | | __abs__(...) | x.__abs__() <==> abs(x) | | __add__(...) | x.__add__(y) <==> x+y ... | __mod__(...) | x.__mod__(y) <==> x%y | | __mul__(...) | x.__mul__(y) <==> x*y ... The __mul__ method implements multiplication. I don't know the specific implementation in numpy, but it's probably little more than a thin wrapper around x * y (with perhaps some type and overflow checking). Skip
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web