# Path: soap/context/soap.py
# class SoapContext(_Context):
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         for c in _soap_classes:
#             c._repr = c.__repr__
# 
#     def precision_hook(self, value):
#         fp_format = {'single': 32, 'double': 64}.get(value, None)
#         if fp_format is not None:
#             value = gmpy2.ieee(fp_format).precision - 1
#         if isinstance(value, str):
#             value = int(value)
#         gmpy2.get_context().precision = value + 1
#         return value
# 
#     def repr_hook(self, value):
#         str_to_func = {'repr': _repr, 'str': _str}
#         value = str_to_func.get(value, value)
#         if value == _repr:
#             builtins.repr = _repr
#             for c in _soap_classes:
#                 c.__repr__ = c._repr
#         elif value == _str:
#             builtins.repr = str
#             for c in _soap_classes:
#                 c.__repr__ = c.__str__
#         else:
#             raise ValueError(
#                 'Attribute repr cannot accept value {}'.format(value))
#         return value
# 
#     def xmode_hook(self, value):
#         allowed = ['plain', 'verbose', 'context']
#         if value not in allowed:
#             raise ConfigError(
#                 'Config xmode must take values in {allowed}'
#                 .format(allowed=allowed))
#         _run_line_magic('xmode', value)
#         return value
# 
#     def autocall_hook(self, value):
#         value = bool(value)
#         _run_line_magic('autocall', str(int(value)))
#         return value


from soap.context.soap import SoapContext
    # debugging
    ipdb=False,
    # interactive shell
    autocall=True,
    xmode='context',
    # general
    repr=repr,
    multiprocessing=True,
    # platform
    device='Virtex7',
    frequency=333,
    port_count=2,
    # analysis related
    fast_outer=True,     # analyze only innermost loop for error
    fast_factor=0.05,    # accelerate error analysis by computing a fraction
                         # of iterations and extrapolate
    scalar_array=True,
    unroll_factor=0,     # steps before no unrolling in static analysis
    widen_factor=0,      # steps before widening in static analysis
    precision='single',
    norm='mse_error',    # function for computing multiple variable avg error
    ii_precision=5,      # how precise are IIs computed
    round_values=True,
    scheduler='alap',    # the scheduler used for sequential nodes
    # transform related
    rand_seed=42,
    sample_unique=True,
    reduce_limit=2000,
    size_limit=500,
    loop_size_limit=0,

# Path: soap/context/soap.py
# class SoapContext(_Context):
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
#         for c in _soap_classes:
#             c._repr = c.__repr__
# 
#     def precision_hook(self, value):
#         fp_format = {'single': 32, 'double': 64}.get(value, None)
#         if fp_format is not None:
#             value = gmpy2.ieee(fp_format).precision - 1
#         if isinstance(value, str):
#             value = int(value)
#         gmpy2.get_context().precision = value + 1
#         return value
# 
#     def repr_hook(self, value):
#         str_to_func = {'repr': _repr, 'str': _str}
#         value = str_to_func.get(value, value)
#         if value == _repr:
#             builtins.repr = _repr
#             for c in _soap_classes:
#                 c.__repr__ = c._repr
#         elif value == _str:
#             builtins.repr = str
#             for c in _soap_classes:
#                 c.__repr__ = c.__str__
#         else:
#             raise ValueError(
#                 'Attribute repr cannot accept value {}'.format(value))
#         return value
# 
#     def xmode_hook(self, value):
#         allowed = ['plain', 'verbose', 'context']
#         if value not in allowed:
#             raise ConfigError(
#                 'Config xmode must take values in {allowed}'
#                 .format(allowed=allowed))
#         _run_line_magic('xmode', value)
#         return value
# 
#     def autocall_hook(self, value):
#         value = bool(value)
#         _run_line_magic('autocall', str(int(value)))
#         return value


# Path: soap/context/default.py
from soap.context.soap import SoapContext

    # debugging
    ipdb=False,
    # interactive shell
    autocall=True,
    xmode='context',
    # general
    repr=repr,
    multiprocessing=True,
    # platform
    device='Virtex7',
    frequency=333,
    port_count=2,
    # analysis related
    fast_outer=True,     # analyze only innermost loop for error
    fast_factor=0.05,    # accelerate error analysis by computing a fraction
                         # of iterations and extrapolate
    scalar_array=True,
    unroll_factor=0,     # steps before no unrolling in static analysis
    widen_factor=0,      # steps before widening in static analysis
    precision='single',
    norm='mse_error',    # function for computing multiple variable avg error
    ii_precision=5,      # how precise are IIs computed
    round_values=True,
    scheduler='alap',    # the scheduler used for sequential nodes
    # transform related
    rand_seed=42,
    sample_unique=True,
    reduce_limit=2000,
    size_limit=500,
    loop_size_limit=0,

    algorithm='partition',