def portfolio_computeKnm_np(X, Xbar, l, sigma):
    '\n    X: n x d\n    l: d\n    '
    n = np.shape(X)[0]
    m = np.shape(Xbar)[0]
    xdim = np.shape(X)[1]
    l = l.reshape(1, xdim)
    X = (X / l)
    Xbar = (Xbar / l)
    Q = np.tile(np.sum((X * X), axis=1, keepdims=True), reps=(1, m))
    Qbar = np.tile(np.sum((Xbar * Xbar), axis=1, keepdims=True).T, reps=(n, 1))
    dist = ((Qbar + Q) - (2 * X.dot(Xbar.T)))
    knm = (sigma * np.exp(((- 0.5) * dist)))
    return knm
X: n x d
l: d
def portfolio_computeKnm_np(X, Xbar, l, sigma):
    '\n    X: n x d\n    l: d\n    '
    n = np.shape(X)[0]
    m = np.shape(Xbar)[0]
    xdim = np.shape(X)[1]
    l = l.reshape(1, xdim)
    X = (X / l)
    Xbar = (Xbar / l)
    Q = np.tile(np.sum((X * X), axis=1, keepdims=True), reps=(1, m))
    Qbar = np.tile(np.sum((Xbar * Xbar), axis=1, keepdims=True).T, reps=(n, 1))
    dist = ((Qbar + Q) - (2 * X.dot(Xbar.T)))
    knm = (sigma * np.exp(((- 0.5) * dist)))
    return knm