def unique_cpx_roots(rlist,tol = <NUM_LIT>):
uniq = [rlist[<NUM_LIT:0>]]<EOL>mult = [<NUM_LIT:1>]<EOL>for k in range(<NUM_LIT:1>,len(rlist)):<EOL><INDENT>N_uniq = len(uniq)<EOL>for m in range(N_uniq):<EOL><INDENT>if abs(rlist[k]-uniq[m]) <= tol:<EOL><INDENT>mult[m] += <NUM_LIT:1><EOL>uniq[m] = (uniq[m]*(mult[m]-<NUM_LIT:1>) + rlist[k])/float(mult[m])<EOL>break<EOL><DEDENT><DEDENT>uniq = np.hstack((uniq,rlist[k]))<EOL>mult = np.hstack((mult,[<NUM_LIT:1>]))<EOL><DEDENT>return np.array(uniq), np.array(mult)<EOL>
The average of the root values is used when multiplicity 
is greater than one.

Mark Wickert October 2016