<p dir="auto">Hello together,</p>
<p dir="auto">the -= assignment seems to break for matrices &gt; (90,90).</p>
<p dir="auto"><strong>Reproduction</strong></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import numpy as np
    for a in xrange(200):
    px=np.arange(a)
    #px=np.random.random(a)
    dx = np.repeat(px[np.newaxis, :], a, axis=0) - np.repeat(px[:, np.newaxis], a, axis=1)
    dx2 = np.repeat(px[np.newaxis, :], a, axis=0)
    dx2 -= dx2.T
    if len(np.nonzero(dx-dx2)[0]) != 0:
        print a
        break"><pre class="notranslate"><code class="notranslate">import numpy as np
    for a in xrange(200):
    px=np.arange(a)
    #px=np.random.random(a)
    dx = np.repeat(px[np.newaxis, :], a, axis=0) - np.repeat(px[:, np.newaxis], a, axis=1)
    dx2 = np.repeat(px[np.newaxis, :], a, axis=0)
    dx2 -= dx2.T
    if len(np.nonzero(dx-dx2)[0]) != 0:
        print a
        break
</code></pre></div>
<p dir="auto">I'm using  <code class="notranslate">numpy</code> version 1.8.1.</p>
<p dir="auto">Cheers,<br>
Stephan</p>
<h1 dir="auto">-------</h1>
<p dir="auto">Edit: I tested it on different machines:</p>
<p dir="auto">It gives out</p>
<ul dir="auto">
<li>91 on<code class="notranslate">numpy</code> version 1.6.2, 1.8.0 and 1.8.1.</li>
<li>3 on 1.3.0</li>
</ul>
<p dir="auto"><em>Original ticket <a href="http://projects.scipy.org/numpy/ticket/2075" rel="nofollow">http://projects.scipy.org/numpy/ticket/2075</a> on 2012-03-07 by trac user lxop, assigned to unknown.</em></p>
<p dir="auto">When I try to write to the transpose of an array, I get</p>
<p dir="auto"><code class="notranslate">AttributeError: attribute 'T' of 'numpy.ndarray' objects is not writable</code></p>
<p dir="auto">which seems fine, but the write <em>has</em> actually taken place.<br>
In particular, this occurs with in-place operations (+= etc).</p>
<p dir="auto">Test code:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="a = np.array ([1,2,3]).reshape ((1,3))
b = np.array ([4,5,6]).reshape ((3,1))
a.T += b"><pre class="notranslate"><code class="notranslate">a = np.array ([1,2,3]).reshape ((1,3))
b = np.array ([4,5,6]).reshape ((3,1))
a.T += b
</code></pre></div>
<p dir="auto">The result is the above error is raised and the operation actually goes ahead anyway.  I would expect only one or the other.</p>