SCALAPACK 2.2.2
LAPACK: Linear Algebra PACKage
Loading...
Searching...
No Matches

◆ zlarnd()

double complex function zlarnd ( integer  idist,
integer, dimension( 4 )  iseed 
)

Definition at line 1898 of file tools.f.

1899*
1900* -- LAPACK auxiliary routine (version 2.0) --
1901* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
1902* Courant Institute, Argonne National Lab, and Rice University
1903* June 30, 1994
1904*
1905* .. Scalar Arguments ..
1906 INTEGER IDIST
1907* ..
1908* .. Array Arguments ..
1909 INTEGER ISEED( 4 )
1910* ..
1911*
1912* Purpose
1913* =======
1914*
1915* ZLARND returns a random complex number from a uniform or normal
1916* distribution.
1917*
1918* Arguments
1919* =========
1920*
1921* IDIST (input) INTEGER
1922* Specifies the distribution of the random numbers:
1923* = 1: real and imaginary parts each uniform (0,1)
1924* = 2: real and imaginary parts each uniform (-1,1)
1925* = 3: real and imaginary parts each normal (0,1)
1926* = 4: uniformly distributed on the disc abs(z) <= 1
1927* = 5: uniformly distributed on the circle abs(z) = 1
1928*
1929* ISEED (input/output) INTEGER array, dimension (4)
1930* On entry, the seed of the random number generator; the array
1931* elements must be between 0 and 4095, and ISEED(4) must be
1932* odd.
1933* On exit, the seed is updated.
1934*
1935* Further Details
1936* ===============
1937*
1938* This routine calls the auxiliary routine DLARAN to generate a random
1939* real number from a uniform (0,1) distribution. The Box-Muller method
1940* is used to transform numbers from a uniform to a normal distribution.
1941*
1942* =====================================================================
1943*
1944* .. Parameters ..
1945 DOUBLE PRECISION ZERO, ONE, TWO
1946 parameter( zero = 0.0d+0, one = 1.0d+0, two = 2.0d+0 )
1947 DOUBLE PRECISION TWOPI
1948 parameter( twopi = 6.2831853071795864769252867663d+0 )
1949* ..
1950* .. Local Scalars ..
1951 DOUBLE PRECISION T1, T2
1952* ..
1953* .. External Functions ..
1954 DOUBLE PRECISION DLARAN
1955 EXTERNAL dlaran
1956* ..
1957* .. Intrinsic Functions ..
1958 INTRINSIC dcmplx, exp, log, sqrt
1959* ..
1960* .. Executable Statements ..
1961*
1962* Generate a pair of real random numbers from a uniform (0,1)
1963* distribution
1964*
1965 t1 = dlaran( iseed )
1966 t2 = dlaran( iseed )
1967*
1968 IF( idist.EQ.1 ) THEN
1969*
1970* real and imaginary parts each uniform (0,1)
1971*
1972 zlarnd = dcmplx( t1, t2 )
1973 ELSE IF( idist.EQ.2 ) THEN
1974*
1975* real and imaginary parts each uniform (-1,1)
1976*
1977 zlarnd = dcmplx( two*t1-one, two*t2-one )
1978 ELSE IF( idist.EQ.3 ) THEN
1979*
1980* real and imaginary parts each normal (0,1)
1981*
1982 zlarnd = sqrt( -two*log( t1 ) )*exp( dcmplx( zero, twopi*t2 ) )
1983 ELSE IF( idist.EQ.4 ) THEN
1984*
1985* uniform distribution on the unit disc abs(z) <= 1
1986*
1987 zlarnd = sqrt( t1 )*exp( dcmplx( zero, twopi*t2 ) )
1988 ELSE IF( idist.EQ.5 ) THEN
1989*
1990* uniform distribution on the unit circle abs(z) = 1
1991*
1992 zlarnd = exp( dcmplx( zero, twopi*t2 ) )
1993 END IF
1994 RETURN
1995*
1996* End of ZLARND
1997*
double complex function zlarnd(idist, iseed)
Definition tools.f:1899
double precision function dlaran(iseed)
Definition tools.f:2000
Here is the call graph for this function:
Here is the caller graph for this function: