lose/utils/algorithms/distances.py
def log_distance(x, y, func=None, k=None):
    """Calculates the distance between x and y using the octagonal
    formula.

    This wraps a distance function with a log output.  If no distance
    function is provided, then euclidean is used.

    Args:
        x (point): a point in space
        y (point): a point in space
        func (callback):  returning the log of a distance
        k (numeric): a factor  [default: 1.2]

    Returns:
        int:  the distance calculated between point x and point y
    """
    if k is None:
        k = 1.2
    if func is None:
        func = octagonal_distance
    distance = func(x, y)
    if distance == 0:
        distance = 1 / 10**10
    logged_distance = 6 * math.log(distance)
    return logged_distance
Calculates the distance between x and y using the octagonal
    formula.

    This wraps a distance function with a log output.  If no distance
    function is provided, then euclidean is used.

    Args:
        x (point): a point in space
        y (point): a point in space
        func (callback):  returning the log of a distance
        k (numeric): a factor  [default: 1.2]

    Returns:
        int:  the distance calculated between point x and point y
    
Calculates the distance between x and y using the octagonal
formula.

This wraps a distance function with a log output.  If no distance
function is provided, then euclidean is used.
Calculates the distance between x and y using the octagonal formula . This wraps a distance function with a log output . If no distance function is provided then euclidean is used .
def log_distance(x, y, func=None, k=None):
    if k is None:
        k = 1.2
    if func is None:
        func = octagonal_distance
    distance = func(x, y)
    if distance == 0:
        distance = 1 / 10**10
    logged_distance = 6 * math.log(distance)
    return logged_distance
def log_distance ( x , y , func = None , k = None ) : if k is None : k = 1.2 if func is None : func = octagonal_distance distance = func ( x , y ) if distance == 0 : distance = 1 / 10 ** 10 logged_distance = 6 * math . log ( distance ) return logged_distance
Calculates the distance between x and y using the octagonal
formula.
Calculates the distance between x and y using the octagonal formula .
"""Calculates the distance between x and y using the octagonal
    formula.

    This wraps a distance function with a log output.  If no distance
    function is provided, then euclidean is used.

    Args:
        x (point): a point in space
        y (point): a point in space
        func (callback):  returning the log of a distance
        k (numeric): a factor  [default: 1.2]

    Returns:
        int:  the distance calculated between point x and point y
    """
the distance calculated between point x and point y
the distance calculated between point x and point y
int
x
a point in space
a point in space
y
a point in space
a point in space
func
returning the log of a distance
returning the log of a distance
k
a factor  [default: 1.2]
a factor [ default : 1 . 2 ]