#NEWLINE# def write( self , target , a , comment = '' , field = None , precision = None , symmetry = None ) : #NEWLINE# #INDENT# "\n        Writes sparse or dense array `a` to Matrix Market file-like `target`.\n\n        Parameters\n        ----------\n        target : str or file-like\n            Matrix Market filename (extension .mtx) or open file-like object.\n        a : array like\n            Sparse or dense 2D array.\n        comment : str, optional\n            Comments to be prepended to the Matrix Market file.\n        field : None or str, optional\n            Either 'real', 'complex', 'pattern', or 'integer'.\n        precision : None or int, optional\n            Number of digits to display for real or complex values.\n        symmetry : None or str, optional\n            Either 'general', 'symmetric', 'skew-symmetric', or 'hermitian'.\n            If symmetry is None the symmetry type of 'a' is determined by its\n            values.\n        " #NEWLINE# ( stream , close_it ) = self . _open ( target , 'wb' ) #NEWLINE# try : #NEWLINE# #INDENT# self . _write ( stream , a , symmetry , field , precision , symmetry ) #NEWLINE# #UNINDENT# finally : #NEWLINE# #INDENT# if close_it : #NEWLINE# #INDENT# stream . close ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# stream . flush ( )