i\'m trying to implement this code but it\'s quite slow because of two for loops. Can any one suggest vectorized version of this code please
import numpy as n