Function flatten #
将多维矩阵展平成一维矩阵。返回一个新矩阵,原始矩阵保持不变。
Syntax #
math.flatten(x)
Parameters #
| Parameter | Type | Description |
|---|---|---|
x |
DenseMatrix | Array | 要展平的矩阵 |
Returns #
| Type | Description |
|---|---|
| DenseMatrix | Array | 返回展平后的矩阵 |
Throws #
Type | Description —- | ———–
Examples #
math.flatten([[1,2], [3,4]]) // returns [1, 2, 3, 4]