GraphLib  2.0
une librairie C# pour l’exploitation de graphes en reconnaissance des formes
 All Classes Namespaces Functions Enumerations Enumerator Properties
Matching.SmallPrimeUtility Class Reference

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 Public Member Functions

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...
 

Properties

static IList< int > PrimeTable [get]
 A List of all primes from 2 to 2^16. More...
 

Detailed Description

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.

Member Function Documentation

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
numeratorNumerator argument, expressed as list of prime factors.
denominatorDenominator 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
valueInteger, 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
iThe 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
lhsLeft Hand Side argument, expressed as list of prime factors.
rhsRight Hand Side argument, expressed as list of prime factors.
Returns
Product, expressed as list of prime factors.

Property Documentation

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: