C# Class GSF.NumericalAnalysis.Euclidean

Contains an implementation of greatest common denominator and least common multiple using the Euclidean algorithm.
显示文件 Open project: GridProtectionAlliance/gsf

Public Methods

Method Description
GreatestCommonDenominator ( ) : int

Gets the greatest common denominator of all the integers in the source collection.

GreatestCommonDenominator ( int a, int b ) : int

Gets the greatest common denominator of the given integers.

GreatestCommonDenominator ( this source ) : int

Gets the greatest common denominator of all the integers in the source collection.

GreatestCommonDenominator ( ) : long

Gets the greatest common denominator of all the integers in the source collection.

GreatestCommonDenominator ( long a, long b ) : long

Gets the greatest common denominator of the given integers.

GreatestCommonDenominator ( this source ) : long

Gets the greatest common denominator of all the integers in the source collection.

LeastCommonMultiple ( ) : int

Gets the least common multiple of all the integers in the source collection.

LeastCommonMultiple ( int a, int b ) : int

Gets the least common multiple of the given integers.

LeastCommonMultiple ( this source ) : int

Gets the least common multiple of all the integers in the source collection.

LeastCommonMultiple ( ) : long

Gets the least common multiple of all the integers in the source collection.

LeastCommonMultiple ( long a, long b ) : long

Gets the least common multiple of the given integers.

LeastCommonMultiple ( this source ) : long

Gets the least common multiple of all the integers in the source collection.

Mod ( double numerator, double denominator ) : double

Implementation of the modulo operator using Euclidean division.

Wrap ( double value, double minimum, double range ) : double

Wraps a value to a range of values defined by the given minimum value and range.

This method wraps the given value based on the assumption that for every pair of values x and y where x-y=range, the values are equivalent. This is probably most widely understood in terms of angles, where 0, 360, 720, etc. are all equivalent angles. If you wanted to wrap an angle such that it is between 120 and 480, for instance, you could call Euclidean.Wrap(angle, 120, 360).

Method Details

GreatestCommonDenominator() public static method

Gets the greatest common denominator of all the integers in the source collection.
public static GreatestCommonDenominator ( ) : int
return int

GreatestCommonDenominator() public static method

Gets the greatest common denominator of the given integers.
public static GreatestCommonDenominator ( int a, int b ) : int
a int The first of the given integers.
b int The second of the given integers.
return int

GreatestCommonDenominator() public static method

Gets the greatest common denominator of all the integers in the source collection.
public static GreatestCommonDenominator ( this source ) : int
source this The collection of integers.
return int

GreatestCommonDenominator() public static method

Gets the greatest common denominator of all the integers in the source collection.
public static GreatestCommonDenominator ( ) : long
return long

GreatestCommonDenominator() public static method

Gets the greatest common denominator of the given integers.
public static GreatestCommonDenominator ( long a, long b ) : long
a long The first of the given integers.
b long The second of the given integers.
return long

GreatestCommonDenominator() public static method

Gets the greatest common denominator of all the integers in the source collection.
public static GreatestCommonDenominator ( this source ) : long
source this The collection of integers.
return long

LeastCommonMultiple() public static method

Gets the least common multiple of all the integers in the source collection.
public static LeastCommonMultiple ( ) : int
return int

LeastCommonMultiple() public static method

Gets the least common multiple of the given integers.
public static LeastCommonMultiple ( int a, int b ) : int
a int The first of the given integers.
b int The second of the given integers.
return int

LeastCommonMultiple() public static method

Gets the least common multiple of all the integers in the source collection.
public static LeastCommonMultiple ( this source ) : int
source this The collection of integers.
return int

LeastCommonMultiple() public static method

Gets the least common multiple of all the integers in the source collection.
public static LeastCommonMultiple ( ) : long
return long

LeastCommonMultiple() public static method

Gets the least common multiple of the given integers.
public static LeastCommonMultiple ( long a, long b ) : long
a long The first of the given integers.
b long The second of the given integers.
return long

LeastCommonMultiple() public static method

Gets the least common multiple of all the integers in the source collection.
public static LeastCommonMultiple ( this source ) : long
source this The collection of integers.
return long

Mod() public static method

Implementation of the modulo operator using Euclidean division.
public static Mod ( double numerator, double denominator ) : double
numerator double The number to be divided.
denominator double The number to divide by.
return double

Wrap() public static method

Wraps a value to a range of values defined by the given minimum value and range.
This method wraps the given value based on the assumption that for every pair of values x and y where x-y=range, the values are equivalent. This is probably most widely understood in terms of angles, where 0, 360, 720, etc. are all equivalent angles. If you wanted to wrap an angle such that it is between 120 and 480, for instance, you could call Euclidean.Wrap(angle, 120, 360).
public static Wrap ( double value, double minimum, double range ) : double
value double The value to be wrapped.
minimum double The minimum value of the range.
range double The size of the range.
return double