setcol(): matrix
Set a column of a matrix.
Replaces the values of column n in a matrix with a given column vector.
Replace the first column of a matrix
Replace the first column of a matrix
import { assertEquals, assertThrows } from "jsr:@std/assert"; assertEquals(setcol([2, 0], [[5, 6, 5], [7, 8, -1]], 0), [ [2, 6, 5], [0, 8, -1] ]);
Replace the third column of a matrix
Replace the third column of a matrix
import { assertEquals, assertThrows } from "jsr:@std/assert"; assertEquals(setcol([9, 21], [[5, 6, 5], [7, 8, -1]], 2), [ [5, 6, 9], [7, 8, 21] ]);
A new matrix with the updated column.