title: Linear indexing in symmetric matrices
body: <p>We can access matrices using linear indexing, which follows this pattern</p>
  
  <p>0 1 2</p>
  
  <p>3 4 5</p>
  
  <p>6 7 8</p>
  
  <p>It's easy to get the i,j coordinates for this case (n is the matrix dimension). For 0-index based, it would be.</p>
  
  <p>i = index / n</p>
  
  <p>j = index % n</p>
  
  <p>Now, what if my matrix is symmetric and I only want to access the upper part</p>
  
  <p>0 1 2 3</p>
  
  <p>.. 4 5 6</p>
  
  <p>..... 7 8</p>
  
  <p>........ 9</p>
  
  <p>I know the linear index will be given by</p>
  
  <p>index = j + n*i - i (i-1) / 2</p>
  
  <p>but I want to know i,j given idx. Do you guys know of any way of doing this?. I looked up this here, but I couldn't find an answer. Thanks in advance.</p>