Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Replace the diagonal of an arbitrary matrix with zeros
ResourceFunction["ZeroDiagonal"][matrix] replaces the diagonal of matrix with zeros. |
Zero the diagonal of a matrix:
In[1]:= | ![]() |
Out[1]= | ![]() |
Use on a sparse matrix:
In[2]:= | ![]() |
Out[2]= | ![]() |
In[3]:= | ![]() |
Out[3]= | ![]() |
Use on a non-square matrix with symbols:
In[4]:= | ![]() |
Out[4]= | ![]() |
Use on a machine-precision matrix:
In[5]:= | ![]() |
Out[5]= | ![]() |
Create a random directed graph with no self-loops:
In[6]:= | ![]() |
Out[6]= | ![]() |
Wolfram Language 11.3 (March 2018) or above
This work is licensed under a Creative Commons Attribution 4.0 International License