Problem with ratlsq.f90 subroutine


Kither
03-20-2011, 12:44 PM
Hi all.
I'm using the subroutine ratlsq to find out the chebyshev rational approximation coefficients of exp(-x) (degree m=k=4 until 30).
The main program is very easy...just call the subroutine ratlsq.
I use the subroutine which are available on Recipes f90. The compiling goes well but when i try to run the program, it fails with these error.
I hope someone can help me because, this error is driving me crazy.

1)Compiling with:

-g95 -o main.f90 pythag_dp.f90 nr.f90 nrtype.f90 nrutil.f90 ratlsq.f90 ratval_v.f90 svbksb_dp.f90 svdcmp_dp.f90

when i run the program, the error is :
Exception: unknown exception 0xC000001E
At line 30 of file ratlsq.f90
(line 30 is: xs(npth:npt)=b-(b-a)*sin(theta*arth(npt-npth,-1,npt-npth+1))**2)

2) compiling with:
-g95 -ftrace=frame -o main.f90 pythag_dp.f90 nr.f90 nrtype.f90 nrutil.f90 ratlsq.f90 ratval_v.f90 svbksb_dp.f90 svdcmp_dp.f90

when i run the program, the error is :
Exception: unknown exception 0xC000001E
Traceback: (Innermost first)
At line 31 of file ratlsq.f90
(line 31 is: fs=func(xs))

3)compiling with:
-g95 -ftrace=full -o main.f90 pythag_dp.f90 nr.f90 nrtype.f90 nrutil.f90 ratlsq.f90 ratval_v.f90 svbksb_dp.f90 svdcmp_dp.f90

when i run the program, the error is :
Exception: unknown exception 0xC000001E
Traceback: (Innermost first)
At line 31 of file ratlsq.f90
(line 31 is: fs=func(xs))

Thanks a lot in advance.
Andrea

Kither
03-20-2011, 05:51 PM
It looks like a over-bound error but the sizes of arrays seem ok.
Very weird.

Kither
03-20-2011, 08:19 PM
Ok there was a problem when I passed the function to the routine... but now there is another... Line 40 runtime error: actual assumed shape array argument does not conform.

Problem with the assumed array arguments in the routine svdcmp? o problem of the compiler g95, which doesn't digest well these kind of arrays? advice?

line 40: call svdcmp_dp(u,w,v)

Kither
03-21-2011, 04:51 PM
The assumed shape arrays weren't digested very well by the compiler... So I passed to subroutines the dimension m and k of polynomials. Now the program runs, but the results are totaly wrong.

desplay:
ratlsq iteration= 1 max error= 1.718E+00
ratlsq iteration= 2 max error= 1.718E+00
ratlsq iteration= 3 max error= 1.718E+00
ratlsq iteration= 4 max error= 1.718E+00
ratlsq iteration= 5 max error= 1.718E+00
coefficients:
1.99155989055482
6.05837125184786
1.43978826497491
4.92188354022370
2.59218754136678



Please...Could anyone help me? I'm becoming crazy.
Thanks in advance.
A.

edit: I printed the coefficients: there is no change during the iteration. Something is wrong.

1.00004290343873 -0.504204994678529 8.363269740845265E-002
0.495404706845922 7.957687576717667E-002 err: 0.000000000000000
ratlsq iteration= 1 max error= 1.718E+00
1.99155989055482 6.05837125184786 1.43978826497491
4.92188354022370 2.59218754136678 err: 0.738747079195713
ratlsq iteration= 2 max error= 1.718E+00
1.99155989055482 6.05837125184786 1.43978826497491
4.92188354022370 2.59218754136678 err: 0.738747079195713
ratlsq iteration= 3 max error= 1.718E+00
1.99155989055482 6.05837125184786 1.43978826497491
4.92188354022370 2.59218754136678 err: 0.738747079195713
ratlsq iteration= 4 max error= 1.718E+00
1.99155989055482 6.05837125184786 1.43978826497491
4.92188354022370 2.59218754136678 err: 0.738747079195713
ratlsq iteration= 5 max error= 1.718E+00

Kither
03-23-2011, 09:31 PM
But is there an author or anybody else who can help me??? O_o

Kither
04-02-2011, 07:00 PM
Solved. I wrote a new program with the usual Remez algorithm.