Bug in matrix exponential

Issue #351 resolved
Konstantin created an issue

First of all, thank you for this amazing library!

Consider the computation of the following matrix exponential:

std::complex<double> I(0, 1);
blaze::DynamicMatrix<std::complex<double>> A {
    {0,      0,               0,     0},
    {0,  -20.0,               0,     0},
    {0,      0, -20.0 - 180.0*I,     0},
    {0,      0,               0, -20.0} };

std::cout << blaze::matexp(A);

On my computer blaze returns the result (sorry for the formatting)

( (1,0) (0,0) (0,0) (0,0) )
( (0,0) (2.06115e-09,0) (0,0) (0,0) )
( (0,0) (0,0) (2.57639e+22,1.24726e+23) (0,0) )
( (0,0) (0,0) (0,0) (2.06115e-09,0) )

The huge matrix element (2.57639e+22,1.24726e+23) is incorrect. Both Mathematica and the Eigen library return the correct result

( (1,0) (0,0) (0,0) (0,0) )
( (0,0) (2.06115e-09,0) (0,0) (0,0) )
( (0,0) (0,0) (-1.23352e-09,1.6513e-09) (0,0) )
( (0,0) (0,0) (0,0) (2.06115e-09,0) )

Comments (4)

  1. Klaus Iglberger

    Hi Konstantin!

    Thanks a lot for pointing out this defect. With your minimum example the issue is easy to reproduce. We apologize for the inconvenience and will try to fix the issue as quickly as possible. Thanks again,

    Best regards,

    Klaus!

  2. Klaus Iglberger

    Commit 69e2fe5 fixes the matrix exponential kernels. The fix is immediately available via cloning the Blaze repository and will be officially released in Blaze 3.8.

  3. Log in to comment