Package org.apfloat
Class GCDHelper
- java.lang.Object
-
- org.apfloat.GCDHelper
-
class GCDHelper extends java.lang.Object
Binary recursive GCD algorithm implementation.- Since:
- 1.6
- Version:
- 1.10.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
GCDHelper.HalfGcdType
private static class
GCDHelper.Matrix
-
Constructor Summary
Constructors Modifier Constructor Description private
GCDHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static Apint[]
binaryDivide(Apint a, Apint b)
private static Apint
cmod(Apint a, Apint m)
private static Apint
elementaryGcd(Apint a, Apint b)
static Apint
gcd(Apint a, Apint b)
private static GCDHelper.HalfGcdType
halfBinaryGcd(Apint a, Apint b, long k)
private static Apint
powerOfTwo(long n)
private static Apint
recursiveGcd(Apint a, Apint b)
private static long
v(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
-
-