This function is used to return a new matrix with the values initialized to ones.
numpy.matlib.ones(shape,dtype,order)
It accepts the following parameters.
A matrix is returned with all the entries initialized to 1.
import numpy as np import numpy.matlib print(numpy.matlib.ones((3,3)))
Output:
import numpy as np import numpy.matlib print(numpy.matlib.ones((3,3),int))
Output:
import numpy as np import numpy.matlib print(numpy.matlib.ones((3,3),int,'C'))
Output: