def f(x):
    x = x.reshape((- 1), input_dim)
    Knm = portfolio_computeKnm_np(x, X, lengthscales, kern_var)
    val = (mean_constant + ((Knm @ invKmm) @ (Y - mean_constant)))
    return (- val.reshape(x.shape[0]))
def f(x):
    x = x.reshape((- 1), input_dim)
    Knm = portfolio_computeKnm_np(x, X, lengthscales, kern_var)
    val = (mean_constant + ((Knm @ invKmm) @ (Y - mean_constant)))
    return (- val.reshape(x.shape[0]))