i like this post (click again to cancel)
0
i dont like this post (click again to cancel) remove favorite mark from this question (click again to restore mark)

How do I efficiently set the diagonal elements of a >= 2 dimensional NumPy array?

flag offensive community wiki
add comment
1 Answers:
i like this answer (click again to cancel)
0
i dont like this answer (click again to cancel)

In recent Subversion versions of NumPy (and in the upcoming release of NumPy 1.4.0) you can use the fill_diagonal function. The source code of the function is in index_tricks.py if you'd rather use it now; just copy and paste it.

add comment
Your answer:
You are now not logged in but you can answer first and then login
toggle preview

Made with Django.