1 16 package org.apache.commons.math.stat.descriptive.moment; 17 18 import java.io.Serializable ; 19 20 import org.apache.commons.math.stat.descriptive.AbstractStorelessUnivariateStatistic; 21 22 39 public class StandardDeviation extends AbstractStorelessUnivariateStatistic 40 implements Serializable { 41 42 43 static final long serialVersionUID = 5728716329662425188L; 44 45 46 private Variance variance = null; 47 48 52 public StandardDeviation() { 53 variance = new Variance(); 54 } 55 56 61 public StandardDeviation(final SecondMoment m2) { 62 variance = new Variance(m2); 63 } 64 65 75 public StandardDeviation(boolean isBiasCorrected) { 76 variance = new Variance(isBiasCorrected); 77 } 78 79 90 public StandardDeviation(boolean isBiasCorrected, SecondMoment m2) { 91 variance = new Variance(isBiasCorrected, m2); 92 } 93 94 97 public void increment(final double d) { 98 variance.increment(d); 99 } 100 101 104 public long getN() { 105 return variance.getN(); 106 } 107 108 111 public double getResult() { 112 return Math.sqrt(variance.getResult()); 113 } 114 115 118 public void clear() { 119 variance.clear(); 120 } 121 122 136 public double evaluate(final double[] values) { 137 return Math.sqrt(variance.evaluate(values)); 138 } 139 140 158 public double evaluate(final double[] values, final int begin, final int length) { 159 return Math.sqrt(variance.evaluate(values, begin, length)); 160 } 161 162 186 public double evaluate(final double[] values, final double mean, 187 final int begin, final int length) { 188 return Math.sqrt(variance.evaluate(values, mean, begin, length)); 189 } 190 191 212 public double evaluate(final double[] values, final double mean) { 213 return Math.sqrt(variance.evaluate(values, mean)); 214 } 215 216 219 public boolean isBiasCorrected() { 220 return variance.isBiasCorrected(); 221 } 222 223 226 public void setBiasCorrected(boolean isBiasCorrected) { 227 variance.setBiasCorrected(isBiasCorrected); 228 } 229 } | Popular Tags |