function UCI = GPF_UCI_OnPoints(this, X, Alpha)
% Return the Alpha% UCI of the ObjectiveFcnGP value for all
% feasible rows of X. Return Inf for infeasible rows.
%

%   Copyright 2016-2022 The MathWorks, Inc.

UCI = inf(size(X,1),1);
if isempty(this.ObjectiveFcnModel) || ...
        (this.PrivOptions.NumCoupledConstraints > 0 && any(cellfun(@isempty, this.ConstraintModels)))
    return;
else
    [Xcanon, InputFeasible] = legalizePoints(this, X);
    allSat = allConstraintsSatisfied(this, Xcanon, this.ConstraintModels, this.ErrorModel);
    feasible = InputFeasible & allSat;
    [FMean, YSD] = predict(this.ObjectiveFcnModel, Xcanon);
    FSD = bayesoptim.funStd(YSD, this.ObjectiveFcnModel.Sigma);
    UCI = norminv(1-Alpha, FMean, FSD);
    UCI(~feasible) = Inf;
    UCI(feasible & FSD==0) = FMean(feasible & FSD==0);          % If FSD==0, set UCI equal to the mean
end
end
