import type { array, matrix } from "../types"; /** * Set a column of a matrix. * * Replaces the values of column `n` in a matrix with a given column vector. * * @param x Column vector (Mx1) to insert. * @param mat Matrix (MxN) in which to set the column. * @param n Column index (0-based). * @returns A new matrix with the updated column. * @throws When the column index is out of bounds or the vector length mismatches the number of rows. * * @example Replace the first column of a matrix * ```ts * import { assertEquals, assertThrows } from "jsr:@std/assert"; * * assertEquals(setcol([2, 0], [[5, 6, 5], [7, 8, -1]], 0), [ * [2, 6, 5], * [0, 8, -1] * ]); * * ``` * * @example Replace the third column of a matrix * ```ts * import { assertEquals, assertThrows } from "jsr:@std/assert"; * * assertEquals(setcol([9, 21], [[5, 6, 5], [7, 8, -1]], 2), [ * [5, 6, 9], * [7, 8, 21] * ]); * * ``` * * @example Column vector length mismatch error * ```ts * import { assertEquals, assertThrows } from "jsr:@std/assert"; * * assertThrows(() => setcol([1, 2, 3], [[4, 5], [6, 7]], 1), "Column vector length must match the number of matrix rows."); * * ``` * * @example Column index out of bounds error * ```ts * import { assertEquals, assertThrows } from "jsr:@std/assert"; * * assertThrows(() => setcol([1, 2], [[4, 5], [6, 7]], 2), "Column index must be an integer between 0 and N-1."); * ``` */ export default function setcol(x: array, mat: matrix, n: number): matrix; //# sourceMappingURL=setcol.d.ts.map