Skip to content

AbstractLAPACK dgeev argument checking #12

@uhoefel

Description

@uhoefel

There seems to be an issue in AbstractLAPACK.java in dgeev.
My test input works with netlib.fommil and looks like this:

int n = 2;
double[] a = {1.0, 0.75, 0.5, 1.0};
double[] wr = new double[2];
double[] wi = new double[2];
int lwork = 68; // optimal size from previous query
double[] work = new double[lwork];
intW info = new intW(2);

LAPACK.getInstance().dgeev("N", "N", n, a, n, wr, wi, new double[1], 1, new double[1], 1, work, lwork, info);

To my understanding, that should give the following eigenvalues in wr:

$$\lambda_{1,2} = \frac{\pm\sqrt{6}+4}{4}$$

My suspicion is that lines 338-341

if (lsame("N", jobvl))
    checkIndex(offsetvl + n * ldvl - 1, vl.length);
if (lsame("N", jobvr))
    checkIndex(offsetvr + n * ldvr - 1, vr.length);

should read

if (lsame("V", jobvl))
    checkIndex(offsetvl + n * ldvl - 1, vl.length);
if (lsame("V", jobvr))
    checkIndex(offsetvr + n * ldvr - 1, vr.length);

The documentation of LAPACK states for vl that (similar for vr)

If JOBVL = 'N', VL is not referenced.

so I would at least not intuit that its length matters (or I may very well miss something).

PS: Thanks for fixing the split packages!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions