Skip to content

Commit

Permalink
Various StyleCop fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cdrnet committed Dec 22, 2008
1 parent 695f594 commit fdaa82e
Show file tree
Hide file tree
Showing 19 changed files with 63 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,11 @@ IList<double> x
{
if(!Number.AlmostZero(w[i - 1]) || !Number.AlmostZero(w[i + 1]))
{
d[i] = (w[i + 1] * diff[i - 1] + w[i - 1] * diff[i]) / (w[i + 1] + w[i - 1]);
d[i] = ((w[i + 1] * diff[i - 1]) + (w[i - 1] * diff[i])) / (w[i + 1] + w[i - 1]);
}
else
{
d[i] = ((tt[i + 1] - tt[i]) * diff[i - 1] + (tt[i] - tt[i - 1]) * diff[i]) / (tt[i + 1] - tt[i - 1]);
d[i] = (((tt[i + 1] - tt[i]) * diff[i - 1]) + ((tt[i] - tt[i - 1]) * diff[i])) / (tt[i + 1] - tt[i - 1]);
}
}

Expand Down Expand Up @@ -249,9 +249,9 @@ double x2
t = t - t0;
t1 = t1 - t0;
t2 = t2 - t0;
double a = (x2 - x0 - t2 / t1 * (x1 - x0)) / (t2 * t2 - t1 * t2);
double b = (x1 - x0 - a * t1 * t1) / t1;
return 2 * a * t + b;
double a = (x2 - x0 - (t2 / t1 * (x1 - x0))) / ((t2 * t2) - (t1 * t2));
double b = (x1 - x0 - (a * t1 * t1)) / t1;
return (2 * a * t) + b;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,13 +197,13 @@ double t
if(i != j)
{
double v = s * _w[i] / (t - _t[i]);
s1 = s1 + v * _x[i];
s1 = s1 + (v * _x[i]);
s2 = s2 + v;
}
else
{
double v = _w[i];
s1 = s1 + v * _x[i];
s1 = s1 + (v * _x[i]);
s2 = s2 + v;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ IList<double> x
_transformFactor = 2.0 / (b - a);

// trigonometric recurrence
double a0 = Math.PI / (2 * (x.Count - 1) + 2);
double delta = 2 * Math.PI / (2 * (x.Count - 1) + 2);
double a0 = Math.PI / ((2 * (x.Count - 1)) + 2);
double delta = 2 * Math.PI / ((2 * (x.Count - 1)) + 2);
double alpha = Math.Sin(delta / 2);
alpha = 2 * alpha * alpha;
double beta = Math.Sin(delta);
Expand All @@ -150,8 +150,8 @@ IList<double> x
w[0] = sa;
for(int i = 1; i < t.Length; i++)
{
double temps = sa - (alpha * sa - beta * ca);
double tempc = ca - (alpha * ca + beta * sa);
double temps = sa - ((alpha * sa) - (beta * ca));
double tempc = ca - ((alpha * ca) + (beta * sa));
sa = temps;
ca = tempc;
sign = -sign;
Expand Down Expand Up @@ -237,12 +237,12 @@ int numberOfPoints

double transformSummand = 0.5 * (a + b);
double transformFactor = (b - a) / 2.0;
double angleFactor = Math.PI / (2 * (numberOfPoints - 1) + 2);
double angleFactor = Math.PI / ((2 * (numberOfPoints - 1)) + 2);

double[] nodes = new double[numberOfPoints];
for(int i = 0; i < numberOfPoints; i++)
{
nodes[i] = transformSummand + transformFactor * Math.Cos((2 * i + 1) * angleFactor);
nodes[i] = transformSummand + (transformFactor * Math.Cos(((2 * i) + 1) * angleFactor));
}

return nodes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ IList<double> x

for(int i = 1; i < t.Length; i++)
{
double temps = sa - (alpha * sa - beta * ca);
double tempc = ca - (alpha * ca + beta * sa);
double temps = sa - ((alpha * sa) - (beta * ca));
double tempc = ca - ((alpha * ca) + (beta * sa));
sa = temps;
ca = tempc;
sign = -sign;
Expand Down Expand Up @@ -245,7 +245,7 @@ int numberOfPoints
double[] nodes = new double[numberOfPoints];
for(int i = 0; i < numberOfPoints; i++)
{
nodes[i] = transformSummand + transformFactor * Math.Cos(i * angleFactor);
nodes[i] = transformSummand + (transformFactor * Math.Cos(i * angleFactor));
}

return nodes;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ double[] d
double delta3 = delta * delta2;
c[j] = x[i];
c[j + 1] = d[i];
c[j + 2] = (3 * (x[i + 1] - x[i]) - 2 * d[i] * delta - d[i + 1] * delta) / delta2;
c[j + 3] = (2 * (x[i] - x[i + 1]) + d[i] * delta + d[i + 1] * delta) / delta3;
c[j + 2] = (3 * (x[i + 1] - x[i]) - (2 * d[i] * delta) - (d[i + 1] * delta)) / delta2;
c[j + 3] = (2 * (x[i] - x[i + 1]) + (d[i] * delta) + (d[i + 1] * delta)) / delta3;
}

_spline.Init(t, c);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ double rightBoundary
a1[0] = 0;
a2[0] = 2;
a3[0] = 1;
b[0] = 3 * (xx[1] - xx[0]) / (tt[1] - tt[0]) - 0.5 * leftBoundary * (tt[1] - tt[0]);
b[0] = 3 * ((xx[1] - xx[0]) / (tt[1] - tt[0])) - (0.5 * leftBoundary * (tt[1] - tt[0]));
break;
default:
throw new NotSupportedException(Properties.LocalStrings.InvalidLeftBoundaryCondition);
Expand All @@ -224,7 +224,7 @@ double rightBoundary
a1[i] = tt[i + 1] - tt[i];
a2[i] = 2 * (tt[i + 1] - tt[i - 1]);
a3[i] = tt[i] - tt[i - 1];
b[i] = 3 * (xx[i] - xx[i - 1]) / (tt[i] - tt[i - 1]) * (tt[i + 1] - tt[i]) + 3 * (xx[i + 1] - xx[i]) / (tt[i + 1] - tt[i]) * (tt[i] - tt[i - 1]);
b[i] = (3 * (xx[i] - xx[i - 1]) / (tt[i] - tt[i - 1]) * (tt[i + 1] - tt[i])) + (3 * (xx[i + 1] - xx[i]) / (tt[i + 1] - tt[i]) * (tt[i] - tt[i - 1]));
}

// Right Boundary
Expand All @@ -246,7 +246,7 @@ double rightBoundary
a1[n - 1] = 1;
a2[n - 1] = 2;
a3[n - 1] = 0;
b[n - 1] = 3 * (xx[n - 1] - xx[n - 2]) / (tt[n - 1] - tt[n - 2]) + 0.5 * rightBoundary * (tt[n - 1] - tt[n - 2]);
b[n - 1] = (3 * (xx[n - 1] - xx[n - 2]) / (tt[n - 1] - tt[n - 2])) + (0.5 * rightBoundary * (tt[n - 1] - tt[n - 2]));
break;
default:
throw new NotSupportedException(Properties.LocalStrings.InvalidRightBoundaryCondition);
Expand Down Expand Up @@ -326,14 +326,14 @@ double[] d
for(int k = 1; k < a.Length; k++)
{
double t = a[k] / b[k - 1];
b[k] = b[k] - t * c[k - 1];
d[k] = d[k] - t * d[k - 1];
b[k] = b[k] - (t * c[k - 1]);
d[k] = d[k] - (t * d[k - 1]);
}

x[x.Length - 1] = d[d.Length - 1] / b[b.Length - 1];
for(int k = x.Length - 2; k >= 0; k--)
{
x[k] = (d[k] - c[k] * x[k + 1]) / b[k];
x[k] = (d[k] - (c[k] * x[k + 1])) / b[k];
}

return x;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ out int closestIndex
closestIndex = Math.Max(_samples.Locate(t), 0);
int ret = Math.Min(
Math.Max(
closestIndex - (_effectiveOrder - 1) / 2,
closestIndex - ((_effectiveOrder - 1) / 2),
0
),
_samples.Count - _effectiveOrder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ out int closestIndex
closestIndex = Math.Max(_samples.Locate(t), 0);
int ret = Math.Min(
Math.Max(
closestIndex - (_effectiveOrder - 1) / 2,
closestIndex - ((_effectiveOrder - 1) / 2),
0
),
_samples.Count - _effectiveOrder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ double t
double hp = t - _t[i + level];
double ho = _t[i] - t;
double den = _t[i] - _t[i + level];
x[i] = (hp * x[i] + ho * x[i + 1]) / den;
x[i] = ((hp * x[i]) + (ho * x[i + 1])) / den;
}
}

Expand Down Expand Up @@ -193,9 +193,9 @@ out double second
double hp = t - _t[i + level];
double ho = _t[i] - t;
double den = _t[i] - _t[i + level];
d2x[i] = (hp * d2x[i] + ho * d2x[i + 1] + 2 * dx[i] - 2 * dx[i + 1]) / den;
dx[i] = (hp * dx[i] + x[i] + ho * dx[i + 1] - x[i + 1]) / den;
x[i] = (hp * x[i] + ho * x[i + 1]) / den;
d2x[i] = ((hp * d2x[i]) + (ho * d2x[i + 1]) + (2 * dx[i]) - (2 * dx[i + 1])) / den;
dx[i] = ((hp * dx[i]) + x[i] + (ho * dx[i + 1]) - x[i + 1]) / den;
x[i] = ((hp * x[i]) + (ho * x[i + 1])) / den;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ double t
// Interpolation
t = t - _t[low];
int k = low << 2;
return _c[k] + t * (_c[k + 1] + t * (_c[k + 2] + t * _c[k + 3]));
return _c[k] + (t * (_c[k + 1] + (t * (_c[k + 2] + (t * _c[k + 3])))));
}

/// <summary>
Expand Down Expand Up @@ -202,9 +202,9 @@ out double second
// Differentiation
t = t - _t[low];
int k = low << 2;
first = _c[k + 1] + 2 * t * _c[k + 2] + 3 * t * t * _c[k + 3];
second = 2 * _c[k + 2] + 6 * t * _c[k + 3];
return _c[k] + t * (_c[k + 1] + t * (_c[k + 2] + t * _c[k + 3]));
first = _c[k + 1] + (2 * t * _c[k + 2]) + (3 * t * t * _c[k + 3]);
second = (2 * _c[k + 2]) + (6 * t * _c[k + 3]);
return _c[k] + (t * (_c[k + 1] + (t * (_c[k + 2] + (t * _c[k + 3])))));
}

/// <summary>
Expand Down Expand Up @@ -240,12 +240,12 @@ double t
for(int i = 0, j = 0; i < low; i++, j += 4)
{
double w = _t[i + 1] - _t[i];
result += w * (_c[j] + w * (_c[j + 1] * 0.5 + w * (_c[j + 2] / 3 + w * _c[j + 3] * 0.25)));
result += w * (_c[j] + (w * (_c[j + 1] * 0.5) + (w * ((_c[j + 2] / 3) + (w * _c[j + 3] * 0.25)))));
}

t = t - _t[low];
int k = low << 2;
return result + t * (_c[k] + t * (_c[k + 1] * 0.5 + t * (_c[k + 2] / 3 + t * _c[k + 3] * 0.25)));
return result + t * (_c[k] + (t * (_c[k + 1] * 0.5) + (t * ((_c[k + 2] / 3) + (t * _c[k + 3] * 0.25)))));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ out int closestIndex
closestIndex = Math.Max(_samples.Locate(t), 0);
int ret = Math.Min(
Math.Max(
closestIndex - (_effectiveOrder - 1) / 2,
closestIndex - ((_effectiveOrder - 1) / 2),
0
),
_samples.Count - _effectiveOrder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ out int closestIndex
closestIndex = Math.Max(_samples.Locate(t), 0);
int ret = Math.Min(
Math.Max(
closestIndex - (_effectiveOrder - 1) / 2,
closestIndex - ((_effectiveOrder - 1) / 2),
0
),
_samples.Count - _effectiveOrder
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ double maxValue

// The shift operation and extra int cast before the first multiplication give better performance.
// See comment in NextDouble().
return minValue + (double)(int)(x >> 1) * IntToDoubleMultiplier * range;
return minValue + ((double)(int)(x >> 1) * IntToDoubleMultiplier * range);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ uint[] seedArray
_mt[0] = _seed & 0xffffffffU;
for(_mti = 1; _mti < N; _mti++)
{
_mt[_mti] = (1812433253U * (_mt[_mti - 1] ^ (_mt[_mti - 1] >> 30)) + _mti);
_mt[_mti] = (1812433253U * (_mt[_mti - 1] ^ (_mt[_mti - 1] >> 30))) + _mti;

// See Knuth TAOCP Vol2. 3rd Ed. P.106 for multiplier.
// In the previous versions, MSBs of the seed affect only MSBs of the array mt[].
Expand Down Expand Up @@ -725,7 +725,7 @@ double maxValue

// The shift operation and extra int cast before the first multiplication give better performance.
// See comment in NextDouble().
return minValue + (double)(int)(y >> 1) * IntToDoubleMultiplier * range;
return minValue + ((double)(int)(y >> 1) * IntToDoubleMultiplier * range);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ double maxValue
throw new ArgumentException(Properties.LocalStrings.ArgumentRangeLessEqual("minValue", "maxValue", "Double.MaxValue"));
}

return minValue + _generator.NextDouble() * range;
return minValue + (_generator.NextDouble() * range);
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ double maxValue

// The shift operation and extra int cast before the first multiplication give better performance.
// See comment in NextDouble().
return minValue + (double)(int)(w >> 1) * IntToDoubleMultiplier * range;
return minValue + ((double)(int)(w >> 1) * IntToDoubleMultiplier * range);
}

/// <summary>
Expand Down
10 changes: 0 additions & 10 deletions src/app/MathNet.Iridium/Library/Settings.StyleCop
Original file line number Diff line number Diff line change
Expand Up @@ -117,21 +117,11 @@
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FieldsMustBePrivate">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="FileMayOnlyContainASingleClass">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
<Rule Name="ArithmeticExpressionsMustDeclarePrecedence">
<RuleSettings>
<BooleanProperty Name="Enabled">False</BooleanProperty>
</RuleSettings>
</Rule>
</Rules>
<AnalyzerSettings />
</Analyzer>
Expand Down
16 changes: 8 additions & 8 deletions src/app/MathNet.Iridium/Library/Transformations/InternalFFT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ TransformationConvention convention
double re = samples[odd];
double im = samples[odd + 1];

double tmpr = re * uR - im * uI;
double tmpi = re * uI + im * uR;
double tmpr = (re * uR) - (im * uI);
double tmpi = (re * uI) + (im * uR);

re = samples[even];
im = samples[even + 1];
Expand Down Expand Up @@ -252,8 +252,8 @@ TransformationConvention convention
double re = samples[odd];
double im = samples[odd + 1];

double tmpr = re * uR - im * uI;
double tmpi = re * uI + im * uR;
double tmpr = (re * uR) - (im * uI);
double tmpi = (re * uI) + (im * uR);

re = samples[even];
im = samples[even + 1];
Expand Down Expand Up @@ -421,12 +421,12 @@ int levels
realBackward[i] = uRealBw;
imagBackward[i] = uImagBw;

uwI = uImagFw * wRreal - uRealFw * wImag;
uRealFw = uRealFw * wRreal + uImagFw * wImag;
uwI = (uImagFw * wRreal) - (uRealFw * wImag);
uRealFw = (uRealFw * wRreal) + (uImagFw * wImag);
uImagFw = uwI;

uwI = uImagBw * wRreal + uRealBw * wImag;
uRealBw = uRealBw * wRreal - uImagBw * wImag;
uwI = (uImagBw * wRreal) + (uRealBw * wImag);
uRealBw = (uRealBw * wRreal) - (uImagBw * wImag);
uImagBw = uwI;
}

Expand Down
Loading

0 comments on commit fdaa82e

Please sign in to comment.