Update Rkp.m to solve the dual problem