[SciPy-user] mmwrite and sparse matrices. It works?

Stas Fomin stas-fomin at yandex.ru
Sat Apr 23 15:58:39 CDT 2005

 I am newbie in SciPy. (Just installed Numeric-23.5.win32-py2.3.exe and SciPy_complete-0.3.2.win32-py2.3-num23.5.exe)

http://oliphant.ee.byu.edu:81/scipy/io/mmwrite declares that 
"mmwrite Writes the sparse or dense matrix A to a Matrix Market formatted file".
I try small piece of code:

Python 2.3.2 (#49, Nov 13 2003, 10:34:54) [MSC v.1200 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from scipy import *;
>>> A = sparse.dok_matrix()
>>> A[1,3] = 4
>>> print A
  (1, 3)        4
>>> fn=open('file.mtx','w')
>>> io.mmio.mmwrite(fn,A)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "C:\Python\Lib\site-packages\scipy\io\mmio.py", line 266, in mmwrite
    if typecode in 'fF':
TypeError: 'in <string>' requires string as left operand

Also, I failed to "mmwrite"  csc_matrices...

Does "mmio" package work with matrices from "sparse"?
If so, please, provide small example.

         Sincerely, Stas Fomin.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.scipy.net/pipermail/scipy-user/attachments/20050424/a8af5cd4/attachment.htm

More information about the SciPy-user mailing list