Added more vector operations, and fixed stochastic gradient.