[DRE-maint] Bug#994241: ruby-lapack autopkgtest needs to be adapted for LAPACK 3.10

Sébastien Villemot sebastien at debian.org
Tue Sep 14 14:23:20 BST 2021


Package: ruby-lapack
Version: 1.8.1-1
Severity: serious
Tags: sid bookworm
X-Debbugs-CC: debian-ci at lists.debian.org
User: debian-ci at lists.debian.org
Usertags: needs-update

Dear Maintainer,

Since the upload of lapack 3.10.0-1, the autopkgtest of ruby-lapack
fails in unstable. See for example:
https://ci.debian.net/data/autopkgtest/unstable/amd64/r/ruby-lapack/15155031/log.gz

More precisely, the tests about generalized singular value
decomposition (GSVD) fail.

Mathematically, the GSVD does not have a unique solution. For some
reason, lapack 3.10 now returns a different (still valid) solution, but
the ruby-lapack testsuite hardcodes another, specific, solution.

Please find attached a Fortran 2008 source code through which I
verified that the decomposition given by both lapack 3.9 and 3.10 is
valid, though the Q matrix is different between the two versions. The
code needs to be compiled with gfortran, and linked against -llapack. I
verified only the double float decomposition (dggsvd), but the single
float decomposition test (sggsvd) most likely fails for the same
reason.

The testsuite of ruby-lapack thus needs to be adapted, by allowing
alternative solutions (either accept both the old and the new
solutions, or completely rethink the test by only verifying the the
decomposition is valid as I did in my program).

N.B. : when trying to reproduce the problem, please ensure that your
lapack alternative (as given by “update-alternatives --display
liblapack.so.3-x86_64-linux-gnu) points to /usr/lib/x86_64-linux-
gnu/lapack/liblapack.so.3, and not to the binary provided by either
openblas or atlas (because these two have not yet been recompiled
against lapack 3.10, and thus do not expose the problem).

Best regards,

-- 
⢀⣴⠾⠻⢶⣦⠀  Sébastien Villemot
⣾⠁⢠⠒⠀⣿⡁  Debian Developer
⢿⡄⠘⠷⠚⠋⠀  https://sebastien.villemot.name
⠈⠳⣄⠀⠀⠀⠀  https://www.debian.org



-------------- next part --------------
program ggsvd
  use iso_fortran_env
  implicit none

  interface
     subroutine dggsvd(jobu, jobv, jobq, m, n, p, k, l, a, lda, b, &
          ldb, alpha, beta, u, ldu, v, ldv, q, ldq, work, &
          iwork, info)
       import :: real64
       real(real64), dimension(*), intent(inout) :: a, b
       real(real64), dimension(*), intent(out) :: alpha, beta, q, u, v, work
       character, intent(in) :: jobq, jobu, jobv
       integer, intent(in) :: lda, ldb, ldq, ldu, ldv, m, n, p
       integer, intent(out) :: info, k, l
       integer, dimension(*), intent(out) :: iwork
     end subroutine dggsvd
  end interface

  real(real64) :: a(4,3), b(2,3), alpha(3), beta(3), u(4,4), v(2,2), q(3,3), work(12), d1(4,3), d2(2,3), a_bak(4,3), b_bak(2,3)
  integer :: info, k, l, iwork(3)

  a = reshape(source = [ real(real64) :: 1., 3., 4., 7., 2., 2., 5., 8., 3., 1., 6., 8. ], shape = [4,3])
  b = reshape(source = [ real(real64) :: -2., 4., -3., 6., 3., 5. ], shape = [ 2, 3 ])

  print '("A=",/,4(3es12.4,:,/))', transpose(a)
  print '("B=",/,2(3es12.4,:,/))', transpose(b)

  a_bak = a
  b_bak = b

  call dggsvd("U", "V", "Q", 4, 3, 2, k, l, a, 4, b, 2, alpha, beta, u, 4, v, 2, q, 3, work, iwork, info)

  print '("U=",/,4(4es12.4,:,/))', transpose(u)
  print '("V=",/,2(2es12.4,:,/))', transpose(v)
  print '("Q=",/,3(3es12.4,:,/))', transpose(q)
  print '("k=",i1)', k
  print '("l=",i1)', l

  if (k /= 1) stop "k is incorrect"
  if (l /= 2) stop "l is incorrect"

  ! We are in the case where M-K-L>0
  ! Also note that N-K-L=0

  d1 = 0._real64
  d1(1,1) = 1._real64
  d1(2,2) = alpha(2)
  d1(3,3) = alpha(3)

  d2 = 0._real64
  d2(1,2) = beta(2)
  d2(2,3) = beta(3)

  associate (r => a(1:3,1:3))
    associate (a2 => matmul(u, matmul(d1, matmul(r, transpose(q)))), &
         b2 => matmul(v, matmul(d2, matmul(r, transpose(q)))))
      print '("Error on reconstructed A: ", es12.4)', maxval(abs(a_bak-a2))
      print '("Error on reconstructed B: ", es12.4)', maxval(abs(b_bak-b2))
    end associate
  end associate
end program ggsvd
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://alioth-lists.debian.net/pipermail/pkg-ruby-extras-maintainers/attachments/20210914/088ed48a/attachment.sig>


More information about the Pkg-ruby-extras-maintainers mailing list