def gf_to_dict(f, p, symmetric=True):
 (n, result) = (gf_degree(f), {})
 for k in range(0, (n + 1)):
  if symmetric:
   a = gf_int(f[(n - k)], p)
  else:
   a = f[(n - k)]
  if a:
   result[k] = a
 return result

def gf_to_dict ( f , p , symmetric = True ) : ( n , result ) = ( gf_degree ( f ) , { } ) for k in range ( 0 , ( n + 1 ) ) : if symmetric : a = gf_int ( f [ ( n - k ) ] , p ) else : a = f [ ( n - k ) ] if a : result [ k ] = a return result
convert a gf(p)[x] polynomial to a dict .