doctest the vectorize function