import type { array, matrix } from "../types"; /** * Flip the order of elements in an array or matrix. * * Flips the order of elements in an array or matrix along a specified dimension. Default dimension is 1 (columns). * * @param x The array or matrix to flip. * @param dim The dimension to apply the flip (0 = rows, 1 = columns). Defaults to 1. * @returns The array or matrix with flipped elements. * @throws If no input is provided. * * @example Flip a 1D array (dim = 1) * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(flipdim([5, 6, 3], 1), [3, 6, 5]); * * ``` * * @example Flip a 1D array with no dimension specified (no change) * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(flipdim([5, 6, 3], 0), [5, 6, 3]); * * ``` * * @example Flip a 2D matrix along columns (dim = 1) * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(flipdim([[5, 6, 5], [7, 8, -1]]), [[5, 6, 5], [-1, 8, 7]]); * * ``` * * @example Flip a 2D matrix along rows (dim = 0) * ```ts * import { assertEquals } from "jsr:@std/assert"; * * assertEquals(flipdim([[5, 6, 5], [7, 8, -1]], 0), [[7, 5], [8, 6], [-1, 5]]); * * ``` */ export default function flipdim(x: number | array | matrix, dim?: number): number | array | matrix; //# sourceMappingURL=flipdim.d.ts.map