XLPack 7.0
XLPack Numerical Library (C API) Reference Manual
Loading...
Searching...
No Matches

◆ dlatme()

void dlatme ( int  n,
char  dist,
int  iseed[],
double  d[],
int  mode,
double  cond,
double  dmax,
char  ei[],
char  rsign,
char  upper,
char  sim,
double  ds[],
int  modes,
double  conds,
int  kl,
int  ku,
double  anorm,
int  lda,
double  a[],
double  work[],
int *  info 
)

Generates random non-symmetric square matrices with specified eigenvalues

Purpose
This routine generates random non-symmetric square matrices with specified eigenvalues.

dlatme operates by applying the following sequence of operations:
  1. Set the diagonal to d, where d may be input or computed according to mode, cond, dmax, and rsign as described below.
  2. If complex conjugate pairs are desired (mode = 0 and ei[0] = 'R', or mode = 5), certain pairs of adjacent elements of d are interpreted as the real and complex parts of a complex conjugate pair; A thus becomes block diagonal, with 1 x 1 and 2 x 2 blocks.
  3. If upper = 'T', the upper triangle of A is set to random values out of distribution dist.
  4. If sim = 'T', A is multiplied on the left by a random matrix X, whose singular values are specified by ds, modes, and conds, and on the right by X inverse.
  5. If kl < n-1, the lower bandwidth is reduced to kl using Householder transformations. If ku < n-1, the upper bandwidth is reduced to ku.
  6. If anorm is not negative, the matrix is scaled to have maximum-element-norm anorm.
(Note: Since the matrix cannot be reduced beyond Hessenberg form, no packing options are available.)
Parameters
[in]nNumber of columns (or rows) of A. (n >= 0)
[in]distThe type of distribution to be used to generate the random eigenvalues/singular values.
= 'U': Uniform distribution on (0, 1).
= 'S': Uniform distribution on (-1, 1).
= 'N': Normal distribution on (0, 1).
[in,out]iseed[]Array iseed[liseed] (liseed >= 4)
[in] The seed of the random number generator. (0 <= iseed[i] <= 4095, and iseed[3] should be odd)
[out] The values of iseed[] are changed on exit, and can be used in the next call to continue the same random number sequence.
[in,out]d[]Array d[ld] (ld >= n)
This array is used to specify the eigenvalues of A.
[in] If mode = 0, d[] is assumed to contain the input eigenvalues (but see the description of ei[]).
[out] If mode != 0, the eigenvalues will be computed according to mode, cond, dmax and rsign, and placed in d[].
[in]modeDescribes how the eigenvalues are to be specified.
= 0: Use d[] (with ei[]) as input.
= 1: d[0] = 1 and d[1] to d[n-1] = 1/cond.
= 2: d[0] to d[n-2] = 1 and d[n-1] = 1/cond.
= 3: d[i] = cond^(-i/(n-1)) (i = 0 to n-1).
= 4: d[i] = 1-i/(n-1)*(1-1/cond) (i = 0 to n-1).
= 5: Random numbers in the range (1/cond, 1) such that their logarithms are uniformly distributed. Each odd-even pair of elements will be either used as two real eigenvalues or as the real and imaginary part of a complex conjugate pair of eigenvalues; the choice of which is done is random, with 50-50 probability, for each pair.
= 6: Random numbers from same distribution as the rest of the matrix.
< 0: Same as |mode| but the order of the elements of d[] is reversed. Thus if mode is between 1 and 4, D has entries ranging from 1 to 1/cond, if between -1 and -4, d has entries ranging from 1/cond to 1.
[in]condThis is used as described under mode above. (cond >= 1)
[in]dmaxIf mode != -6, 0 nor 6, the contents of d[], as computed according to mode and cond, will be scaled by dmax/max(abs(d[i])). Note that dmax need not be positive: if dmax is negative (or zero), d[] will be scaled by a negative number (or zero).
[in]ei[]Array ei[lei] (lei >= n)
To be referenced only when mode = 0.
ei[0] = ' ':
  All input eigenvalues in d[] will be real.
ei[0] = 'R':
  ei[] specifies which elements of d[] (on input) are real eigenvalues and which are the real and imaginary parts of a complex conjugate pair of eigenvalues.
  If ei[j-1] = 'R' and ei[j] = 'I', the j-th eigenvalue is d[j-1] + d[j]i, and the (j+1)-th eigenvalue is the conjugate complex, d[j-1] - d[j]i.
  If ei[j-1] = ei[j] = 'R', the j-th eigenvalue is d[j-1] (real).
  Two adjacent elements of ei[] both should not have the value 'I'.
ei[0] should not be 'I'.
[in]rsignTo be used except for mode = -6, 0 and 6.
= 'T': The elements of d[], as computed according to mode and cond, will be multiplied by a random sign (+1 or -1).
= 'F': They will not be multiplied.
[in]upper= 'T': The elements of A above the diagonal (and above the 2 x 2 diagonal blocks, if A has complex eigenvalues) will be set to random numbers out of dist.
= 'F': They will not be set.
[in]sim= 'T': A will be operated on by a "similarity transform", i.e. multiplied on the left by a matrix X and on the right by X inverse. X = U*S*V, where U and V are random unitary matrices and S is a (diagonal) matrix of singular values specified by ds[], modes and conds.
= 'F': A will not be trandformed.
[in,out]ds[]Array ds[lds] (lds >= n)
This array is used to specify the singular values of X, in the same way that d[] specifies the eigenvalues of A.
If modes = 0, ds[] contains the singular values, which may not be zero.
[in]modes
[in]condsSame as mode and cond, but for specifying the diagonal of S. modes = -6 and 6 are not allowed (since they would result in randomly ill-conditioned eigenvalues.)
[in]klThe lower bandwidth of the matrix. (kl >= 1)
kl = 1 specifies upper Hessenberg form. If kl >= n-1, then A will have full lower bandwidth.
[in]kuThe upper bandwidth of the matrix. (ku >= 1)
If ku >= n-1, then A will have full upper bandwidth; if ku >= n-1 and kl >= n-1, then A will be dense. Only one of ku and kl may be less than n-1.
[in]anormIf anorm >= 0, then A will be scaled by a non-negative real number to make the maximum-element-norm of A to be anorm.
[in]ldaLeading dimension of two dimensional array a[][]. (lda >= n)
[out]a[][]Array a[la][lda] (la >= n)
The desired test matrix.
[out]work[]Array work[lwork] (lwork >= 3*n)
Work array.
[out]info= 0: Successful exit
= -1: The argument n had an illegal value (n < 0)
= -2: The argument dist had an illegal value (dist != 'U', 'S' nor 'N')
= -5: The argument mode had an illegal value (mode < -6 or mode > 6)
= -6: The argument cond had an illegal value (cond < 1)
= -8: The argument ei had an illegal value (invalid ei[] value(s))
= -9: The argument rsign had an illegal value (rsign != 'T' nor 'F')
= -10: The argument upper had an illegal value (upper != 'T' nor 'F')
= -11: The argument sim had an illegal value (sim != 'T' nor 'F')
= -12: The argument ds had an illegal value (invalid ds[] value(s))
= -13: The argument modes had an illegal value (modes < -5 or modes > 5)
= -14: The argument conds had an illegal value (conds < 1)
= -15: The argument kl had an illegal value (kl < 1)
= -16: The argument ku had an illegal value (ku > 1 or both ku and kl < n-1)
= -18: The argument lda had an illegal value (lda < n)
= 1: Error return from dlatm1 (computing d[])
= 2: Cannot scale to dmax (max. singular value is 0)
= 3: Error return from dlatm1 (computing ds[])
= 4: Error return from dlarge
= 5: Zero singular value from dlatm1
Reference
LAPACK