Package de.tilman_neumann.jml.gcd
Class Gcd63
- java.lang.Object
- 
- de.tilman_neumann.jml.gcd.Gcd63
 
- 
 public class Gcd63 extends Object GCD implementations for longs. The binary gcd is much faster than the Euclidean, and also faster than the built-in BigInteger gcd().- Author:
- Tilman Neumann
 
- 
- 
Constructor SummaryConstructors Constructor Description Gcd63()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description longgcd(long a, long b)Faster binary gcd adapted from OpenJdk's MutableBigInteger.binaryGcd(int, int).Longgcd(Collection<Long> arguments)GCD of all arguments.longgcd_binary1(long m, long n)Binary gcd implementation.longgcd_euclid_withDivision(long m, long n)Greatest common divisor of the given two arguments.
 
- 
- 
- 
Method Detail- 
gcd_euclid_withDivisionpublic long gcd_euclid_withDivision(long m, long n)Greatest common divisor of the given two arguments. Euclid's algorithm implementation with division.- Parameters:
- m-
- n-
- Returns:
- gcd(m, n)
 
 - 
gcd_binary1public long gcd_binary1(long m, long n)Binary gcd implementation.- Parameters:
- m-
- n-
- Returns:
- gcd(m, n)
 
 - 
gcdpublic long gcd(long a, long b)Faster binary gcd adapted from OpenJdk's MutableBigInteger.binaryGcd(int, int).- Parameters:
- a-
- b-
- Returns:
- gcd(a, b)
 
 - 
gcdpublic Long gcd(Collection<Long> arguments) GCD of all arguments.- Parameters:
- arguments-
- Returns:
- gcd of all arguments
 
 
- 
 
-