Skip to content

dgetf2: fails to return singularity of singular matrix #610

@kortschak

Description

@kortschak

We have noticed a problem with the OpenBLAS dgetf2 routine in that it fails to identify a singular matrix as such (see comments in gonum/lapack#22). We only see this in Travis CI builds (the failures don't show up in builds on our own machines, so up until now we have not filed an issue). I have below a minimal reproducer that has no Go dependency.

#include <stdio.h>
#include <lapacke.h>

int row_major = 101;

int main() {
    // row 3 = row1 + 2 * row2
    int m  = 3, n = 3, lda = 3;
    double a[9] = {
        1, 5, 7,
        2, 10, -3,
        5, 25, 1,
    };
    int ipiv[3];

    int info;

    info = LAPACKE_dgetf2(row_major, m, n, a, lda, ipiv);
    printf("dgetf2 info=%d\n", info);

    return info;
}
~/dgetf2 $ gcc dgetf2.c -o dgetf2 -lopenblas
~/dgetf2 $ ./dgetf2 
dgetf2 info=2

Compare the output above with a what octave thinks about the matrix above:

octave:1> a = [1 5 7; 2 10 -3; 5 25 1];
octave:2> inv(a)
warning: inverse: matrix singular to machine precision, rcond = 0
ans =

   Inf   Inf   Inf
   Inf   Inf   Inf
   Inf   Inf   Inf

The sha for OpenBLAS used here is 8e5a108 (I can check this is also the case for the current develop tip, but am confident it is since we see the correct behaviour when called from Go).

Now compare with what we see on Travis. Relevant Travis CI output https://travis-ci.org/gonum/lapack/jobs/73760112:

Cloning into 'OpenBLAS'...
remote: Counting objects: 7581, done.
remote: Compressing objects: 100% (2844/2844), done.
remote: Total 7581 (delta 5022), reused 6786 (delta 4713), pack-reused 0
Receiving objects: 100% (7581/7581), 9.80 MiB | 13.36 MiB/s, done.
Resolving deltas: 100% (5022/5022), done.
Checking connectivity... done.
~/OpenBLAS ~ ~/gopath/src/github.com/gonum/lapack
OpenBLAS 3f1b57668e3d73944981d7bda194ca133f4660b7

snip

~/gopath/src/github.com/gonum/lapack/dgetf2 ~/gopath/src/github.com/gonum/lapack
dgetf2 info=0
~/gopath/src/github.com/gonum/lapack

Here we have info returning 0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions