optimized Z in openmp implementation