Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
MATLABの関数に似た何かをしたい:
MATLAB
mat = vec2mat(vec,matcol) mat = vec2mat(vec,matcol,padding) [mat,padded] = vec2mat(...)
しかし、armadillo c ++ライブラリでは、方法を知っていますか?
私が思うに、リシェイプで同様の動作を実現するのはそれほど難しいことではありません。
mat vec2mat(vec V, size_t cols) { size_t rows = std::ceil(V.n_elems / double(cols)); return V.reshape(cols, rows);// return the original vector as matrix }
まったく同じではありませんが(常に0で埋められます)、非常に似ていると思います。