Code >
file.vb
import numpy as np
n_array = np.array([[95, 25, 15],
[30, 24, 2],
[14, 25, 47]])
print("Numpy Matrix is:")
print(n_array)
trace = np.trace(n_array)
print("Trace of given matrix:")
print(trace)
Output>
Output
Numpy Matrix is:
[[95 25 15]
[30 24 2]
[14 25 47]]
Trace of given matrix:
166