@Test public void testComputeC2() { for (int i = 0; i < 10; i++) { Complex q2 = random(), f2 = random(); Complex result = q2.plus(1).times(f2); assertEquals(result, computeC2(q2, f2), 0); } }
@VisibleForTesting static Complex computeC2(Complex q2, Complex f2) { double tmp; double re0; double im0; re0 = 1 + q2.getRe(); im0 = q2.getIm(); tmp = re0 * f2.getRe() - im0 * f2.getIm(); im0 = re0 * f2.getIm() + im0 * f2.getRe(); re0 = tmp; return Complex.cart(re0, im0); }
MullerNewtonSolver implements IRootsSolver { @VisibleForTesting static Complex computeC2(Complex q2, Complex f2) { double tmp; double re0; double im0; re0 = 1 + q2.getRe(); im0 = q2.getIm(); tmp = re0 * f2.getRe() - im0 * f2.getIm(); im0 = re0 * f2.getIm() + im0 * f2.getRe(); re0 = tmp; return Complex.cart(re0, im0); } }
MullerNewtonSolver implements IRootsSolver { @VisibleForTesting static Complex computeC2(Complex q2, Complex f2) { double tmp; double re0; double im0; re0 = 1 + q2.getRe(); im0 = q2.getIm(); tmp = re0 * f2.getRe() - im0 * f2.getIm(); im0 = re0 * f2.getIm() + im0 * f2.getRe(); re0 = tmp; return Complex.cart(re0, im0); } MullerNewtonSolver(); }
MullerNewtonSolver implements IRootsSolver { @VisibleForTesting static Complex computeC2(Complex q2, Complex f2) { double tmp; double re0; double im0; re0 = 1 + q2.getRe(); im0 = q2.getIm(); tmp = re0 * f2.getRe() - im0 * f2.getIm(); im0 = re0 * f2.getIm() + im0 * f2.getRe(); re0 = tmp; return Complex.cart(re0, im0); } MullerNewtonSolver(); @Override void clear(); @Override MullerNewtonSolver exemplar(); @Override boolean factorize(final Polynomial p); @Override Polynomial remainder(); @Override Complex[] roots(); boolean isLeastSquaresDivision(); void setLeastSquaresDivision(boolean lq); }
MullerNewtonSolver implements IRootsSolver { @VisibleForTesting static Complex computeC2(Complex q2, Complex f2) { double tmp; double re0; double im0; re0 = 1 + q2.getRe(); im0 = q2.getIm(); tmp = re0 * f2.getRe() - im0 * f2.getIm(); im0 = re0 * f2.getIm() + im0 * f2.getRe(); re0 = tmp; return Complex.cart(re0, im0); } MullerNewtonSolver(); @Override void clear(); @Override MullerNewtonSolver exemplar(); @Override boolean factorize(final Polynomial p); @Override Polynomial remainder(); @Override Complex[] roots(); boolean isLeastSquaresDivision(); void setLeastSquaresDivision(boolean lq);  }