title: Data structure for representing sparse tensor?
body: <p>What is an appropriate data structure to represent a sparse tesnor in C++?
  The first option that comes to mind is a <code>boost::unordered_map</code> since it allows operations like fast setting and retrieval of an an element like below:</p>
  
  <pre><code>A(i,j,k,l) = 5
  </code></pre>
  
  <p>However, I would also like to be able to do contractions over a single index, which would involve summation over one of the indices</p>
  
  <pre><code>C(i,j,k,m) = A(i,j,k,l)*B(l,m)
  </code></pre>
  
  <p>How easy would it be to implement this operator with a <code>boost::unordered_map</code>? Is there a more appropriate data structure?</p>