Use np.sqrt instead of math.sqrt in CG for complex problems.