Permalink
Browse files

UnitTests StyleCop

  • Loading branch information...
cdrnet committed Jan 2, 2009
1 parent 9c0458a commit 9798e5162d881621dc5cb5691379532d2f4feb1f
@@ -193,6 +193,18 @@ internal static string
get { return "Size must be a Power of Two in every dimension."; }
}
+ internal static string
+ ArgumentEven
+ {
+ get { return "Value must be even."; }
+ }
+
+ internal static string
+ ArgumentOdd
+ {
+ get { return "Value must be odd."; }
+ }
+
internal static string
ArgumentRangeLessEqual(string left, string right, string range)
{
@@ -1,23 +1,31 @@
-#region Math.NET Iridium (LGPL) by Ruegg
-// Math.NET Iridium, part of the Math.NET Project
-// http://mathnet.opensourcedotnet.info
+//-----------------------------------------------------------------------
+// <copyright file="BugRegression.cs" company="Math.NET Project">
+// Copyright (c) 2002-2009, Christoph Rüegg.
+// All Right Reserved.
+// </copyright>
+// <author>
+// Christoph Rüegg, http://christoph.ruegg.name
+// </author>
+// <product>
+// Math.NET Iridium, part of the Math.NET Project.
+// http://mathnet.opensourcedotnet.info
+// </product>
+// <license type="opensource" name="LGPL" version="2 or later">
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published
+// by the Free Software Foundation; either version 2 of the License, or
+// any later version.
//
-// Copyright (c) 2002-2008, Christoph Rüegg, http://christoph.ruegg.name
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published
-// by the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#endregion
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// </license>
+//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
@@ -94,9 +102,9 @@ public void IRID119_PolynomialExtrapolatePositiveDirection()
PolynomialInterpolationAlgorithm pia = new PolynomialInterpolationAlgorithm(10);
SampleList sl = new SampleList(10);
- for(int i=0;i<10;i++)
+ for(int i = 0; i < 10; i++)
{
- sl.Add(x[i],y[i]);
+ sl.Add(x[i], y[i]);
}
pia.Prepare(sl);
@@ -118,13 +126,15 @@ public void IRID177_MatrixPseudoInverse()
Matrix a = new Matrix(new double[][] {
new double[] { 15, 23, 44, 54 },
new double[] { 1, 5, 9, 4 },
- new double[] { 8, 11, 4, 2 }});
+ new double[] { 8, 11, 4, 2 }
+ });
Matrix aInverse = new Matrix(new double[][] {
new double[] { 0.00729481932863557, -0.0906433578450537, 0.0629567950756452 },
new double[] { -0.00695248549232449, 0.0302767536403138, 0.0601374162387492 },
new double[] { -0.00876996343998189, 0.155054444209528, -0.033311997806593 },
- new double[] { 0.0265993197732062, -0.114057602060568, -0.0159589740025151 }});
+ new double[] { 0.0265993197732062, -0.114057602060568, -0.0159589740025151 }
+ });
NumericAssert.AreAlmostEqual(aInverse, a.Inverse(), "A");
NumericAssert.AreAlmostEqual(Matrix.Transpose(aInverse), Matrix.Transpose(a).Inverse(), "B");
@@ -209,7 +219,6 @@ public void IRID182_Eigenvalues()
});
// Expected data evaluated with MATLAB "[V,D] = eig(A)"
-
ComplexVector expectedEigenValues = ComplexVector.Create(new double[] {
0d, 0d, 0d, 0d,
0.00262233860281324,
@@ -223,19 +232,19 @@ public void IRID182_Eigenvalues()
});
Matrix expectedEigenVectors = new Matrix(new double[][] {
- new double[] { 0.106498497282379, 0.419691143613967, -0.0557817580954078, -0.00690851159493115, 0.371136426079307, 0.223461682210106, -0.468606464889867, 0.343527867020022, 0.0756466774996531, -0.369826279577119, -0.0284941597416966, 0.375195260395109},
- new double[] { 0.106498497282348, 0.419691143613984, -0.0557817580953903, -0.00690851159494274, 0.347453164986349, -0.567931379282469, 0.448676542846663, 0.0426012577167882, -0.00926728212925367, -0.290807685971263, -0.0241538261982648, -0.278790999189846},
- new double[] { 0.141668469389994, 0.156579178192424, -0.546459905897362, -0.320022417617439, -0.370241497490735, 0.332713332831733, 0.399336647042652, -0.104765030616846, 0.0739529635375817, -0.283780350824145, 0.138326048745256, 0.176134628893008},
- new double[] { 0.456535390675942, -0.214226432376964, 0.109822773758153, 0.133529424410943, -0.191583966179205, -0.266148198349251, -0.313325326798921, -0.506526681171299, 0.0272792573144116, -0.495783211258065, 0.0584677852966494, 0.059551430007216},
- new double[] { 0.364647620387872, 0.0977045432532739, 0.436554618830564, 0.335448611182954, 0.163995962609024, 0.328414432657394, 0.477700760063001, -0.152793609708388, 0.192188934685942, 0.137049561691855, -0.0685542301292428, 0.328126132911985},
- new double[] { -0.0118021512337526, 0.687830921400826, 0.0253622787075734, 0.0340672396524277, -0.128932474003535, 0.111659773051072, -0.253460159931006, -0.480758764565753, -0.0957818149202032, 0.338676131657749, 0.180081795108562, -0.210185274196965},
- new double[] { 0.283462964841237, 0.0345316526707189, -0.136594149073437, -0.0420356194913279, -0.0133246227195541, 0.102617378729154, -0.00943588067870301, -0.0313070656278569, -0.574003455674121, 0.0681122379738542, -0.741712896390675, -0.0446883956970386},
- new double[] { 0.244849290172628, 0.0918403159398603, -0.0949837111837109, 0.577123713866291, -0.38448721213687, 0.141537415024233, -0.0419331454701546, 0.452402089212107, 0.0853436565432261, -0.0866385554860394, 0.0434070293735178, -0.445597633077243},
- new double[] { 0.400790602926352, -0.199507773642233, -0.135930857423972, -0.0303383327890531, 0.343450721385221, 0.108021571075484, 0.0137877512860494, 0.0892884039126865, -0.512143067951694, 0.158808597386327, 0.590928375174204, -0.0752948350722554},
- new double[] { 0.221355443237417, -0.0542519363253111, -0.585993504810665, 0.258161164492889, 0.123510354803434, -0.32794171148589, -0.105403788999763, -0.0520352776917921, 0.325720237275597, 0.455414054946441, -0.0958514753059141, 0.280573659051638},
- new double[] { 0.407153336780693, -0.096005525911419, 0.0677148671312564, -0.494402873973341, 0.192742899138734, 0.18832136952349, -0.123734336631771, 0.0245713241631777, 0.481424400615441, 0.12926200568014, -0.142716239407588, -0.467562669903876},
- new double[] { 0.316238576923814, 0.181825098245019, 0.312639383751487, -0.345156725151147, -0.45371975647163, -0.374725665985126, -0.0236025978381509, 0.375795487357127, -0.0703605067966124, 0.23951349378026, 0.0902717934751914, 0.30253869587827}
- });
+ new double[] { 0.106498497282379, 0.419691143613967, -0.0557817580954078, -0.00690851159493115, 0.371136426079307, 0.223461682210106, -0.468606464889867, 0.343527867020022, 0.0756466774996531, -0.369826279577119, -0.0284941597416966, 0.375195260395109 },
+ new double[] { 0.106498497282348, 0.419691143613984, -0.0557817580953903, -0.00690851159494274, 0.347453164986349, -0.567931379282469, 0.448676542846663, 0.0426012577167882, -0.00926728212925367, -0.290807685971263, -0.0241538261982648, -0.278790999189846 },
+ new double[] { 0.141668469389994, 0.156579178192424, -0.546459905897362, -0.320022417617439, -0.370241497490735, 0.332713332831733, 0.399336647042652, -0.104765030616846, 0.0739529635375817, -0.283780350824145, 0.138326048745256, 0.176134628893008 },
+ new double[] { 0.456535390675942, -0.214226432376964, 0.109822773758153, 0.133529424410943, -0.191583966179205, -0.266148198349251, -0.313325326798921, -0.506526681171299, 0.0272792573144116, -0.495783211258065, 0.0584677852966494, 0.059551430007216 },
+ new double[] { 0.364647620387872, 0.0977045432532739, 0.436554618830564, 0.335448611182954, 0.163995962609024, 0.328414432657394, 0.477700760063001, -0.152793609708388, 0.192188934685942, 0.137049561691855, -0.0685542301292428, 0.328126132911985 },
+ new double[] { -0.0118021512337526, 0.687830921400826, 0.0253622787075734, 0.0340672396524277, -0.128932474003535, 0.111659773051072, -0.253460159931006, -0.480758764565753, -0.0957818149202032, 0.338676131657749, 0.180081795108562, -0.210185274196965 },
+ new double[] { 0.283462964841237, 0.0345316526707189, -0.136594149073437, -0.0420356194913279, -0.0133246227195541, 0.102617378729154, -0.00943588067870301, -0.0313070656278569, -0.574003455674121, 0.0681122379738542, -0.741712896390675, -0.0446883956970386 },
+ new double[] { 0.244849290172628, 0.0918403159398603, -0.0949837111837109, 0.577123713866291, -0.38448721213687, 0.141537415024233, -0.0419331454701546, 0.452402089212107, 0.0853436565432261, -0.0866385554860394, 0.0434070293735178, -0.445597633077243 },
+ new double[] { 0.400790602926352, -0.199507773642233, -0.135930857423972, -0.0303383327890531, 0.343450721385221, 0.108021571075484, 0.0137877512860494, 0.0892884039126865, -0.512143067951694, 0.158808597386327, 0.590928375174204, -0.0752948350722554 },
+ new double[] { 0.221355443237417, -0.0542519363253111, -0.585993504810665, 0.258161164492889, 0.123510354803434, -0.32794171148589, -0.105403788999763, -0.0520352776917921, 0.325720237275597, 0.455414054946441, -0.0958514753059141, 0.280573659051638 },
+ new double[] { 0.407153336780693, -0.096005525911419, 0.0677148671312564, -0.494402873973341, 0.192742899138734, 0.18832136952349, -0.123734336631771, 0.0245713241631777, 0.481424400615441, 0.12926200568014, -0.142716239407588, -0.467562669903876 },
+ new double[] { 0.316238576923814, 0.181825098245019, 0.312639383751487, -0.345156725151147, -0.45371975647163, -0.374725665985126, -0.0236025978381509, 0.375795487357127, -0.0703605067966124, 0.23951349378026, 0.0902717934751914, 0.30253869587827 }
+ });
// Verify the eigen values
ComplexVector eigenValues = m.EigenValues;
@@ -256,6 +265,7 @@ public void IRID182_Eigenvalues()
{
a.NegateInplace();
}
+
if(b[0] < 0)
{
b.NegateInplace();
@@ -1,23 +1,31 @@
-#region Math.NET Iridium (LGPL) by Ruegg
-// Math.NET Iridium, part of the Math.NET Project
-// http://mathnet.opensourcedotnet.info
+//-----------------------------------------------------------------------
+// <copyright file="CodeSamples.cs" company="Math.NET Project">
+// Copyright (c) 2002-2009, Christoph Rüegg.
+// All Right Reserved.
+// </copyright>
+// <author>
+// Christoph Rüegg, http://christoph.ruegg.name
+// </author>
+// <product>
+// Math.NET Iridium, part of the Math.NET Project.
+// http://mathnet.opensourcedotnet.info
+// </product>
+// <license type="opensource" name="LGPL" version="2 or later">
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published
+// by the Free Software Foundation; either version 2 of the License, or
+// any later version.
//
-// Copyright (c) 2002-2008, Christoph Rüegg, http://christoph.ruegg.name
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published
-// by the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#endregion
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// </license>
+//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
@@ -50,7 +58,8 @@ public void CodeSample_LinearAlgebra_Eigen()
{
Matrix m = new Matrix(new double[][] {
new double[] { 10.0, -18.0 },
- new double[] { 6.0, -11.0 }});
+ new double[] { 6.0, -11.0 }
+ });
ComplexVector eigenValues = m.EigenValues;
NumericAssert.AreAlmostEqual(1.0, eigenValues[0].Real, "Re{eigenvalueA}");
@@ -73,15 +82,15 @@ public void CodeSample_PolynomialRegression()
int polynomialOrder = 3;
// Build the matrix for the least-squares fitting
- double[][] m = Matrix.CreateMatrixData(x.Length, polynomialOrder+1);
- for(int i=0; i<x.Length; i++)
+ double[][] m = Matrix.CreateMatrixData(x.Length, polynomialOrder + 1);
+ for(int i = 0; i < x.Length; i++)
{
double xi = x[i];
double[] xrow = m[i];
xrow[0] = 1d;
- for(int j=1; j<xrow.Length; j++)
+ for(int j = 1; j < xrow.Length; j++)
{
- xrow[j] = xrow[j-1] * xi;
+ xrow[j] = xrow[j - 1] * xi;
}
}
@@ -1,23 +1,31 @@
-#region Math.NET Iridium (LGPL) by Ruegg
-// Math.NET Iridium, part of the Math.NET Project
-// http://mathnet.opensourcedotnet.info
+//-----------------------------------------------------------------------
+// <copyright file="CombinatoricsTest.cs" company="Math.NET Project">
+// Copyright (c) 2002-2009, Christoph Rüegg.
+// All Right Reserved.
+// </copyright>
+// <author>
+// Christoph Rüegg, http://christoph.ruegg.name
+// </author>
+// <product>
+// Math.NET Iridium, part of the Math.NET Project.
+// http://mathnet.opensourcedotnet.info
+// </product>
+// <license type="opensource" name="LGPL" version="2 or later">
+// This program is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as published
+// by the Free Software Foundation; either version 2 of the License, or
+// any later version.
//
-// Copyright (c) 2002-2008, Christoph Rüegg, http://christoph.ruegg.name
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU Lesser General Public License for more details.
//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU Lesser General Public License as published
-// by the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this program; if not, write to the Free Software
-// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-#endregion
+// You should have received a copy of the GNU Lesser General Public
+// License along with this program; if not, write to the Free Software
+// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+// </license>
+//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
Oops, something went wrong.

0 comments on commit 9798e51

Please sign in to comment.