from sage.modules.free_module_element import vector def _mat2vec(m): return vector(m.base_ring(), m.list())