title: How to raise a matrix to the power of elements in an array that is increasing in an ascending order?
body: <p>Currently I have a C matrix generated by:</p>
  
  <pre class="lang-py prettyprint-override"><code>def c_matrix(n):
      exp = np.exp(1j*np.pi/n)
      exp_n = np.array([[exp, 0], [0, exp.conj()]], dtype=complex)
      c_matrix = np.array([exp_n**i for i in range(1, n, 1)], dtype=complex)
      return c_matrix
  </code></pre>
  
  <p>What this does is basically generate a list of number from 0 to n-1 using list comprehension, then returns a list of the matrix <code>exp_n</code>being raised to the elements of the ascendingly increasing list. i.e.</p>
  
  <pre><code>exp_n**[0, 1, ..., n-1] = [exp_n**0, exp_n**1, ..., exp_n**(n-1)]
  
  </code></pre>
  
  <p>So I was wondering if there's a more numpythonic way of doing it(in order to make use of Numpy's broadcasting ability) like:</p>
  
  <pre><code>exp_n**np.arange(1,n,1) = np.array(exp_n**0, exp_n**1, ..., exp_n**(n-1))
  </code></pre>