code: private static double dot(int[] x, double[] w, int j, int p) {
          int pos = j * (p + 1);
          double dot = w[pos + p];
  
          for (int i : x) {
              dot += w[pos+i];
          }
  
          return dot;
      }
docs: Returns the dot product between weight vector and x (augmented with 1).