Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

sum of diagonal numpy


arr= np.arange(16)
arr= np.reshape(arr,(4,4))

a=np.diagonal(arr, 0,0,1)

result=sum(a)
print(result)
Source by numpy.org #
 
PREVIOUS NEXT
Tagged: #sum #diagonal #numpy
ADD COMMENT
Topic
Name
1+6 =