[Numpy-discussion] objects are not aligned. Matrix and Array
Charles R Harris
charlesr.harris@gmail....
Sat Dec 19 09:13:12 CST 2009
On Sat, Dec 19, 2009 at 4:53 AM, Chris Colbert <sccolbert@gmail.com> wrote:
>
>
> On Sat, Dec 19, 2009 at 6:43 AM, Charles R Harris <
> charlesr.harris@gmail.com> wrote:
>
>>
>>
>> On Fri, Dec 18, 2009 at 10:20 PM, Wayne Watson <
>> sierra_mtnview@sbcglobal.net> wrote:
>>
>>> This program gives me the message following it:
>>> ================Program==========
>>> import numpy as np
>>> from numpy import matrix
>>> import math
>>>
>>>
>> You don't want math.
>>
>
>
> Why do you say that? The builtins are MUCH faster than numpy for single
> values:
>
> In [1]: import math
>
> In [2]: import numpy as np
>
> In [3]: %timeit np.sin(1.57)
> 100000 loops, best of 3: 2.41 us per loop
>
> In [4]: %timeit math.sin(1.57)
> 10000000 loops, best of 3: 165 ns per loop
>
> In [6]: %timeit np.array([np.sin(1.57)])
> 100000 loops, best of 3: 11.5 us per loop
>
> In [7]: %timeit np.array([math.sin(1.57)])
> 100000 loops, best of 3: 7.01 us per loop
>
>
>
Fair point. I was thinking of the vector case down the road.
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20091219/981c936e/attachment-0001.html
More information about the NumPy-Discussion
mailing list