Horizontal Matrix Flip
Mirror a matrix along its vertical axis by reversing the elements of every row.
Description
Mirror a rectangular matrix from left to right by reversing every row.
A horizontal matrix flip mirrors grid data across its vertical centerline. It is useful for checking image-like arrays, board states, kernels, and coordinate grids without changing the order of the rows.
When to use Horizontal Matrix Flip
- Mirror pixel or tile values left to right
- Reverse the column order of tabular grid data
- Prepare a reflected kernel or board position
How the calculation works
Each row is copied and reversed independently. Row zero remains row zero, but column zero moves to the last column, column one moves to the next-to-last column, and so on. The original matrix is not mutated.
Interpreting the result
The output has exactly the same shape as the input. Applying the horizontal flip twice returns the original matrix. For a one-column matrix, the values are unchanged.
Important limitations
- The matrix must be non-empty and rectangular.
- This operation mirrors columns; it does not transpose rows and columns or rotate the grid.