added matrix input for doubles