<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 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]