function X = Laplace_inv(P,muX,sigmaX)
% X = Laplace_inv(P,muX,sigmaX)
% return the inverse CDF of the Laplace distribution
% (with mean muX, and standard deviation sigmaX)
% corresponding to a non-exceedence probability P
%
%    Reference: http://en.wikipedia.org/wiki/Laplace_distribution

  X = muX + sigmaX/sqrt(2)*log(2*P);
  idx = find(X>=muX);
  X(idx) = muX - sigmaX/sqrt(2) * log(2-2*P(idx));

% ------------------------------------------------------------- Laplace_inv
