Bug#1037242: liblapacke: dsyev() only returns upper/lower triangle of eigenvector matrix

David Houseman david at grey-house.net
Fri Jun 9 11:16:44 BST 2023


Package: liblapacke
Version: 3.9.0-3
Severity: important
X-Debbugs-Cc: david at grey-house.net

Hello,

Given a symmetric matrix, LAPACKE dsyev() should return in place the matrix of eigenvectors
(when JOBZ = 'V'). The eigenvector matrix is not symmetric (it is orthogonal). However,
it appears that dsyev() only returns the upper/lower triangle of the eigenvector matrix,
which is not enough to easily construct the full eigenvector matrix.


Example (compile with gcc main.c -llapacke):

#include "stdio.h"
#include "lapacke.h"

int main()
{
    const int N = 2;
    double a[2*2] = { 1.0, 0.5, 0.5, 1.0 };
    double s[2];

    printf( "input:\n" );
    printf( "%f %f\n", a[0], a[1] );
    printf( "%f %f\n", a[2], a[3] );

    LAPACKE_dsyev( LAPACK_ROW_MAJOR, 'V', 'U', N, a, N, s );

    printf( "output:\n" );
    printf( "%f %f\n", a[0], a[1] );
    printf( "%f %f\n", a[2], a[3] );

    return 0;
}

Output:

input:
1.000000 0.500000
0.500000 1.000000
output:
-0.707107 0.707107
0.500000 0.707107

Problem:
The 0.5 in the output lower triangle should be 0.707107.
There is the opposite problem if UPLO = 'L'.
This problem applies to symmetric matrices of all sizes.

I reported this problem to the library authors at
  https://github.com/Reference-LAPACK/lapack/issues/850
and they have indicated that this problem is fixed upstream.

This is a fairly critical problem that would silently lead
to quite wrong answers for certain mathematical techniques
possibly including symmetric matrix inversion and/or
multilinear regression. I think it would be better to have
it fixed but I have no idea how difficult it would be to
patch debian stable. I will try the new debian testing and
see whether it is also affected.

Thank you very much,

David Houseman


-- System Information:
Debian Release: 11.7
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-21-amd64 (SMP w/4 CPU threads)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages liblapacke depends on:
ii  libblas3 [libblas.so.3]                3.9.0-3
ii  libc6                                  2.31-13+deb11u6
ii  liblapack3 [liblapack.so.3]            3.9.0-3
ii  libopenblas0-pthread [liblapack.so.3]  0.3.13+ds-3
ii  libtmglib3                             3.9.0-3

liblapacke recommends no packages.

liblapacke suggests no packages.

-- no debconf information



More information about the debian-science-maintainers mailing list