Re: [Numpy-discussion] should the return type of matlib.reshape be ndarray or matrix?

2011-10-03 Thread Pengkui Luo
Most functions in numpy return ndarray by default. Use numpy.asmatrix() if you want a matrix. >>> from numpy import matlib, asmatrix >>> m = matlib.reshape([1,2],(2,1)) >>> type(m) >>> type( asmatrix(m) ) -- Pengkui On Wed, Sep 28, 2011 at 22:09, Alan G Isaac wrote: > Is this the intended b

Re: [Numpy-discussion] How to apply Numpy ufunc to Scipy sparse matrices?

2011-09-11 Thread Pengkui Luo
On Sun, Sep 11, 2011 at 13:23, Pauli Virtanen wrote: > Sun, 11 Sep 2011 03:03:26 -0500, Pengkui Luo wrote: > [clip] > > However, converting a large sparse matrix to dense would easily eat up > > the memory. Is there a way for np.sign (as well as other ufunc) to take >

[Numpy-discussion] How to apply Numpy ufunc to Scipy sparse matrices?

2011-09-11 Thread Pengkui Luo
It seems that numpy universal functions only apply to ndarray (or dense matrix). Is there a way to apply them to scipy sparse matrices also? For example, suppose S is an large sparse matrix (lil_matrix format, dtype=np.float). I want to get another sparse matrix B (of the same shape) that represen