Package: arpack
Severity: important
Tags: patch

Hi,
on the GNU Octave mailing list, the following issue was noted. It seems
that for some inputs, ARPACK causes a segfault in Octave. 

The issue was first noted in 2006[1]. A patch was sent to ARPACK
upstream, but there never was an answer.

The issue came up again last year[2]. 

So, I'm asking you include the attached patch in ARPACK. A test program
(segtest.m) for Octave is included. It segfaults Octave with current
ARPACK, when called as segtest(100).

[1] 
http://www-old.cae.wisc.edu/pipermail/octave-maintainers/2006-November/001230.html
[2] http://www-old.cae.wisc.edu/pipermail/bug-octave/2009-November/009818.html

BTW, I think there's something wrong with the orig tarball. It seems to
duplicate all source files and directories in a directory ARPACK.

Thanks
        Thomas

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

Kernel: Linux 2.6.26-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
*** ARPACK.orig/SRC/dneupd.f	2000-09-20 22:58:34.000000000 +0200
--- ARPACK/SRC/dneupd.f	2006-11-03 11:27:21.159925329 +0100
***************
*** 353,359 ****
       &           mode  , msglvl, outncv, ritzr   ,
       &           ritzi , wri   , wrr   , irr     ,
       &           iri   , ibd   , ishift, numcnv  ,
!      &           np    , jj 
        logical    reord
        Double precision 
       &           conds  , rnorm, sep  , temp,
--- 353,359 ----
       &           mode  , msglvl, outncv, ritzr   ,
       &           ritzi , wri   , wrr   , irr     ,
       &           iri   , ibd   , ishift, numcnv  ,
!      &           np    , jj    , nconv2
        logical    reord
        Double precision 
       &           conds  , rnorm, sep  , temp,
***************
*** 661,676 ****
       &                   workl(iuptri), ldh          , 
       &                   workl(invsub), ldq          , 
       &                   workl(iheigr), workl(iheigi), 
!      &                   nconv        , conds        ,
       &                   sep          , workl(ihbds) , 
       &                   ncv          , iwork        ,
       &                   1            , ierr)
  c
              if (ierr .eq. 1) then
                 info = 1
                 go to 9000
              end if
  c
              if (msglvl .gt. 2) then
                  call dvout (logfil, ncv, workl(iheigr), ndigit,
       &           '_neupd: Real part of the eigenvalues of H--reordered')
--- 661,681 ----
       &                   workl(iuptri), ldh          , 
       &                   workl(invsub), ldq          , 
       &                   workl(iheigr), workl(iheigi), 
!      &                   nconv2       , conds        ,
       &                   sep          , workl(ihbds) , 
       &                   ncv          , iwork        ,
       &                   1            , ierr)
  c
+             if (nconv2 .lt. nconv) then
+                nconv = nconv2
+             end if
+ 
              if (ierr .eq. 1) then
                 info = 1
                 go to 9000
              end if
  c
+ 
              if (msglvl .gt. 2) then
                  call dvout (logfil, ncv, workl(iheigr), ndigit,
       &           '_neupd: Real part of the eigenvalues of H--reordered')
*** ARPACK.orig/SRC/sneupd.f	2000-09-20 22:58:34.000000000 +0200
--- ARPACK/SRC/sneupd.f	2006-11-03 11:32:54.691913071 +0100
***************
*** 353,359 ****
       &           mode  , msglvl, outncv, ritzr   ,
       &           ritzi , wri   , wrr   , irr     ,
       &           iri   , ibd   , ishift, numcnv  ,
!      &           np    , jj 
        logical    reord
        Real 
       &           conds  , rnorm, sep  , temp,
--- 353,359 ----
       &           mode  , msglvl, outncv, ritzr   ,
       &           ritzi , wri   , wrr   , irr     ,
       &           iri   , ibd   , ishift, numcnv  ,
!      &           np    , jj    , nconv2
        logical    reord
        Real 
       &           conds  , rnorm, sep  , temp,
***************
*** 661,671 ****
       &                   workl(iuptri), ldh          , 
       &                   workl(invsub), ldq          , 
       &                   workl(iheigr), workl(iheigi), 
!      &                   nconv        , conds        ,
       &                   sep          , workl(ihbds) , 
       &                   ncv          , iwork        ,
       &                   1            , ierr)
  c
              if (ierr .eq. 1) then
                 info = 1
                 go to 9000
--- 661,675 ----
       &                   workl(iuptri), ldh          , 
       &                   workl(invsub), ldq          , 
       &                   workl(iheigr), workl(iheigi), 
!      &                   nconv2       , conds        ,
       &                   sep          , workl(ihbds) , 
       &                   ncv          , iwork        ,
       &                   1            , ierr)
  c
+             if (nconv2 .lt. nconv) then
+                nconv = nconv2
+             end if
+ 
              if (ierr .eq. 1) then
                 info = 1
                 go to 9000
*** ARPACK.orig/SRC/zneupd.f	2002-08-15 07:51:12.000000000 +0200
--- ARPACK/SRC/zneupd.f	2006-11-03 11:33:28.032312460 +0100
***************
*** 301,307 ****
       &           invsub, iuptri, iwev  , j    , ldh   , ldq   ,
       &           mode  , msglvl, ritz  , wr   , k     , irz   ,
       &           ibd   , outncv, iq    , np   , numcnv, jj    ,
!      &           ishift
        Complex*16
       &           rnorm, temp, vl(1)
        Double precision
--- 301,307 ----
       &           invsub, iuptri, iwev  , j    , ldh   , ldq   ,
       &           mode  , msglvl, ritz  , wr   , k     , irz   ,
       &           ibd   , outncv, iq    , np   , numcnv, jj    ,
!      &           ishift, nconv2
        Complex*16
       &           rnorm, temp, vl(1)
        Double precision
***************
*** 592,600 ****
              call ztrsen('None'       , 'V'          , select      ,
       &                   ncv          , workl(iuptri), ldh         ,
       &                   workl(invsub), ldq          , workl(iheig),
!      &                   nconv        , conds        , sep         , 
       &                   workev       , ncv          , ierr)
  c
              if (ierr .eq. 1) then
                 info = 1
                 go to 9000
--- 592,604 ----
              call ztrsen('None'       , 'V'          , select      ,
       &                   ncv          , workl(iuptri), ldh         ,
       &                   workl(invsub), ldq          , workl(iheig),
!      &                   nconv2       , conds        , sep         , 
       &                   workev       , ncv          , ierr)
  c
+             if (nconv2 .lt. nconv) then
+                nconv = nconv2
+             end if
+ 
              if (ierr .eq. 1) then
                 info = 1
                 go to 9000
*** ARPACK.orig/SRC/cneupd.f	2002-08-15 07:51:12.000000000 +0200
--- ARPACK/SRC/cneupd.f	2006-11-03 11:31:54.499802784 +0100
***************
*** 301,307 ****
       &           invsub, iuptri, iwev  , j    , ldh   , ldq   ,
       &           mode  , msglvl, ritz  , wr   , k     , irz   ,
       &           ibd   , outncv, iq    , np   , numcnv, jj    ,
!      &           ishift
        Complex
       &           rnorm, temp, vl(1)
        Real
--- 301,307 ----
       &           invsub, iuptri, iwev  , j    , ldh   , ldq   ,
       &           mode  , msglvl, ritz  , wr   , k     , irz   ,
       &           ibd   , outncv, iq    , np   , numcnv, jj    ,
!      &           ishift, nconv2
        Complex
       &           rnorm, temp, vl(1)
        Real
***************
*** 592,600 ****
              call ctrsen('None'       , 'V'          , select      ,
       &                   ncv          , workl(iuptri), ldh         ,
       &                   workl(invsub), ldq          , workl(iheig),
!      &                   nconv        , conds        , sep         , 
       &                   workev       , ncv          , ierr)
  c
              if (ierr .eq. 1) then
                 info = 1
                 go to 9000
--- 592,604 ----
              call ctrsen('None'       , 'V'          , select      ,
       &                   ncv          , workl(iuptri), ldh         ,
       &                   workl(invsub), ldq          , workl(iheig),
!      &                   nconv2       , conds        , sep         , 
       &                   workev       , ncv          , ierr)
  c
+             if (nconv2 .lt. nconv) then
+                nconv = nconv2
+             end if
+ 
              if (ierr .eq. 1) then
                 info = 1
                 go to 9000
function aerr = segtest (iter)
  %% This will seg-fault octave consistently, but not matlab.
  n=20;
  k=4; 
  A = 
sparse([3:n,1:n,1:(n-2)],[1:(n-2),1:n,3:n],[ones(1,n-2),4*ones(1,n),-ones(1,n-2)]);
  opts.disp = 0; opts.p = 19;
  aerr = 0;
  for i=1:iter
    [v1,d1] = eigs(A, k, 'sr', opts);
    d1 = diag(d1);
    merr = 0;
    for i=1:k
      newerr = max(abs((A - d1(i)*speye(n))*v1(:,i)));
      if (newerr > merr)
        merr = newerr;
      end
    end
    fprintf('Max Err: %g\n', merr);
    if (merr > aerr)
      aerr = merr;
    end
  end
end


Reply via email to