Home > @josh-brown/vector > MatrixBuilder > fill
Constructs a matrix of the specified dimension, whose entries are all the specified value
Signature:
fill(value: S, shape: MatrixShape): M;|
Parameter |
Type |
Description |
|---|---|---|
|
value |
S |
The value that should be used for every entry in the new matrix |
|
shape |
The shape of the matrix as a tuple |
Returns:
M
The new matrix
const allTwos = matrixBuilder.fill(2, 3, 4)
// [ 2 2 2 2 ]
// [ 2 2 2 2 ]
// [ 2 2 2 2 ]