List of usage examples for org.apache.commons.math3.analysis.solvers LaguerreSolver solveAllComplex
public Complex[] solveAllComplex(double[] coefficients, double initial) throws NullArgumentException, NoDataException, TooManyEvaluationsException
From source file:dom.rootlocus.utils.Utils.java
public Complex[] getRoots(PolynomialFunction p) { double[] coefficients = p.getCoefficients(); LaguerreSolver solver = new LaguerreSolver(1e-10); Complex[] r = solver.solveAllComplex(p.getCoefficients(), 0); return r;// w w w . j a v a2 s . c o m // Complex[] roots = new Complex[r.length]; // for (int i = 0; i < r.length; i++) { // double Re = new BigDecimal(r[i].getReal()).setScale(5, RoundingMode.HALF_UP).doubleValue(); // double Img = new BigDecimal(r[i].getImaginary()).setScale(5, RoundingMode.HALF_UP).doubleValue(); // roots[i] = new Complex(Re, Img); // } // return roots; }