PendingDeprecationWarning: the matrix subclass is not the recommended way to represent matrices or deal with linear algebra (see https://docs.scipy.org/doc/numpy/user/numpy-for-matlab-users.html). Please adjust your code to use regular ndarray.return matrix(data, dtype=dtype, copy=False)
def format_matrix(matrix, format='dense'): ''' Returns the matrix in the appropriate form, so that it can be efficiently loaded with our swig wrapper ''' if (format == 'dense'): # Ensure is 2D. matrix = np.atleast_2d(matrix) return np.asfortranarray(matrix) elif(format == 'sparse'): return scipy.sparse.coo_matrix(matrix) elif(format == 'scalar'): return np.asfortranarray(np.matrix(matrix)) else: raise NotImplementedError()