precompute phase factors