-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Closed
Labels
Description
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:
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
The run time of ~6 seconds is very small. But more importantly: I should not have the inv() function to return an all-zero matrix without any error!
Am I missing something here? Is it a result I should be expecting?
About my environment:
Right before running the snippet above, I made sure I had enough RAM:
$ cat /proc/meminfo | grep MemFree
MemFree: 138568436 kB
Running Conda 3.12.0 with:
numpy 1.9.2 py27_p0 [mkl]
OS: Linux seftrtools1 3.16.0-34-generic #47~14.04.1-Ubuntu SMP Fri Apr 10 17:49:16 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ python --version
Python 2.7.6
$ ulimit
unlimited
Reactions are currently unavailable