#This function calculates -loglikelihood at a current iterate with set of support points=S and set of weights = C #valf is a vector storing the values [f(X_(1)),...,f(X_(n))]. LoglikFunc <- function(valf,C){ Loglik <- -mean(log(valf)) + sum(C) Loglik }