org.apache.hadoop.examples.pi.math
Class Modular

java.lang.Object
  extended by org.apache.hadoop.examples.pi.math.Modular

public class Modular
extends Object

Modular arithmetics


Constructor Summary
Modular()
           
 
Method Summary
static double addMod(double x, double a)
          Given x in [0,1) and a in (-1,1), return (x, a) mod 1.0.
static long mod(long e, long n)
          Compute 2^e mod n
static long modInverse(long x, long y)
          Given 0 < x < y, return x^(-1) mod y.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Modular

public Modular()
Method Detail

mod

public static long mod(long e,
                       long n)
Compute 2^e mod n


addMod

public static double addMod(double x,
                            double a)
Given x in [0,1) and a in (-1,1), return (x, a) mod 1.0.


modInverse

public static long modInverse(long x,
                              long y)
Given 0 < x < y, return x^(-1) mod y.



Copyright © 2009 The Apache Software Foundation