title: Vector operations on Eigen Array of Vectors
body: <p>I have a 2D Eigen Array where each item in the array is a 3-element Eigen Vector (e.g. a velocity field over a surface).</p>
  
  <p>I want to multiply each each element of the 2D array with a 3-element Eigen RowVector, effectively taking the dot product.</p>
  
  <pre><code>    Eigen::Array&lt;Eigen::Vector3d, Eigen::Dynamic, Eigen::Dynamic&gt; velField(5, 5);
      Eigen::Vector3d n;
      // ... initialisation of n and velField not shown
  
      Eigen::Array&lt;double, Eigen::Dynamic, Eigen::Dynamic&gt; result(5, 5);
      result = n.transpose() * velField;
  </code></pre>
  
  <p>This gives a compile error YOU MIXED DIFFERENT NUMERIC TYPES. However, if I don't <em>assign</em> the result, but just compute it:</p>
  
  <pre><code>    n.transpose() * velField;
  </code></pre>
  
  <p>it compiles. What is the correct return type for 'result' - or how else can I fix this?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>The same problem can be observed in this simpler case (multiplying by a double):</p>
  
  <pre><code>Eigen::Array&lt;Eigen::Vector3d, Eigen::Dynamic, Eigen::Dynamic&gt; velField(5, 5);
  // ... initialisation of velField not shown
  Eigen::Array&lt;Eigen::Vector3d, Eigen::Dynamic, Eigen::Dynamic&gt; result(5, 5);
  result = 3.0 * velField;
  </code></pre>
  
  <p>However the same code works when using <code>std::complex&lt;double&gt;</code> instead of <code>Eigen::Vector3d</code>:</p>
  
  <pre><code>Eigen::Array&lt;std::complex&lt;double&gt;, Eigen::Dynamic, Eigen::Dynamic&gt; velField(5, 5);
  // ... initialisation of velField not shown
  Eigen::Array&lt;std::complex&lt;double&gt;, Eigen::Dynamic, Eigen::Dynamic&gt; result(5, 5);
  result = 3.0 * velField;
  </code></pre>
  
  <p>I wonder why it works for <code>std::complex</code> but not with <code>Eigen::Vector3d</code>. Both types define the operator <code>*</code> with a <code>double</code>.</p>