added matrix generation base cases