Exemplo n.º 1
0
 @Override
 public <A> D estimate(A data, NumberArrayAdapter<?, A> adapter) {
   // We first need the basic parameters:
   int len = adapter.size(data);
   final int cut = ((int) (len * trim)) >> 1;
   // X positions of samples
   double[] x = new double[len];
   for (int i = 0; i < len; i++) {
     final double val = adapter.getDouble(data, i);
     x[i] = val;
   }
   // Sort our copy.
   Arrays.sort(x);
   { // Trim:
     // TODO: is it more efficient to just copy, or instead use a trimmed array
     // adapter?
     double[] trimmed = new double[len - 2 * cut];
     System.arraycopy(x, cut, trimmed, 0, trimmed.length);
     x = trimmed;
     len = trimmed.length;
   }
   return inner.estimate(x, ArrayLikeUtil.DOUBLEARRAYADAPTER);
 }
Exemplo n.º 2
0
 @Override
 public String toString() {
   return this.getClass().getSimpleName() + "(" + inner.toString() + ", trim=" + trim + ")";
 }
Exemplo n.º 3
0
 @Override
 public Class<? super D> getDistributionClass() {
   return inner.getDistributionClass();
 }