Inconsistent output of eigen() for views with complex element type

Issue #199 resolved
Tim Zimmermann created an issue

Consider the following code snippet:

int main(){

    DynamicMatrix<complex<double>, columnMajor> M{{1,2,3},{4,5,2},{7,0,9}};
    DynamicMatrix<complex<double>, rowMajor> buffer(3UL,3UL);
    auto v = column<0UL>(buffer);

    eigen(M, v);
    cout << M << endl;
    cout << v << endl;
    cout << buffer << endl;

}

I expected to find the complex eigenvalues of matrix M in the first column of buffer. However running the code yields:

(        (1,0)        (2,0)        (3,0) )
(        (4,0)        (5,0)        (2,0) )
(        (7,0)        (0,0)        (9,0) )

( (-1.75221,0) )
(       (0,0) )
(       (0,0) )

( (-1.75221,0)  (11.6633,0)   (5.0889,0) )
(        (0,0)        (0,0)        (0,0) )
(        (0,0)        (0,0)        (0,0) )

I know that from a performance point of view, it is not a good idea to mix up a row major matrix with a column view as in this example. Nevertheless, I find it quiet confusing (and worrying) that a column view can access elements of a matrix row. Is there something I'm missing here?

Moreover, this issue is only restricted to complex matrices M, i.e. changing the element data type of M to double yields the expected output (eigenvalues are written in the first column of buffer).

Comments (4)

  1. Klaus Iglberger

    Hi Tim!

    Thanks a lot for creating this issue. You are correct, in this case the result is written to the first row of the buffer matrix instead of the first column. The error is on our side, we have unfortunately missed to take non-contiguous vectors into account in the implementation of the eigen() functions. We will fix the issue right away. Thanks again for reporting this bug,

    Best regards,

    Klaus!

  2. Klaus Iglberger

    Commit 62400bf provides a fix for the eigen() functionality for using non-contiguous dense vectors. The fix is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.5.

  3. Log in to comment