title: Is there any difference when creating numpy matrix in the following ways?
body: <p>When I pratice numpy matrix these days, I create a matrix in this way:</p>
  
  <pre><code>theta = np.mat([1,1])
  temp = np.mat(theta)
  </code></pre>
  
  <p>then I excute the following code for example</p>
  
  <pre><code>temp[0,0] = theta[0,0] - 0.3
  print(temp, theta)
  </code></pre>
  
  <p>but the answer is so <strong>unexpected</strong>:</p>
  
  <pre><code>[[0 1]] [[0 1]]
  </code></pre>
  
  <p>but when I tried the another way:</p>
  
  <pre><code>theta = np.mat([1,1])
  temp = np.mat(np.ones(a.shape))
  </code></pre>
  
  <p>the answer is totally <strong>right</strong></p>
  
  <p>Later I found that in fact, in the first way, temp is a view of theta, when change temp's value, theta will change too, but Can anyone explain the result I got?
  why excute the following code will get <code>[[0 1]] [[0 1]]</code></p>
  
  <pre><code>theta = np.mat([1,1])
  temp = np.mat(theta)
  temp[0,0] = theta[0,0] - 0.3
  print(temp, theta)
  </code></pre>
  
  <p>Thanks a lot !!!</p>