numpy.matlib.ones¶
-
numpy.matlib.ones(shape, dtype=None, order='C')[source]¶ Matrix of ones.
Return a matrix of given shape and type, filled with ones.
- Parameters
- Returns
- outmatrix
Matrix of ones of given shape, dtype, and order.
See also
onesArray of ones.
matlib.zerosZero matrix.
Notes
If
shapehas length one i.e.(N,), or is a scalarN, out becomes a single row matrix of shape(1,N).Examples
>>> np.matlib.ones((2,3)) matrix([[1., 1., 1.], [1., 1., 1.]])
>>> np.matlib.ones(2) matrix([[1., 1.]])