Hi, I am building a package that is using sgd. When doing tests I sometimes encountered models that got stuck in the sgd C++ part for no particular reason, crashing R in the end. I did address sanitizing, but everything checked out. Then I investigated where it got stuck, and it was while running the boost::math::tools::schroeder_iterate function for the update in implicit_sgd.h (rows 79 and 110). I made a fork at https://github.com/jonlachmann/sgd fixing this by just setting the max iterations for boost::math::tools::schroeder_iterate to 1000. I have no idea if this is a reasonable value, but it solves the problem.
Do you want me to create a pull request, or is this something that might need further looking into?