{"action":"closed","issue":{"url":"https://api.github.com/repos/xianyi/OpenBLAS/issues/556","labels_url":"https://api.github.com/repos/xianyi/OpenBLAS/issues/556/labels{/name}","comments_url":"https://api.github.com/repos/xianyi/OpenBLAS/issues/556/comments","events_url":"https://api.github.com/repos/xianyi/OpenBLAS/issues/556/events","html_url":"https://github.com/xianyi/OpenBLAS/issues/556","id":71538164,"number":556,"title":"segfaults on matrix inversions","user":{"login":"ml31415","id":2386612,"avatar_url":"https://avatars.githubusercontent.com/u/2386612?v=3","gravatar_id":"","url":"https://api.github.com/users/ml31415","html_url":"https://github.com/ml31415","followers_url":"https://api.github.com/users/ml31415/followers","following_url":"https://api.github.com/users/ml31415/following{/other_user}","gists_url":"https://api.github.com/users/ml31415/gists{/gist_id}","starred_url":"https://api.github.com/users/ml31415/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ml31415/subscriptions","organizations_url":"https://api.github.com/users/ml31415/orgs","repos_url":"https://api.github.com/users/ml31415/repos","events_url":"https://api.github.com/users/ml31415/events{/privacy}","received_events_url":"https://api.github.com/users/ml31415/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-04-28T09:44:26Z","updated_at":"2015-04-28T14:56:57Z","closed_at":"2015-04-28T14:56:57Z","body":"I'm a bit illiterate with low level math libs, but stumbled across a bug, which I initially had thought to be a numpy bug and filed it there https://github.com/numpy/numpy/issues/5802 . Trying to invert a nan-filled matrix with certain sizes segfaulted there. This also affected other maxtrix operations for numpy, namely `linalg.cond` and `linalg.solve`. I also managed to reproduce the segfault using armadillo and openblas, so I suppose openblas is the actual source of the problem and this should be the right place to file the bug. \r\n\r\nUnfortunately I have no clue how to reproduce it with low level cblas functions, but this is how to reproduce the segfault:\r\n\r\nFirst option, using numpy (1.9.2, linux):\r\n`python -c \"import numpy as np; np.linalg.inv(np.ones((8,8)) * np.nan)\"`\r\n\r\nSecond, the following lines in C++, using recent ubuntu armadillo and openblas packages:\r\n```\r\n// g++ test_matrix_pseudoinverse.cpp -o test_matrix_pseudoinverse -L/usr/lib/openblas-base -larmadillo -lopenblas \r\n\r\n#include <cstdio>\r\n#include <math.h>\r\n#include <armadillo>\r\n\r\nusing namespace std;\r\n\r\nint main()\r\n{\r\n    for(int M=1; M <= 15; M++) { // dimension\r\n        arma::mat _A(M,M);\r\n        arma::mat _B(M,M);\r\n\r\n        for(int i=0; i < M; i++) {\r\n            for(int j=0; j < M; j++) {\r\n                //_A(i,j) = rand()/(1.0 + RAND_MAX);\r\n                _A(i,j) = NAN;\r\n            }\r\n        }\r\n        _B = arma::inv(_A);\r\n        cout << M << \" \";\r\n    }\r\n    cout << endl;\r\n    return 0;\r\n}\r\n```\r\n\r\nThe latter one counts up to 9 and then crashes. On numpy reproducibly any edge length with a multiple of 8 segfaulted. A dump of the numpy segfault is here: http://pastebin.com/A8RuGpjn If you need further information for debugging, I'll try my best to provide them.\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/12363102-segfaults-on-matrix-inversions?utm_campaign=plugin&utm_content=tracker%2F69691&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F69691&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"}}