XLPack 6.1
Excel VBA Numerical Library Reference Manual
Loading...
Searching...
No Matches

◆ Zlatme()

Sub Zlatme ( N As  Long,
Dist As  String,
Iseed() As  Long,
D() As  Complex,
Mode As  Long,
Cond As  Double,
Dmax As  Complex,
Rsign As  String,
Upper As  String,
Sim As  String,
Ds() As  Double,
Modes As  Long,
Conds As  Double,
Kl As  Long,
Ku As  Long,
ANorm As  Double,
A() As  Complex,
Info As  Long 
)

Generates random non-symmetric square matrices with specified eigenvalues (complex matrices)

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

Zlatme 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 Upper = "T", the upper triangle of A is set to random values out of distribution Dist.
  3. 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.
  4. 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.
  5. 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).
= "D": Uniform on the complex disc |z| < 1.
= "N": Normal distribution on (0, 1).
[in,out]Iseed()Array Iseed(LIseed - 1) (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 - 1) (LD >= N)
This array is used to specify the eigenvalues of A.
[in] If Mode = 0, D() is assumed to contain the input eigenvalues.
[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 or real: if Dmax is negative or complex (or zero), D() will be scaled by a negative or complex number (or zero).
If Rsign = "F" then the largest (absolute) eigenvalue will be equal to Dmax.
[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 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 - 1) (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.
[out]A()Array A(LA1 - 1, LA2 - 1) (LA1 >= N, LA2 >= N)
The desired test matrix.
[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", "D" nor "N")
= -3: The argument Iseed() is invalid.
= -4: The argument D() is invalid.
= -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 Rsign had an illegal value. (Rsign <> "T" nor "F")
= -9: The argument Upper had an illegal value. (Upper <> "T" nor "F")
= -10: The argument Sim had an illegal value. (Sim <> "T" nor "F")
= -11: The argument Ds() had an illegal value. (invalid Ds() value(s))
= -12: The argument Modes had an illegal value. (Modes < -5 or Modes > 5)
= -13: The argument Conds had an illegal value. (Conds < 1)
= -14: The argument Kl had an illegal value. (Kl < 1)
= -15: The argument Ku had an illegal value. (Ku > 1 or both Ku and Kl < N-1)
= -17: The argument A() is invalid.
= 1: Error return from Zlatm1. (During computing D())
= 2: Cannot scale to Dmax. (Max. singular value is 0)
= 3: Error return from Dlatm1. (During computing Ds())
= 4: Error return from Zlarge.
= 5: Zero singular value from Dlatm1.
Reference
LAPACK