function F = GEV_cdf ( x, param )
% F = GEV_cdf ( x, [ m , s, k ] )
% compute the CDF of the generalized extreme value distribution 
% with parameters m, s, and a
%  F =  exp(-(1+k*z).^(-1/k) ); where  z = ( x - m ) / s;
% usually -0.5 < k < +0.5

 m = param(1);	% shift
 s = param(2);	% scale
 k = param(3);	% shape

 z = ( x - m ) / s;

 F = real( exp(-(1+k*z).^(-1/k) ));

 F(find(1 + k*z < 0)) = eps;

% GEV_cdf --------------------------------------------------- 
% HP Gavin 31 Feb 2013,  2019-11-20


