function f = exactLocate(x,P,Q,r)
for i = 1:length(r)
    f(i) = x'*(permute(P(i,:,:),[2 3 1]))*x + Q(i,:)*x + r(i);
end
end