GremlinEq
fraction_macros.h
1 //---------------------------------------------------------------------------
2 //
3 // $Id: fraction_macros.h,v 1.1 2013/05/17 15:30:12 sahughes Exp $
4 //
5 //---------------------------------------------------------------------------
6 
7 /* fractions_macros.h
8  * macros related to the continued fractions
9  */
10 
11 #define PREP_ALPHAGAMMA(type) \
12  /* constants for alpha_n gamma_{n+1} */ \
13  const Real ag_mult = 4*epsilonsq*(1 - q*q); \
14  /* the rt variables are minus the linear roots of the poly */ \
15  const type ag_rt1 = nu; \
16  const type ag_rt2 = nu + 2.0; \
17  const type ag_rt3 = nu - 0.5; \
18  const type ag_rt4 = nu + 2.5; \
19  /* the qoff variables are the offsets for the quadratic terms */ \
20  const type ag_qoff_e1 = nu - 1.0; \
21  const type ag_qoff_e2 = nu + 3.0; \
22  const type ag_qoff_t = nu + 1.0
23 #define alphagamma(n) \
24  ({ typeof(ag_qoff_e1) macroa1 = (n)+ag_qoff_e1; \
25  typeof(ag_qoff_e2) macroa2 = (n)+ag_qoff_e2; \
26  typeof(ag_qoff_t) macroa3 = (n)+ag_qoff_t; \
27  ag_mult * ((n)+ag_rt1) * ((n)+ag_rt2) * ((n)+ag_rt3) * ((n)+ag_rt4) \
28  *(macroa1*macroa1 + epsilonsq) * (macroa2*macroa2 + epsilonsq) \
29  *(macroa3*macroa3 + tausq); })
30 
31 #define PREP_BETA(type) \
32  /* constants for beta_n */ \
33  /* offsets for the inner n calculation */ \
34  const type b_off_in1 = nu; \
35  const type b_off_in2 = nu + 1.0; \
36  /* the outer roots */ \
37  const type b_rt1 = nu + 1.5; \
38  const type b_rt2 = nu - 0.5; \
39  /* the additive things for the inner calulation */ \
40  const Real b_add1 = 2*epsilonsq - epsilon*m*q - lambda - 2; \
41  const Real b_add2 = epsilon*(epsilon - m*q)*(4 + epsilonsq)
42 #define beta(n) \
43  ({ typeof(b_off_in1) macrob1 = ((n) + b_off_in1) * ((n) + b_off_in2); \
44  4.0 * (macrob1*(macrob1 + b_add1) + b_add2) \
45  * ((n) + b_rt1) * ((n) + b_rt2); })
46 
47 #define PREP_ALPHA() \
48  const Real kappa = Sqrt(1-q*q); \
49  const Complex iepskappa = I*epsilon*kappa; \
50  const Real tau = (epsilon - m*q)/kappa
51 #define alpha(n) \
52  ({ typeof(nu) macroa_1 = (n) + nu; \
53  typeof(macroa_1) macroa_2 = macroa_1 - 1.0; \
54  iepskappa * macroa_1 * (2.0*macroa_1 - 1.0) \
55  * (macroa_2*macroa_2 + epsilonsq) * (macroa_1 + 1.0 + I*tau); })
56 
57 #define PREP_GAMMA() \
58  const Real kappa = Sqrt(1-q*q); \
59  const Complex iepskappa = I*epsilon*kappa; \
60  const Real tau = (epsilon - m*q)/kappa
61 #define gamma(n) \
62  ({ typeof(nu) macrog_1 = (n) + nu; \
63  typeof(macrog_1) macrog_2 = macrog_1 + 2.0; \
64  -iepskappa * (macrog_1 + 1.0) * (2.0*macrog_1 + 3.0) \
65  * (macrog_2*macrog_2 + epsilonsq) * (macrog_1 - I*tau); })
66 
67 #define PREP_ALPHA_GAMMA() \
68  const Real kappa = Sqrt(1-q*q); \
69  const Complex iepskappa = I*epsilon*kappa; \
70  const Real tau = (epsilon - m*q)/kappa