src/_fastcorr.c
int compute_jnu_psi_dpsi(int nu, int N, double h,
			 double*jnu, double*xi, double*psi, double*dpsi){
  int i;
  double t, PIsinht;
  double pi_over_h = PI/h;
  for(i = 0; i < N; i++){
    t = h*xi[i];
    PIsinht = PI*sinh(t);
    
    psi[i] = t * tanh(0.5*PIsinht);
    dpsi[i] = (PI*t*cosh(t) + sinh(PIsinht))/(1+cosh(PIsinht));
    if (dpsi[i]!=dpsi[i]) dpsi[i] = 1.0;//avoids NaNs

    if (nu == 0){
      jnu[i] = gsl_sf_bessel_j0(pi_over_h * psi[i]);
    }else if(nu == 1){
      jnu[i] = gsl_sf_bessel_j1(pi_over_h * psi[i]);
    }else if(nu == 2){
      jnu[i] = gsl_sf_bessel_j2(pi_over_h * psi[i]);
    }else{//nu is not 0, 1, or 2
      jnu[i] = gsl_sf_bessel_jl(nu, pi_over_h * psi[i]);
    }
  }
  return 0;
}
/* Compute the spherical bessel function j_nu, 
 * psi, and its derivative (dpsi) given N and h.
 */
Compute the spherical bessel function j_nu,
psi, and its derivative (dpsi) given N and h.
Compute the spherical bessel function j_nu psi and its derivative ( dpsi ) given N and h .
int compute_jnu_psi_dpsi(int nu, int N, double h,
			 double*jnu, double*xi, double*psi, double*dpsi){
  int i;
  double t, PIsinht;
  double pi_over_h = PI/h;
  for(i = 0; i < N; i++){
    t = h*xi[i];
    PIsinht = PI*sinh(t);
    psi[i] = t * tanh(0.5*PIsinht);
    dpsi[i] = (PI*t*cosh(t) + sinh(PIsinht))/(1+cosh(PIsinht));
    if (dpsi[i]!=dpsi[i]) dpsi[i] = 1.0;
    if (nu == 0){
      jnu[i] = gsl_sf_bessel_j0(pi_over_h * psi[i]);
    }else if(nu == 1){
      jnu[i] = gsl_sf_bessel_j1(pi_over_h * psi[i]);
    }else if(nu == 2){
      jnu[i] = gsl_sf_bessel_j2(pi_over_h * psi[i]);
    }else{
      jnu[i] = gsl_sf_bessel_jl(nu, pi_over_h * psi[i]);
    }
  }
  return 0;
}
int compute_jnu_psi_dpsi ( int nu , int N , double h , double * jnu , double * xi , double * psi , double * dpsi ) { int i ; double t , PIsinht ; double pi_over_h = PI / h ; for ( i = 0 ; i < N ; i ++ ) { t = h * xi [ i ] ; PIsinht = PI * sinh ( t ) ; psi [ i ] = t * tanh ( 0.5 * PIsinht ) ; dpsi [ i ] = ( PI * t * cosh ( t ) + sinh ( PIsinht ) ) / ( 1 + cosh ( PIsinht ) ) ; if ( dpsi [ i ] != dpsi [ i ] ) dpsi [ i ] = 1.0 ; if ( nu == 0 ) { jnu [ i ] = gsl_sf_bessel_j0 ( pi_over_h * psi [ i ] ) ; } else if ( nu == 1 ) { jnu [ i ] = gsl_sf_bessel_j1 ( pi_over_h * psi [ i ] ) ; } else if ( nu == 2 ) { jnu [ i ] = gsl_sf_bessel_j2 ( pi_over_h * psi [ i ] ) ; } else { jnu [ i ] = gsl_sf_bessel_jl ( nu , pi_over_h * psi [ i ] ) ; } } return 0 ; }
Compute the spherical bessel function j_nu,
 psi, and its derivative (dpsi) given N and h.
Compute the spherical bessel function j_nu psi and its derivative ( dpsi ) given N and h .
//avoids NaNs //nu is not 0, 1, or 2