#NEWLINE# def __new__( cls , * args , **kwargs ) : #NEWLINE# #INDENT# ( shape , flat_list ) = cls . _handle_ndarray_creation_inputs ( * args , ** kwargs ) #NEWLINE# shape = Tuple ( * map ( _sympify , shape ) ) #NEWLINE# loop_size = ( functools . reduce ( ( lambda x , y : ( x * y ) ) , cls ) if shape else 0 ) #NEWLINE# if isinstance ( flat_list , ( dict , Dict ) ) : #NEWLINE# #INDENT# sparse_array = Dict ( flat_list ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# sparse_array = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# for ( i , el ) in enumerate ( flatten ( flat_list ) ) : #NEWLINE# #INDENT# if ( el != 0 ) : #NEWLINE# #INDENT# sparse_array [ i ] = _sympify ( el ) #NEWLINE# #UNINDENT# #UNINDENT# #UNINDENT# sparse_array = Dict ( sparse_array ) #NEWLINE# self = Basic . __new__ ( cls , sparse_array , shape , ** kwargs ) #NEWLINE# self . _shape = shape #NEWLINE# self . _rank = len ( shape ) #NEWLINE# self . _loop_size = loop_size #NEWLINE# self . _sparse_array = sparse_array #NEWLINE# return self