Pass in full arrays/matrices, and fix StochasticGradient and other tests