# Path: soap/analysis/core.py
# class Analysis(object):
# 
#     def __init__(
#             self, expr_set, state, out_vars=None, recurrences=None,
#             size_limit=None, round_values=None, multiprocessing=None):
#         """Analysis class initialisation.
# 
#         :param expr_set: A set of expressions or a single expression.
#         :type expr_set: `set` or :class:`soap.expression.Expression`
#         :param state: The ranges of input variables.
#         :type state: dictionary containing mappings from variables to
#             :class:`soap.semantics.error.Interval`
#         """
#         super().__init__()
#         self.expr_set = expr_set
#         self.state = state
#         self.out_vars = out_vars
#         self.recurrences = recurrences
#         self.size_limit = size_limit or context.size_limit
#         self.round_values = round_values
#         if multiprocessing is not None:
#             self.multiprocessing = multiprocessing
#         else:
#             self.multiprocessing = context.multiprocessing
#         self._results = None
# 
#     def analyze(self):
#         """Analyzes the set of expressions with input ranges and precisions
#         provided in initialisation.
# 
#         :returns: a list of dictionaries each containing results and the
#             expression.
#         """
#         results = self._results
#         if results:
#             return results
# 
#         expr_set = self.expr_set
#         state = self.state
#         out_vars = self.out_vars
#         recurrences = self.recurrences
#         round_values = self.round_values
# 
#         size = len(expr_set)
#         limit = self.size_limit
#         if limit >= 0 and size > limit:
#             logger.debug(
#                 'Number of equivalent structures over limit {} > {}, '
#                 'reduces population size by sampling.'.format(size, limit))
#             random.seed(context.rand_seed)
#             expr_set = random.sample(expr_set, limit)
#         size = len(expr_set)
# 
#         if self.multiprocessing:
#             map = pool.map
#         else:
#             map = lambda func, args_list: (func(args) for args in args_list)
#         args_list = [
#             (expr, state, out_vars, recurrences, round_values)
#             for expr in expr_set]
# 
#         try:
#             results = set()
#             for i, result in enumerate(map(_analyze_expression, args_list)):
#                 logger.persistent('Analysing', '{}/{}'.format(i, size))
#                 results.add(result)
#         except KeyboardInterrupt:
#             logger.warning(
#                 'Analysis interrupted, completed: {}.'.format(len(results)))
#         logger.unpersistent('Analysing')
# 
#         self._results = results
#         return results
# 
#     def frontier(self):
#         """Computes the Pareto frontier from analyzed results."""
#         return sample_unique(pareto_frontier(self.analyze()))
# 
#     def thick_frontier(self):
#         return thick_frontier(self.analyze())


from soap.analysis.core import Analysis
    return Analysis(expr_set, state, out_vars, **kwargs).analyze()


def frontier(expr_set, state, out_vars=None, **kwargs):
    """Provides the Pareto frontier of the area and error analysis of
    expressions with input ranges and precisions.

    :param expr_set: A set of expressions.
    :type expr_set: set or list
    :param state: The ranges of input variables.
    :type state: dictionary containing mappings from variables to
        :class:`soap.semantics.error.Interval`
    :param out_vars: The output variables of the metastate
    :type out_vars: :class:`collections.Sequence`
    """
    return Analysis(expr_set, state, out_vars, **kwargs).frontier()


def thick_frontier(expr_set, state, out_vars=None, **kwargs):
    """Provides the thick Pareto frontier of the area and error analysis of
    expressions with input ranges and precisions.

    :param expr_set: A set of expressions.
    :type expr_set: set or list
    :param state: The ranges of input variables.
    :type state: dictionary containing mappings from variables to
        :class:`soap.semantics.error.Interval`
    :param out_vars: The output variables of the metastate
    :type out_vars: :class:`collections.Sequence`
    """

# Path: soap/analysis/core.py
# class Analysis(object):
# 
#     def __init__(
#             self, expr_set, state, out_vars=None, recurrences=None,
#             size_limit=None, round_values=None, multiprocessing=None):
#         """Analysis class initialisation.
# 
#         :param expr_set: A set of expressions or a single expression.
#         :type expr_set: `set` or :class:`soap.expression.Expression`
#         :param state: The ranges of input variables.
#         :type state: dictionary containing mappings from variables to
#             :class:`soap.semantics.error.Interval`
#         """
#         super().__init__()
#         self.expr_set = expr_set
#         self.state = state
#         self.out_vars = out_vars
#         self.recurrences = recurrences
#         self.size_limit = size_limit or context.size_limit
#         self.round_values = round_values
#         if multiprocessing is not None:
#             self.multiprocessing = multiprocessing
#         else:
#             self.multiprocessing = context.multiprocessing
#         self._results = None
# 
#     def analyze(self):
#         """Analyzes the set of expressions with input ranges and precisions
#         provided in initialisation.
# 
#         :returns: a list of dictionaries each containing results and the
#             expression.
#         """
#         results = self._results
#         if results:
#             return results
# 
#         expr_set = self.expr_set
#         state = self.state
#         out_vars = self.out_vars
#         recurrences = self.recurrences
#         round_values = self.round_values
# 
#         size = len(expr_set)
#         limit = self.size_limit
#         if limit >= 0 and size > limit:
#             logger.debug(
#                 'Number of equivalent structures over limit {} > {}, '
#                 'reduces population size by sampling.'.format(size, limit))
#             random.seed(context.rand_seed)
#             expr_set = random.sample(expr_set, limit)
#         size = len(expr_set)
# 
#         if self.multiprocessing:
#             map = pool.map
#         else:
#             map = lambda func, args_list: (func(args) for args in args_list)
#         args_list = [
#             (expr, state, out_vars, recurrences, round_values)
#             for expr in expr_set]
# 
#         try:
#             results = set()
#             for i, result in enumerate(map(_analyze_expression, args_list)):
#                 logger.persistent('Analysing', '{}/{}'.format(i, size))
#                 results.add(result)
#         except KeyboardInterrupt:
#             logger.warning(
#                 'Analysis interrupted, completed: {}.'.format(len(results)))
#         logger.unpersistent('Analysing')
# 
#         self._results = results
#         return results
# 
#     def frontier(self):
#         """Computes the Pareto frontier from analyzed results."""
#         return sample_unique(pareto_frontier(self.analyze()))
# 
#     def thick_frontier(self):
#         return thick_frontier(self.analyze())


# Path: soap/analysis/utils.py
from soap.analysis.core import Analysis

    return Analysis(expr_set, state, out_vars, **kwargs).analyze()


def frontier(expr_set, state, out_vars=None, **kwargs):
    """Provides the Pareto frontier of the area and error analysis of
    expressions with input ranges and precisions.

    :param expr_set: A set of expressions.
    :type expr_set: set or list
    :param state: The ranges of input variables.
    :type state: dictionary containing mappings from variables to
        :class:`soap.semantics.error.Interval`
    :param out_vars: The output variables of the metastate
    :type out_vars: :class:`collections.Sequence`
    """
    return Analysis(expr_set, state, out_vars, **kwargs).frontier()


def thick_frontier(expr_set, state, out_vars=None, **kwargs):
    """Provides the thick Pareto frontier of the area and error analysis of
    expressions with input ranges and precisions.

    :param expr_set: A set of expressions.
    :type expr_set: set or list
    :param state: The ranges of input variables.
    :type state: dictionary containing mappings from variables to
        :class:`soap.semantics.error.Interval`
    :param out_vars: The output variables of the metastate
    :type out_vars: :class:`collections.Sequence`
    """

    return Analysis(expr_set, state, out_vars, **kwargs).thick_frontier()