Methods for joint dimension reduction and clustering