Home > @josh-brown/vector > MatrixBuilder > repeat
Constructs a new matrix consisted of repetitions of a smaller matrix.
Signature:
repeat(matrix: Matrix<S>, rows: number, columns: number): M;|
Parameter |
Type |
Description |
|---|---|---|
|
matrix |
Matrix<S> |
The matrix to be repeated |
|
rows |
number |
The number of times to repeat the matrix vertically |
|
columns |
number |
The number of times to repeat the matrix horizontally |
Returns:
M
The new matrix
const I = matrixBuilder.identity(2);
const repeated = matrixBuilder.repeat(I, 1, 2);
// [ 1 0 1 0 ]
// [ 0 1 0 1 ]