/** * Bi-section point. * * @param iv interval with f(left) * f(right) != 0. * @param f univariate polynomial, non-zero. * @return a point c in the interval iv such that f(c) != 0. */ public C bisectionPoint(Interval<C> iv, GenPolynomial<C> f) { if (f == null) { return null; } RingFactory<C> cfac = f.ring.coFac; C two = cfac.fromInteger(2); C c = iv.left.sum(iv.right); c = c.divide(two); if (f.isZERO() || f.isConstant()) { return c; } C m = PolyUtil.<C>evaluateMain(cfac, f, c); while (m.isZERO()) { C d = iv.left.sum(c); d = d.divide(two); if (d.equals(c)) { d = iv.right.sum(c); d = d.divide(two); if (d.equals(c)) { throw new RuntimeException("should not happen " + iv); } } c = d; m = PolyUtil.<C>evaluateMain(cfac, f, c); // System.out.println("c = " + c); } // System.out.println("c = " + c); return c; }
public boolean equals(Object o) { if (o instanceof Triple) { Triple t = (Triple) o; return first.equals(t.first) && second.equals(t.second) && third.equals(t.third); } return false; }
@Override @SuppressWarnings("rawtypes") public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } InstanceContextHolder other = (InstanceContextHolder) obj; if (context == null) { if (other.context != null) { return false; } } else if (!context.equals(other.context)) { return false; } if (instance == null) { if (other.instance != null) { return false; } } else if (!instance.equals(other.instance)) { return false; } return true; }
@Override public boolean equals(Object o) { if (o instanceof Block<?>) { Block<?> c = (Block<?>) o; return x == c.x && y == c.y && content.equals(c.content); } return false; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } final ThreeTuple<?, ?, ?> t = (ThreeTuple<?, ?, ?>) obj; if (a.equals(t.a) && b.equals(t.b) && c.equals(t.c)) { return true; } return false; }
/** * Is Quotient one. * * @return If this is 1 then true is returned, else false. * @see edu.jas.structure.RingElem#isONE() */ public boolean isONE() { return num.equals(den); }