Package org.apfloat
Class GCDHelper
- java.lang.Object
-
- org.apfloat.GCDHelper
-
class GCDHelper extends java.lang.ObjectBinary recursive GCD algorithm implementation.- Since:
- 1.6
- Version:
- 1.10.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classGCDHelper.HalfGcdTypeprivate static classGCDHelper.Matrix
-
Constructor Summary
Constructors Modifier Constructor Description privateGCDHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static Apint[]binaryDivide(Apint a, Apint b)private static Apintcmod(Apint a, Apint m)private static ApintelementaryGcd(Apint a, Apint b)static Apintgcd(Apint a, Apint b)private static GCDHelper.HalfGcdTypehalfBinaryGcd(Apint a, Apint b, long k)private static ApintpowerOfTwo(long n)private static ApintrecursiveGcd(Apint a, Apint b)private static longv(Apint a)
-
-
-
Method Detail
-
gcd
public static Apint gcd(Apint a, Apint b) throws ApfloatRuntimeException
- Throws:
ApfloatRuntimeException
-
elementaryGcd
private static Apint elementaryGcd(Apint a, Apint b) throws ApfloatRuntimeException
- Throws:
ApfloatRuntimeException
-
recursiveGcd
private static Apint recursiveGcd(Apint a, Apint b) throws ApfloatRuntimeException
- Throws:
ApfloatRuntimeException
-
halfBinaryGcd
private static GCDHelper.HalfGcdType halfBinaryGcd(Apint a, Apint b, long k) throws ApfloatRuntimeException
- Throws:
ApfloatRuntimeException
-
binaryDivide
private static Apint[] binaryDivide(Apint a, Apint b) throws ApfloatRuntimeException
- Throws:
ApfloatRuntimeException
-
v
private static long v(Apint a) throws ApfloatRuntimeException
- Throws:
ApfloatRuntimeException
-
powerOfTwo
private static Apint powerOfTwo(long n) throws ApfloatRuntimeException
- Throws:
ApfloatRuntimeException
-
cmod
private static Apint cmod(Apint a, Apint m) throws ApfloatRuntimeException
- Throws:
ApfloatRuntimeException
-
-