Computes the entries of a matrix as specified.


void slatm1 (lapack_int *mode, *cond, lapack_int *irsign, lapack_int *idist, lapack_int *iseed, float *d, lapack_int *n, lapack_int *info);

void dlatm1 (lapack_int *mode, *cond, lapack_int *irsign, lapack_int *idist, lapack_int *iseed, double *d, lapack_int *n, lapack_int *info);

void clatm1 (lapack_int *mode, *cond, lapack_int *irsign, lapack_int *idist, lapack_int *iseed, lapack_complex *d, lapack_int *n, lapack_int *info);

void zlatm1 (lapack_int *mode, *cond, lapack_int *irsign, lapack_int *idist, lapack_int *iseed, lapack_complex_double *d, lapack_int *n, lapack_int *info);

Include Files

  • mkl.h


The ?latm1 routine computes the entries of D(1..n) as specified by mode, cond and irsign. idist and iseed determine the generation of random numbers.

?latm1 is called by slatmr (for slatm1 and dlatm1), and by clatmr(for clatm1 and zlatm1) to generate random test matrices for LAPACK programs.

Input Parameters


On entry describes how d is to be computed:

mode = 0 means do not change d.

mode = 1 sets d[0] = 1 and d[1:n - 1] = 1.0/cond

mode = 2 sets d[0:n - 2] = 1 and d[n - 1]=1.0/cond

mode = 3 sets d[i - 1]=cond**(-(i-1)/(n-1))

mode = 4 sets d[i - 1]= 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 sets 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.


On entry, used as described under mode above. If used, it must be 1.


On entry, if mode is not -6, 0, or 6, determines sign of entries of d.

If irsign = 0, entries of d are unchanged.

If irsign = 1, each entry of d is multiplied by a random complex number uniformly distributed with absolute value 1.


Specifies the distribution of the random numbers.

For slatm1 and dlatm1:

= 1: uniform (0,1)

= 2: uniform (-1,1)

= 3: normal (0,1)

For clatm1 and zlatm1:

= 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)


Array, size (4).

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[3] are changed on exit, and can be used in the next call to ?latm1 to continue the same random number sequence.


Array, size n.


Number of entries of d.

Output Parameters


On exit, the seed is updated.


On exit, d is updated, unless mode = 0.


If info = 0, the execution is successful.

If info = -1, mode is not in range -6 to 6.

If info = -2, mode is neither -6, 0 nor 6, and irsign is neither 0 nor 1.

If info = -3, mode is neither -6, 0 nor 6 and cond is less than 1.

If info = -4, mode equals 6 or -6 and idist is not in range 1 to 4.

If info = -7, n is negative.

For more complete information about compiler optimizations, see our Optimization Notice.
Select sticky button color: 
Orange (only for download buttons)