Home > @josh-brown/vector > MatrixBuilder > ones
Constructs a matrix of the specified dimensions, consisting of all ones
Signature:
ones(shape: MatrixShape): M;|
Parameter |
Type |
Description |
|---|---|---|
|
shape |
The shape of the matrix as a tuple |
Returns:
M
The new matrix
const allOnes = matrixBuilder.ones(2, 3);
// [ 1 1 1 ]
// [ 1 1 1 ]