Using matrix variables