vec2mat and mat2vec