Utility class that maintains a small table of prime numbers and provides simple implementations of Prime Factorization algorithms. This is a quick and dirty utility class to support calculations of permutation sets with indexes under 2^31. The prime table contains all primes up to Sqrt(2^31) which are all of the primes requires to factorize any Int32 positive integer.
More...
|
static List< int > | Factor (int i) |
| Performs a prime factorization of a given integer using the table of primes in PrimeTable. Since this will only factor Int32 sized integers, a simple list of factors is returned instead of the more scalable, but more difficult to consume, list of primes and associated exponents. More...
|
|
static List< int > | MultiplyPrimeFactors (IList< int > lhs, IList< int > rhs) |
| Given two integers expressed as a list of prime factors, multiplies these numbers together and returns an integer also expressed as a set of prime factors. This allows multiplication to overflow well beyond a Int64 if necessary. More...
|
|
static List< int > | DividePrimeFactors (IList< int > numerator, IList< int > denominator) |
| Given two integers expressed as a list of prime factors, divides these numbers and returns an integer also expressed as a set of prime factors. If the result is not a integer, then the result is undefined. That is, 11 / 5 when divided by this function will not yield a correct result. As such, this function is ONLY useful for division with combinatorial results where the result is known to be an integer AND the division occurs as the last operation(s). More...
|
|
static long | EvaluatePrimeFactors (IList< int > value) |
| Given a list of prime factors returns the long representation. More...
|
|
Utility class that maintains a small table of prime numbers and provides simple implementations of Prime Factorization algorithms. This is a quick and dirty utility class to support calculations of permutation sets with indexes under 2^31. The prime table contains all primes up to Sqrt(2^31) which are all of the primes requires to factorize any Int32 positive integer.
static List<int> Matching.SmallPrimeUtility.DividePrimeFactors |
( |
IList< int > |
numerator, |
|
|
IList< int > |
denominator |
|
) |
| |
|
static |
Given two integers expressed as a list of prime factors, divides these numbers and returns an integer also expressed as a set of prime factors. If the result is not a integer, then the result is undefined. That is, 11 / 5 when divided by this function will not yield a correct result. As such, this function is ONLY useful for division with combinatorial results where the result is known to be an integer AND the division occurs as the last operation(s).
- Parameters
-
numerator | Numerator argument, expressed as list of prime factors. |
denominator | Denominator argument, expressed as list of prime factors. |
- Returns
- Resultant, expressed as list of prime factors.
static long Matching.SmallPrimeUtility.EvaluatePrimeFactors |
( |
IList< int > |
value | ) |
|
|
static |
Given a list of prime factors returns the long representation.
- Parameters
-
value | Integer, expressed as list of prime factors. |
- Returns
- Standard long representation.
static List<int> Matching.SmallPrimeUtility.Factor |
( |
int |
i | ) |
|
|
static |
Performs a prime factorization of a given integer using the table of primes in PrimeTable. Since this will only factor Int32 sized integers, a simple list of factors is returned instead of the more scalable, but more difficult to consume, list of primes and associated exponents.
- Parameters
-
i | The number to factorize, must be positive. |
- Returns
- A simple list of factors.
static List<int> Matching.SmallPrimeUtility.MultiplyPrimeFactors |
( |
IList< int > |
lhs, |
|
|
IList< int > |
rhs |
|
) |
| |
|
static |
Given two integers expressed as a list of prime factors, multiplies these numbers together and returns an integer also expressed as a set of prime factors. This allows multiplication to overflow well beyond a Int64 if necessary.
- Parameters
-
lhs | Left Hand Side argument, expressed as list of prime factors. |
rhs | Right Hand Side argument, expressed as list of prime factors. |
- Returns
- Product, expressed as list of prime factors.
IList<int> Matching.SmallPrimeUtility.PrimeTable |
|
staticget |
A List of all primes from 2 to 2^16.
The documentation for this class was generated from the following file:
- D:/Documents/Polytech/5ème_année/PFE/Dépôt_Projet/GraphMatchingSeb/GraphMatching/Matching/Combinatorics/SmallPrimeUtility.cs