dexsf(3f) - [M_datapac:SPARSITY] compute the double exponential
sparsity function
SUBROUTINE DEXSF(P,Sf)
REAL(kind=wp),intent(in) :: P
REAL(kind=wp),intent(out) :: Sf
DEXSF(3f) computes the sparsity function value for the double
exponential (Laplace) distribution with mean = 0 and standard deviation
= sqrt(2).
This distribution is defined for all x and has the probability
density function
f(x) = 0.5*exp(-abs(x))
Note that the sparsity function of a distribution is the derivative
of the percent point function, and also is the reciprocal of the
probability density function (but in units of P rather than X).
P The value (between 0.0 and 1.0 exclusively) at which the
sparsity function is to be evaluated.
SF The sparsity function value.
Sample program:
program demo_dexsf
use M_datapac, only : dexsf
implicit none
! call dexsf(x,y)
end program demo_dexsf
Results:
The original DATAPAC library was written by James Filliben of the
Statistical Engineering Division, National Institute of Standards
and Technology.
John Urban, 2022.05.31
CC0-1.0
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
real(kind=wp), | intent(in) | :: | P | |||
real(kind=wp), | intent(out) | :: | Sf |
SUBROUTINE DEXSF(P,Sf) REAL(kind=wp),intent(in) :: P REAL(kind=wp),intent(out) :: Sf ! ! CHECK THE INPUT ARGUMENTS FOR ERRORS ! IF ( P<=0.0_wp .OR. P>=1.0_wp ) THEN WRITE (G_IO,99001) 99001 FORMAT (' ***** FATAL ERROR--THE FIRST INPUT ARGUMENT TO DEXSF(3f) IS OUTSIDE THE ALLOWABLE (0,1) INTERVAL *****') WRITE (G_IO,99002) P 99002 FORMAT (' ','***** THE VALUE OF THE ARGUMENT IS ',E15.8,' *****') RETURN ELSE IF ( P<=0.5_wp ) Sf = 1.0_wp/P IF ( P>0.5_wp ) Sf = 1.0_wp/(1.0_wp-P) ENDIF ! END SUBROUTINE DEXSF