create method convert matrix to vector