No longer using sparse matrices
Fix error updating the gradient
Added L log equation