def penalty_ls()

in code/figure_1/penalties.py [0:0]


def penalty_ls(x1, y1, x2, y2, t=1, reg=.1):
    phi = np.diag([1, t])
    w = np.array([1, 0]).reshape(1, 2)
    p1 = np.linalg.norm(ls(x1 @ phi, y1, reg) - w) 
    p2 = np.linalg.norm(ls(x2 @ phi, y2, reg) - w)
    return (p1 + p2) / 2