Scales the array X such that it contains only integers.

def _scale_to_int(X, max_val=None):
    """
    Scales the array X such that it contains only integers.
    """

    if max_val is None:
        X = X / _gcd_array(X)
    else:
        X = X / max(1 / max_val, _gcd_array(X))
    return [int(entry) for entry in X]