symmetric

symmetric(n, dist='normal', pd=False, ew=None, seed=None)

Generates a random symmetric matrix of size n with eigenvalues ew.

Parameters

Name Type Description Default
n int The size of the matrix. required
dist str Distribution of individual matrix entries. 'normal'
pd bool Whether to ensure the generated matrix is positive-definite, clipping eigenvalues as necessary. False
ew Optional[np.ndarray] Desired eigenvalues of A. If not provided, generates random values in the range [-1, 1]. None
seed Union[int, np.random.Generator, None] seed for the random number generator. None

Returns

Name Type Description
np.ndarray A random symmetric matrix with the presribed eigenvalues.