Package com.google.common.math
Enum LongMath.MillerRabinTester
- java.lang.Object
-
- java.lang.Enum<LongMath.MillerRabinTester>
-
- com.google.common.math.LongMath.MillerRabinTester
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<LongMath.MillerRabinTester>
- Enclosing class:
- LongMath
private static enum LongMath.MillerRabinTester extends java.lang.Enum<LongMath.MillerRabinTester>
-
-
Constructor Summary
Constructors Modifier Constructor Description private
MillerRabinTester()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) abstract long
mulMod(long a, long b, long m)
Returns a * b mod m.private long
powMod(long a, long p, long m)
Returns a^p mod m.(package private) abstract long
squareMod(long a, long m)
Returns a^2 mod m.(package private) static boolean
test(long base, long n)
private boolean
testWitness(long base, long n)
Returns true if n is a strong probable prime relative to the specified base.static LongMath.MillerRabinTester
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static LongMath.MillerRabinTester[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
SMALL
public static final LongMath.MillerRabinTester SMALL
Works for inputs <= FLOOR_SQRT_MAX_LONG.
-
LARGE
public static final LongMath.MillerRabinTester LARGE
Works for all nonnegative signed longs.
-
-
Method Detail
-
values
public static LongMath.MillerRabinTester[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (LongMath.MillerRabinTester c : LongMath.MillerRabinTester.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static LongMath.MillerRabinTester valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
test
static boolean test(long base, long n)
-
mulMod
abstract long mulMod(long a, long b, long m)
Returns a * b mod m.
-
squareMod
abstract long squareMod(long a, long m)
Returns a^2 mod m.
-
powMod
private long powMod(long a, long p, long m)
Returns a^p mod m.
-
testWitness
private boolean testWitness(long base, long n)
Returns true if n is a strong probable prime relative to the specified base.
-
-