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