Package: libarpack2
Version: 2.1-8
Severity: normal
Tags: patch

This evening, I ran into a pretty frustrating problem with ARPACK. It
aborted without being able to compute an Arnoldi factorization from
within a custom Python extension, but the same snippet of code (with the same 
matrix!)
would work just fine when executed from the command line in a plain C++
program.

To make a long story short, I eventually tracked down the root cause:
Both LAPACK and ARPACK define a routine called SECOND, but with
different call signatures. LAPACK's copy is a function, whereas ARPACK's
copy is a subroutine. Usually, all goes well, and the linker is
intelligent enough to pick the right copy in all instances. I was
unfortunate enough to be in a situation where that was not the case. The
call to the wrong SECOND messed up the stack, and things got really
strange from there. (For example, DLARNV returned a NaN instead of a
proper number.) Apparently, the dynamic linker that loaded the Python
module resolved the SECOND symbol in ARPACK to the LAPACK one.

Hence, the ARPACK-supplied SECOND routine needs to be renamed. The
attached patch (a revised version of a quick sed job) realizes this
suggestion by renaming the routine to ARSCND (as in "ARpack SeCoND"),
which fixed the problem for me.  Apparently, somebody else on the Octave
team [1] ran into a similar problem, but got only unhelpful replies.

Andreas

[1] http://www.octave.org/octave-lists/archive/help-octave.2004/msg01466.html

-- System Information:
Debian Release: testing/unstable
  APT prefers testing
  APT policy: (500, 'testing'), (99, 'unstable')
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.11
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)

Versions of packages libarpack2 depends on:
ii  atlas3-base [liblapack.s 3.6.0-19        Automatically Tuned Linear Algebra
ii  blas                     1.1-14          Basic Linear Algebra Subroutines, 
ii  lapack3 [liblapack.so.3] 3.0.20000531a-6 library of linear algebra routines
ii  libc6                    2.3.2.ds1-22    GNU C Library: Shared libraries an
ii  refblas3 [libblas.so.3]  1.2-8           Basic Linear Algebra Subroutines 3

-- no debconf information

Attachment: arpack-arscnd-2.patch.gz
Description: Binary data

Reply via email to