code: static double[] scale(double[] x, double c, double[] reuse) {
      if (reuse == null) {
        reuse = new double[x.length];
      }
      for (int i = 0; i < x.length; i++) {
        reuse[i] = c * x[i];
      }
      return reuse;
    }
docs: Performs c * x