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

◆ dlarnd()

double precision function dlarnd ( integer  idist,
integer, dimension( 4 )  iseed 
)

Definition at line 1810 of file tools.f.

1811*
1812* -- LAPACK auxiliary routine (version 2.0) --
1813* Univ. of Tennessee, Univ. of California Berkeley, NAG Ltd.,
1814* Courant Institute, Argonne National Lab, and Rice University
1815* June 30, 1994
1816*
1817* .. Scalar Arguments ..
1818 INTEGER IDIST
1819* ..
1820* .. Array Arguments ..
1821 INTEGER ISEED( 4 )
1822* ..
1823*
1824* Purpose
1825* =======
1826*
1827* DLARND returns a random real number from a uniform or normal
1828* distribution.
1829*
1830* Arguments
1831* =========
1832*
1833* IDIST (input) INTEGER
1834* Specifies the distribution of the random numbers:
1835* = 1: uniform (0,1)
1836* = 2: uniform (-1,1)
1837* = 3: normal (0,1)
1838*
1839* ISEED (input/output) INTEGER array, dimension (4)
1840* On entry, the seed of the random number generator; the array
1841* elements must be between 0 and 4095, and ISEED(4) must be
1842* odd.
1843* On exit, the seed is updated.
1844*
1845* Further Details
1846* ===============
1847*
1848* This routine calls the auxiliary routine DLARAN to generate a random
1849* real number from a uniform (0,1) distribution. The Box-Muller method
1850* is used to transform numbers from a uniform to a normal distribution.
1851*
1852* =====================================================================
1853*
1854* .. Parameters ..
1855 DOUBLE PRECISION ONE, TWO
1856 parameter( one = 1.0d+0, two = 2.0d+0 )
1857 DOUBLE PRECISION TWOPI
1858 parameter( twopi = 6.2831853071795864769252867663d+0 )
1859* ..
1860* .. Local Scalars ..
1861 DOUBLE PRECISION T1, T2
1862* ..
1863* .. External Functions ..
1864 DOUBLE PRECISION DLARAN
1865 EXTERNAL dlaran
1866* ..
1867* .. Intrinsic Functions ..
1868 INTRINSIC cos, log, sqrt
1869* ..
1870* .. Executable Statements ..
1871*
1872* Generate a real random number from a uniform (0,1) distribution
1873*
1874 t1 = dlaran( iseed )
1875*
1876 IF( idist.EQ.1 ) THEN
1877*
1878* uniform (0,1)
1879*
1880 dlarnd = t1
1881 ELSE IF( idist.EQ.2 ) THEN
1882*
1883* uniform (-1,1)
1884*
1885 dlarnd = two*t1 - one
1886 ELSE IF( idist.EQ.3 ) THEN
1887*
1888* normal (0,1)
1889*
1890 t2 = dlaran( iseed )
1891 dlarnd = sqrt( -two*log( t1 ) )*cos( twopi*t2 )
1892 END IF
1893 RETURN
1894*
1895* End of DLARND
1896*
double precision function dlarnd(idist, iseed)
Definition tools.f:1811
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: