Java Utililty Methods Euclidean

List of utility methods to do Euclidean

Description

The list of methods to do Euclidean are organized into topic(s).

Method

longeuclideanGCD(final long firstNumerator, final long secondNumerator)
euclidean GCD
long firstEuclidean = firstNumerator;
long secondEuclidean = secondNumerator;
while (firstEuclidean != 0) {
    final long tempEuclidean = firstEuclidean;
    firstEuclidean = secondEuclidean % firstEuclidean;
    secondEuclidean = tempEuclidean;
return Math.abs(secondEuclidean);
...
longeuclideanGcd(long a, long b)
euclidean Gcd
while (b != 0) {
    long t = b;
    b = a % b;
    a = t;
return a;
doubleeuclideanLength(double[] vector)
euclidean Length
double x2 = 0;
for (double d : vector) {
    x2 += d * d;
return Math.sqrt(x2);
floateuclideanMod(final float x, final float y)
Returns Euclidean modulo of x , y .
final float mod = x % y;
return (mod < 0) ? mod + y : mod;
floateuclideanNorm(float vector[])
euclidean Norm
int n = vector.length;
if (n < 1) {
    return 0;
if (n == 1) {
    return Math.abs(vector[0]);
double scale = 0; 
...
doubleeuclideanNormSquared(double[] x1, double[] x2)
Computing the norm as the Euclidean norm squared (i.e.
double distance = 0.0;
for (int d = 0; d < x1.length; d++) {
    double difference = x1[d] - x2[d];
    distance += difference * difference;
return distance;