[petsc-users] PETSc recommended visualization packages

Ethan Coon ecoon at lanl.gov
Thu Jul 14 16:33:41 CDT 2011


On Thu, 2011-07-14 at 17:47 -0300, Lisandro Dalcin wrote:

> 
> 1) readMatDense() is wrong. The I,J,V arrays are the CSR structure,
> not the COO (coordinate) format, Then you cannot simply:
> 
>        for i,j,v in zip(I,J,V):
>             mat[i,j] = v
> 
> I think you have to:
> 
> for row, rstart in enumerate(I):
>     rend = I[row+1]
>     mat[row, J[rstart:rend]] = V[rstart:rend]
> 

Ok, thanks, I wasn't sure of which format you were using, and didn't
have a handy matrix binary file to test it (and didn't want to think too
hard about it).  I just needed a reader for vecs working today, so was
in a hurry to get something done. 

> 
> 2) It would be nice to provie a 'scipy' Mat format returning a
> 'scipy.sparse.csr_matrix' instance. A possible implementation would
> be:
> 
> def readMatSciPy(fh):
>     (M, N), (I, J, V) = readMatSparse(fh)
>     from scipy.sparse import csr_matrix
>     return csr_matrix((V, J, I), shape=(M, N))
> 
> 

Agreed, I considered doing that as the default for sparse, but wasn't
sure what others would want.  Providing both makes sense.

I have to finish up some other crap first, but will get these fixes done
soon.

Note that this should work for people using the release version with no
modifications, if Andrew is still reading this.

Thanks,

Etha

> 

-- 
------------------------------------
Ethan Coon
Post-Doctoral Researcher
Applied Mathematics - T-5
Los Alamos National Laboratory
505-665-8289

http://www.ldeo.columbia.edu/~ecoon/
------------------------------------



More information about the petsc-users mailing list