use numpy to accelerate computation