numpy.matlib.empty() function | Python
Last Updated :
22 Apr, 2020
numpy.matlib.empty()
function return a new matrix of given shape and type, without initializing entries.
Syntax : numpy.matlib.empty(shape, dtype = None, order = ‘C’)
Parameters :
shape : [int or tuple of int] Shape of the empty matrix.
dtype : [data-type, optional] Desired output data-type.
order : [{‘C’, ‘F’}, optional] Whether to store multi-dimensional data in row-major (C-style) or column-major (Fortran-style) order in memory.
Return : [matrix] A new matrix of given shape and type, without initializing entries.
Code #1 :
import numpy as geek
import numpy.matlib
gfg = geek.matlib.empty(( 2 , 2 ))
print (gfg)
|
Output :
[[ 6.91957648e-310 1.90383493e-316]
[ 6.91957669e-310 5.30409905e-317]]
Code #2 :
import numpy as geek
import numpy.matlib
gfg = geek.matlib.empty(( 2 , 2 ), dtype = int )
print (gfg)
|
Output :
[[139855860099992 40294208]
[139855825297024 10730496]]
Share your thoughts in the comments
Please Login to comment...