SciPy

scipy.sparse.dok_matrix.reshape

dok_matrix.reshape(shape, order='C')[source]

Gives a new shape to a sparse matrix without changing its data.

Parameters:

shape : length-2 tuple of ints

The new shape should be compatible with the original shape.

order : ‘C’, optional

This argument is in the signature solely for NumPy compatibility reasons. Do not pass in anything except for the default value, as this argument is not used.

Returns:

reshaped_matrix : self with the new dimensions of shape

See also

np.matrix.reshape
NumPy’s implementation of ‘reshape’ for matrices