riecovest.random_matrices.random_covariance

riecovest.random_matrices.random_covariance(dim, rank, complex_data=False, rng=None)

Samples a random covariance matrix with given rank.

Uses a heuristic method to generate the matrix, giving little control over the exact properties of the matrix.

Parameters:
  • dim (int) – Dimension of the covariance matrix.

  • rank (int or 'full') – Rank of the covariance matrix. If ‘full’, the matrix is full rank.

  • complex_data (bool) – Whether the data is complex or real.

  • rng (numpy.random.Generator) – Random number generator.

Returns:

cov – Random covariance matrix.

Return type:

ndarray of shape (dim, dim)