Vectorize gradient. Some tests fail.