@Override
  public double[] swap(double[] S, int first, int second) {
    double temp = S[first];
    S[first] = S[second];
    S[second] = temp;