mmwrite doesn't seem to support unsigned integers. Is there a reason for that?
I could use int32 instead, but using an uint16 would use less memory and prevent accidentally adding negative values.
from scipy.sparse import coo_matrix
import scipy.io
import numpy as np
# 0 , 0, 0
# 88, 99, 11
# 0, 22, 33
matrix = coo_matrix(( [88,99,11,22,33], ( [1,1,1,2,2], [0,1,2,1,2] ) ), dtype=np.uint16 )
scipy.io.mmwrite( 'matrix', matrix )
Traceback (most recent call last):
File "process_data.py", line 161, in <module>
scipy.io.mmwrite( 'matrix', matrix )
File "/usr/lib64/python3.5/site-packages/scipy/io/mmio.py", line 102, in mmwrite
MMFile().write(target, a, comment, field, precision, symmetry)
File "/usr/lib64/python3.5/site-packages/scipy/io/mmio.py", line 448, in write
self._write(stream, a, comment, field, precision,symmetry)
File "/usr/lib64/python3.5/site-packages/scipy/io/mmio.py", line 683, in _write
raise TypeError('unexpected dtype kind ' + kind)
TypeError: unexpected dtype kind u
Link to scipy/io/mmio.py", line 683 - doesn't seem to have a case for unsigned integers
# scipy, numpy, python versions
1.0.0 1.13.3 sys.version_info(major=3, minor=5, micro=4, releaselevel='final', serial=0)
Can I please take this up??
@ilayn Can I get info if kshitij12345 had fixed this issue? If not, I can do it.
We don't really know if the issue is picked up or not. Let's try pinging first @kshitij12345
@Tokixix @ilayn I have submitted a pull request. If someone can review and guide me, that would be great!
Most helpful comment
Can I please take this up??