You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2011/01/18 00:00:52 UTC
svn commit: r1060124 -
/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/stat/StatUtilsTest.java
Author: sebb
Date: Mon Jan 17 23:00:52 2011
New Revision: 1060124
URL: http://svn.apache.org/viewvc?rev=1060124&view=rev
Log:
Tab and trailing space removal
Modified:
commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/stat/StatUtilsTest.java
Modified: commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/stat/StatUtilsTest.java
URL: http://svn.apache.org/viewvc/commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/stat/StatUtilsTest.java?rev=1060124&r1=1060123&r2=1060124&view=diff
==============================================================================
--- commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/stat/StatUtilsTest.java (original)
+++ commons/proper/math/branches/MATH_2_X/src/test/java/org/apache/commons/math/stat/StatUtilsTest.java Mon Jan 17 23:00:52 2011
@@ -423,46 +423,46 @@ public final class StatUtilsTest extends
}
- /**
- * Run the test with the values 50 and 100 and assume standardized values
- */
-
- public void testNormalize1() {
- double sample[] = { 50, 100 };
- double expectedSample[] = { -25 / Math.sqrt(1250), 25 / Math.sqrt(1250) };
- double[] out = StatUtils.normalize(sample);
- for (int i = 0; i < out.length; i++) {
- assertEquals(out[i], expectedSample[i]);
- }
-
- }
-
- /**
- * Run with 77 random values, assuming that the outcome has a mean of 0 and a standard deviation of 1 with a
- * precision of 1E-10.
- */
-
- public void testNormalize2() {
- // create an sample with 77 values
- int length = 77;
- double sample[] = new double[length];
- for (int i = 0; i < length; i++) {
- sample[i] = Math.random();
- }
- // normalize this sample
- double standardizedSample[] = StatUtils.normalize(sample);
-
- DescriptiveStatistics stats = new DescriptiveStatistics();
- // Add the data from the array
- for (int i = 0; i < length; i++) {
- stats.addValue(standardizedSample[i]);
- }
- // the calculations do have a limited precision
- double distance = 1E-10;
- // check the mean an standard deviation
- assertEquals(0.0, stats.getMean(), distance);
- assertEquals(1.0, stats.getStandardDeviation(), distance);
+ /**
+ * Run the test with the values 50 and 100 and assume standardized values
+ */
+
+ public void testNormalize1() {
+ double sample[] = { 50, 100 };
+ double expectedSample[] = { -25 / Math.sqrt(1250), 25 / Math.sqrt(1250) };
+ double[] out = StatUtils.normalize(sample);
+ for (int i = 0; i < out.length; i++) {
+ assertEquals(out[i], expectedSample[i]);
+ }
- }
+ }
+
+ /**
+ * Run with 77 random values, assuming that the outcome has a mean of 0 and a standard deviation of 1 with a
+ * precision of 1E-10.
+ */
+
+ public void testNormalize2() {
+ // create an sample with 77 values
+ int length = 77;
+ double sample[] = new double[length];
+ for (int i = 0; i < length; i++) {
+ sample[i] = Math.random();
+ }
+ // normalize this sample
+ double standardizedSample[] = StatUtils.normalize(sample);
+
+ DescriptiveStatistics stats = new DescriptiveStatistics();
+ // Add the data from the array
+ for (int i = 0; i < length; i++) {
+ stats.addValue(standardizedSample[i]);
+ }
+ // the calculations do have a limited precision
+ double distance = 1E-10;
+ // check the mean an standard deviation
+ assertEquals(0.0, stats.getMean(), distance);
+ assertEquals(1.0, stats.getStandardDeviation(), distance);
+
+ }
}