Reverses a matrix in place so the first row becomes the last and each row reads backward.
The effect is a half-turn of the grid: item (r, c) moves to (rows - 1 - r, columns - 1 - c). The shape stays the same.
Applying it twice returns the original matrix.
Syntax
matrix.reverse(id: any matrix type) -> void
matrix.reverse() -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| id | any matrix type | required | The matrix to reverse in place: row order and the order inside each row. |
Returns
Nothing.
Example
//@version=6
indicator("matrix.reverse: half-turn", overlay = false)
matrix<float> m = matrix.new<float>(2, 2, 0.0)
matrix.set(m, 0, 0, 1.0)
matrix.reverse(m)
plot(matrix.get(m, 1, 1), "Now 1")See also
Runs on Sidechair