From: Daniel W. <dan...@gm...> - 2008-07-11 14:18:34
|
I had a similar problem with pytrilinos that required the swig interface to be fixed. It should work whatever int type is chosen. I might look into this at some point. Cheers. On Thu, Jul 10, 2008 at 6:11 AM, Artur Palha <art...@gm...> wrote: > Hello Daniel > > Once again I manage to solve the problem. > > When I was trying to make a simple program that mimics the problem I > have, to send you, as you asked, I found the problem. Maybe there is a > bug with pysparse or the problem is mine. > > The simplest program is: > > import numpy > import pysparse > > GN = numpy.array([0,1,2,3]) > > B = pysparse.spmatrix.ll_mat(10, 10, 10) > > for i in range(0,2): > B[GN[i], GN[i]] += 10 > > print B > > > If you do this it works. But if you use: > > GN = numpy.array([0,1,2,3], dtype="int32") > > It gives the error I stated. > > If one prints the dtype of GN of the first code, it states that it is > int64. Hence the problem is that one cannot give in32 as an index to a > ll_mat on a 64bit machine, or at least on mine. > > Once again thank you for your help! > > -artur palha > > On Wed, Jul 9, 2008 at 3:16 PM, Artur Palha <art...@gm...> wrote: >> Thank you for the help, again. >> >> The error it gives is: >> >> IndexError: first index is invalid >> >> And the error comes up when I try to assign a value to an entry of the >> B matrix in this way: >> >> B[ GN[e,n,m], GN[e,i,j] ] += something >> >> B is the sparse matrix and GN is a 3d array. >> >> I have checked that the values of GN are correct. The exact same code >> works on another machine. I even tried a simpler code and it gives the >> same error. The strange thing is that if I try to do it in ipython, >> line by line, it works. Even if I assign a the value of GN to another >> variable, as: >> >> a = GN[e,n,m] >> b = GN[e,i,j] >> >> and then try: >> >> B[a,b] += something >> >> it does not work also, or if I assing to a and b constant values as: >> >> a = 1 >> b = 2 >> >> B[a,b] += something >> >> It only works if I do: >> >> B[1,2] += something >> >> Any help? >> >> Thank you >> >> -artur palha >> >> On Thu, Jul 3, 2008 at 6:06 PM, Daniel Wheeler >> <dan...@gm...> wrote: >>> On Thu, Jul 3, 2008 at 8:50 AM, Artur Palha <art...@gm...> wrote: >>>> I hope someone can help me >>>> >>>> I am trying to compile pysparse on a 64 bit machine with openSuse 10.3. >>>> >>>> It compiles but gives an error acessing the sparse arrays. >>> >>> What is the error? I use pysparse on a 64 bit machine without problems. >>> >>>> I read on >>>> the README file that there is an incompatibility issue with pysparse >>>> and numpy on 64bit machines and that a patch is needed. >>> >>> According to the CVS log, the message was there from the initial >>> import of pysparse. I'll remove it. >>> >>>> I have >>>> installed version 1.1.0 of Numpy do I need the patch or the problem is >>>> somewhere else? >>> >>> Can you give some more details? >>> >>> -- >>> Daniel Wheeler >>> >> > -- Daniel Wheeler |