Stochastic gradient descent squared loss
You probably do not need help with this question anymore (looks like it's been a year), but I thought I'd point something out in case someone else finds it useful. I think your squared loss expression should be \$(w'*x - y)^2\$ and the derivative of that with respect to \$x\$ is: \$2*(w'*x-y)*w\$. What you have is the outer product which results in a matrix minus a scalar. So I noticed two errors: 


You need an inner product instead of an outer product. 
You applied the chain rule wrong when you took the derivative w.r.t x.