Code for the paper by Polyak