tomat(x: ): matrix<number | boolean> | matrix
Converts a number, boolean, or array into a matrix.
If input is a number or boolean, it is converted into a 1x1 matrix. If input is a vector, it is converted into a single-row matrix. If input is already a matrix, it remains unchanged.
Convert a number to a matrix
Convert a number to a matrix
import { assertEquals, assertThrows } from "jsr:@std/assert"; assertEquals(tomat(5), [[5]]);
Convert a boolean to a matrix
Convert a boolean to a matrix
import { assertEquals, assertThrows } from "jsr:@std/assert"; assertEquals(tomat(true), [[true]]);