From: Arjen M. <arj...@wl...> - 2003-09-25 06:35:48
|
Jo=E3o Cardoso wrote: >=20 > On Thursday 25 September 2003 01:45, Alan W. Irwin wrote: > | On 2003-09-25 00:27+0100 Jo=E3o Cardoso wrote: > | > On Wednesday 24 September 2003 20:26, Alan W. Irwin wrote: > | > | You misunderstood what I said. I am not advocating incorporatin= g the > | > | relevant part of lapack source into plplot. As you say, that is= much > | > | too big, and also I would be concerned about supporting it. Ins= tead, > | > | I am advocating simply *linking* to lapack which should be > | > | straightforward with the help of cfortran.h. > | > > | > Yes, that is the fast and simplest solution. But overkill; after a= ll we > | > are replacing a 230 lines function by a whole library! It would be= much > | > better if we could find a single file svd.c. > | > | If you could find ~200-line SVD code written in C >=20 > I was talking about the SVD NR code included in csa.c, it's 232 lines. >=20 > I had already searched netlib and gams, but stoped at (c)lapack; howeve= r, > eispack has an almost self-contained svd.f: > http://www.netlib.org/cgi-bin/netlibfiles.pl?filename=3D/eispack/svd.f >=20 > After converting it to C with the help of f2c, it resulted in a 577 lin= es file > (the original fortrans code has 358 lines of code). However I get an > undefined symbol when trying to link with a dummy main(): >=20 > jcard@linux:~/Desktop/eispack> gcc test.c svd.o pythag.o -o test -lm > svd.o(.text+0x363): In function `svd_': > : undefined reference to `d_sign' > svd.o(.text+0x784): In function `svd_': > : undefined reference to `d_sign' > svd.o(.text+0x16ae): In function `svd_': > : undefined reference to `d_sign' > collect2: ld returned 1 exit status >=20 > Of course using f2c means linking with -lf2c, but perhaps that could be > avoided in our case, as we don't need entry/exit points. Your knowledge= of > fortran can be helpfull -- I don't even know how to call the subrotine = :( > Can you help? >=20 >From the Fortran code I see that dsign() is a function. I do not know what f2c makes out of this, but this is my educated guess: double d_sign( double v, double w ) { if { w >=3D 0.0 } {=20 return abs(v) ;=20 } else { return -abs(v) ; } } (You transfer the sign of w to the first argument) Regards, Arjen |