{"action":"created","issue":{"url":"https://api.github.com/repos/xianyi/OpenBLAS/issues/492","labels_url":"https://api.github.com/repos/xianyi/OpenBLAS/issues/492/labels{/name}","comments_url":"https://api.github.com/repos/xianyi/OpenBLAS/issues/492/comments","events_url":"https://api.github.com/repos/xianyi/OpenBLAS/issues/492/events","html_url":"https://github.com/xianyi/OpenBLAS/issues/492","id":55341985,"number":492,"title":"wrong result on zsyr with negative incx, for OpenBLAS 0.2.13.","user":{"login":"zym1010","id":4273204,"avatar_url":"https://avatars.githubusercontent.com/u/4273204?v=3","gravatar_id":"","url":"https://api.github.com/users/zym1010","html_url":"https://github.com/zym1010","followers_url":"https://api.github.com/users/zym1010/followers","following_url":"https://api.github.com/users/zym1010/following{/other_user}","gists_url":"https://api.github.com/users/zym1010/gists{/gist_id}","starred_url":"https://api.github.com/users/zym1010/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zym1010/subscriptions","organizations_url":"https://api.github.com/users/zym1010/orgs","repos_url":"https://api.github.com/users/zym1010/repos","events_url":"https://api.github.com/users/zym1010/events{/privacy}","received_events_url":"https://api.github.com/users/zym1010/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":7,"created_at":"2015-01-23T22:35:27Z","updated_at":"2015-02-21T23:41:02Z","closed_at":null,"body":"I found this problem initially because the scipy linked against OpenBLAS won't pass a test related to z/c syr. (https://github.com/scipy/scipy/issues/4453). I translated the related test code (https://github.com/scipy/scipy/blob/master/scipy/linalg/tests/test_blas.py#L315) into C and linked it against three different libraries (OpenBLAS, ATLAS, and Accelerate on a mac).\r\n\r\n```\r\n#include <stdio.h>\r\n#include <complex.h> \r\nint main(void)\r\n{\r\n    int i, n;\r\n    double complex alpha;\r\n    char lowerOrUpper = 'U';\r\n    double complex a[] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* to save the result */\r\n    double complex w[] = {0, 1 + 2*I, 0, 0, 3+4*I, 0, 0, 5+6*I, 0, 0, 7+8*I, 0};\r\n    int offx;  \r\n    int incx;\r\n    alpha = 1.0;\r\n    n = 4;\r\n    offx = 1;\r\n    incx = -3;\r\n\r\n    zsyr_(&lowerOrUpper, &n, &alpha, w + offx, &incx, a, &n);\r\n\r\n    for (i = 0; i < n*n; ++i) {\r\n        printf(\"%.2f + %.2fi\\t \", creal(a[i]), cimag(a[i]));\r\n        if ((i+1)%n == 0) {\r\n            printf(\"\\n\");\r\n        } \r\n    }\r\n    return 0;\r\n}\r\n```\r\n\r\nThe reference result in scipy test is \r\n```\r\nIn [6]: resz_reverse\r\nOut[6]:\r\narray([[-15.+112.j, -13. +82.j, -11. +52.j,  -9. +22.j],\r\n       [  0.  +0.j, -11. +60.j,  -9. +38.j,  -7. +16.j],\r\n       [  0.  +0.j,   0.  +0.j,  -7. +24.j,  -5. +10.j],\r\n       [  0.  +0.j,   0.  +0.j,   0.  +0.j,  -3.  +4.j]])\r\n```\r\n\r\nThe output of my test program using OpenBLAS is \r\n```\r\n0.00 + 0.00i\t 0.00 + 0.00i\t 0.00 + 0.00i\t 0.00 + 0.00i\r\n0.00 + 0.00i\t 0.00 + 0.00i\t 0.00 + 0.00i\t 0.00 + 0.00i\r\n0.00 + 0.00i\t 0.00 + 0.00i\t 64.00 + 0.00i\t 0.00 + 0.00i\r\n0.00 + 0.00i\t 0.00 + 0.00i\t 16.00 + 24.00i\t -5.00 + 12.00i\r\n```\r\n\r\nyet the outputs for ATLAS and Accelerate are the same (transpose it to match the result from scipy, since C and Fortran have different storage schemes):\r\n```\r\n-15.00 + 112.00i\t 0.00 + 0.00i\t 0.00 + 0.00i\t 0.00 + 0.00i\r\n-13.00 + 82.00i\t -11.00 + 60.00i\t 0.00 + 0.00i\t 0.00 + 0.00i\r\n-11.00 + 52.00i\t -9.00 + 38.00i\t -7.00 + 24.00i\t 0.00 + 0.00i\r\n-9.00 + 22.00i\t -7.00 + 16.00i\t -5.00 + 10.00i\t -3.00 + 4.00i\r\n```\r\n\r\nI wonder if this is a bug in OpenBLAS in general, or it's limited to my processor (dual E5-2620 v3, Ubuntu Server 14.04.1)\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/7994531-wrong-result-on-zsyr-with-negative-incx-for-openblas-0-2-13?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>"},"comment":{"url":"https://api.github.com/repos/xianyi/OpenBLAS/issues/comments/75399804","html_url":"https://github.com/xianyi/OpenBLAS/issues/492#issuecomment-75399804","issue_url":"https://api.github.com/repos/xianyi/OpenBLAS/issues/492","id":75399804,"user":{"login":"martin-frbg","id":6192365,"avatar_url":"https://avatars.githubusercontent.com/u/6192365?v=3","gravatar_id":"","url":"https://api.github.com/users/martin-frbg","html_url":"https://github.com/martin-frbg","followers_url":"https://api.github.com/users/martin-frbg/followers","following_url":"https://api.github.com/users/martin-frbg/following{/other_user}","gists_url":"https://api.github.com/users/martin-frbg/gists{/gist_id}","starred_url":"https://api.github.com/users/martin-frbg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/martin-frbg/subscriptions","organizations_url":"https://api.github.com/users/martin-frbg/orgs","repos_url":"https://api.github.com/users/martin-frbg/repos","events_url":"https://api.github.com/users/martin-frbg/events{/privacy}","received_events_url":"https://api.github.com/users/martin-frbg/received_events","type":"User","site_admin":false},"created_at":"2015-02-21T23:41:02Z","updated_at":"2015-02-21T23:41:02Z","body":"I believe the \"interface differences\" comment is related to my observation that openblas passes the complex arguments as an array of doubles rather than as std:complex (as netlib, atlas et al. do) - this\r\nhowever appears to be a red herring. Unfortunately I did not get around to comparing earlier versions\r\nof the original gotoBlas yet, all I can say is that the last one, which was the starting point of OpenBLAS already displayed the erroneous behaviour with negative incx."}}