CG Algorithm implementation in C++.