コード例 #1
0
 /**
  * run Sequential.
  *
  * @param S polynomial list.
  * @param action what to to.
  */
 @SuppressWarnings("unchecked")
 static void runSequential(PolynomialList S, String action, boolean plusextra) {
   List<GenSolvablePolynomial> L = S.list;
   List<GenSolvablePolynomial> G = null;
   long t;
   SolvableReduction sred = new SolvableReductionSeq();
   SolvableGroebnerBase sbb = null;
   if (plusextra) {
     // sbb = new SolvableGroebnerBaseSeqPlusextra();
     // System.out.println("SolvableGroebnerBaseSeqPlusextra not implemented using
     // SolvableGroebnerBaseSeq");
     sbb = new SolvableGroebnerBaseSeq(sred);
   } else {
     sbb = new SolvableGroebnerBaseSeq();
   }
   t = System.currentTimeMillis();
   System.out.println("\nSolvable GB [" + action + "] sequential ...");
   if (action.equals("irr")) {
     G = sred.leftIrreducibleSet(L);
   }
   if (action.equals("left")) {
     G = sbb.leftGB(L);
   }
   if (action.equals("right")) {
     G = sbb.rightGB(L);
   }
   if (action.equals("two")) {
     G = sbb.twosidedGB(L);
   }
   if (G == null) {
     System.out.println("unknown action = " + action + "\n");
     return;
   }
   S = new PolynomialList(S.ring, G);
   System.out.println("G =\n" + S);
   System.out.println("G.size() = " + G.size());
   t = System.currentTimeMillis() - t;
   if (plusextra) {
     System.out.print("seq+, ");
   } else {
     System.out.print("seq, ");
   }
   System.out.println("time = " + t + " milliseconds");
   checkGB(S);
   System.out.println("");
 }
コード例 #2
0
  /**
   * run Parallel.
   *
   * @param S polynomial list.
   * @param action what to to.
   */
  @SuppressWarnings("unchecked")
  static void runParallel(PolynomialList S, int threads, String action, boolean plusextra) {
    List<GenSolvablePolynomial> L = S.list;
    List<GenSolvablePolynomial> G = null;
    long t;
    SolvableReduction sred = new SolvableReductionPar();
    SolvableGroebnerBaseParallel sbb = null;
    SolvableGroebnerBaseSeqPairParallel sbbs = null;
    if (plusextra) {
      sbbs = new SolvableGroebnerBaseSeqPairParallel(threads);
    } else {
      sbb = new SolvableGroebnerBaseParallel(threads);
    }

    t = System.currentTimeMillis();
    System.out.println("\nSolvable GB [" + action + "] parallel " + threads + " threads ...");
    if (action.equals("irr")) {
      G = sred.leftIrreducibleSet(L);
    }
    if (action.equals("left")) {
      if (plusextra) {
        G = sbbs.leftGB(L);
      } else {
        G = sbb.leftGB(L);
      }
    }
    if (action.equals("right")) {
      if (plusextra) {
        G = sbbs.rightGB(L);
      } else {
        G = sbb.rightGB(L);
      }
    }
    if (action.equals("two")) {
      if (plusextra) {
        G = sbbs.twosidedGB(L);
      } else {
        G = sbb.twosidedGB(L);
      }
    }
    if (G == null) {
      System.out.println("unknown action = " + action + "\n");
      return;
    }
    if (G.size() > 0) {
      S = new PolynomialList(G.get(0).ring, G);
    } else {
      S = new PolynomialList(S.ring, G);
    }
    System.out.println("G =\n" + S);
    System.out.println("G.size() = " + G.size());
    t = System.currentTimeMillis() - t;
    if (plusextra) {
      System.out.print("p+ ");
    } else {
      System.out.print("p ");
    }
    System.out.println("= " + threads + ", time = " + t + " milliseconds");
    checkGB(S);
    System.out.println("");
    if (plusextra) {
      sbbs.terminate();
    } else {
      sbb.terminate();
    }
  }