Copied over some numerical stability transformations to the CVXPY implementations
Made tests more rigorous so as to reproduce failure conditions