Dinesh B Vadhia | 1 Feb 17:09
Picon
Gravatar

tocsr() errors

I'm converting a sparse coo matrix to a csr matrix and getting errors.  The details are:
 
My import statements are:
 
> import numpy
> import scipy
> from scipy import sparse
 
The coo_matrix statement is:
 
> A = scipy.sparse.coo_matrix((scipy.data, (scipy.row, scipy.column)), (M,N))
When I use:
 
> A = A.tocsr()
 
The error message recieved is:

  File "C:\Python25\lib\site-packages\scipy\sparse\sparse.py", line 2174, in tocsr
    self.data)
  File "C:\Python25\lib\site-packages\scipy\sparse\sparsetools.py", line 176, in cootocsr
    return _sparsetools.cootocsr(*args)
TypeError: Array must be have 1 dimensions.  Given array has 2 dimensions
 
When I try:
 
> A = sparse.csr_matrix(A)
 
The error message is:
 
X = sparse.csr_matrix(A)
  File "C:\Python25\lib\site-packages\scipy\sparse\sparse.py", line 1162, in __init__
    temp = s.tocsr()
  File "C:\Python25\lib\site-packages\scipy\sparse\sparse.py", line 2174, in tocsr
    self.data)
  File "C:\Python25\lib\site-packages\scipy\sparse\sparsetools.py", line 176, in cootocsr
    return _sparsetools.cootocsr(*args)
TypeError: Array must be have 1 dimensions.  Given array has 2 dimensions
 
Is it saying that A must be of dimension 1? If so, surely it can't be as A is a (M,N) matrix.  Any ideas?
 
Dinesh
 
 
_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user
Dinesh B Vadhia | 1 Feb 17:12
Picon
Gravatar

Sparse Pickle

Once a sparse matrix (of any format but in particular coo_matrix) has been populated can it (or a csr_matrix after a tocsr()) be Pickle'd?  Cheers.
 
Dinesh
 
 
_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user
Stef Mientki | 1 Feb 18:29
Picon
Gravatar

wxmsw26u_vc_enthought.dll not found ?

hello,

I've a application, based on wxPython en SciPy.
When I run the application in an IDE, everything works perfect without 
any error messages
(about 1 out of 100 cases the error described below will happen in IDE too).

When I run the application standalone, I get the following error message

and when I press OK, the program continues and works perfect.

Now I've searched for the string "wxmsw26u_vc_enthought.dll",
but I can't find it anywhere ??

How can I prevent this error message ?
Any other hints for finding the problem would also be appreciated.

I run on winXP, SP2,
Python 2.4.3 - Enthought Edition 1.1.0 (#69, Oct  6 2006, 12:53:45) [MSC 
v.1310 32 bit (Intel)] on win32.
and updated wxPython to version 2.8.

thanks,
Stef Mientki

_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user
Matthieu Brucher | 1 Feb 18:37
Picon

Re: wxmsw26u_vc_enthought.dll not found ?

Hi,

Are you using MAtplotlib with the wxAgg backend ? If it is, you should use the wx one, wxAgg is no longer supported with wxPython 2.8

Matthieu

2008/2/1, Stef Mientki <stef.mientki <at> gmail.com>:
hello,

I've a application, based on wxPython en SciPy.
When I run the application in an IDE, everything works perfect without any error messages
(about 1 out of 100 cases the error described below will happen in IDE too).

When I run the application standalone, I get the following error message



and when I press OK, the program continues and works perfect.

Now I've searched for the string "wxmsw26u_vc_enthought.dll",
but I can't find it anywhere ??

How can I prevent this error message ?
Any other hints for finding the problem would also be appreciated.

I run on winXP, SP2,
Python 2.4.3 - Enthought Edition 1.1.0 (#69, Oct  6 2006, 12:53:45) [MSC v.1310 32 bit (Intel)] on win32.
and updated wxPython to version 2.8.

thanks,
Stef Mientki


_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user




--
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user
Stef Mientki | 1 Feb 18:41
Picon
Gravatar

Re: wxmsw26u_vc_enthought.dll not found ?

thanks Matthieu,

Matthieu Brucher wrote:
> Hi,
>
> Are you using MAtplotlib with the wxAgg backend ?
Yes
> If it is, you should use the wx one, wxAgg is no longer supported with 
> wxPython 2.8
Too bad, wx is much slower and uglier (no anti-aliasing) than wxAgg :-(

cheers,
Stef
David Warde-Farley | 1 Feb 18:41
Picon
Favicon
Gravatar

Re: Sparse Pickle

Hi Dinesh,

There should be no problem pickling any of those, but what are you using it for? Pickle (even cPickle) tends to be pretty slow for large objects.

In case you do need something quicker, if you look through the mailing list archives you'll see that Andrew Straw posted some really clever code for quickly saving/loading CSR and CSC sparse matrices to/from the filesystem. 

Cheers,

David

On 1-Feb-08, at 11:12 AM, Dinesh B Vadhia wrote:

Once a sparse matrix (of any format but in particular coo_matrix) has been populated can it (or a csr_matrix after a tocsr()) be Pickle'd?  Cheers.
 
Dinesh
 
 
_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user

_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user
lorenzo bolla | 1 Feb 19:55
Picon
Gravatar

Re: tocsr() errors

In your statement:
> A = scipy.sparse.coo_matrix((scipy.data, (scipy.row, scipy.column)), (M,N))
data, row and column must be 1d arrays.
for coo_matrix, data is a list of nonzero elements, row and column determine "where" data is.
see docstring in scipy.sparse (if you use ipython, just type: scipy.sparse? )
for a more complete description of sparse matrices, see here:
http://www.scipy.org/SciPy_Tutorial#head-c60163f2fd2bab79edd94be43682414f18b90df7

hth,
L.


On Feb 1, 2008 5:09 PM, Dinesh B Vadhia <dineshbvadhia <at> hotmail.com> wrote:
I'm converting a sparse coo matrix to a csr matrix and getting errors.  The details are:
 
My import statements are:
 
> import numpy
> import scipy
> from scipy import sparse
 
The coo_matrix statement is:
 
> A = scipy.sparse.coo_matrix((scipy.data, (scipy.row, scipy.column)), (M,N))
When I use:
 
> A = A.tocsr()
 
The error message recieved is:

  File "C:\Python25\lib\site-packages\scipy\sparse\sparse.py", line 2174, in tocsr
    self.data)
  File "C:\Python25\lib\site-packages\scipy\sparse\sparsetools.py", line 176, in cootocsr
    return _sparsetools.cootocsr(*args)
TypeError: Array must be have 1 dimensions.  Given array has 2 dimensions
 
When I try:
 
> A = sparse.csr_matrix(A)
 
The error message is:
 
X = sparse.csr_matrix(A)
  File "C:\Python25\lib\site-packages\scipy\sparse\sparse.py", line 1162, in __init__
    temp = s.tocsr()
  File "C:\Python25\lib\site-packages\scipy\sparse\sparse.py", line 2174, in tocsr
    self.data)
  File "C:\Python25\lib\site-packages\scipy\sparse\sparsetools.py", line 176, in cootocsr
    return _sparsetools.cootocsr(*args)
TypeError: Array must be have 1 dimensions.  Given array has 2 dimensions
 
Is it saying that A must be of dimension 1? If so, surely it can't be as A is a (M,N) matrix.  Any ideas?
 
Dinesh
 
 

_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user




--
Lorenzo Bolla
lbolla <at> gmail.com
http://lorenzobolla.emurse.com/
_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user
Tom Johnson | 1 Feb 20:47
Picon
Gravatar

Faster allclose, comparing arrays

Frequently, I am comparing vectors to one another, and I am finding
that a good portion of my time is spent in allclose.  This is done
through a class which stores a bunch of metadata and also a 'vector'
attribute:

def __eq__(self, other):
      return allclose(self.vector, other.vector, rtol=RTOL, atol=ATOL)

So I place these objects in a list and check equality via "if x in
objlist".   Couple of questions:

1) Is this a "good" method for comparing arrays?
2) Is there any way to speed up allclose?

Thanks.
Stef Mientki | 1 Feb 20:53
Picon
Favicon
Gravatar

Re: wxmsw26u_vc_enthought.dll not found ?


Stef Mientki wrote:
> thanks Matthieu,
>
> Matthieu Brucher wrote:
>   
>> Hi,
>>
>> Are you using MAtplotlib with the wxAgg backend ?
>>     
> Yes
>   
>> If it is, you should use the wx one, wxAgg is no longer supported with 
>> wxPython 2.8
>>     
> Too bad, wx is much slower and uglier (no anti-aliasing) than wxAgg :-(
>   
And even worse:
replacing wxAgg by wx, doesn't vanish the error message :-(
anyway thanks,
Stef
> cheers,
> Stef
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user <at> scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-user
>
>
>   
Matthieu Brucher | 1 Feb 21:01
Picon

Re: wxmsw26u_vc_enthought.dll not found ?


>> If it is, you should use the wx one, wxAgg is no longer supported with
>> wxPython 2.8
>>
> Too bad, wx is much slower and uglier (no anti-aliasing) than wxAgg :-(
>

And even worse:
replacing wxAgg by wx, doesn't vanish the error message :-(
anyway thanks,

Stef

This shouldn't be the case. Do you have Visual Studio ? If this is the case, you can check which library in your setup (although I still suspect Matplotlib to be guilty) depends on this library with the Depend.exe application.

Matthieu
--
French PhD student
Website : http://matthieu-brucher.developpez.com/
Blogs : http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn : http://www.linkedin.com/in/matthieubrucher
_______________________________________________
SciPy-user mailing list
SciPy-user <at> scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user

Gmane