ell_algo package

Submodules

ell_algo.ell_calc module

This module contains the EllCalc class.

class ell_algo.ell_calc.EllCalc(ndim: int)[source]

Bases: object

The EllCalc class is used for calculating ellipsoid parameters and has attributes for storing constants and configuration options.

Examples

>>> calc = EllCalc(3)
calc_deep_cut(beta: float, tsq: float) Tuple[CutStatus, Tuple[float, float, float] | None][source]

Deep Cut

The function calculates the deep cut based on the given beta and tsq values.

Parameters:
  • beta (float) – The parameter beta represents a float value

  • tsq (float) – tsq is the square of the value of tau

Returns:

The function calc_deep_cut returns a tuple of four values: CutStatus, float, float, float.

Examples

>>> calc = EllCalc(3)
>>> calc.calc_deep_cut(1.0, 4.0)
(<CutStatus.Success: 0>, (1.25, 0.8333333333333334, 0.84375))
>>> calc.calc_deep_cut(0.0, 4.0)
(<CutStatus.Success: 0>, (0.5, 0.5, 1.125))
>>> calc.calc_deep_cut(1.5, 2.0)
(<CutStatus.NoSoln: 1>, None)
calc_deep_cut_q(beta: float, tsq: float) Tuple[CutStatus, Tuple[float, float, float] | None][source]

Deep Cut (discrete)

The function calc_deep_cut_q calculates the deep cut for a given beta and tsq value.

Parameters:
  • beta (float) – The parameter beta represents a float value

  • tsq – tsq is the square of the threshold value. It is a float value that represents the

threshold squared :type tsq: float :return: The function calc_deep_cut_q returns a tuple of four values: CutStatus, float, float, float.

Examples

>>> from ell_algo.ell_calc import EllCalc
>>> calc = EllCalc(3)
>>> calc.calc_deep_cut_q(0.0, 4.0)
(<CutStatus.Success: 0>, (0.5, 0.5, 1.125))
>>> calc.calc_deep_cut_q(1.5, 2.0)
(<CutStatus.NoSoln: 1>, None)
>>> calc.calc_deep_cut_q(-1.5, 4.0)
(<CutStatus.NoEffect: 2>, None)
calc_parallel_central_cut(beta1: float, tsq: float) Tuple[CutStatus, Tuple[float, float, float] | None][source]

Parallel central cut

The function calc_parallel_central_cut calculates the parallel central cut for given values of beta1 and tsq.

Parameters:

beta1 – The parameter beta1 represents a float value. It is used in the calculation of the

central cut :type beta1: float :param tsq: The parameter tsq represents the square of a value :type tsq: float :return: The function calc_parallel_central_cut returns a tuple of four values: CutStatus, float, float, float.

Examples

>>> calc = EllCalc(4)
>>> calc.calc_parallel_central_cut(0.11, 0.01)
(<CutStatus.Success: 0>, (0.020000000000000004, 0.4, 1.0666666666666667))
>>> calc.calc_parallel_central_cut(-1.0, 0.01)
(<CutStatus.NoSoln: 1>, None)
calc_parallel_deep_cut(beta0: float, beta1: float, tsq: float) Tuple[CutStatus, Tuple[float, float, float] | None][source]

parallel deep cut

The function calc_parallel_deep_cut calculates the parallel deep cut based on the given parameters.

Parameters:
  • beta0 (float) – The parameter beta0 represents a float value

  • beta1 (float) – The parameter beta1 represents a float value

  • tsq (float) – tsq is a float representing the value of tsq

Returns:

The function calc_parallel returns a tuple of type Tuple[CutStatus, Optional[Tuple[float, float, float]]].

calc_parallel_deep_cut_q(beta0: float, beta1: float, tsq: float) Tuple[CutStatus, Tuple[float, float, float] | None][source]

Parallel deep cut (discrete)

The function calc_parallel_deep_cut_q calculates the parallel deep cut for a given set of parameters.

Parameters:
  • beta0 (float) – The parameter beta0 represents a float value

  • beta1 (float) – The parameter beta1 represents a float value

  • tsq (float) – tsq is a float value that represents the square of a variable

Returns:

The function calc_parallel_deep_cut_q returns a tuple of type `Tuple[CutStatus, float, float,

float]`.

calc_single_or_parallel_central_cut(beta, tsq: float) Tuple[CutStatus, Tuple[float, float, float] | None][source]

single or parallel central cut

The function calc_single_or_parallel_central_cut calculates either a single or parallel central cut based on the input parameters.

Parameters:

beta – The parameter beta is of type _type_ and represents some value. The specific

details of its purpose and usage are not provided in the code snippet :param tsq: tsq is a float value representing the squared t-value :type tsq: float :return: a tuple containing the following elements: 1. CutStatus: The status of the cut calculation. 2. float: The calculated value. 3. float: The calculated value. 4. float: The calculated value.

Examples

>>> calc = EllCalc(4)
>>> calc.calc_single_or_parallel_central_cut([0, 0.11], 0.01)
(<CutStatus.Success: 0>, (0.020000000000000004, 0.4, 1.0666666666666667))
>>> calc.calc_single_or_parallel_central_cut([0, -1], 0.01)
(<CutStatus.NoSoln: 1>, None)
calc_single_or_parallel_deep_cut(beta, tsq: float) Tuple[CutStatus, Tuple[float, float, float] | None][source]

Calculate single or parallel deep cut

The calc_single_or_parallel_deep_cut function calculates either a single or parallel deep cut based on the input parameters.

Parameters:
  • beta – The parameter beta can be of type int, float, or a list of two elements

  • tsq – The tsq parameter is a floating-point number that represents the square of the

tolerance for the ellipsoid algorithm. It is used in the calculations performed by the calc_single_or_parallel_deep_cut method. :type tsq: float :return: The function calc_single_or_parallel_deep_cut returns a tuple containing the following elements:

Examples

>>> calc = EllCalc(3)
calc_single_or_parallel_deep_cut_q(beta, tsq: float) Tuple[CutStatus, Tuple[float, float, float] | None][source]

single deep cut or parallel cut (discrete)

The function calc_single_or_parallel_deep_cut_q calculates the deep cut or parallel cut based on the input parameters beta and tsq.

Parameters:

beta – The parameter beta can be either a single value (int or float) or a list of two

values :param tsq: tsq is a float value representing the square of the threshold value :type tsq: float :return: The function calc_single_or_parallel_deep_cut_q returns a tuple containing four elements: CutStatus, float, float, and float.

use_parallel_cut: bool = True

ell_algo.ell_calc_core module

This module contains the EllCalcCore class.

class ell_algo.ell_calc_core.EllCalcCore(n_f: float)[source]

Bases: object

The EllCalcCore class is used for calculating ellipsoid parameters.

Examples

>>> calc = EllCalcCore(3)
calc_central_cut(tau: float) Tuple[float, float, float][source]

Calculate Central Cut

The calc_central_cut function calculates the central cut values based on the given input.

Parameters:

tau (float) – tau is a float representing the value of tau

Returns:

The function calc_central_cut returns a tuple containing the following elements:

Examples

>>> calc = EllCalcCore(3)
>>> calc.calc_central_cut(4.0)
(1.0, 0.5, 1.125)
calc_deep_cut(beta: float, tau: float) Tuple[float, float, float][source]

Calculate Deep Cut

The calc_deep_cut function calculates the deep cut values based on the given input.

Parameters:
  • beta (float) – beta is a float representing the value of beta

  • tau (float) – tau is a float representing the value of tau

Returns:

The function calc_deep_cut returns a tuple containing the following elements:

Examples

>>> calc = EllCalcCore(3)
>>> calc.calc_deep_cut(1.0, 2.0)
(1.25, 0.8333333333333334, 0.84375)
>>> calc.calc_deep_cut(0.0, 2.0)
(0.5, 0.5, 1.125)
calc_parallel_central_cut(beta1: float, tsq: float) Tuple[float, float, float][source]

Calculate Parallel Central Cut

The function calc_parallel_central_cut calculates the parallel central cut for given values of beta1 and tsq.

Parameters:

beta1 – The parameter beta1 represents a float value. It is used in the calculation of the

central cut :type beta1: float :param tsq: The parameter tsq represents the square of a value :type tsq: float :return: The function calc_parallel_central_cut returns a tuple of four values: CutStatus, float, float, float.

Examples

>>> calc = EllCalcCore(4)
>>> calc.calc_parallel_central_cut(0.11, 0.01)
(0.01897790039191521, 0.3450527343984584, 1.0549907942519101)
calc_parallel_central_cut_old(beta1: float, tsq: float) Tuple[float, float, float][source]

Calculate Parallel Central Cut

The function calc_parallel_central_cut calculates the parallel central cut for given values of beta1 and tsq.

Parameters:

beta1 – The parameter beta1 represents a float value. It is used in the calculation of the

central cut :type beta1: float :param tsq: The parameter tsq represents the square of a value :type tsq: float :return: The function calc_parallel_central_cut returns a tuple of four values: CutStatus, float, float, float.

Examples

>>> calc = EllCalcCore(4)
>>> calc.calc_parallel_central_cut_old(0.11, 0.01)
(0.018977900391915218, 0.3450527343984585, 1.0549907942519101)
calc_parallel_deep_cut(beta0: float, beta1: float, tsq: float) Tuple[float, float, float][source]

Calculation Parallel Deep Cut

The calc_parallel_deep_cut function calculates various values based on the input parameters and returns them as a tuple.

Parameters:
  • beta0 (float) – The parameter beta0 represents a float value

  • beta1 (float) – The parameter beta1 represents a float value

  • tsq (float) – tsq is a float representing the square of the value t

Returns:

a tuple with three elements.

Examples

>>> calc = EllCalcCore(4)
>>> calc.calc_parallel_deep_cut(0.11, 0.01, 0.01)
(0.027228509068282114, 0.45380848447136857, 1.0443438549074862)
>>> calc.calc_parallel_deep_cut(-0.25, 0.25, 1.0)
(0.0, 0.8, 1.25)
calc_parallel_deep_cut_old(beta0: float, beta1: float, tsq: float) Tuple[float, float, float][source]

Calculation Parallel Deep Cut

The calc_parallel_deep_cut function calculates various values based on the input parameters and returns them as a tuple.

Parameters:
  • beta0 (float) – The parameter beta0 represents a float value

  • beta1 (float) – The parameter beta1 represents a float value

  • tsq (float) – tsq is a float representing the square of the value t

Returns:

a tuple with three elements.

Examples

>>> calc = EllCalcCore(4)
>>> calc.calc_parallel_deep_cut_old(0.11, 0.01, 0.01)
(0.02722850906828212, 0.4538084844713687, 1.0443438549074862)

ell_algo.ell_config module

class ell_algo.ell_config.CInfo(feasible: bool, num_iters: int)[source]

Bases: object

class ell_algo.ell_config.CutStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

NoEffect = 2
NoSoln = 1
Success = 0
Unknown = 3
class ell_algo.ell_config.Options[source]

Bases: object

max_iters: int = 2000
tol: float = 1e-08

ell_algo.skeleton module

This is a skeleton file that can serve as a starting point for a Python console script. To run this script uncomment the following lines in the [options.entry_points] section in setup.cfg:

console_scripts =
     fibonacci = ell_algo.skeleton:run

Then run pip install . (or pip install -e . for editable mode) which will install the command fibonacci inside your current environment.

Besides console scripts, the header (i.e. until _logger…) of this file can also be used as template for Python modules.

Note

This file can be renamed depending on your needs or safely removed if not needed.

References

ell_algo.skeleton.fib(n)[source]

Fibonacci example function

Parameters:

n (int) – integer

Returns:

n-th Fibonacci number

Return type:

int

ell_algo.skeleton.main(args)[source]

Wrapper allowing fib() to be called with string arguments in a CLI fashion

Instead of returning the value from fib(), it prints the result to the stdout in a nicely formatted message.

Parameters:

args (List[str]) – command line parameters as list of strings (for example ["--verbose", "42"]).

ell_algo.skeleton.parse_args(args)[source]

Parse command line parameters

Parameters:

args (List[str]) – command line parameters as list of strings (for example ["--help"]).

Returns:

command line parameters namespace

Return type:

argparse.Namespace

ell_algo.skeleton.run()[source]

Calls main() passing the CLI arguments extracted from sys.argv

This function can be used as entry point to create console scripts with setuptools.

ell_algo.skeleton.setup_logging(loglevel)[source]

Setup basic logging

Parameters:

loglevel (int) – minimum loglevel for emitting messages

Module contents