#NEWLINE# def median( a , dim = None ) : #NEWLINE# #INDENT# if ( dim is not None ) : #NEWLINE# #INDENT# out = Array ( ) #NEWLINE# safe_call ( backend . get ( ) . af_median ( ct . pointer ( out . arr ) , a . arr , ct . c_int ( dim ) ) ) #NEWLINE# return out #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# real = ct . c_double ( 0 ) #NEWLINE# imag = ct . c_double ( 0 ) #NEWLINE# safe_call ( backend . get ( ) . af_median_all ( ct . pointer ( real ) , ct . pointer ( imag ) , a . arr ) ) #NEWLINE# real = real . value #NEWLINE# imag = imag . value #NEWLINE# return ( real if ( dim == 0 ) else ( real + ( imag * 1j ) ) )