pyriemann.datasets.make_matrices

pyriemann.datasets.make_matrices(n_matrices, n_dim, kind, rs=None, return_params=False, evals_low=0.5, evals_high=2.0, eigvecs_same=False, eigvecs_mean=0.0, eigvecs_std=1.0)[source]

Generate matrices with specific properties.

Parameters:
n_matricesint

Number of matrices to generate.

n_dimint | list of int

If int, dimension of square matrices to generate. If list, dimensions of “real” or “comp” matrices to generate.

kind{“real”, “comp”, “inv”, “orth, “sym”, “spd”, “spsd”, “cinv”, “unit”, “herm”, “hpd”, “hpsd”}

Kind of matrices to generate:

  • “real” for real-valued matrices;

  • “comp” for complex-valued matrices.

Kind of square matrices to generate:

  • “inv” for invertible real-valued matrices;

  • “orth” for orthogonal matrices;

  • “sym” for symmetric real-valued matrices;

  • “spd” for symmetric positive-definite matrices;

  • “spsd” for symmetric positive semi-definite matrices;

  • “cinv” for invertible complex-valued matrices;

  • “unit” for unitary matrices;

  • “herm” for Hermitian matrices;

  • “hpd” for Hermitian positive-definite matrices;

  • “hpsd” for Hermitian positive semi-definite matrices.

rsint | RandomState instance | None, default=None

Random state for reproducible output across multiple function calls.

return_paramsbool, default=False

If True, returns evals and evecs for “spd”, “spsd”, “hpd” and “hpsd”.

evals_lowfloat, default=0.5

Lowest value of the uniform distribution to draw eigen values.

evals_highfloat, default=2.0

Highest value of the uniform distribution to draw eigen values.

eigvecs_samebool, default=False

If True, uses the same eigen vectors for all matrices.

eigvecs_meanfloat, default=0.0

Mean of the normal distribution to draw eigen vectors.

Added in version 0.8.

eigvecs_stdfloat, default=1.0

Standard deviation of the normal distribution to draw eigen vectors.

Added in version 0.8.

Returns:
matsndarray, shape (n_matrices, n_dim, n_dim) or (n_matrices, *n_dim)

Set of generated matrices.

evalsndarray, shape (n_matrices, n_dim)

Eigen values used for “spd”, “spsd”, “hpd” and “hpsd”. Only returned if return_params=True.

evecsndarray, shape (n_matrices, n_dim, n_dim) or (n_dim, n_dim)

Eigen vectors used for “spd”, “spsd”, “hpd” and “hpsd”. Only returned if return_params=True.

Notes

Added in version 0.5.

Changed in version 0.8: Add support for kinds “sym” and “herm”.

Changed in version 0.10: Add support for non-square matrices, and for kinds “inv” and “cinv”, “orth”, and “unit”.