sgd prototype, not compiled