title: Matrix multiplication problems - Numpy vs Matlab?
body: <p>I am trying to translate some Matlab code I have into Python (using numpy). I have the following Matlab code:</p>
  
  <pre><code>(1/x)*eye(2)
  </code></pre>
  
  <p>X is simply 1000000. As I understand, * in Matlab indicates matrix multiplication, and the equivalent is .dot in numpy. So in Python, I have:</p>
  
  <pre><code>numpy.array([(1/x)]).dot(numpy.identity(2))
  </code></pre>
  
  <p>I get the error "shapes (1,) and (2,2) not aligned: 1 (dim 0) != 2 (dim 0)" when I try to run the numpy code.</p>
  
  <p>Apparently I'm not understanding something. Anybody know what the proper numpy code would be?</p>