# Path: dppy/utils.py
# def det_ST(array, S, T=None):
#     """ Compute :math:`\\det M_{S, T} = \\det [M_{ij}]_{i\\inS, j\\in T}`
# 
#     :param array:
#         Matrix
#     :type M:
#         array_like
# 
#     :param S:
#         collection of indices
#     :type M:
#         1D list, array_like
# 
#     :param T:
#         collection of indices
#     :type M:
#         1D list, array_like, default None
# 
#     :return:
#         - if `T is None` return :math:`\\det M_{S, S}`
#         - else return :math:`\\det M_{S, T}`. If S=T=[], numpy convention = 1.0
#     :rtype:
#         float
#     """
# 
#     if T is None:  # det M_SS = det M_S
#         return det(array[np.ix_(S, S)])
# 
#     else:  # det M_ST, numpy deals with det M_[][] = 1.0
#         return det(array[np.ix_(S, T)])
# 
# 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 time
import numpy as np
import scipy.linalg as la
from dppy.utils import det_ST, check_random_state
        from cvxopt import matrix, spmatrix, solvers

- `add_exchange_delete_sampler`
- `add_delete_sampler`
- `basis_exchange_sampler`
- `zonotope_sampler`

.. seealso:

    `Documentation on ReadTheDocs <https://dppy.readthedocs.io/en/latest/finite_dpps/mcmc_sampling.html>`_
"""




############################################
# Approximate samplers for projection DPPs #
############################################
def dpp_sampler_mcmc(kernel, mode='AED', **params):
    """ Interface function with initializations and samplers for MCMC schemes.

    .. seealso::

        - :ref:`finite_dpps_mcmc_sampling_add_exchange_delete`
        - :func:`add_exchange_delete_sampler <add_exchange_delete_sampler>`
        - :func:`initialize_AED_sampler <initialize_AED_sampler>`
        - :func:`add_delete_sampler <add_delete_sampler>`
        - :func:`basis_exchange_sampler <basis_exchange_sampler>`
        - :func:`initialize_AD_and_E_sampler <initialize_AD_and_E_sampler>`
    """


# Path: dppy/utils.py
# def det_ST(array, S, T=None):
#     """ Compute :math:`\\det M_{S, T} = \\det [M_{ij}]_{i\\inS, j\\in T}`
# 
#     :param array:
#         Matrix
#     :type M:
#         array_like
# 
#     :param S:
#         collection of indices
#     :type M:
#         1D list, array_like
# 
#     :param T:
#         collection of indices
#     :type M:
#         1D list, array_like, default None
# 
#     :return:
#         - if `T is None` return :math:`\\det M_{S, S}`
#         - else return :math:`\\det M_{S, T}`. If S=T=[], numpy convention = 1.0
#     :rtype:
#         float
#     """
# 
#     if T is None:  # det M_SS = det M_S
#         return det(array[np.ix_(S, S)])
# 
#     else:  # det M_ST, numpy deals with det M_[][] = 1.0
#         return det(array[np.ix_(S, T)])
# 
# 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/mcmc_sampling.py
import time
import numpy as np
import scipy.linalg as la
from dppy.utils import det_ST, check_random_state
        from cvxopt import matrix, spmatrix, solvers


- `add_exchange_delete_sampler`
- `add_delete_sampler`
- `basis_exchange_sampler`
- `zonotope_sampler`

.. seealso:

    `Documentation on ReadTheDocs <https://dppy.readthedocs.io/en/latest/finite_dpps/mcmc_sampling.html>`_
"""




############################################
# Approximate samplers for projection DPPs #
############################################
def dpp_sampler_mcmc(kernel, mode='AED', **params):
    """ Interface function with initializations and samplers for MCMC schemes.

    .. seealso::

        - :ref:`finite_dpps_mcmc_sampling_add_exchange_delete`
        - :func:`add_exchange_delete_sampler <add_exchange_delete_sampler>`
        - :func:`initialize_AED_sampler <initialize_AED_sampler>`
        - :func:`add_delete_sampler <add_delete_sampler>`
        - :func:`basis_exchange_sampler <basis_exchange_sampler>`
        - :func:`initialize_AD_and_E_sampler <initialize_AD_and_E_sampler>`
    """


    rng = check_random_state(params.get('random_state', None))