'Fast (vectorized) function to compute barycentric coordinates alpha.
Parameters
x, y : array-like of dim 1 (shape (nx,))
Coordinates of the points whose points barycentric
coordinates are requested
tris_pts : array like of dim 3 (shape: (nx,3,2))
Coordinates of the containing triangles apexes.
Returns
alpha : array of dim 2 (shape (nx,3))
Barycentric coordinates of the points inside the containing
triangles.'

@staticmethod
def _get_alpha_vec(x, y, tris_pts):

    ndim = (tris_pts.ndim - 2)
    a = (tris_pts[:, 1, :] - tris_pts[:, 0, :])
    b = (tris_pts[:, 2, :] - tris_pts[:, 0, :])
    abT = np.concatenate([np.expand_dims(a, (ndim + 1)), np.expand_dims(b, (ndim + 1))], (ndim + 1))
    ab = _transpose_vectorized(abT)
    x = np.expand_dims(x, ndim)
    y = np.expand_dims(y, ndim)
    OM = (np.concatenate([x, y], ndim) - tris_pts[:, 0, :])
    metric = _prod_vectorized(ab, abT)
    metric_inv = _pseudo_inv22sym_vectorized(metric)
    Covar = _prod_vectorized(ab, _transpose_vectorized(np.expand_dims(OM, ndim)))
    ksi = _prod_vectorized(metric_inv, Covar)
    alpha = _to_matrix_vectorized([[((1 - ksi[:, 0, 0]) - ksi[:, 1, 0])], [ksi[:, 0, 0]], [ksi[:, 1, 0]]])
    return alpha
