title: 'ComplexWarning' when summing up complex values in loop
body: <p>I get an 'ComplexWarning' for the code:</p>
  
  <pre><code>import numpy as np
  
  A = [np.array([[0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j]]), np.array([[ 0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j]]), np.array([[ 0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j]]), np.array([[ 0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j]]), np.array([[ 0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.j],
     [0.+0.00235702j],
     [0.+0.j]]), np.array([[0],
     [0],       
     [0],
     [0],
     [0],
     [1]])]
  
  for k in range(0, 6):
      C[k] = A[0][k] + A[1][k] + A[2][k] + A[3][k] + A[4][k] + A[5][k]
  
  ComplexWarning: Casting complex values to real discards the imaginary part
  </code></pre>
  
  <p>So it does sum up somehow, but discarding the imaginary part and my result is:</p>
  
  <pre><code>C = [[0],[0],[0],[0],[0],[1]]
  </code></pre>
  
  <p>My problem is, that when I do it manually, e.g. adding up each row by hand by</p>
  
  <pre><code>C[0] = A[0][0] + A[1][0] + A[2][0] + A[3][0] + A[4][0] + A[5][0]
  </code></pre>
  
  <p>a.s.o., it just works fine without any errors and my result is</p>
  
  <pre><code>C = [[0.+0.j],[0.+0.j],[0.+0.j],[0.+0.j],[0.+0.00235702j],[1.+0.j]]
  </code></pre>
  
  <p>I don't see, why the use of a loop to sum up the rows of my matrices gives an error, while it works otherwise. And I can't do it by hand, since it is just a small part in a bigger calculation, which in the end shut end up doing this summing for approximately 6000 times.
  Anyone seen this error before and knows what to do?</p>