Add complex_math include. Clean-up square()
Call fabs() for all threads instead of branching in some.
More fabs() and fmax() changes to prevent branching
Template kernels with g_err_flag to eliminate a common branch
Move rho_init outside of a loop, we only need to do it once.