
function f = objfunl2(x)

%OBJFUNL2 provides the objective function evaluations needed for unifitl2nlp.m.

c = length(x);
n = round((1 + sqrt(1+8*c))/4);
nch2 = n*(n-1)/2;

f = 0;
index = n;
for i = 2:n
   for j = 1:(i-1)
      index = index + 1;
      f = f + x(index+2*nch2)*x(index)*x(index) + ...
         x(index+3*nch2)*x(index+nch2)*x(index+nch2);
   end
end

