 LAPACK 3.11.0 LAPACK: Linear Algebra PACKage
Searching...
No Matches

## ◆ zlarnd()

 complex*16 function zlarnd ( integer IDIST, integer, dimension( 4 ) ISEED )

ZLARND

Purpose:
``` ZLARND returns a random complex number from a uniform or normal
distribution.```
Parameters
 [in] IDIST ``` IDIST is INTEGER Specifies the distribution of the random numbers: = 1: real and imaginary parts each uniform (0,1) = 2: real and imaginary parts each uniform (-1,1) = 3: real and imaginary parts each normal (0,1) = 4: uniformly distributed on the disc abs(z) <= 1 = 5: uniformly distributed on the circle abs(z) = 1``` [in,out] ISEED ``` ISEED is INTEGER array, dimension (4) On entry, the seed of the random number generator; the array elements must be between 0 and 4095, and ISEED(4) must be odd. On exit, the seed is updated.```
Further Details:
```  This routine calls the auxiliary routine DLARAN to generate a random
real number from a uniform (0,1) distribution. The Box-Muller method
is used to transform numbers from a uniform to a normal distribution.```

Definition at line 74 of file zlarnd.f.

75*
76* -- LAPACK auxiliary routine --
77* -- LAPACK is a software package provided by Univ. of Tennessee, --
78* -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
79*
80* .. Scalar Arguments ..
81 INTEGER IDIST
82* ..
83* .. Array Arguments ..
84 INTEGER ISEED( 4 )
85* ..
86*
87* =====================================================================
88*
89* .. Parameters ..
90 DOUBLE PRECISION ZERO, ONE, TWO
91 parameter( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
92 DOUBLE PRECISION TWOPI
93 parameter( twopi = 6.28318530717958647692528676655900576839d+0 )
94* ..
95* .. Local Scalars ..
96 DOUBLE PRECISION T1, T2
97* ..
98* .. External Functions ..
99 DOUBLE PRECISION DLARAN
100 EXTERNAL dlaran
101* ..
102* .. Intrinsic Functions ..
103 INTRINSIC dcmplx, exp, log, sqrt
104* ..
105* .. Executable Statements ..
106*
107* Generate a pair of real random numbers from a uniform (0,1)
108* distribution
109*
110 t1 = dlaran( iseed )
111 t2 = dlaran( iseed )
112*
113 IF( idist.EQ.1 ) THEN
114*
115* real and imaginary parts each uniform (0,1)
116*
117 zlarnd = dcmplx( t1, t2 )
118 ELSE IF( idist.EQ.2 ) THEN
119*
120* real and imaginary parts each uniform (-1,1)
121*
122 zlarnd = dcmplx( two*t1-one, two*t2-one )
123 ELSE IF( idist.EQ.3 ) THEN
124*
125* real and imaginary parts each normal (0,1)
126*
127 zlarnd = sqrt( -two*log( t1 ) )*exp( dcmplx( zero, twopi*t2 ) )
128 ELSE IF( idist.EQ.4 ) THEN
129*
130* uniform distribution on the unit disc abs(z) <= 1
131*
132 zlarnd = sqrt( t1 )*exp( dcmplx( zero, twopi*t2 ) )
133 ELSE IF( idist.EQ.5 ) THEN
134*
135* uniform distribution on the unit circle abs(z) = 1
136*
137 zlarnd = exp( dcmplx( zero, twopi*t2 ) )
138 END IF
139 RETURN
140*
141* End of ZLARND
142*
double precision function dlaran(ISEED)
DLARAN
Definition: dlaran.f:67
complex *16 function zlarnd(IDIST, ISEED)
ZLARND
Definition: zlarnd.f:75
Here is the call graph for this function:
Here is the caller graph for this function: