@Override public void put(double val,double weight){
  final double nn=weight + this.n;
  final double delta=val - this.m1;
  final double otherm2=val * val;
  final double otherm3=otherm2 * val;
  final double otherm4=otherm3 * val;
  final double delta_nn=delta / nn;
  final double delta_nn2=delta_nn * delta_nn;
  final double delta_nn3=delta_nn2 * delta_nn;
  final double na2=this.n * this.n;
  final double nb2=weight * weight;
  final double ntn=this.n * weight;
  this.m4+=otherm4 + delta * delta_nn3 * ntn* (na2 - ntn + nb2) + 6. * (na2 * otherm2 + nb2 * this.m2) * delta_nn2 + 4. * (this.n * otherm3 - weight * this.m3) * delta_nn;
  this.m3+=otherm3 + delta * delta_nn2 * ntn* (this.n - weight) + 3. * (this.n * otherm2 - weight * this.m2) * delta_nn;
  this.m2+=otherm2 + delta * delta_nn * this.n* weight;
  this.m1+=weight * delta_nn;
  this.n=nn;
  min=Math.min(min,val);
  max=Math.max(max,val);
}

@ Override public void put ( double val , double weight ) { final double nn = weight + this . n ; final double delta = val - this . m1 ; final double otherm2 = val * val ; final double otherm3 = otherm2 * val ; final double otherm4 = otherm3 * val ; final double delta_nn = delta / nn ; final double delta_nn2 = delta_nn * delta_nn ; final double delta_nn3 = delta_nn2 * delta_nn ; final double na2 = this . n * this . n ; final double nb2 = weight * weight ; final double ntn = this . n * weight ; this . m4 += otherm4 + delta * delta_nn3 * ntn * ( na2 - ntn + nb2 ) + 6. * ( na2 * otherm2 + nb2 * this . m2 ) * delta_nn2 + 4. * ( this . n * otherm3 - weight * this . m3 ) * delta_nn ; this . m3 += otherm3 + delta * delta_nn2 * ntn * ( this . n - weight ) + 3. * ( this . n * otherm2 - weight * this . m2 ) * delta_nn ; this . m2 += otherm2 + delta * delta_nn * this . n * weight ; this . m1 += weight * delta_nn ; this . n = nn ; min = Math . min ( min , val ) ; max = Math . max ( max , val ) ; }
add data with a given weight .
