replaced mat with Mat<elem_type>