matrix rotations for fox algorithm