Articles → Numpy → Create an identity matrix in NumPy

Create an identity matrix in NumPy






What is identity matrix?





Click to Enlarge


Syntax


Eye(dimensions)



Example


import numpy as np

print("====2 ROWS and 2 COLUMNS======")
print(np.eye(2))
print("====3 ROWS and 3 COLUMNS======")
print(np.eye(3))





Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Monday, March 25, 2019

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250