SPRANDSYM

Random sparse symmetric matrices

R = SPRANDSYM(S) is a symmetric random matrix whose lower triangle

and diagonal have the same structure as S.  The elements are

normally distributed, with mean 0 and variance 1.

R = SPRANDSYM(n,density) is a symmetric random, n-by-n, sparse

matrix with approximately density*n*n nonzeros; each entry is

the sum of one or more normally distributed random samples.

R = SPRANDSYM(n,density,rcond) also has a reciprocal condition number

equal to rcond.  The distribution of entries is

nonuniform; it is roughly symmetric about 0; all are in [-1,1].

If rcond is a VECTOR of length n, then R has eigenvalues rcond.

Thus, if rcond is a positive (nonnegative) vector then R will

be positive (nonnegative) definite

In either case, R is generated by random Jacobi rotations

applied to a diagonal matrix with the given eigenvalues or

condition number.  It has a great deal of topological and

algebraic structure.

R = SPRANDSYM(n, density, rcond, kind) is positive definite.

If kind = 1, R is generated by random Jacobi rotation of

a positive definite diagonal matrix.

R has the desired condition number exactly.

If kind = 2, R is a shifted sum of outer products.

R has the desired condition number only

approximately, but has less structure.

If R = SPRANDSYM(S, density, rcond, 3),

then R has the same structure as the MATRIX S and

approximate condition number 1/rcond.  density is ignored.