function retPP = GEBCPostProbs(inX,inWN,inWP)
%function retPP = GEBCPostProbs(inX,inWN,inWP)
% Compute the posterior weights based on the estimated prior weights.
%
% Dabao Zhang     July 1, 2006
%
% Revised by:
%
% Copyright (c) 2006 by Zhang & Zhang.

tmpX2 = inX.*inX;
tmpCPhi = normcdf(inX,0,1);
tmpDPhi = normpdf(inX,0,1);

% Compute the G functions;
tmpGp = (tmpCPhi-tmpDPhi.*(sqrt(pi/2)+inX))./(tmpX2*sqrt(pi/2));
tmpGn = (1-tmpCPhi-tmpDPhi.*(sqrt(pi/2)-inX))./(tmpX2*sqrt(pi/2));

retPP = zeros(length(inX),2);
% Compute the posterior weight;
tmpC = (1-inWP-inWN)*tmpDPhi+inWP*tmpGp+inWN*tmpGn;
retPP(:,1) = (inWN*tmpGn)./tmpC;
retPP(:,2) = (inWP*tmpGp)./tmpC;
