def find_intersection(x, tr_bounds, lb, ub):
 lb_centered = (lb - x)
 ub_centered = (ub - x)
 lb_total = np.maximum(lb_centered, (- tr_bounds))
 ub_total = np.minimum(ub_centered, tr_bounds)
 orig_l = np.equal(lb_total, lb_centered)
 orig_u = np.equal(ub_total, ub_centered)
 tr_l = np.equal(lb_total, (- tr_bounds))
 tr_u = np.equal(ub_total, tr_bounds)
 return (lb_total, ub_total, orig_l, orig_u, tr_l, tr_u)

def find_intersection ( x , tr_bounds , lb , ub ) : lb_centered = ( lb - x ) ub_centered = ( ub - x ) lb_total = np . maximum ( lb_centered , ( - tr_bounds ) ) ub_total = np . minimum ( ub_centered , tr_bounds ) orig_l = np . equal ( lb_total , lb_centered ) orig_u = np . equal ( ub_total , ub_centered ) tr_l = np . equal ( lb_total , ( - tr_bounds ) ) tr_u = np . equal ( ub_total , tr_bounds ) return ( lb_total , ub_total , orig_l , orig_u , tr_l , tr_u )
find intersection of trust-region bounds and initial bounds .