@Override public void addObservation(final double[] x,final double y) throws MathIllegalArgumentException {
  if ((!this.hasIntercept && x.length != nvars) || (this.hasIntercept && x.length + 1 != nvars)) {
    throw new MathIllegalArgumentException(LocalizedCoreFormats.INVALID_REGRESSION_OBSERVATION,x.length,nvars);
  }
  if (!this.hasIntercept) {
    include(x.clone(),1.0,y);
  }
 else {
    final double[] tmp=new double[x.length + 1];
    System.arraycopy(x,0,tmp,1,x.length);
    tmp[0]=1.0;
    include(tmp,1.0,y);
  }
  ++nobs;
}

@ Override public void addObservation ( final double [ ] x , final double y ) throws MathIllegalArgumentException { if ( ( ! this . hasIntercept && x . length != nvars ) || ( this . hasIntercept && x . length + 1 != nvars ) ) { throw new MathIllegalArgumentException ( LocalizedCoreFormats . INVALID_REGRESSION_OBSERVATION , x . length , nvars ) ; } if ( ! this . hasIntercept ) { include ( x . clone ( ) , 1.0 , y ) ; } else { final double [ ] tmp = new double [ x . length + 1 ] ; System . arraycopy ( x , 0 , tmp , 1 , x . length ) ; tmp [ 0 ] = 1.0 ; include ( tmp , 1.0 , y ) ; } ++ nobs ; }
adds an observation to the regression model .
