porting arapck code to octave
David Bateman
dbateman at dbateman.org
Sat Dec 20 10:23:34 CST 2008
Jaroslav Hajek wrote:
> 1. rather than your MY_LOCAL_BUFFER, you can use the pre-defined
> OCTAVE_LOCAL_BUFFER_INIT.
>
> 2. the following snippet:
> for (octave_idx_type i = 0; i < n; i++)
> workd[i+ipntr[1]-1] = static_cast<double>(i) * workd[i+ipntr[0]-1];
> is obviously not multiplying by diag(1:100), but by diag(0:99).
>
> 3.
> retval(1) = eig_val;
> retval(2) = eig_vec;
>
> should read
>
> retval(0) = eig_val;
> retval(1) = eig_vec;
>
> after correcting these problems, I get the correct answer:
> ans =
>
> 97.000
> 98.000
> 99.000
> 100.000
>
> regards
>
>
>
Unfortunately, that doesn't work for me as it never gets to point 3) and
in any case point 2) would just mean the eigenvalues that are found
should be [99, 98, 97, 96]... The code has an internal error in the
arpack function dsaupd (error number -9999).. However, as it seems to
work for you the question is why it works for you and not me...
Basically, I can only see compiler/linker issues as a reason at the
moment.. I compiled with gfortran version 4.3.2 and the flags
FFLAGS = -O2 -fPIC
and linked dssimp.oct against the shared version of the library. What
did you do differently?
D.
--
David Bateman dbateman at dbateman.org
35 rue Gambetta +33 1 46 04 02 18 (Home)
92100 Boulogne-Billancourt FRANCE +33 6 72 01 06 33 (Mob)
More information about the Octave-maintainers
mailing list