def arc_distance_numpy_broadcast(a, b):
    theta_1 = a[:, 0][:, None]
    theta_2 = b[:, 0][None, :]
    phi_1 = a[:, 1][:, None]
    phi_2 = b[:, 1][None, :]

    temp = (np.sin((theta_2 - theta_1) / 2)**2
            +
            np.cos(theta_1) * np.cos(theta_2)
            * np.sin((phi_2 - phi_1) / 2)**2)
    distance_matrix = 2 * (np.arctan2(np.sqrt(temp), np.sqrt(1 - temp)))
    return distance_matrix
Calculates the pairwise arc distance between all points in vector a and b.
dataset/ETHPy150Open iskandr/parakeet/benchmarks/arc_distance.py/arc_distance_numpy_broadcast