title: Why the following Eigen example won't compile?
body: <p>I am trying to compile this MWE, but getting lots of errors:</p>
  
  <pre><code>#include &lt;eigen/Eigen/Core&gt;
  #include &lt;eigen/unsupported/Eigen/CXX11/Tensor&gt;
  #include &lt;array&gt;
  
  using namespace Eigen;
  
  int main()
  {
  // Create 2 matrices using tensors of rank 2
  Eigen::Tensor&lt;int, 2&gt; a(2, 3);
  a.setValues({{1, 2, 3}, {6, 5, 4}});
  Eigen::Tensor&lt;int, 2&gt; b(3, 2);
  a.setValues({{1, 2}, {4, 5}, {5, 6}});
  
  // Compute the traditional matrix product
  array&lt;IndexPair&lt;int&gt;, 1&gt; product_dims = { IndexPair&lt;int&gt;(1, 0) };
  Eigen::Tensor&lt;int, 2&gt; AB = a.contract(b, product_dims);
  
  // Compute the product of the transpose of the matrices
  array&lt;IndexPair&lt;int&gt;, 1&gt; transpose_product_dims = { IndexPair&lt;int&gt;(0, 1) };
  Eigen::Tensor&lt;int, 2&gt; AtBt = a.contract(b, transpose_product_dims);
  }
  </code></pre>
  
  <p>This is actually from an example for Eigen tensors:</p>
  
  <p><a href="https://bitbucket.org/eigen/eigen/src/default/unsupported/Eigen/CXX11/src/Tensor/README.md?fileviewer=file-view-default" rel="nofollow noreferrer">https://bitbucket.org/eigen/eigen/src/default/unsupported/Eigen/CXX11/src/Tensor/README.md?fileviewer=file-view-default</a></p>
  
  <p>about contraction but I think it has some errors and wasn't compiled properly, which I tried to fix.</p>
  
  <p>errors:</p>
  
  <pre><code>1.cc:11:3: error: no member named 'setValues' in 'Eigen::Tensor&lt;int, 2, 0, long&gt;'
  a.setValues({{1, 2, 3}, {6, 5, 4}});
  ~ ^
  1.cc:11:13: error: expected expression
  a.setValues({{1, 2, 3}, {6, 5, 4}});
              ^
  1.cc:13:3: error: no member named 'setValues' in 'Eigen::Tensor&lt;int, 2, 0, long&gt;'
  a.setValues({{1, 2}, {4, 5}, {5, 6}});
  ~ ^
  1.cc:13:13: error: expected expression
  a.setValues({{1, 2}, {4, 5}, {5, 6}});
              ^
  1.cc:16:26: error: non-aggregate type 'array&lt;IndexPair&lt;int&gt;, 1&gt;' cannot be initialized with an initializer list
  array&lt;IndexPair&lt;int&gt;, 1&gt; product_dims = { IndexPair&lt;int&gt;(1, 0) };
                           ^              ~~~~~~~~~~~~~~~~~~~~~~~~
  1.cc:20:26: error: non-aggregate type 'array&lt;IndexPair&lt;int&gt;, 1&gt;' cannot be initialized with an initializer list
  array&lt;IndexPair&lt;int&gt;, 1&gt; transpose_product_dims = { IndexPair&lt;int&gt;(0, 1) };
                           ^                        ~~~~~~~~~~~~~~~~~~~~~~~~
  6 errors generated.
  </code></pre>