#NEWLINE# def find_roots( a , mode = 'f' ) : #NEWLINE# #INDENT# "\n    Find LP roots (poles) from a set of LP coefficients.\n\n    Parameters\n    ----------\n    a : array\n        LP coefficients.\n    mode : {'f', 'b'}\n        Mode of LP coefficients.  'f' for coefficients ordered m, m - 1,..., 1.\n        'b' for coefficients ordered 1, 2, ...., m\n\n    Returns\n    -------\n    roots : array\n        LP roots (poles)\n\n    " #NEWLINE# if ( mode not in [ 'f' , 'b' ] ) : #NEWLINE# #INDENT# raise ValueError ( "mode must be 'f' or 'b'" ) #NEWLINE# #UNINDENT# p = np . empty ( ( len ( a ) + 1 ) , dtype = a . dtype ) #NEWLINE# p [ 0 ] = ( 1.0 + 0j ) #NEWLINE# if ( mode == 'f' ) : #NEWLINE# #INDENT# p [ 1 : ] = ( - a . flat [ : : ( - 1 ) ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# p [ 1 : ] = ( - a . flat [ : ] ) #NEWLINE# #UNINDENT# return np . roots ( p )