I have a problem resizing the matrix - the set_shape function seems to have no effect:
>>> M <14x3562 sparse matrix of type '<type 'numpy.float32'>' with 6136 stored elements in LInked List format> >>> new_shape = (15,3562) >>> M.set_shape(new_shape) >>> M <14x3562 sparse matrix of type '<type 'numpy.float32'>' with 6136 stored elements in LInked List format>
Anyone else come across this?
I also tried to do this manually, i.e.
>>> M._shape = new_shape >>> M.data = np.concatenate(M.data, np.empty((0,0), dtype=np.float32))
but this causes an error:
or
>>> M.data = np.concatenate(M.data, []) *** TypeError: an integer is required
For reference:
- Python 2.6.5 (r265: 79063, Apr 16, 2010 1:57:41 PM)
- scipy 0.11.0.dev-03f9e4a
source share