ArrayReshape[list,dims]
list の要素を次元 dims の矩形配列に並べる.
ArrayReshape[list,dims,padding]
list に十分な要素がない場合は指定された充填を行う.
ArrayReshape
ArrayReshape[list,dims]
list の要素を次元 dims の矩形配列に並べる.
ArrayReshape[list,dims,padding]
list に十分な要素がない場合は指定された充填を行う.
詳細
- ArrayReshapeは,常に指定された次元の矩形配列を与える.必要な場合は最後の要素を無視したり新しい要素を付け加えたりする.
- 要素は,長さまではFlatten[ArrayReshape[list,dims]]がFlatten[list]と等しくなるように,結果の配列に並べられる.
- ArrayReshape[list,dims,padding]では,ArrayPadでサポートされているすべての形の充填を指定することができる.デフォルトの充填値は0である.
- ArrayReshapeはSparseArrayオブジェクトに使うことができる.
例題
すべて開く すべて閉じる例 (4)
ArrayReshape[{a, b, c, d, e, f}, {2, 3}]ArrayReshape[Range[24], {2, 3, 4}]ArrayReshape[{1, 2, 3, 4, 5, 6, 7}, {5, 3}, x]ArrayReshape[{10, 20, 30, 40, 50, 60, 70}, {5, 3}, "Extrapolated"]スコープ (1)
一般化と拡張 (1)
ArrayReshapeはSparseArrayオブジェクトに使うことができる:
ArrayReshape[SparseArray[{1 -> 1, 4 -> 5}, 10], {2, 6}, x]MatrixForm[%]アプリケーション (2)
特性と関係 (2)
Partitionに基づき,ArrayReshapeと等価であるが充填はしない関数:
pareshape[list_, dims_] := Fold[Partition, Flatten[list], dims[[-1 ;; 2 ;; -1]]]pareshape[Range[24], {2, 3, 4}]% === ArrayReshape[Range[24], {2, 3, 4}]行列の次元をもとに戻しても要素順はTransposeとは同じにならない:
m = {{1, 2, 3, 4}, {5, 6, 7, 8}, {9, 10, 11, 12}};ArrayReshape[m, Reverse[Dimensions[m]]]Transpose[m]関連するガイド
テキスト
Wolfram Research (2012), ArrayReshape, Wolfram言語関数, https://reference.wolfram.com/language/ref/ArrayReshape.html.
CMS
Wolfram Language. 2012. "ArrayReshape." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ArrayReshape.html.
APA
Wolfram Language. (2012). ArrayReshape. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ArrayReshape.html
BibTeX
@misc{reference.wolfram_2026_arrayreshape, author="Wolfram Research", title="{ArrayReshape}", year="2012", howpublished="\url{https://reference.wolfram.com/language/ref/ArrayReshape.html}", note=[Accessed: 18-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_arrayreshape, organization={Wolfram Research}, title={ArrayReshape}, year={2012}, url={https://reference.wolfram.com/language/ref/ArrayReshape.html}, note=[Accessed: 18-August-2026]}