numpy.matlib.empty()

This function is used to return a new matrix with the uninitialized entries.

Syntax

snippet
numpy.matlib.empty(shape,dtype,order)

Parameters

It accepts the following parameters.

  1. shape: It is the Tuple defining the shape of the matrix.
  2. dtype: It is the data type of the matrix.
  3. order: It is the insertion order of the matrix.

Return

A matrix with uninitialized entries is returned.

Example

snippet
import numpy as np  
  
import numpy.matlib  
  
print(numpy.matlib.empty((3,3)))

Output:

Output
[[6.94892251e-310 2.29200848e-316 0.00000000e+000] [0.00000000e+000 2.37151510e-322 2.37151510e-322] [0.00000000e+000 6.94889962e-310 0.00000000e+000]]

Example: initializing integer values

snippet
import numpy as np  
  
import numpy.matlib  
  
print(numpy.matlib.empty((3,3),int))

Output:

Output
[[140584865515528 35760528 0] [ 0 0 0] [ 0 0 0]]

Example: specifying Insertion order

snippet
import numpy as np  
  
import numpy.matlib  
  
print(numpy.matlib.empty((3,3),int,'C'))

Output:

Output
[[140437489977352 22202768 0] [ 0 0 0] [ 0 0 0]]
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents