def cross_distances(a, b, distance_type=12): _check_row_float32(a) na, d = a.shape _check_row_float32(b) nb, d2 = b.shape assert d2 == d dis = numpy.empty((nb, na), dtype=numpy.float32) yael.compute_cross_distances_alt_nonpacked(distance_type, d, na, nb, fvec_ref(a), d, fvec_ref(b), d, fvec_ref(dis), na) return dis
def cross_distances(a, b, distance_type = 12): _check_row_float32(a) na, d = a.shape _check_row_float32(b) nb, d2 = b.shape assert d2 == d dis = numpy.empty((nb, na), dtype = numpy.float32) yael.compute_cross_distances_alt_nonpacked(distance_type, d, na, nb, yael.numpy_to_fvec_ref(a), d, yael.numpy_to_fvec_ref(b), d, yael.numpy_to_fvec_ref(dis), na) return dis