There is a simple matrix operation that other scientific computing systems typically have and Mathematica sorely lacks:
Replace the diagonal of a matrix with all zeros.
Or more generally, replace the diagonal with some given values.
I am not sure why this is missing from Mathematica. Perhaps it is considered trivial to implement. To show that it isn’t, I challenge the readers of this forum to post an implementation which is:
- As efficient as possibleit should be fast and not use too much memory
- As general as possibleit should work with all sorts of matrices that can be used in Mathematica
Think through your submission before you post it. I expect that I will be able to point out problems in the first few submissions. If not, and I am proven wrong, then I will be happy to learn new methods of doing this.
If you agree that this functionality needs to be added to the next version of Mathematica, upvote this post!


