 LAPACK  3.10.0 LAPACK: Linear Algebra PACKage

◆ zlatm1()

 subroutine zlatm1 ( integer MODE, double precision COND, integer IRSIGN, integer IDIST, integer, dimension( 4 ) ISEED, complex*16, dimension( * ) D, integer N, integer INFO )

ZLATM1

Purpose:
ZLATM1 computes the entries of D(1..N) as specified by
MODE, COND and IRSIGN. IDIST and ISEED determine the generation
of random numbers. ZLATM1 is called by ZLATMR to generate
random test matrices for LAPACK programs.
Parameters
 [in] MODE MODE is INTEGER On entry describes how D is to be computed: MODE = 0 means do not change D. MODE = 1 sets D(1)=1 and D(2:N)=1.0/COND MODE = 2 sets D(1:N-1)=1 and D(N)=1.0/COND MODE = 3 sets D(I)=COND**(-(I-1)/(N-1)) MODE = 4 sets D(i)=1 - (i-1)/(N-1)*(1 - 1/COND) MODE = 5 sets D to random numbers in the range ( 1/COND , 1 ) such that their logarithms are uniformly distributed. MODE = 6 set D to random numbers from same distribution as the rest of the matrix. MODE < 0 has the same meaning as ABS(MODE), except that the order of the elements of D is reversed. Thus if MODE is positive, D has entries ranging from 1 to 1/COND, if negative, from 1/COND to 1, Not modified. [in] COND COND is DOUBLE PRECISION On entry, used as described under MODE above. If used, it must be >= 1. Not modified. [in] IRSIGN IRSIGN is INTEGER On entry, if MODE neither -6, 0 nor 6, determines sign of entries of D 0 => leave entries of D unchanged 1 => multiply each entry of D by random complex number uniformly distributed with absolute value 1 [in] IDIST IDIST is INTEGER On entry, IDIST specifies the type of distribution to be used to generate a random matrix . 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 => complex number uniform in DISK( 0, 1 ) Not modified. [in,out] ISEED ISEED is INTEGER array, dimension ( 4 ) On entry ISEED specifies the seed of the random number generator. The random number generator uses a linear congruential sequence limited to small integers, and so should produce machine independent random numbers. The values of ISEED are changed on exit, and can be used in the next call to ZLATM1 to continue the same random number sequence. Changed on exit. [in,out] D D is COMPLEX*16 array, dimension ( N ) Array to be computed according to MODE, COND and IRSIGN. May be changed on exit if MODE is nonzero. [in] N N is INTEGER Number of entries of D. Not modified. [out] INFO INFO is INTEGER 0 => normal termination -1 => if MODE not in range -6 to 6 -2 => if MODE neither -6, 0 nor 6, and IRSIGN neither 0 nor 1 -3 => if MODE neither -6, 0 nor 6 and COND less than 1 -4 => if MODE equals 6 or -6 and IDIST not in range 1 to 4 -7 => if N negative

Definition at line 136 of file zlatm1.f.

137 *
138 * -- LAPACK auxiliary routine --
139 * -- LAPACK is a software package provided by Univ. of Tennessee, --
140 * -- Univ. of California Berkeley, Univ. of Colorado Denver and NAG Ltd..--
141 *
142 * .. Scalar Arguments ..
143  INTEGER IDIST, INFO, IRSIGN, MODE, N
144  DOUBLE PRECISION COND
145 * ..
146 * .. Array Arguments ..
147  INTEGER ISEED( 4 )
148  COMPLEX*16 D( * )
149 * ..
150 *
151 * =====================================================================
152 *
153 * .. Parameters ..
154  DOUBLE PRECISION ONE
155  parameter( one = 1.0d0 )
156 * ..
157 * .. Local Scalars ..
158  INTEGER I
159  DOUBLE PRECISION ALPHA, TEMP
160  COMPLEX*16 CTEMP
161 * ..
162 * .. External Functions ..
163  DOUBLE PRECISION DLARAN
164  COMPLEX*16 ZLARND
165  EXTERNAL dlaran, zlarnd
166 * ..
167 * .. External Subroutines ..
168  EXTERNAL xerbla, zlarnv
169 * ..
170 * .. Intrinsic Functions ..
171  INTRINSIC abs, dble, exp, log
172 * ..
173 * .. Executable Statements ..
174 *
175 * Decode and Test the input parameters. Initialize flags & seed.
176 *
177  info = 0
178 *
179 * Quick return if possible
180 *
181  IF( n.EQ.0 )
182  \$ RETURN
183 *
184 * Set INFO if an error
185 *
186  IF( mode.LT.-6 .OR. mode.GT.6 ) THEN
187  info = -1
188  ELSE IF( ( mode.NE.-6 .AND. mode.NE.0 .AND. mode.NE.6 ) .AND.
189  \$ ( irsign.NE.0 .AND. irsign.NE.1 ) ) THEN
190  info = -2
191  ELSE IF( ( mode.NE.-6 .AND. mode.NE.0 .AND. mode.NE.6 ) .AND.
192  \$ cond.LT.one ) THEN
193  info = -3
194  ELSE IF( ( mode.EQ.6 .OR. mode.EQ.-6 ) .AND.
195  \$ ( idist.LT.1 .OR. idist.GT.4 ) ) THEN
196  info = -4
197  ELSE IF( n.LT.0 ) THEN
198  info = -7
199  END IF
200 *
201  IF( info.NE.0 ) THEN
202  CALL xerbla( 'ZLATM1', -info )
203  RETURN
204  END IF
205 *
206 * Compute D according to COND and MODE
207 *
208  IF( mode.NE.0 ) THEN
209  GO TO ( 10, 30, 50, 70, 90, 110 )abs( mode )
210 *
211 * One large D value:
212 *
213  10 CONTINUE
214  DO 20 i = 1, n
215  d( i ) = one / cond
216  20 CONTINUE
217  d( 1 ) = one
218  GO TO 120
219 *
220 * One small D value:
221 *
222  30 CONTINUE
223  DO 40 i = 1, n
224  d( i ) = one
225  40 CONTINUE
226  d( n ) = one / cond
227  GO TO 120
228 *
229 * Exponentially distributed D values:
230 *
231  50 CONTINUE
232  d( 1 ) = one
233  IF( n.GT.1 ) THEN
234  alpha = cond**( -one / dble( n-1 ) )
235  DO 60 i = 2, n
236  d( i ) = alpha**( i-1 )
237  60 CONTINUE
238  END IF
239  GO TO 120
240 *
241 * Arithmetically distributed D values:
242 *
243  70 CONTINUE
244  d( 1 ) = one
245  IF( n.GT.1 ) THEN
246  temp = one / cond
247  alpha = ( one-temp ) / dble( n-1 )
248  DO 80 i = 2, n
249  d( i ) = dble( n-i )*alpha + temp
250  80 CONTINUE
251  END IF
252  GO TO 120
253 *
254 * Randomly distributed D values on ( 1/COND , 1):
255 *
256  90 CONTINUE
257  alpha = log( one / cond )
258  DO 100 i = 1, n
259  d( i ) = exp( alpha*dlaran( iseed ) )
260  100 CONTINUE
261  GO TO 120
262 *
263 * Randomly distributed D values from IDIST
264 *
265  110 CONTINUE
266  CALL zlarnv( idist, iseed, n, d )
267 *
268  120 CONTINUE
269 *
270 * If MODE neither -6 nor 0 nor 6, and IRSIGN = 1, assign
271 * random signs to D
272 *
273  IF( ( mode.NE.-6 .AND. mode.NE.0 .AND. mode.NE.6 ) .AND.
274  \$ irsign.EQ.1 ) THEN
275  DO 130 i = 1, n
276  ctemp = zlarnd( 3, iseed )
277  d( i ) = d( i )*( ctemp / abs( ctemp ) )
278  130 CONTINUE
279  END IF
280 *
281 * Reverse if MODE < 0
282 *
283  IF( mode.LT.0 ) THEN
284  DO 140 i = 1, n / 2
285  ctemp = d( i )
286  d( i ) = d( n+1-i )
287  d( n+1-i ) = ctemp
288  140 CONTINUE
289  END IF
290 *
291  END IF
292 *
293  RETURN
294 *
295 * End of ZLATM1
296 *
double precision function dlaran(ISEED)
DLARAN
Definition: dlaran.f:67
subroutine xerbla(SRNAME, INFO)
XERBLA
Definition: xerbla.f:60
complex *16 function zlarnd(IDIST, ISEED)
ZLARND
Definition: zlarnd.f:75
subroutine zlarnv(IDIST, ISEED, N, X)
ZLARNV returns a vector of random numbers from a uniform or normal distribution.
Definition: zlarnv.f:99
Here is the call graph for this function:
Here is the caller graph for this function: