title: Identifying if only the diagonal is non-zero
body: <p>Let's say I have a matrix with all 0's with the exception of the diagonal. </p>
  
  <pre><code>m &lt;- matrix(ncol=3,nrow=3)
  m[,1] &lt;- c(1,0,0)
  m[,2] &lt;- c(0,1,0)
  m[,3] &lt;- c(0,0,1)
  </code></pre>
  
  <p>What logical check could I use to test if the upper and lower triangle of the matrix are zero?</p>