Fix bug in Model::sgd, getting rid of passing P[i] and Q[i] by value