On Sat, Dec 19, 2009 at 4:53 AM, Chris Colbert <sccolb...@gmail.com> wrote:

>
>
> On Sat, Dec 19, 2009 at 6:43 AM, Charles R Harris <
> charlesr.har...@gmail.com> wrote:
>
>>
>>
>> On Fri, Dec 18, 2009 at 10:20 PM, Wayne Watson <
>> sierra_mtnv...@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
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to