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

◆ dlaran()

double precision function dlaran ( integer, dimension( 4 )  iseed)

Definition at line 1999 of file tools.f.

2000*
2001* -- LAPACK auxiliary routine (version 2.0) --
2002* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
2003* Courant Institute, Argonne National Lab, and Rice University
2004* February 29, 1992
2005*
2006* .. Array Arguments ..
2007 INTEGER ISEED( 4 )
2008* ..
2009*
2010* Purpose
2011* =======
2012*
2013* DLARAN returns a random real number from a uniform (0,1)
2014* distribution.
2015*
2016* Arguments
2017* =========
2018*
2019* ISEED (input/output) INTEGER array, dimension (4)
2020* On entry, the seed of the random number generator; the array
2021* elements must be between 0 and 4095, and ISEED(4) must be
2022* odd.
2023* On exit, the seed is updated.
2024*
2025* Further Details
2026* ===============
2027*
2028* This routine uses a multiplicative congruential method with modulus
2029* 2**48 and multiplier 33952834046453 (see G.S.Fishman,
2030* 'Multiplicative congruential random number generators with modulus
2031* 2**b: an exhaustive analysis for b = 32 and a partial analysis for
2032* b = 48', Math. Comp. 189, pp 331-344, 1990).
2033*
2034* 48-bit integers are stored in 4 integer array elements with 12 bits
2035* per element. Hence the routine is portable across machines with
2036* integers of 32 bits or more.
2037*
2038* =====================================================================
2039*
2040* .. Parameters ..
2041 INTEGER M1, M2, M3, M4
2042 parameter( m1 = 494, m2 = 322, m3 = 2508, m4 = 2549 )
2043 DOUBLE PRECISION ONE
2044 parameter( one = 1.0d+0 )
2045 INTEGER IPW2
2046 DOUBLE PRECISION R
2047 parameter( ipw2 = 4096, r = one / ipw2 )
2048* ..
2049* .. Local Scalars ..
2050 INTEGER IT1, IT2, IT3, IT4
2051* ..
2052* .. Intrinsic Functions ..
2053 INTRINSIC dble, mod
2054* ..
2055* .. Executable Statements ..
2056*
2057* multiply the seed by the multiplier modulo 2**48
2058*
2059 it4 = iseed( 4 )*m4
2060 it3 = it4 / ipw2
2061 it4 = it4 - ipw2*it3
2062 it3 = it3 + iseed( 3 )*m4 + iseed( 4 )*m3
2063 it2 = it3 / ipw2
2064 it3 = it3 - ipw2*it2
2065 it2 = it2 + iseed( 2 )*m4 + iseed( 3 )*m3 + iseed( 4 )*m2
2066 it1 = it2 / ipw2
2067 it2 = it2 - ipw2*it1
2068 it1 = it1 + iseed( 1 )*m4 + iseed( 2 )*m3 + iseed( 3 )*m2 +
2069 $ iseed( 4 )*m1
2070 it1 = mod( it1, ipw2 )
2071*
2072* return updated seed
2073*
2074 iseed( 1 ) = it1
2075 iseed( 2 ) = it2
2076 iseed( 3 ) = it3
2077 iseed( 4 ) = it4
2078*
2079* convert 48-bit integer to a real number in the interval (0,1)
2080*
2081 dlaran = r*( dble( it1 )+r*( dble( it2 )+r*( dble( it3 )+r*
2082 $ ( dble( it4 ) ) ) ) )
2083 RETURN
2084*
2085* End of DLARAN
2086*
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: