Package org.apache.hadoop.examples.pi.Util

Examples of org.apache.hadoop.examples.pi.Util.Timer.tick()


        final long s = square(r, n, r2p64);
        if (s != answer)
          assertEquals("r=" + r + ", n=" + n + ", answer=" + answer + " but s=" + s, answer, s);
      }
    }
    t.tick("square");

    for(int i = 0; i < rn.length; i++) {
      final long n = rn[i][0][0];
      final BigInteger N = BigInteger.valueOf(n);
      for(int j = 1; j < rn[i].length; j++) {
View Full Code Here


        final long s = R.multiply(R).mod(N).longValue();
        if (s != answer)
          assertEquals("r=" + r + ", n=" + n + ", answer=" + answer + " but s=" + s, answer, s);
      }
    }
    t.tick("R.multiply(R).mod(N)");

    for(int i = 0; i < rn.length; i++) {
      final long n = rn[i][0][0];
      final BigInteger N = BigInteger.valueOf(n);
      for(int j = 1; j < rn[i].length; j++) {
View Full Code Here

        final long s = R.modPow(TWO, N).longValue();
        if (s != answer)
          assertEquals("r=" + r + ", n=" + n + ", answer=" + answer + " but s=" + s, answer, s);
      }
    }
    t.tick("R.modPow(TWO, N)");
  }

  static long[][][] generateEN(int nsize, int esize) {
    final long[][][] en = new long[nsize][][];
View Full Code Here

    }
  }
 
  static void modBenchmarks() {
    final Timer t = new Timer(false);
    t.tick("modBenchmarks()");

    final long[][][] en = generateEN(10000, 10);
    t.tick("generateEN");

    for(int i = 0; i < en.length; i++) {
View Full Code Here

  static void modBenchmarks() {
    final Timer t = new Timer(false);
    t.tick("modBenchmarks()");

    final long[][][] en = generateEN(10000, 10);
    t.tick("generateEN");

    for(int i = 0; i < en.length; i++) {
      final long n = en[i][0][0];
      for(int j = 1; j < en[i].length; j++) {
        final long e = en[i][j][0];
View Full Code Here

        final long s = Modular.mod(e, n);
        if (s != answer)
          assertEquals("e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s, answer, s);
      }
    }
    t.tick("Modular.mod");
   
    final Montgomery2 m2 = new Montgomery2();
    for(int i = 0; i < en.length; i++) {
      final long n = en[i][0][0];
      m2.set(n);
View Full Code Here

        final long s = m2.mod(e);
        if (s != answer)
          assertEquals("e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s, answer, s);
      }
    }
    t.tick("montgomery.mod");

    for(int i = 0; i < en.length; i++) {
      final long n = en[i][0][0];
      m2.set(n);
      for(int j = 1; j < en[i].length; j++) {
View Full Code Here

        final long s = m2.mod2(e);
        if (s != answer)
          assertEquals("e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s, answer, s);
      }
    }
    t.tick("montgomery.mod2");

    for(int i = 0; i < en.length; i++) {
      final long n = en[i][0][0];
      final BigInteger N = BigInteger.valueOf(n);
      for(int j = 1; j < en[i].length; j++) {
View Full Code Here

        final long s = TWO.modPow(BigInteger.valueOf(e), N).longValue();
        if (s != answer)
          assertEquals("e=" + e + ", n=" + n + ", answer=" + answer + " but s=" + s, answer, s);
      }
    }
    t.tick("BigInteger.modPow(e, n)");
  }

  public static void main(String[] args) {
    squareBenchmarks();
    modBenchmarks();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.