Implement the algorithm in paper "A Provably Efficient Algorithm for Training Deep Networks" in C/C++ according to the given Matlab code.