def matrix_to_zero(e):
 if isinstance(e, Matrix):
  if (zeros(*e.shape) == e):
   e = Integer(0)
 elif isinstance(e, numpy_ndarray):
  e = _numpy_matrix_to_zero(e)
 elif isinstance(e, scipy_sparse_matrix):
  e = _scipy_sparse_matrix_to_zero(e)
 return e

def matrix_to_zero ( e ) : if isinstance ( e , Matrix ) : if ( zeros ( * e . shape ) == e ) : e = Integer ( 0 ) elif isinstance ( e , numpy_ndarray ) : e = _numpy_matrix_to_zero ( e ) elif isinstance ( e , scipy_sparse_matrix ) : e = _scipy_sparse_matrix_to_zero ( e ) return e
convert a zero matrix to the scalar zero .