# Path: dppy/utils.py
# def check_random_state(seed: object) -> np.random.RandomState:
#     """Turn seed into a np.random.RandomState instance
#     Parameters
#     ----------
#     seed : None | int | instance of RandomState
#         If seed is None, return the RandomState singleton used by np.random.
#         If seed is an int, return a new RandomState instance seeded with seed.
#         If seed is already a RandomState instance, return it.
#         Otherwise raise ValueError.
# 
#     Returns
#     -------
#     np.random.RandomState
# 
#     .. seealso::
# 
#         `Scikit learn source code <https://github.com/scikit-learn/scikit-learn/blob/7813f7efb/sklearn/utils/validation.py#L763>`_
#     """
#     if seed is None or seed is np.random:
#         return np.random.mtrand._rand
#     if isinstance(seed, (int, np.integer)):
#         return np.random.RandomState(seed)
#     if isinstance(seed, np.random.RandomState):
#         return seed
#     raise ValueError('%r cannot be used to seed a numpy.random.RandomState'
#                      ' instance' % seed)


import numpy as np
import scipy.linalg as la
import scipy.sparse as sp
from dppy.utils import check_random_state
            A = rng.randn(N, N) + 1j * rng.randn(N, N)

        # elif beta==4:
        else:
            err_print = ('With `haar_mode="QR", `beta` = 1 or 2.',
                         'Given: {}'.format(beta))
            raise ValueError('\n'.join(err_print))

        # U, _ = la.qr(A)
        Q, R = la.qr(A)
        d = np.diagonal(R)
        U = np.multiply(Q, d / np.abs(d), Q)

    else:
        err_print = ('Invalid `haar_mode`.',
                     'Choose from `haar_mode="Hermite" or "QR".',
                     'Given: {}'.format(haar_mode))
        raise ValueError('\n'.join(err_print))

    return la.eigvals(U)


def mu_ref_unif_unit_circle_sampler_quindiag(beta=2, size=10,
                                             random_state=None):
    """
    .. see also::

        :cite:`KiNe04` Theorem 1
    """


# Path: dppy/utils.py
# def check_random_state(seed: object) -> np.random.RandomState:
#     """Turn seed into a np.random.RandomState instance
#     Parameters
#     ----------
#     seed : None | int | instance of RandomState
#         If seed is None, return the RandomState singleton used by np.random.
#         If seed is an int, return a new RandomState instance seeded with seed.
#         If seed is already a RandomState instance, return it.
#         Otherwise raise ValueError.
# 
#     Returns
#     -------
#     np.random.RandomState
# 
#     .. seealso::
# 
#         `Scikit learn source code <https://github.com/scikit-learn/scikit-learn/blob/7813f7efb/sklearn/utils/validation.py#L763>`_
#     """
#     if seed is None or seed is np.random:
#         return np.random.mtrand._rand
#     if isinstance(seed, (int, np.integer)):
#         return np.random.RandomState(seed)
#     if isinstance(seed, np.random.RandomState):
#         return seed
#     raise ValueError('%r cannot be used to seed a numpy.random.RandomState'
#                      ' instance' % seed)


# Path: dppy/random_matrices.py
import numpy as np
import scipy.linalg as la
import scipy.sparse as sp
from dppy.utils import check_random_state

            A = rng.randn(N, N) + 1j * rng.randn(N, N)

        # elif beta==4:
        else:
            err_print = ('With `haar_mode="QR", `beta` = 1 or 2.',
                         'Given: {}'.format(beta))
            raise ValueError('\n'.join(err_print))

        # U, _ = la.qr(A)
        Q, R = la.qr(A)
        d = np.diagonal(R)
        U = np.multiply(Q, d / np.abs(d), Q)

    else:
        err_print = ('Invalid `haar_mode`.',
                     'Choose from `haar_mode="Hermite" or "QR".',
                     'Given: {}'.format(haar_mode))
        raise ValueError('\n'.join(err_print))

    return la.eigvals(U)


def mu_ref_unif_unit_circle_sampler_quindiag(beta=2, size=10,
                                             random_state=None):
    """
    .. see also::

        :cite:`KiNe04` Theorem 1
    """


    rng = check_random_state(random_state)