public static double[] subtract(double[] x, double[] y) {
		if (x.length != y.length)
			throw new RuntimeException("diff lengths: " + x.length + " "
					+ y.length);
		double[] result = new double[x.length];
		for (int i = 0; i < x.length; i++) {
			result[i] = x[i] - y[i];
		}
		return result;
	}