ensure diag of r matrix is positive.