protected double variance(double[] s,double[] sS,double[] sumOfWeights){
  double var=0;
  for (int i=0; i < s.length; i++) {
    if (sumOfWeights[i] > 0) {
      var+=singleVariance(s[i],sS[i],sumOfWeights[i]);
    }
  }
  return var;
}

protected double variance ( double [ ] s , double [ ] sS , double [ ] sumOfWeights ) { double var = 0 ; for ( int i = 0 ; i < s . length ; i ++ ) { if ( sumOfWeights [ i ] > 0 ) { var += singleVariance ( s [ i ] , sS [ i ] , sumOfWeights [ i ] ) ; } } return var ; }
computes variance for subsets .
