public double target(double[] x, double[][] X, int rowpos, double[] Y){
    double y = Y[rowpos], result=0;

    for(int i=0; i < X.length; i++){
      if((i != rowpos) && (X[i] != null)){
        double var = (y==Y[i]) ? 0.0 : Math.sqrt((double)m_Dimension - 1);
        double f=0;
        for(int j=0; j < m_Dimension; j++)
          if(Utils.gr(m_Variance[rowpos][j], 0.0)){
            f += x[j]*(X[rowpos][j]-X[i][j]) * (X[rowpos][j]-X[i][j]);     
            //System.out.println("i:"+i+" j: "+j+" row: "+rowpos);
          }
        f = Math.sqrt(f);
        //System.out.println("???distance between "+rowpos+" and "+i+": "+f+"|y:"+y+" vs "+Y[i]);
        if(Double.isInfinite(f))
          System.exit(1);
        result += 0.5 * (f - var) * (f - var);
      }
    }
    //System.out.println("???target: "+result);
    return result;
  }