Implemented the sparse_cg function. We are not sure if it works. We have to check the linear helper functions.