/** Test iterators. */
  public void testIterators() {
    // integers
    BigInteger rf = new BigInteger();
    // System.out.println("rf = " + rf);

    // polynomials over integral numbers
    GenPolynomialRing<BigInteger> pf = new GenPolynomialRing<BigInteger>(rf, rl);
    // System.out.println("pf = " + pf);

    // random polynomial
    GenPolynomial<BigInteger> p = pf.random(kl, 2 * ll, el, q);
    // System.out.println("p = " + p);

    // test monomials
    for (Monomial<BigInteger> m : p) {
      // System.out.println("m = " + m);
      assertFalse("m.c == 0 ", m.coefficient().isZERO());
      assertFalse("m.e < (0) ", m.exponent().signum() < 0);
    }

    // test exponents
    Iterator<ExpVector> et = p.exponentIterator();
    while (et.hasNext()) {
      ExpVector e = et.next();
      // System.out.println("e = " + e);
      assertFalse("e < (0) ", e.signum() < 0);
    }

    // test coefficents
    Iterator<BigInteger> ct = p.coefficientIterator();
    while (ct.hasNext()) {
      BigInteger i = ct.next();
      // System.out.println("i = " + i);
      assertFalse("i == 0 ", i.isZERO());
    }
  }
Пример #2
0
 /**
  * ExpVector sign.
  *
  * @param U
  * @return 0 if U is zero, -1 if some entry is negative, 1 if no entry is negativ and at least one
  *     entry is positive.
  */
 public static int EVSIGN(ExpVector U) {
   return U.signum();
 }