<p dir="auto">I have been experimenting with large matrix inversions (have to inverse the whole matrix is my specific case) to check the runtime. It all works well until I tried to inverse a 50000 by 50000 matrix:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="In [10]: A = np.eye(50000)

In [11]: A
Out[11]: 
array([[ 1.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  1.,  0., ...,  0.,  0.,  0.],
       [ 0.,  0.,  1., ...,  0.,  0.,  0.],
       ..., 
       [ 0.,  0.,  0., ...,  1.,  0.,  0.],
       [ 0.,  0.,  0., ...,  0.,  1.,  0.],
       [ 0.,  0.,  0., ...,  0.,  0.,  1.]])

In [12]: %time X = np.linalg.inv(A)
CPU times: user 2.95 s, sys: 3.24 s, total: 6.19 s
Wall time: 6.19 s

In [13]: X.shape
Out[13]: (50000, 50000)

In [14]: np.abs(X).sum()
Out[14]: 0.0"><pre class="notranslate"><code class="notranslate">In [10]: A = np.eye(50000)

In [11]: A
Out[11]: 
array([[ 1.,  0.,  0., ...,  0.,  0.,  0.],
       [ 0.,  1.,  0., ...,  0.,  0.,  0.],
       [ 0.,  0.,  1., ...,  0.,  0.,  0.],
       ..., 
       [ 0.,  0.,  0., ...,  1.,  0.,  0.],
       [ 0.,  0.,  0., ...,  0.,  1.,  0.],
       [ 0.,  0.,  0., ...,  0.,  0.,  1.]])

In [12]: %time X = np.linalg.inv(A)
CPU times: user 2.95 s, sys: 3.24 s, total: 6.19 s
Wall time: 6.19 s

In [13]: X.shape
Out[13]: (50000, 50000)

In [14]: np.abs(X).sum()
Out[14]: 0.0
</code></pre></div>
<p dir="auto">The run time of ~6 seconds is very small. But more importantly: <strong>I should not have the inv() function to return an all-zero matrix without any error!</strong></p>
<p dir="auto">Am I missing something here? Is it a result I should be expecting?</p>
<hr>
<p dir="auto">About my environment:</p>
<p dir="auto">Right before running the snippet above, I made sure I had enough RAM:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ cat /proc/meminfo | grep MemFree
MemFree:        138568436 kB"><pre class="notranslate"><code class="notranslate">$ cat /proc/meminfo | grep MemFree
MemFree:        138568436 kB
</code></pre></div>
<p dir="auto">Running Conda 3.12.0 with:<br>
numpy                     1.9.2                   py27_p0  [mkl]</p>
<p dir="auto">OS: Linux seftrtools1 3.16.0-34-generic <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="647989" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/47" data-hovercard-type="pull_request" data-hovercard-url="/numpy/numpy/pull/47/hovercard" href="https://github.com/numpy/numpy/pull/47">#47</a>~14.04.1-Ubuntu SMP Fri Apr 10 17:49:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ python --version
Python 2.7.6"><pre class="notranslate"><code class="notranslate">$ python --version
Python 2.7.6
</code></pre></div>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ulimit
unlimited"><pre class="notranslate"><code class="notranslate">$ ulimit
unlimited
</code></pre></div>
<p dir="auto">Can I revisit this one?   <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/carlkl/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/carlkl">@carlkl</a> pointed out that this is a rather significant change in behavior.  Previously, for platforms and compilers where <code class="notranslate">double == long double</code>, at <em>Numpy compile time</em>, such as MSVC, this would give <code class="notranslate">npy_longdouble</code> as <code class="notranslate">double</code>.  This is useful in the case when we are compiling <em>using</em> Numpy, but with a compiler where it is <em>not</em> true that <code class="notranslate">double == long double</code>.  One example is compiling Scipy with mingw-w64, where, by default <code class="notranslate">long double</code> is Float80.   Could y'all say more about why this change is needed?  Why do we need to force <code class="notranslate">npy_longdouble</code> to be the <em>compiler</em> long double, rather than <em>Numpy</em> <code class="notranslate">long double</code>?</p>
<p dir="auto"><em>Originally posted by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/matthew-brett/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/matthew-brett">@matthew-brett</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="1037158312" data-permission-text="Title is private" data-url="https://github.com/numpy/numpy/issues/20206" data-hovercard-type="pull_request" data-hovercard-url="/numpy/numpy/pull/20206/hovercard?comment_id=746542568&amp;comment_type=review_comment" href="https://github.com/numpy/numpy/pull/20206#discussion_r746542568">#20206 (comment)</a></em></p>
<hr>
<p dir="auto">Also pinging <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/seiko2plus/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/seiko2plus">@seiko2plus</a>, <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/mattip/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/mattip">@mattip</a>, and since it seems faintly C++ related <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/serge-sans-paille/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/serge-sans-paille">@serge-sans-paille</a></p>