mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
1.1 KiB
1.1 KiB
| layout |
|---|
| default |
§Function transpose
Transpose a matrix. All values of the matrix are reflected over its main diagonal. Only two dimensional matrices are supported.
§Syntax
math.transpose(x)
§Parameters
| Parameter | Type | Description |
|---|---|---|
x |
Array | Matrix | Matrix to be transposed |
§Returns
| Type | Description |
|---|---|
| Array | Matrix | The transposed matrix |
§Examples
var A = [[1, 2, 3], [4, 5, 6]];
math.transpose(A); // returns [[1, 4], [2, 5], [3, 6]]