You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by md...@apache.org on 2003/06/21 04:16:43 UTC
cvs commit: jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat AbstractStoreUnivariate.java
mdiggory 2003/06/20 19:16:43
Modified: math/src/java/org/apache/commons/math/stat
AbstractStoreUnivariate.java
Log:
PR: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20980
Submitted by: phil@steitz.com
Revision Changes Path
1.5 +2 -20 jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/AbstractStoreUnivariate.java
Index: AbstractStoreUnivariate.java
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/math/src/java/org/apache/commons/math/stat/AbstractStoreUnivariate.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- AbstractStoreUnivariate.java 20 Jun 2003 21:05:47 -0000 1.4
+++ AbstractStoreUnivariate.java 21 Jun 2003 02:16:43 -0000 1.5
@@ -52,6 +52,7 @@
* <http://www.apache.org/>.
*/
package org.apache.commons.math.stat;
+import java.util.Arrays;
/**
* Provides univariate measures for an array of doubles.
@@ -284,31 +285,12 @@
}
/**
- * Uses <a href="http://www.nist.gov/dads/HTML/shellsort.html">Shell sort
- * </a>
* @see org.apache.commons.math.stat.StoreUnivariate#getSortedValues()
*
*/
public double[] getSortedValues() {
double[] values = getValues();
- int n = values.length;
- int j = n;
- while (j > 1) {
- j = j / 2;
- boolean done = false;
- while (!done) {
- done = true;
- for (int i = 0; i < n - j; i++) {
- int k = i + j;
- if (values[i] > values[k]) {
- double temp = values[i];
- values[i] = values[k];
- values[k] = temp;
- done = false;
- }
- }
- }
- }
+ Arrays.sort(values);
return values;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org