title: Conditional sum of two 3D arrays; condition is a 1D array
body: <p>I want to add two 3D (shape (N, 3)) numpy arrays conditionally where the condition is specified as a 1D array (shape of N).</p>
  <p>What's an efficient (vectorized) way to do this? numpy.where() only supports a conditional operation where all three arrays (including the condition) have matching dimensions.</p>
  <p>For instance:</p>
  <pre><code>a = np.asarray([[1, 1], [2, 2], [3, 3], [4, 4]])
  b = np.asarray([[0.2, 0.2], [0.3, 0.3], [0.4, 0.4], [0.5, 0.5]])
  c = np.asarray([0, 1, 1, 0])
  </code></pre>
  <p>I would like to be able to do:</p>
  <pre><code>np.where(c == 1, a + b, a)
  </code></pre>
  <p>i.e., do an element-wise add of a + b as long as the corresponding element in c is equal to 1 at the same index in the array.</p>
  <p>However, I get an error instead:</p>
  <pre><code>ValueError: operands could not be broadcast together with shapes (4,) (4,3) (4,3) 
  </code></pre>