fix: optimize using python complex implementation