the ann implementation in C++