Skip to content

Commit

Permalink
add document by cody AI
Browse files Browse the repository at this point in the history
  • Loading branch information
luk036 committed Dec 27, 2023
1 parent a00f1e5 commit 0490e42
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 29 deletions.
41 changes: 24 additions & 17 deletions src/ellalgo/ell_calc_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ class EllCalcCore:
_cst3: float

def __init__(self, n_f: float) -> None:
"""
The function initializes several variables based on the input value.
"""Initialize EllCalcCore instance.
:param n_f: The parameter `n_f` represents a floating point value. It is used to
initialize the `EllCalcCore` object
The __init__ method initializes the EllCalcCore object with the provided
n_f parameter. This sets up internal variables used in calculations.
:param n_f: Float value to initialize the instance with.
:type n_f: float
Examples:
Expand Down Expand Up @@ -54,13 +54,15 @@ def __init__(self, n_f: float) -> None:
self._cst3 = self._n_f * self._cst0

def calc_central_cut(self, tau: float) -> Tuple[float, float, float]:
r"""Calculate Central Cut
The `calc_central_cut` function calculates the central cut values based on the given input.
:param tau: tau is a float representing the value of tau
r"""Calculate the central cut values.
The `calc_central_cut` method calculates the central cut values ρ, σ, δ
based on the input tau value.
:param tau: The tau value
:type tau: float
:return: The function `calc_central_cut` returns a tuple containing the following elements:
:return: Tuple of (ρ, σ, δ)
:rtype: Tuple[float, float, float]
.. svgbob::
:align: center
Expand Down Expand Up @@ -105,9 +107,14 @@ def calc_central_cut(self, tau: float) -> Tuple[float, float, float]:
def calc_deep_cut_fast(
self, beta: float, tau: float, eta: float
) -> Tuple[float, float, float]:
r"""Calculate Deep Cut fast
The `calc_deep_cut_fast` function calculates the deep cut values based on the given input.
r"""Calculates the deep cut ellipsoid parameters using precomputed eta values.
Given the beta, tau, and eta values, this method calculates the
deep cut ellipsoid parameters rho, sigma, and delta using a precomputed eta value.
that avoids explicitly calculating the intermediate eta value.
This allows the deep cut to be computed faster.
The rho, sigma, and delta values define the deep cut ellipsoid.
:param beta: beta is a float representing the value of beta
:type beta: float
Expand Down Expand Up @@ -159,10 +166,10 @@ def calc_deep_cut_fast(
return (rho, sigma, delta)

def calc_deep_cut(self, beta: float, tau: float) -> Tuple[float, float, float]:
r"""Calculate Deep Cut
The `calc_deep_cut` function calculates the deep cut values based on the given input.
r"""Calculate deep cut values.
Calculates the deep cut values ρ, σ, δ for given β and τ.
:param beta: beta is a float representing the value of beta
:type beta: float
:param tau: tau is a float representing the value of tau
Expand Down
24 changes: 12 additions & 12 deletions src/ellalgo/ell_config.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
from enum import Enum


# The above class defines an enumeration for different cut statuses.
# The CutStatus enum defines a set of constant values that represent different statuses that can result from a cut operation. A cut is likely some optimization operation that partitions or divides a problem into smaller pieces.
#
# This enum has four possible values:
#
# Success - Indicates the cut operation succeeded
# NoSoln - Indicates the cut did not yield a valid solution
# NoEffect - The cut had no effect on improving the optimization
# Unknown - The status is unknown or unclear
class CutStatus(Enum):
Success = 0
NoSoln = 1
Expand All @@ -20,18 +27,11 @@ class Options:
# the number of iterations it took.
class CInfo:
def __init__(self, feasible: bool, num_iters: int) -> None:
"""
The function initializes a new CInfo object with the given feasibility and number of iterations.
:param feasible: A boolean value indicating whether the solution is feasible or not
:type feasible: bool
:param num_iters: The `num_iters` parameter represents the number of iterations or steps taken
in a process or algorithm. It is an integer value that indicates how many times a certain
operation or calculation has been performed
"""Initializes a CInfo object.
:type num_iters: int
Args:
feasible (bool): Whether the solution is feasible.
num_iters (int): Number of iterations performed.
"""
self.feasible: bool = feasible
self.num_iters: int = num_iters

0 comments on commit 0490e42

Please sign in to comment.