LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-31-2009, 04:50 PM   #1
brownflamigo1
Member
 
Registered: Jun 2007
Distribution: Ubuntu
Posts: 90

Rep: Reputation: 15
Fortran routine returns an error that I cannot interpret


Hello Everyone!

This was the first time I had to program in Fortran (77). I need to implement an Unequal Error Protection piece where a double integral is present. I am using a provided DBLIN (IMSL library) routine for the integral itself and pass all the necessary arguments into it (like the function of two variables, the integration limits and etc.).
Most probably, there is a problem in my program, but I cannot find any idea on how to resolve it...

The error I get is:
Code:
*** TERMINAL ERROR          (IER = 133) FROM IMSL ROUTINE DBLIN 
*** TERMINAL ERROR          (IER = 133) FROM IMSL ROUTINE DBLIN
The DBLIN function description says that this error indicates:
Quote:
C IER = 133 INDICATES THAT AERR.LE.0.0
What could exactly be causing it?

The code of my program is:
Code:
PROGRAM MAIN
      implicit DOUBLE PRECISION (a-h,o-z)
      common sig,d1,r1,Ms
      open(13,file='C.dat')
c      INTEGER    IRULE, NOUT
c      REAL       A, B, ERRABS, ERREST, ERRREL, F, G, H, RESULT
        

    	do 10 isnrdb=1,15
    	
c    	d0 = 0.8944D0
c   	r0 = 0.4472D0  
    	d1 = 0.4472D0 
    	r1 = 0.8944D0
    	A = -7.0
    	B = 7.0
    	ERRABS = 0.0
        ERRREL = 0.01
        IRULE = 6
    	

    	mm = 4D0
    	Ms = 2D0**mm
    	pm = 1D0

        snr = 10.D0**(DBLE(isnrdb)/10.D0)
        sig = (pm/snr)/2.D0

c	write(*,*) 'The value of temp is: ',temp(2.D0,3.D0,0.D0,0.D0)
	write(*,*) 'The finsum:',finsum(2.D0,3.D0)
	MM = dblin(finsum,A,B,G,H,ERRABS,ERROR,IER)
	write(*,*) 'AA:',dblin(finsum,A,B,G,H,ERRABS,ERROR,IER)

c        write(13,*) isnrdb, sngl(C)


 10   continue

	END

c	----------------------------------------------	

c	This function performs the final summation
c	before the integration of the two sums.
c	Param: aa-bb,cc-dd are the two intervals for
c	the performance of the summatioon function.
      function finsum(rre,rim) 
      implicit double precision (a-h,o-z)
      common sig,d1,r1,Ms
      
      aa=0.D0
      bb=0.D0
      cc=6.D0
      dd=6.D0

      finsum = 0.D0
      finsum = finsum+temp(rre,rim,aa,bb)
      finsum = finsum+temp(rre,rim,cc,dd)
      return
      end


c	This function performs an intermediate step in
c	the capacity calculation process.
c	Param: aa-bb,cc-dd are the two intervals for
c	the performance of the summatioon function.
      function temp(rre,rim,aa,bb) 
      implicit double precision (a-h,o-z)
      common sig,d1,r1,Ms

      temp = 0.D0
      bot = psum(rre,rim,aa,bb)+psum(rre,rim,cc,dd) 
c      write(*,*) 'The value of BOT is: ', bot
      do 180 i=aa,bb
		  sir=DBLE(-r1+(i/5)*d1)
		  sii=DBLE(-r1+MOD(i,5)*d1)
		  
		  int1111 = qpdf(rre,rim,sir,sii)/bot
		  int111 = dlog(DBLE(int1111))/dlog(2.D0)
		  int111 = int111+dlog(DBLE(Ms/8))/dlog(2.D0)
c		  int11 = int111*qpdf(rre,rim,sir,sii)
c		  write(*,*) 'The valueis: ', int111*qpdf(rre,rim,sir,sii)
		  temp = temp+int111*qpdf(rre,rim,sir,sii)
 180  continue
 
c      do 190 i=cc,dd
c		  sir=DBLE(-r1+(i/5)*d1)
c		  sii=DBLE(-r1+MOD(i,5)*d1)
c		  
c		  int1111 = qpdf(rre,rim,sir,sii)/bot
c		  int111 = dlog(DBLE(int1111))/dlog(2.D0)
c		  int111 = int111+dlog(DBLE(Ms/8))/dlog(2.D0)
c		  int11 = int111*qpdf(rre,rim,sir,sii)
c		  temp = temp + int11 
c 190  continue
c      temp = temp/1.D0
c      write(*,*) 'inter1:', temp/1.D0
      return
      end

c	This function performs a summation of probability 
c	density function from a to b, with individual
c 	spacing for each of the constellation points.
c	Param: [a;b] is the summation interval.
c	Internally only the qpdf is used.
c
c	DBLE converts value to a double precision real.
c	Functionality compared to MATLAB
      function psum(rre,rim,a,b) 
      implicit double precision (a-h,o-z)
      common sig,d1,r1,Ms

      psum = 0.D0
      
      do 200 i=a,b
		  sir=DBLE(-r1+(i/5)*d1)
		  sii=DBLE(-r1+MOD(i,5)*d1)
c		  write(*,*) 'The value of arg is: ',arg
c		  write(*,*) 'The value of sir is: ', sir
		  psum = psum + qpdf(rre,rim,sir,sii) 
 200  continue
      psum = psum
      return
      end


c	This function defines a 2-dimensional pdf for further
c	mapping of the QAM constellation points.

c	Functionality compared to MATLAB
      function qpdf(r_r, r_i, si_r, si_i)
      implicit double precision (a-h,o-z)
      common sig,d1,r1,Ms
      
      PI=3.141592654D0
      t=(1.D0/(2.D0*PI*sig)) * dexp(-(r_i-si_i)**2/(2.D0*sig)) 
      qpdf = t * dexp(-(r_r-si_r)**2/(2.D0*sig)) 
      return
      end
      
c	The following two functions define the inner limits      
      REAL FUNCTION G (X)
      REAL       X
      G = -7.0
      RETURN
      END

      REAL FUNCTION H (X)
      REAL       X
      H = 7.0
      RETURN
      END

The routine for double integral I use is available at this location.


Any help is much appreciated.
 
Old 09-01-2009, 01:13 AM   #2
neonsignal
Senior Member
 
Registered: Jan 2005
Location: Melbourne, Australia
Distribution: Debian Bookworm (Fluxbox WM)
Posts: 1,391
Blog Entries: 54

Rep: Reputation: 360Reputation: 360Reputation: 360Reputation: 360
You are passing in a desired absolute error of 0 (your parameter ERRABS) to dblin. This would mean it would have to do a numerical integration over an infinite number of points. So dblin returns an error instead.

--

"I'm livin' in the 70's
I feel like I lost my keys
Got the right day but I got the wrong week
And I get paid for just bein' a freak"

Last edited by neonsignal; 09-01-2009 at 01:20 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
GRASS GIS 6.2.2 BadAlloc Error Causes Crash on Previously Usable Data & Routine joek Linux - Software 0 09-22-2007 06:27 PM
g77 in gcc 4.1.0 not found only gfortran fortran 95 compiler! I need fortran 77. TheBrick Linux - Software 3 07-04-2007 06:39 AM
NagiosGrapher: any perl expert to help interpret error? Akhran Linux - Software 3 04-20-2007 09:23 AM
does linux fortran compiler in fedora 4 support VAX FORTRAN? terrence Programming 17 08-31-2005 08:59 AM
Who is able to interpret this USB error message PGPGPG Linux - Hardware 2 05-19-2003 05:22 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:24 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration