C# Class YAMP.Numerics.Helpers

Provides some commonly used methods for numeric algorithms.
Show file Open project: FlorianRappl/YAMP

Public Properties

Property Type Description
BernoulliNumbers Double[]
LanczosD Double[]
LogPI Double
LogTwo Double
SqrtPI Double
SqrtThree Double
SqrtTwo Double
SqrtTwoPI Double
TwoPIpow Double[]

Public Methods

Method Description
BinomialCoefficient ( Double n, Double k ) : Double

Computes the real binomial coefficient (almost general) given two values, n choose k.

BinomialCoefficient ( ScalarValue n, ScalarValue k ) : ScalarValue

Computes the complex binomial coefficient (very general) given two values, n choose k.

ChebEval ( ChebSeries cs, Double x ) : Double

Evaluate a real Chebyshev polynomial on an interval, given the coefficients.

ChebEval ( Int32 n, Double coefficients, Double x ) : Double

Evaluate a real Chebyshev polynomial on an interval, given the coefficients.

ChebEval ( ChebSeries cs, ScalarValue z ) : ScalarValue

Evaluate a complex Chebyshev polynomial on an interval, given the coefficients.

ComputeRoots ( Int32 N, Int32 sign ) : ScalarValue[]

computes the N-th roots of unity, which are the factors in a length-N Fourier transform.

Factorial ( Int32 n ) : Double

Computes the factorial of an integer and returns a double with the result.

GCD ( Int32 A, Int32 B ) : Int32

Computes the greatest common divisor of two numbers.

Hypot ( Double a, Double b ) : Double

Computes the length of a right triangle's hypotenuse.

IsPrimeNumber ( Int32 n ) : System.Boolean

Returns a boolean if the given integer is a prime number.

PowMod ( Int32 b, Int32 e, Int32 m ) : Int32

Computes a power of an integer in modular arithmetic.

Power ( ScalarValue z, Int32 n ) : ScalarValue

Takes the power of z to an integer n.

Private Methods

Method Description
IsProbablyPrime ( Int32 n, Int32 m, Int32 s, Int32 d, Int32 w ) : System.Boolean

Method Details

BinomialCoefficient() public static method

Computes the real binomial coefficient (almost general) given two values, n choose k.
public static BinomialCoefficient ( Double n, Double k ) : Double
n Double We have n elements.
k Double We choose k elements.
return Double

BinomialCoefficient() public static method

Computes the complex binomial coefficient (very general) given two values, n choose k.
public static BinomialCoefficient ( ScalarValue n, ScalarValue k ) : ScalarValue
n ScalarValue We have n elements.
k ScalarValue We choose k elements.
return ScalarValue

ChebEval() public static method

Evaluate a real Chebyshev polynomial on an interval, given the coefficients.
public static ChebEval ( ChebSeries cs, Double x ) : Double
cs ChebSeries The coefficients to consider.
x Double The real evaluation argument.
return Double

ChebEval() public static method

Evaluate a real Chebyshev polynomial on an interval, given the coefficients.
public static ChebEval ( Int32 n, Double coefficients, Double x ) : Double
n System.Int32 The order for the summation of the polynomial.
coefficients Double The coefficients to consider.
x Double The real evaluation argument.
return Double

ChebEval() public static method

Evaluate a complex Chebyshev polynomial on an interval, given the coefficients.
public static ChebEval ( ChebSeries cs, ScalarValue z ) : ScalarValue
cs ChebSeries The coefficients to consider.
z ScalarValue The complex evaluation argument.
return ScalarValue

ComputeRoots() public static method

computes the N-th roots of unity, which are the factors in a length-N Fourier transform.
public static ComputeRoots ( Int32 N, Int32 sign ) : ScalarValue[]
N System.Int32 What number of roots.
sign System.Int32 The sign to take.
return ScalarValue[]

Factorial() public static method

Computes the factorial of an integer and returns a double with the result.
public static Factorial ( Int32 n ) : Double
n System.Int32 The argument to take the factorial.
return Double

GCD() public static method

Computes the greatest common divisor of two numbers.
public static GCD ( Int32 A, Int32 B ) : Int32
A System.Int32 The first number.
B System.Int32 The second number.
return System.Int32

Hypot() public static method

Computes the length of a right triangle's hypotenuse.
public static Hypot ( Double a, Double b ) : Double
a Double The length of one side.
b Double The length of another side.
return Double

IsPrimeNumber() public static method

Returns a boolean if the given integer is a prime number.
public static IsPrimeNumber ( Int32 n ) : System.Boolean
n System.Int32 The integer to examine.
return System.Boolean

PowMod() public static method

Computes a power of an integer in modular arithmetic.
public static PowMod ( Int32 b, Int32 e, Int32 m ) : Int32
b System.Int32 The base, which must be positive.
e System.Int32 The exponent, which must be positive.
m System.Int32 The modulus, which must be positive.
return System.Int32

Power() public static method

Takes the power of z to an integer n.
public static Power ( ScalarValue z, Int32 n ) : ScalarValue
z ScalarValue The complex value z in C.
n System.Int32 The power n in N.
return ScalarValue

Property Details

BernoulliNumbers public static property

Provides access to the first 21 bernoulli numbers.
public static Double[] BernoulliNumbers
return Double[]

LanczosD public static property

Provides access do some Lanczos numbers.
public static Double[] LanczosD
return Double[]

LogPI public static property

Value of ln(Pi)
public static Double LogPI
return Double

LogTwo public static property

Value of ln(2)
public static Double LogTwo
return Double

SqrtPI public static property

Value of Sqrt(Pi)
public static Double SqrtPI
return Double

SqrtThree public static property

Value of Sqrt(3)
public static Double SqrtThree
return Double

SqrtTwo public static property

Value of Sqrt(2)
public static Double SqrtTwo
return Double

SqrtTwoPI public static property

Value of Sqrt(2 * Pi)
public static Double SqrtTwoPI
return Double

TwoPIpow public static property

Provides access to (2*pi)^(10*n) with n = 0, ..., 17.
public static Double[] TwoPIpow
return Double[]