Added documentation for cg.jl and updated test script

Thanks for merging this. I just added a bit of documentation of the cg method and also updated the test script.