Browse Source

constants: new Pi2 = 2 * pi

Signed-off-by: Christoph Ruegg <git@cdrnet.ch>
pull/2/head
Christoph Ruegg 17 years ago
parent
commit
3ae18748f6
  1. 3
      src/Numerics/Constants.cs
  2. 2
      src/Numerics/IntegralTransforms/Algorithms/DiscreteFourierTransform.Naive.cs
  3. 2
      src/Numerics/IntegralTransforms/Algorithms/DiscreteHartleyTransform.Naive.cs

3
src/Numerics/Constants.cs

@ -74,6 +74,9 @@ namespace MathNet.Numerics
/// <summary>The number pi</summary>
public const double Pi = 3.1415926535897932384626433832795028841971693993751d;
/// <summary>The number 2*pi</summary>
public const double Pi2 = 6.2831853071795864769252867665590057683943387987502d;
/// <summary>The number 1/pi</summary>
public const double OneOverPi = 0.31830988618379067153776752674502872406891929148091d;

2
src/Numerics/IntegralTransforms/Algorithms/DiscreteFourierTransform.Naive.cs

@ -44,7 +44,7 @@ namespace MathNet.Numerics.IntegralTransforms.Algorithms
/// <returns>Corresponding frequency-space vector.</returns>
internal static Complex[] Naive(Complex[] samples, int exponentSign)
{
double w0 = exponentSign * 2 * Constants.Pi / samples.Length;
double w0 = exponentSign * Constants.Pi2 / samples.Length;
var spectrum = new Complex[samples.Length];
Parallel.For(

2
src/Numerics/IntegralTransforms/Algorithms/DiscreteHartleyTransform.Naive.cs

@ -43,7 +43,7 @@ namespace MathNet.Numerics.IntegralTransforms.Algorithms
/// <returns>Corresponding frequency-space vector.</returns>
internal static double[] Naive(double[] samples)
{
double w0 = 2 * Constants.Pi / samples.Length;
double w0 = Constants.Pi2 / samples.Length;
var spectrum = new double[samples.Length];
Parallel.For(

Loading…
Cancel
Save