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)

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 .