This method looks unclear to me. What do variables gtest and gfinal mean? Could you please rename them in more meaningful names? 
What do also fac and complex1 mean?