98 SUBROUTINE zlarnv( IDIST, ISEED, N, X )
115 DOUBLE PRECISION ZERO, ONE, TWO
116 parameter( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
118 parameter( lv = 128 )
119 DOUBLE PRECISION TWOPI
120 parameter( twopi = 6.28318530717958647692528676655900576839d+0 )
126 DOUBLE PRECISION U( LV )
129 INTRINSIC dcmplx, exp, log, min, sqrt
136 DO 60 iv = 1, n, lv / 2
137 il = min( lv / 2, n-iv+1 )
142 CALL dlaruv( iseed, 2*il, u )
144 IF( idist.EQ.1 )
THEN
149 x( iv+i-1 ) = dcmplx( u( 2*i-1 ), u( 2*i ) )
151 ELSE IF( idist.EQ.2 )
THEN
156 x( iv+i-1 ) = dcmplx( two*u( 2*i-1 )-one,
159 ELSE IF( idist.EQ.3 )
THEN
164 x( iv+i-1 ) = sqrt( -two*log( u( 2*i-1 ) ) )*
165 $ exp( dcmplx( zero, twopi*u( 2*i ) ) )
167 ELSE IF( idist.EQ.4 )
THEN
173 x( iv+i-1 ) = sqrt( u( 2*i-1 ) )*
174 $ exp( dcmplx( zero, twopi*u( 2*i ) ) )
176 ELSE IF( idist.EQ.5 )
THEN
182 x( iv+i-1 ) = exp( dcmplx( zero, twopi*u( 2*i ) ) )
subroutine zlarnv(idist, iseed, n, x)
ZLARNV returns a vector of random numbers from a uniform or normal distribution.
subroutine dlaruv(iseed, n, x)
DLARUV returns a vector of n random real numbers from a uniform distribution.