# Path: py/dynesty/utils.py
# def unitcheck(u, nonbounded=None):
#     """Check whether `u` is inside the unit cube. Given a masked array
#     `nonbounded`, also allows periodic boundaries conditions to exceed
#     the unit cube."""
# 
#     if nonbounded is None:
#         # No periodic boundary conditions provided.
#         return np.min(u) > 0 and np.max(u) < 1
#     else:
#         # Alternating periodic and non-periodic boundary conditions.
#         unb = u[nonbounded]
#         # pylint: disable=invalid-unary-operand-type
#         ub = u[~nonbounded]
#         return (unb.min() > 0 and unb.max() < 1 and ub.min() > -0.5
#                 and ub.max() < 1.5)
# 
# def get_seed_sequence(rstate, nitems):
#     """
#     Return the list of seeds to initialize random generators
#     This is useful when distributing work across a pool
#     """
#     seeds = np.random.SeedSequence(rstate.integers(0, 2**63 - 1,
#                                                    size=4)).spawn(nitems)
#     return seeds
# 
# def get_random_generator(seed=None):
#     """
#     Return a random generator (using the seed provided if available)
#     """
#     return np.random.Generator(np.random.PCG64(seed))


import warnings
import math
import numpy as np
from numpy import linalg
from numpy import cov as mle_cov
from scipy import spatial
from scipy import cluster
from scipy import linalg as lalg
from scipy.special import logsumexp, gammaln
from .utils import unitcheck, get_seed_sequence, get_random_generator
from scipy.cluster.vq import kmeans2
__all__ = [
    "UnitCube", "Ellipsoid", "MultiEllipsoid", "RadFriends", "SupFriends",
    "logvol_prefactor", "randsphere", "bounding_ellipsoid",
    "bounding_ellipsoids", "_bounding_ellipsoids",
    "_ellipsoid_bootstrap_expand", "_friends_bootstrap_radius",
    "_friends_leaveoneout_radius"
]

SQRTEPS = math.sqrt(float(np.finfo(np.float64).eps))



class UnitCube:
    """
    An N-dimensional unit cube.

    Parameters
    ----------
    ndim : int
        The number of dimensions of the unit cube.

    """
    def __init__(self, ndim):
        self.n = ndim  # dimension
        self.vol = 1.  # volume
        self.funit = 1.  # overlap with the unit cube

    def contains(self, x):
        """Checks if unit cube contains the point `x`."""


# Path: py/dynesty/utils.py
# def unitcheck(u, nonbounded=None):
#     """Check whether `u` is inside the unit cube. Given a masked array
#     `nonbounded`, also allows periodic boundaries conditions to exceed
#     the unit cube."""
# 
#     if nonbounded is None:
#         # No periodic boundary conditions provided.
#         return np.min(u) > 0 and np.max(u) < 1
#     else:
#         # Alternating periodic and non-periodic boundary conditions.
#         unb = u[nonbounded]
#         # pylint: disable=invalid-unary-operand-type
#         ub = u[~nonbounded]
#         return (unb.min() > 0 and unb.max() < 1 and ub.min() > -0.5
#                 and ub.max() < 1.5)
# 
# def get_seed_sequence(rstate, nitems):
#     """
#     Return the list of seeds to initialize random generators
#     This is useful when distributing work across a pool
#     """
#     seeds = np.random.SeedSequence(rstate.integers(0, 2**63 - 1,
#                                                    size=4)).spawn(nitems)
#     return seeds
# 
# def get_random_generator(seed=None):
#     """
#     Return a random generator (using the seed provided if available)
#     """
#     return np.random.Generator(np.random.PCG64(seed))


# Path: py/dynesty/bounding.py
import warnings
import math
import numpy as np
from numpy import linalg
from numpy import cov as mle_cov
from scipy import spatial
from scipy import cluster
from scipy import linalg as lalg
from scipy.special import logsumexp, gammaln
from .utils import unitcheck, get_seed_sequence, get_random_generator
from scipy.cluster.vq import kmeans2

__all__ = [
    "UnitCube", "Ellipsoid", "MultiEllipsoid", "RadFriends", "SupFriends",
    "logvol_prefactor", "randsphere", "bounding_ellipsoid",
    "bounding_ellipsoids", "_bounding_ellipsoids",
    "_ellipsoid_bootstrap_expand", "_friends_bootstrap_radius",
    "_friends_leaveoneout_radius"
]

SQRTEPS = math.sqrt(float(np.finfo(np.float64).eps))



class UnitCube:
    """
    An N-dimensional unit cube.

    Parameters
    ----------
    ndim : int
        The number of dimensions of the unit cube.

    """
    def __init__(self, ndim):
        self.n = ndim  # dimension
        self.vol = 1.  # volume
        self.funit = 1.  # overlap with the unit cube

    def contains(self, x):
        """Checks if unit cube contains the point `x`."""


        return unitcheck(x)