rewrite the matlab code of pcanet into c++