code C++ version of Hn, define all estimators