// Avoid indiscriminate casting to ndarray to// allow for sparse or other strange arraysifisspmatrix(A):
return A.__class__(out)
return np.array(out)
After Change
// Avoid indiscriminate casting to ndarray to// allow for sparse or other strange arraysifisspmatrix(A) or is_pydata_spmatrix(A):
return A.__class__(out)
return np.array(out)