Skip to content

Commit

Permalink
move some Fermi integral coefficients to static arrays (#1371)
Browse files Browse the repository at this point in the history
no need to set these each time we enter the function
  • Loading branch information
zingale authored Oct 28, 2023
1 parent 5dd1a91 commit 8b48c02
Showing 1 changed file with 88 additions and 88 deletions.
176 changes: 88 additions & 88 deletions neutrinos/sneut5.H
Original file line number Diff line number Diff line change
Expand Up @@ -15,49 +15,48 @@ Real ifermi12(const Real f)
// maximum error is 4.19e-9_rt. reference: antia apjs 84,101 1993

// declare work variables
int m1,k1,m2,k2;
Real an,rn,den,ff;
Array1D<Real, 1, 5> a1;
Array1D<Real, 1, 4> b1;
Array1D<Real, 1, 7> a2;
Array1D<Real, 1, 6> b2;
Real rn,den,ff;

// the return value
Real ifermi12r;

// load the coefficients of the expansion from Table 8 of Antia

an = 0.5e0_rt;
m1 = 4;
k1 = 3;
m2 = 6;
k2 = 5;

a1(1) = 1.999266880833e4_rt;
a1(2) = 5.702479099336e3_rt;
a1(3) = 6.610132843877e2_rt;
a1(4) = 3.818838129486e1_rt;
a1(5) = 1.0e0_rt;

b1(1) = 1.771804140488e4_rt;
b1(2) = -2.014785161019e3_rt;
b1(3) = 9.130355392717e1_rt;
b1(4) = -1.670718177489e0_rt;

a2(1) = -1.277060388085e-2_rt;
a2(2) = 7.187946804945e-2_rt;
a2(3) = -4.262314235106e-1_rt;
a2(4) = 4.997559426872e-1_rt;
a2(5) = -1.285579118012e0_rt;
a2(6) = -3.930805454272e-1_rt;
a2(7) = 1.0e0_rt;

b2(1) = -9.745794806288e-3_rt;
b2(2) = 5.485432756838e-2_rt;
b2(3) = -3.299466243260e-1_rt;
b2(4) = 4.077841975923e-1_rt;
b2(5) = -1.145531476975e0_rt;
b2(6) = -6.067091689181e-2_rt;
constexpr Real an{0.5e0_rt};
constexpr int m1{4};
constexpr int k1{3};
constexpr int m2{6};
constexpr int k2{5};

const Array1D<Real, 1, 5> a1 = {
1.999266880833e4_rt,
5.702479099336e3_rt,
6.610132843877e2_rt,
3.818838129486e1_rt,
1.0e0_rt};

const Array1D<Real, 1, 4> b1 = {
1.771804140488e4_rt,
-2.014785161019e3_rt,
9.130355392717e1_rt,
-1.670718177489e0_rt};

const Array1D<Real, 1, 7> a2 = {
-1.277060388085e-2_rt,
7.187946804945e-2_rt,
-4.262314235106e-1_rt,
4.997559426872e-1_rt,
-1.285579118012e0_rt,
-3.930805454272e-1_rt,
1.0e0_rt};

const Array1D<Real, 1, 6> b2 = {
-9.745794806288e-3_rt,
5.485432756838e-2_rt,
-3.299466243260e-1_rt,
4.077841975923e-1_rt,
-1.145531476975e0_rt,
-6.067091689181e-2_rt};

if (f < 4.0e0_rt) {

Expand Down Expand Up @@ -125,64 +124,65 @@ Real zfermim12(const Real x)
// reference: antia apjs 84,101 1993

// declare work variables
int m1,k1,m2,k2;
Real rn,den,xx;
Array1D<Real, 1, 8> a1,b1;
Array1D<Real, 1, 12> a2,b2;

// return value
Real zfermim12r;

// load the coefficients of the expansion from Table 2 of Antia

m1 = 7;
k1 = 7;
m2 = 11;
k2 = 11;

a1(1) = 1.71446374704454e7_rt;
a1(2) = 3.88148302324068e7_rt;
a1(3) = 3.16743385304962e7_rt;
a1(4) = 1.14587609192151e7_rt;
a1(5) = 1.83696370756153e6_rt;
a1(6) = 1.14980998186874e5_rt;
a1(7) = 1.98276889924768e3_rt;
a1(8) = 1.0e0_rt;

b1(1) = 9.67282587452899e6_rt;
b1(2) = 2.87386436731785e7_rt;
b1(3) = 3.26070130734158e7_rt;
b1(4) = 1.77657027846367e7_rt;
b1(5) = 4.81648022267831e6_rt;
b1(6) = 6.13709569333207e5_rt;
b1(7) = 3.13595854332114e4_rt;
b1(8) = 4.35061725080755e2_rt;

a2(1) = -4.46620341924942e-15_rt;
a2(2) = -1.58654991146236e-12_rt;
a2(3) = -4.44467627042232e-10_rt;
a2(4) = -6.84738791621745e-8_rt;
a2(5) = -6.64932238528105e-6_rt;
a2(6) = -3.69976170193942e-4_rt;
a2(7) = -1.12295393687006e-2_rt;
a2(8) = -1.60926102124442e-1_rt;
a2(9) = -8.52408612877447e-1_rt;
a2(10) = -7.45519953763928e-1_rt;
a2(11) = 2.98435207466372e0_rt;
a2(12) = 1.0e0_rt;

b2(1) = -2.23310170962369e-15_rt;
b2(2) = -7.94193282071464e-13_rt;
b2(3) = -2.22564376956228e-10_rt;
b2(4) = -3.43299431079845e-8_rt;
b2(5) = -3.33919612678907e-6_rt;
b2(6) = -1.86432212187088e-4_rt;
b2(7) = -5.69764436880529e-3_rt;
b2(8) = -8.34904593067194e-2_rt;
b2(9) = -4.78770844009440e-1_rt;
b2(10) = -4.99759250374148e-1_rt;
b2(11) = 1.86795964993052e0_rt;
b2(12) = 4.16485970495288e-1_rt;
constexpr int m1{7};
constexpr int k1{7};
constexpr int m2{11};
constexpr int k2{11};

const Array1D<Real, 1, 8> a1 = {
1.71446374704454e7_rt,
3.88148302324068e7_rt,
3.16743385304962e7_rt,
1.14587609192151e7_rt,
1.83696370756153e6_rt,
1.14980998186874e5_rt,
1.98276889924768e3_rt,
1.0e0_rt};

const Array1D<Real, 1, 8> b1 = {
9.67282587452899e6_rt,
2.87386436731785e7_rt,
3.26070130734158e7_rt,
1.77657027846367e7_rt,
4.81648022267831e6_rt,
6.13709569333207e5_rt,
3.13595854332114e4_rt,
4.35061725080755e2_rt};

const Array1D<Real, 1, 12> a2 = {
-4.46620341924942e-15_rt,
-1.58654991146236e-12_rt,
-4.44467627042232e-10_rt,
-6.84738791621745e-8_rt,
-6.64932238528105e-6_rt,
-3.69976170193942e-4_rt,
-1.12295393687006e-2_rt,
-1.60926102124442e-1_rt,
-8.52408612877447e-1_rt,
-7.45519953763928e-1_rt,
2.98435207466372e0_rt,
1.0e0_rt};

const Array1D<Real, 1, 12> b2 = {
-2.23310170962369e-15_rt,
-7.94193282071464e-13_rt,
-2.22564376956228e-10_rt,
-3.43299431079845e-8_rt,
-3.33919612678907e-6_rt,
-1.86432212187088e-4_rt,
-5.69764436880529e-3_rt,
-8.34904593067194e-2_rt,
-4.78770844009440e-1_rt,
-4.99759250374148e-1_rt,
1.86795964993052e0_rt,
4.16485970495288e-1_rt};

if (x < 2.0e0_rt) {

Expand Down

0 comments on commit 8b48c02

Please sign in to comment.