added documentation to cg.jl
updated test script for cg