added matrix input