help-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-gsl] Error handling problem


From: Vicky Landsman
Subject: [Help-gsl] Error handling problem
Date: Mon, 3 Jul 2006 11:51:55 +0200

Greetings everyone, 
I am running a large simulation study on R (S-plus). My study requires a rather 
difficult integration. I perform it by use of C code which includes the call to 
the gsl library, function qags. 
Here is a relevant piece of code: 
/*C code for computing the denominator */
#include<stdio.h>
#include<math.h>
#include<gsl/gsl_integration.h>

....

void Denom (double  *x,long    *n,
                                                long    *p,
                                                double  *params,
                                                double  *delta,
                                                double  *res )
{
   
             
        struct my_params my_p;
        double err;
        gsl_integration_workspace *w;
        gsl_function F;
                
        my_p.sigma  = *(params);
        my_p.gamma0 = *(params+1);
        my_p.alpha0 = *(params+2);
        my_p.delta  = *(delta);

         F.function=&my_fun;
        
          int i;
 for (i = 0;i < *n;i ++){
                my_p.alphaX = CreateAlphaX(i,x,n,p,params);
                my_p.bethaX = CreateBethaX(i,x,n,p,params);
                F.params=&my_p;
                w=gsl_integration_workspace_alloc(1000);
                gsl_integration_qags(&F,-50,50,0,1e-7,1000,w,(res+i),&err);
                gsl_integration_workspace_free(w);
        }
}
         

Usually all goes fine. 
Sometimes, it happens that I receive the following message
gsl: qags.c:553: ERROR: bad integrand behavior found in the integration interval
Default GSL error handler invoked.
and the whole job is aborted. 


Could you help me please to catch this error but continue the program? I tried 
to follow your manuals but failed to apply your recommendations in my case. 


Much thanks, 
Victoria Landsman. 


reply via email to

[Prev in Thread] Current Thread [Next in Thread]