I did profiling for
$python -m timeit -n 100 -s 'import numpy as np;x = np.asarray(1.0)'
'x+x'
with oprofilier, and used gprof2dot.py to create callgraph, but I got
graph[1] which doesn't create any meaning.
I tried to use pprof, but I can not find profiles to be used. like ls.prof
in "pprof /
On Fri, Jun 7, 2013 at 8:08 PM, wrote:
> On Fri, Jun 7, 2013 at 7:48 PM, Nathaniel Smith wrote:
>> On 7 Jun 2013 21:58, wrote:
>>>
>>> Interesting observation, (while lurking on a pull request)
>>>
>>> >>> np.add.reduce(np.arange(5)<3)
>>> 3
>>> >>> np.add((np.arange(5)<3), (np.arange(5)<3))
>>
On Fri, Jun 7, 2013 at 7:48 PM, Nathaniel Smith wrote:
> On 7 Jun 2013 21:58, wrote:
>>
>> Interesting observation, (while lurking on a pull request)
>>
>> >>> np.add.reduce(np.arange(5)<3)
>> 3
>> >>> np.add((np.arange(5)<3), (np.arange(5)<3))
>> array([ True, True, True, False, False], dtype=
On 7 Jun 2013 21:58, wrote:
>
> Interesting observation, (while lurking on a pull request)
>
> >>> np.add.reduce(np.arange(5)<3)
> 3
> >>> np.add((np.arange(5)<3), (np.arange(5)<3))
> array([ True, True, True, False, False], dtype=bool)
>
>
> I often use summing of an array of boolean but didn't
Interesting observation, (while lurking on a pull request)
>>> np.add.reduce(np.arange(5)<3)
3
>>> np.add((np.arange(5)<3), (np.arange(5)<3))
array([ True, True, True, False, False], dtype=bool)
I often use summing of an array of boolean but didn't know the second behavior
Josef
_
I think I've figured this out. It seems like the rule in the "Note" box is
the problem. Since a matrix is not a subclass of my custom class, the
__rmul__ of the matrix is not being called.
Thanks for the info.
Will
On Fri, Jun 7, 2013 at 11:40 AM, Alan G Isaac wrote:
> On 6/7/2013 12:30 PM,
On 6/7/2013 12:30 PM, Will Lee wrote:
> Can somebody tell me why these operations are not the same in numpy?
http://docs.python.org/2/reference/datamodel.html#object.__rmul__
hth,
Alan Isaac
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
That's how it works in python:
"""
Note: If the right operand's type is a subclass of the left operand's type and
that subclass provides the reflected method for the operation, this method will
be called before the left operand's non-reflected method. This behavior allows
subclasses to override
Can somebody tell me why these operations are not the same in numpy?
In [2]: a = numpy.array([1, 2, 3.])
In [4]: matrix = numpy.matrix([[1, 2, 3.], [4, 5, 6], [7, 8, 9]])
In [5]: a.__mul__(matrix)
matrix([[ 1., 4., 9.],
[ 4., 10., 18.],
[ 7., 16., 27.]])
In [6]: a