On Wed, Sep 28, 2011 at 9:09 PM, Alan G Isaac wrote:
> Is this the intended behavior?
>
> >>> from numpy import matlib
> >>> m = matlib.reshape([1,2],(2,1))
> >>> type(m)
>
>
> For any 2d shape, I expected a matrix.
> (And probably an exception if the shape is not 2d.)
>
>
I thin
On Sat, Oct 1, 2011 at 1:45 PM, John Salvatier wrote:
> I apologize, I picked a poor example of what I want to do. Your suggestion
> would work for the example I provided, but not for a more complex example.
> My actual task is something like a "group by" operation along a particular
> axis (with
I apologize, I picked a poor example of what I want to do. Your suggestion
would work for the example I provided, but not for a more complex example.
My actual task is something like a "group by" operation along a particular
axis (with a known number of groups).
Let me try again: What I would like
On Sat, Oct 1, 2011 at 11:34 AM, Olivier Delalleau wrote:
> It'll work, it is equivalent to the suggestion I made in my previous post
> with the f_inplace wrapper function (and it has the same drawback that numpy
> will allocate temporary memory, which wouldn't be the case if f was working
> in-p
It'll work, it is equivalent to the suggestion I made in my previous post
with the f_inplace wrapper function (and it has the same drawback that numpy
will allocate temporary memory, which wouldn't be the case if f was working
in-place directly, by implementing it as "arr *= 2").
Note that you don
Thanks everybody for the different solutions proposed, I really appreciate.
What about this solution? So simple that I didn't think to it...
import numpy as np
from numpy import *
def f(arr):
return arr*2
a = array( [1,1,1] )
b = array( [2,2,2] )
c = array( [3,3,3] )
d = array( [4,4,4] )