LAPACK  3.6.1
LAPACK: Linear Algebra PACKage
subroutine clatm1 ( integer  MODE,
real  COND,
integer  IRSIGN,
integer  IDIST,
integer, dimension( 4 )  ISEED,
complex, dimension( * )  D,
integer  N,
integer  INFO 
)

CLATM1

Purpose:
    CLATM1 computes the entries of D(1..N) as specified by
    MODE, COND and IRSIGN. IDIST and ISEED determine the generation
    of random numbers. CLATM1 is called by CLATMR 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 REAL
           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 CLATM1
           to continue the same random number sequence.
           Changed on exit.
[in,out]D
          D is COMPLEX 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
Author
Univ. of Tennessee
Univ. of California Berkeley
Univ. of Colorado Denver
NAG Ltd.
Date
November 2015

Definition at line 139 of file clatm1.f.

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

Here is the call graph for this function:

Here is the caller graph for this function: