100 SUBROUTINE zlarnv( IDIST, ISEED, N, X )
118 DOUBLE PRECISION ZERO, ONE, TWO
119 parameter ( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
121 parameter ( lv = 128 )
122 DOUBLE PRECISION TWOPI
123 parameter ( twopi = 6.2831853071795864769252867663d+0 )
129 DOUBLE PRECISION U( lv )
132 INTRINSIC dcmplx, exp, log, min, sqrt
139 DO 60 iv = 1, n, lv / 2
140 il = min( lv / 2, n-iv+1 )
145 CALL dlaruv( iseed, 2*il, u )
147 IF( idist.EQ.1 )
THEN
152 x( iv+i-1 ) = dcmplx( u( 2*i-1 ), u( 2*i ) )
154 ELSE IF( idist.EQ.2 )
THEN
159 x( iv+i-1 ) = dcmplx( two*u( 2*i-1 )-one,
162 ELSE IF( idist.EQ.3 )
THEN
167 x( iv+i-1 ) = sqrt( -two*log( u( 2*i-1 ) ) )*
168 $ exp( dcmplx( zero, twopi*u( 2*i ) ) )
170 ELSE IF( idist.EQ.4 )
THEN
176 x( iv+i-1 ) = sqrt( u( 2*i-1 ) )*
177 $ exp( dcmplx( zero, twopi*u( 2*i ) ) )
179 ELSE IF( idist.EQ.5 )
THEN
185 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.