def CL_scaling_vector(x, g, lb, ub):
    v = np.ones_like(x)
    dv = np.zeros_like(x)

    mask = (g < 0) & np.isfinite(ub)
    v[mask] = ub[mask] - x[mask]
    dv[mask] = -1

    mask = (g > 0) & np.isfinite(lb)
    v[mask] = x[mask] - lb[mask]
    dv[mask] = 1

    return v, dv
Compute Coleman-Li scaling vector and its derivatives.
dataset/ETHPy150Open scipy/scipy/scipy/optimize/_lsq/common.py/CL_scaling_vector