Polynomial implements IReadDataBlock { public static Polynomial copyOf(double[] coefficients) { if (Arrays2.isNullOrEmpty(coefficients)) { throw new IllegalArgumentException("Coefficients cannot be null or empty"); } int usedDegree = Doubles.getUsedDegree(coefficients); Polynomial result = Cache.find(coefficients, usedDegree); return result != null ? result : new Polynomial(Arrays.copyOf(coefficients, usedDegree + 1), usedDegree); } private  Polynomial(final double[] coefficients, final int degree); static Division divide(final Polynomial num, final Polynomial denom); @Override void copyTo(double[] buffer, int start); @Override int getLength(); @Override IReadDataBlock rextract(int start, int length); static Complex[] checkRoots(final Complex[] roots); static double getEpsilon(); static Polynomial of(double[] coefficients); static Polynomial copyOf(double[] coefficients); static Polynomial copyOf(double[] coefficients, int start, int end); static Polynomial valueOf(double firstCoefficient, double... nextCoefficients); static Polynomial fromComplexRoots(Complex[] roots); static Polynomial fromComplexRoots(final Complex[] roots, final double c); static Polynomial fromData(IReadDataBlock data); static Polynomial factor(double c, int n); static void setEpsilon(final double value); static IRootsSolver getDefRootsSearcher(); static void setDefRootsSearcher(final IRootsSolver value); Polynomial adjustDegree(); Polynomial derivate(); Polynomial divide(final double d); Polynomial divide(final Polynomial r); @Override boolean equals(final Object obj); boolean equals(Polynomial other, double epsilon); Complex evaluateAt(final Complex x); double evaluateAt(final double x); static double revaluate(final double[] c, final double x); static double evaluate(final double[] c, final double x); static double evaluate(final int degree, IntToDoubleFunction fn, final double x); Complex evaluateAtFrequency(final double w); @Override double get(final int idx); double[] getCoefficients(); int getDegree(); @Override int hashCode(); boolean isZero(); boolean isIdentity(); Polynomial minus(double d); Polynomial minus(final Polynomial r); Polynomial mirror(); Polynomial negate(); Polynomial plus(final double d); Polynomial plus(final Polynomial r); Complex[] roots(); Complex[] roots(IRootsSolver searcher); Polynomial smooth(); Polynomial times(final double d); Polynomial times(final Polynomial r); Polynomial times(final Polynomial r, boolean computeroots); @Override String toString(); String toString(final char var, final boolean bSmooth); String toString(final String fmt, final char var,
            final boolean bSmooth); static final Polynomial ZERO; static final Polynomial ONE; }
@Test public void testCopyOf() { double[] data = new double[]{A, B}; Polynomial p1 = Polynomial.copyOf(data); assertCoefficientsEquals(data, p1); data[0] = 666; assertEquals(A, p1.get(0), NO_DELTA); }
@Test(expected = IllegalArgumentException.class) public void testCopyOfNull() { Polynomial.copyOf(null); }
@Test(expected = IllegalArgumentException.class) public void testCopyOfEmpty() { Polynomial.copyOf(new double[]{}); }