// -----------------------------------------------------------------
// Coefficients for (Mdag M)^(-1 / 4) and (Mdag M)^(1 / 8)
// Note the relative sign between fractional powers!
// For now simply copy in remez output, switch using Norder
#include "susy_includes.h"
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (19, 19) approximation for spectral range [1e-8, 50000]
// Nroot 1 gives errors 1.680918e-05 and 9.075152e-06
// Nroot 2 gives errors 9.075152e-06 and 4.623683e-06
// Nroot 3 gives errors 6.135027e-06 and 3.093154e-06
void setup_rhmc19() {
  if (Nroot == 1) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D19
    ampdeg4 = 3.5781609297300059e-02;
    amp4[0] = 3.0717855433550755e-07;
    amp4[1] = 1.0029877194364809e-06;
    amp4[2] = 3.3516396678877979e-06;
    amp4[3] = 1.1410873683384280e-05;
    amp4[4] = 3.9010444318468622e-05;
    amp4[5] = 1.3347525170664460e-04;
    amp4[6] = 4.5676237254114321e-04;
    amp4[7] = 1.5631239828206335e-03;
    amp4[8] = 5.3493273393033745e-03;
    amp4[9] = 1.8306508430273444e-02;
    amp4[10] = 6.2648751795464655e-02;
    amp4[11] = 2.1439848304452658e-01;
    amp4[12] = 7.3374167738774820e-01;
    amp4[13] = 2.5114673617263459e+00;
    amp4[14] = 8.6027269429096123e+00;
    amp4[15] = 2.9581317991456945e+01;
    amp4[16] = 1.0376274631091705e+02;
    amp4[17] = 4.0372747959857907e+02;
    amp4[18] = 2.7865429990752900e+03;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D19
    shift4[0] = 3.0177513487338543e-09;
    shift4[1] = 3.1640198707444036e-08;
    shift4[2] = 1.8284145486115925e-07;
    shift4[3] = 9.6330653865743114e-07;
    shift4[4] = 4.9884059156280029e-06;
    shift4[5] = 2.5746412021593944e-05;
    shift4[6] = 1.3279825136539079e-04;
    shift4[7] = 6.8487901396126834e-04;
    shift4[8] = 3.5320339813338882e-03;
    shift4[9] = 1.8215198273083606e-02;
    shift4[10] = 9.3938322348130904e-02;
    shift4[11] = 4.8445447391345675e-01;
    shift4[12] = 2.4984467253127556e+00;
    shift4[13] = 1.2886148723664553e+01;
    shift4[14] = 6.6490790460121033e+01;
    shift4[15] = 3.4384001412588748e+02;
    shift4[16] = 1.7984908711932201e+03;
    shift4[17] = 9.9925026080852913e+03;
    shift4[18] = 7.9423937552225543e+04;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D19
    ampdeg8 = 5.2602639578072914e+00;
    amp8[0] = -1.6579767875762556e-10;
    amp8[1] = -1.1933378657034187e-09;
    amp8[2] = -7.6491763360273912e-09;
    amp8[3] = -4.8506632334522925e-08;
    amp8[4] = -3.0708961697783280e-07;
    amp8[5] = -1.9435505815603433e-06;
    amp8[6] = -1.2299882595149823e-05;
    amp8[7] = -7.7839696558059114e-05;
    amp8[8] = -4.9260676303235261e-04;
    amp8[9] = -3.1174504955822726e-03;
    amp8[10] = -1.9728745915332673e-02;
    amp8[11] = -1.2485423427640824e-01;
    amp8[12] = -7.9018197667794865e-01;
    amp8[13] = -5.0021225796272590e+00;
    amp8[14] = -3.1704032339127878e+01;
    amp8[15] = -2.0221992733851556e+02;
    amp8[16] = -1.3327569152018057e+03;
    amp8[17] = -1.0428797473207420e+04;
    amp8[18] = -2.2083388890882154e+05;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D19
    shift8[0] = 5.3667966808839825e-09;
    shift8[1] = 4.4848665745573186e-08;
    shift8[2] = 2.5104164739782321e-07;
    shift8[3] = 1.3145726573450043e-06;
    shift8[4] = 6.7976431788971964e-06;
    shift8[5] = 3.5065304575557148e-05;
    shift8[6] = 1.8079754545412754e-04;
    shift8[7] = 9.3211140042029372e-04;
    shift8[8] = 4.8054651995520668e-03;
    shift8[9] = 2.4774313629046037e-02;
    shift8[10] = 1.2772264147059928e-01;
    shift8[11] = 6.5846989849931281e-01;
    shift8[12] = 3.3947936807672341e+00;
    shift8[13] = 1.7504087935332475e+01;
    shift8[14] = 9.0305963859099236e+01;
    shift8[15] = 4.6729184698558464e+02;
    shift8[16] = 2.4557178121577372e+03;
    shift8[17] = 1.4015074533288203e+04;
    shift8[18] = 1.3399028714880449e+05;
  }
  else if (Nroot == 2) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N2.D19
    ampdeg4 = 1.9010452859799906e-01;
    amp4[0] = 1.5904420098835903e-08;
    amp4[1] = 6.8650256455093847e-08;
    amp4[2] = 2.8575430226824233e-07;
    amp4[3] = 1.1974194169660170e-06;
    amp4[4] = 5.0266701932244784e-06;
    amp4[5] = 2.1109313565798700e-05;
    amp4[6] = 8.8654156742675285e-05;
    amp4[7] = 3.7233184019134022e-04;
    amp4[8] = 1.5637324549982732e-03;
    amp4[9] = 6.5674240208882257e-03;
    amp4[10] = 2.7582158565066510e-02;
    amp4[11] = 1.1584152030609432e-01;
    amp4[12] = 4.8653564076331673e-01;
    amp4[13] = 2.0438045919750292e+00;
    amp4[14] = 8.5930464372962074e+00;
    amp4[15] = 3.6293653450224923e+01;
    amp4[16] = 1.5693574529940190e+02;
    amp4[17] = 7.6711967343508297e+02;
    amp4[18] = 7.4429810752583944e+03;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N2.D19
    shift4[0] = 3.7316137657404911e-09;
    shift4[1] = 3.5675871634675537e-08;
    shift4[2] = 2.0360645572736671e-07;
    shift4[3] = 1.0699951287945853e-06;
    shift4[4] = 5.5367328871006820e-06;
    shift4[5] = 2.8564755949993646e-05;
    shift4[6] = 1.4728435569816390e-04;
    shift4[7] = 7.5933615361845151e-04;
    shift4[8] = 3.9147326914241469e-03;
    shift4[9] = 2.0182193843456785e-02;
    shift4[10] = 1.0404819913098259e-01;
    shift4[11] = 5.3641656970888663e-01;
    shift4[12] = 2.7655242704988039e+00;
    shift4[13] = 1.4259108998258455e+01;
    shift4[14] = 7.3554905257783318e+01;
    shift4[15] = 3.8035174184273126e+02;
    shift4[16] = 1.9917013976874330e+03;
    shift4[17] = 1.1148603680575558e+04;
    shift4[18] = 9.3165444813840702e+04;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N2.D19
    ampdeg8 = 2.2921426538784293e+00;
    amp8[0] = -2.6073729576145865e-10;
    amp8[1] = -1.6587852506444189e-09;
    amp8[2] = -9.5518633283157915e-09;
    amp8[3] = -5.4616377532706407e-08;
    amp8[4] = -3.1200027884269618e-07;
    amp8[5] = -1.7820346540302088e-06;
    amp8[6] = -1.0178032209459498e-05;
    amp8[7] = -5.8131147414777457e-05;
    amp8[8] = -3.3201177817531792e-04;
    amp8[9] = -1.8962610424182555e-03;
    amp8[10] = -1.0830373420712219e-02;
    amp8[11] = -6.1857493468146452e-02;
    amp8[12] = -3.5331304487050602e-01;
    amp8[13] = -2.0184696953787769e+00;
    amp8[14] = -1.1544513496773950e+01;
    amp8[15] = -6.6414161150615485e+01;
    amp8[16] = -3.9376135241172517e+02;
    amp8[17] = -2.7335138653813633e+03;
    amp8[18] = -4.6887274284998050e+04;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N2.D19
    shift8[0] = 4.9309672113881304e-09;
    shift8[1] = 4.2409843914814350e-08;
    shift8[2] = 2.3839902643560719e-07;
    shift8[3] = 1.2492692119480762e-06;
    shift8[4] = 6.4604270792918305e-06;
    shift8[5] = 3.3324052485041102e-05;
    shift8[6] = 1.7180648975948610e-04;
    shift8[7] = 8.8568575010092732e-04;
    shift8[8] = 4.5657452985379404e-03;
    shift8[9] = 2.3536517340198352e-02;
    shift8[10] = 1.2133127324350421e-01;
    shift8[11] = 6.2546784359831842e-01;
    shift8[12] = 3.2243795746447597e+00;
    shift8[13] = 1.6623922128225423e+01;
    shift8[14] = 8.5754881344191574e+01;
    shift8[15] = 4.4362156410315492e+02;
    shift8[16] = 2.3288297770909967e+03;
    shift8[17] = 1.3218184118727824e+04;
    shift8[18] = 1.2154133014938852e+05;
  }
  else if (Nroot == 3) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N3.D19
    ampdeg4 = 3.3081683407087353e-01;
    amp4[0] = 4.9713031748387227e-09;
    amp4[1] = 2.3453781868244054e-08;
    amp4[2] = 1.0497361740774617e-07;
    amp4[3] = 4.7136151130314317e-07;
    amp4[4] = 2.1189129176135698e-06;
    amp4[5] = 9.5273954035215521e-06;
    amp4[6] = 4.2840583386599903e-05;
    amp4[7] = 1.9263734253175299e-04;
    amp4[8] = 8.6621631906693742e-04;
    amp4[9] = 3.8950452082721666e-03;
    amp4[10] = 1.7514560579542770e-02;
    amp4[11] = 7.8756960929138239e-02;
    amp4[12] = 3.5415541455881511e-01;
    amp4[13] = 1.5928590530967153e+00;
    amp4[14] = 7.1707676800565743e+00;
    amp4[15] = 3.2437089059859041e+01;
    amp4[16] = 1.5042014231733441e+02;
    amp4[17] = 7.9411302995324138e+02;
    amp4[18] = 8.6851843338635790e+03;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N3.D19
    shift4[0] = 3.9845081847284163e-09;
    shift4[1] = 3.7099588929996650e-08;
    shift4[2] = 2.1094781095659599e-07;
    shift4[3] = 1.1077688873717432e-06;
    shift4[4] = 5.7311135744481367e-06;
    shift4[5] = 2.9565062689399786e-05;
    shift4[6] = 1.5243208672682259e-04;
    shift4[7] = 7.8582712694059260e-04;
    shift4[8] = 4.0510587217768681e-03;
    shift4[9] = 2.0883743524835827e-02;
    shift4[10] = 1.0765844920681882e-01;
    shift4[11] = 5.5499537424092715e-01;
    shift4[12] = 2.8611362615029252e+00;
    shift4[13] = 1.4751245405881445e+01;
    shift4[14] = 7.6090438544667677e+01;
    shift4[15] = 3.9347909187833318e+02;
    shift4[16] = 2.0614066104803260e+03;
    shift4[17] = 1.1570968859428127e+04;
    shift4[18] = 9.8538001244477477e+04;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N3.D19
    ampdeg8 = 1.7383169444828401e+00;
    amp8[0] = -2.5445803206805749e-10;
    amp8[1] = -1.5527166000894242e-09;
    amp8[2] = -8.6264236979647387e-09;
    amp8[3] = -4.7651748416849790e-08;
    amp8[4] = -2.6304999925545726e-07;
    amp8[5] = -1.4519414235358708e-06;
    amp8[6] = -8.0140255068280050e-06;
    amp8[7] = -4.4233426404388362e-05;
    amp8[8] = -2.4414628841055004e-04;
    amp8[9] = -1.3475650401594923e-03;
    amp8[10] = -7.4378943982927716e-03;
    amp8[11] = -4.1053837950609774e-02;
    amp8[12] = -2.2660813030681734e-01;
    amp8[13] = -1.2510937089111753e+00;
    amp8[14] = -6.9148336648333286e+00;
    amp8[15] = -3.8435862247437015e+01;
    amp8[16] = -2.1999996925343893e+02;
    amp8[17] = -1.4680010077630827e+03;
    amp8[18] = -2.3533986238110887e+04;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N3.D19
    shift8[0] = 4.7897859747706536e-09;
    shift8[1] = 4.1619121603209324e-08;
    shift8[2] = 2.3430467622702102e-07;
    shift8[3] = 1.2281388680408944e-06;
    shift8[4] = 6.3513997645671024e-06;
    shift8[5] = 3.2761513268906164e-05;
    shift8[6] = 1.6890401739256126e-04;
    shift8[7] = 8.7071020314493850e-04;
    shift8[8] = 4.4884777907091954e-03;
    shift8[9] = 2.3137849789185358e-02;
    shift8[10] = 1.1927431632627961e-01;
    shift8[11] = 6.1485473479246266e-01;
    shift8[12] = 3.1696177989208278e+00;
    shift8[13] = 1.6341301414064322e+01;
    shift8[14] = 8.4294709649481561e+01;
    shift8[15] = 4.3603496282237523e+02;
    shift8[16] = 2.2882488689671272e+03;
    shift8[17] = 1.2965434174235752e+04;
    shift8[18] = 1.1778336837462953e+05;
  }
  else {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (18, 18) approximation for spectral range [1e-9, 1000]
// Nroot 1 gives errors 1.701613e-05 and 9.185687e-06
// Nroot 2 gives errors 9.185687e-06 and 4.679847e-06
void setup_rhmc18() {
  if (Nroot == 1) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D18
    ampdeg4 = 9.5197218737473693e-02;
    amp4[0] = 5.4725355667098227e-08;
    amp4[1] = 1.7889478649670330e-07;
    amp4[2] = 5.9858147535930101e-07;
    amp4[3] = 2.0405042216982209e-06;
    amp4[4] = 6.9846699908727387e-06;
    amp4[5] = 2.3928212713219938e-05;
    amp4[6] = 8.1986787355242118e-05;
    amp4[7] = 2.8092533608703473e-04;
    amp4[8] = 9.6258842296941124e-04;
    amp4[9] = 3.2983088033025714e-03;
    amp4[10] = 1.1301716937491929e-02;
    amp4[11] = 3.8726622047878009e-02;
    amp4[12] = 1.3272022668827937e-01;
    amp4[13] = 4.5518346327900755e-01;
    amp4[14] = 1.5671085405081764e+00;
    amp4[15] = 5.5032496358955489e+00;
    amp4[16] = 2.1431519993436826e+01;
    amp4[17] = 1.4797352671258415e+02;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D18
    shift4[0] = 3.0244819244223228e-10;
    shift4[1] = 3.1739710219065483e-09;
    shift4[2] = 1.8367108786803753e-08;
    shift4[3] = 9.6921056815454278e-08;
    shift4[4] = 5.0272491495854338e-07;
    shift4[5] = 2.5990101196144500e-06;
    shift4[6] = 1.3427902700661320e-05;
    shift4[7] = 6.9367291147094066e-05;
    shift4[8] = 3.5833641527601551e-04;
    shift4[9] = 1.8510809068294995e-03;
    shift4[10] = 9.5622656018491160e-03;
    shift4[11] = 4.9397278235458190e-02;
    shift4[12] = 2.5520009154042839e-01;
    shift4[13] = 1.3189932577866750e+00;
    shift4[14] = 6.8321190808611663e+00;
    shift4[15] = 3.5793568465120075e+01;
    shift4[16] = 1.9916058824192100e+02;
    shift4[17] = 1.5846840031802146e+03;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D18
    ampdeg8 = 3.2249755331272394e+00;
    amp8[0] = -1.2468813262454463e-11;
    amp8[1] = -8.9888195557299584e-11;
    amp8[2] = -5.7722091307886893e-10;
    amp8[3] = -3.6671720705785171e-09;
    amp8[4] = -2.3259540023835223e-08;
    amp8[5] = -1.4748179446428940e-07;
    amp8[6] = -9.3508329063594577e-07;
    amp8[7] = -5.9286702524183654e-06;
    amp8[8] = -3.7589235124129824e-05;
    amp8[9] = -2.3832535106690147e-04;
    amp8[10] = -1.5110568407602832e-03;
    amp8[11] = -9.5810078986850299e-03;
    amp8[12] = -6.0763680180211402e-02;
    amp8[13] = -3.8583904970892330e-01;
    amp8[14] = -2.4654878354002325e+00;
    amp8[15] = -1.6276620010071937e+01;
    amp8[16] = -1.2753309009764848e+02;
    amp8[17] = -2.7021687703963685e+03;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D18
    shift8[0] = 5.3792904609642863e-10;
    shift8[1] = 4.4998846187880281e-09;
    shift8[2] = 2.5224145436003196e-08;
    shift8[3] = 1.3229491324071481e-07;
    shift8[4] = 6.8521411977468415e-07;
    shift8[5] = 3.5404690586960083e-06;
    shift8[6] = 1.8284893588512796e-05;
    shift8[7] = 9.4424524515028364e-05;
    shift8[8] = 4.8760667015308642e-04;
    shift8[9] = 2.5179862051538378e-03;
    shift8[10] = 1.3002850768349289e-02;
    shift8[11] = 6.7148001761230855e-02;
    shift8[12] = 3.4679739179632346e-01;
    shift8[13] = 1.7921222942645791e+00;
    shift8[14] = 9.2885378971540131e+00;
    shift8[15] = 4.8890044960749421e+01;
    shift8[16] = 2.7940966784826333e+02;
    shift8[17] = 2.6737989508694272e+03;
  }
  else if (Nroot == 2) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N2.D18
    ampdeg4 = 3.1007987184023872e-01;
    amp4[0] = 2.1254699700902510e-09;
    amp4[1] = 9.1862873169435749e-09;
    amp4[2] = 3.8293349135794409e-08;
    amp4[3] = 1.6069714070840105e-07;
    amp4[4] = 6.7557083778529062e-07;
    amp4[5] = 2.8411386235810000e-06;
    amp4[6] = 1.1949370085924981e-05;
    amp4[7] = 5.0257819801991791e-05;
    amp4[8] = 2.1137983205000719e-04;
    amp4[9] = 8.8904596039774168e-04;
    amp4[10] = 3.7392773840305626e-03;
    amp4[11] = 1.5727707441201385e-02;
    amp4[12] = 6.6163246436179463e-02;
    amp4[13] = 2.7857908958871047e-01;
    amp4[14] = 1.1782704789083462e+00;
    amp4[15] = 5.1016320687070591e+00;
    amp4[16] = 2.4963179868368510e+01;
    amp4[17] = 2.4231211626226408e+02;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N2.D18
    shift4[0] = 3.7399969794843208e-10;
    shift4[1] = 3.5789742269872421e-09;
    shift4[2] = 2.0454061778892497e-08;
    shift4[3] = 1.0765957043749568e-07;
    shift4[4] = 5.5799763397863633e-07;
    shift4[5] = 2.8835280300703870e-06;
    shift4[6] = 1.4892475930346586e-05;
    shift4[7] = 7.6906212169575703e-05;
    shift4[8] = 3.9714276351204451e-04;
    shift4[9] = 2.0508333072762233e-03;
    shift4[10] = 1.0590469003006135e-02;
    shift4[11] = 5.4689954587880972e-02;
    shift4[12] = 2.8244845059267687e-01;
    shift4[13] = 1.4593978307522706e+00;
    shift4[14] = 7.5588696156477972e+00;
    shift4[15] = 3.9644554164862598e+01;
    shift4[16] = 2.2222792020594838e+02;
    shift4[17] = 1.8589812304367392e+03;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N2.D18
    ampdeg8 = 1.7947386755713639e+00;
    amp8[0] = -2.2639541234200276e-11;
    amp8[1] = -1.4424854897526999e-10;
    amp8[2] = -8.3206256065112282e-10;
    amp8[3] = -4.7659373903325840e-09;
    amp8[4] = -2.7273430254589553e-08;
    amp8[5] = -1.5604888463762589e-07;
    amp8[6] = -8.9282879243373761e-07;
    amp8[7] = -5.1082618092499185e-06;
    amp8[8] = -2.9226562662573486e-05;
    amp8[9] = -1.6721796081437893e-04;
    amp8[10] = -9.5673492126375494e-04;
    amp8[11] = -5.4741740827279990e-03;
    amp8[12] = -3.1328526160597586e-02;
    amp8[13] = -1.7949349759791200e-01;
    amp8[14] = -1.0343689954953810e+00;
    amp8[15] = -6.1424324222402440e+00;
    amp8[16] = -4.2694510735286904e+01;
    amp8[17] = -7.3273697395158024e+02;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N2.D18
    shift8[0] = 4.9423146898378493e-10;
    shift8[1] = 4.2549838177127019e-09;
    shift8[2] = 2.3952417526652395e-08;
    shift8[3] = 1.2571459231714283e-07;
    shift8[4] = 6.5117536225762655e-07;
    shift8[5] = 3.3644006490382771e-06;
    shift8[6] = 1.7374173806055384e-05;
    shift8[7] = 8.9713815588400499e-05;
    shift8[8] = 4.6324054119054839e-04;
    shift8[9] = 2.3919526382111893e-03;
    shift8[10] = 1.2350939897778768e-02;
    shift8[11] = 6.3775848413094777e-02;
    shift8[12] = 3.2935042831522138e-01;
    shift8[13] = 1.7017531678575841e+00;
    shift8[14] = 8.8177285191724106e+00;
    shift8[15] = 4.6362205481166789e+01;
    shift8[16] = 2.6351443168147244e+02;
    shift8[17] = 2.4253437766417283e+03;
  }
  else {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (17, 17) approximation for spectral range [5e-8, 2500]
// Nroot 1 gives errors 9.402444e-06 and 5.074920e-06
// Nroot 2 gives errors 5.074920e-06 and 2.585435e-06
void setup_rhmc17() {
  if (Nroot == 1) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D17
    ampdeg4 = 7.3898635863598877e-02;
    amp4[0] = 9.4389721186574806e-07;
    amp4[1] = 2.9255335153377526e-06;
    amp4[2] = 9.2181028689638749e-06;
    amp4[3] = 2.9625444264998394e-05;
    amp4[4] = 9.5673107247326366e-05;
    amp4[5] = 3.0929147700557019e-04;
    amp4[6] = 1.0000953385593864e-03;
    amp4[7] = 3.2339626365186706e-03;
    amp4[8] = 1.0457638703556600e-02;
    amp4[9] = 3.3817171233585963e-02;
    amp4[10] = 1.0936059680366245e-01;
    amp4[11] = 3.5373582143287496e-01;
    amp4[12] = 1.1453792894785906e+00;
    amp4[13] = 3.7271989144880062e+00;
    amp4[14] = 1.2421756864255505e+01;
    amp4[15] = 4.6468662411476913e+01;
    amp4[16] = 3.1592569472084136e+02;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D17
    shift4[0] = 1.3614266517830279e-08;
    shift4[1] = 1.3707435279740474e-07;
    shift4[2] = 7.4446245293445065e-07;
    shift4[3] = 3.6524916652096317e-06;
    shift4[4] = 1.7559071325111740e-05;
    shift4[5] = 8.4058750831248385e-05;
    shift4[6] = 4.0205194524752040e-04;
    shift4[7] = 1.9226561283123295e-03;
    shift4[8] = 9.1940075048519577e-03;
    shift4[9] = 4.3964988128313988e-02;
    shift4[10] = 2.1024207433911124e-01;
    shift4[11] = 1.0055094947266092e+00;
    shift4[12] = 4.8118389933491343e+00;
    shift4[13] = 2.3092618948271735e+01;
    shift4[14] = 1.1235368731343878e+02;
    shift4[15] = 5.8480728206638798e+02;
    shift4[16] = 4.4333553061032990e+03;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D17
    ampdeg8 = 3.6603783616137768e+00;
    amp8[0] = -8.8720799478411066e-10;
    amp8[1] = -5.9402065867111915e-09;
    amp8[2] = -3.5048691066168483e-08;
    amp8[3] = -2.0424469995763447e-07;
    amp8[4] = -1.1878275555484454e-06;
    amp8[5] = -6.9053170853101113e-06;
    amp8[6] = -4.0140089326667887e-05;
    amp8[7] = -2.3332749286421103e-04;
    amp8[8] = -1.3562924562570118e-03;
    amp8[9] = -7.8840099379515159e-03;
    amp8[10] = -4.5832440860976348e-02;
    amp8[11] = -2.6653369980915037e-01;
    amp8[12] = -1.5526170710113636e+00;
    amp8[13] = -9.1176679382359715e+00;
    amp8[14] = -5.5658800206704562e+01;
    amp8[15] = -4.1045768241195475e+02;
    amp8[16] = -8.4673895281635778e+03;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D17
    shift8[0] = 2.4079722857729238e-08;
    shift8[1] = 1.9222640446475186e-07;
    shift8[2] = 1.0087327521129967e-06;
    shift8[3] = 4.9145344009140353e-06;
    shift8[4] = 2.3585928336120716e-05;
    shift8[5] = 1.1284058270270470e-04;
    shift8[6] = 5.3950310251719405e-04;
    shift8[7] = 2.5790714270986352e-03;
    shift8[8] = 1.2328806634246967e-02;
    shift8[9] = 5.8935812217975427e-02;
    shift8[10] = 2.8174230023440089e-01;
    shift8[11] = 1.3470908455830894e+00;
    shift8[12] = 6.4459473367798914e+00;
    shift8[13] = 3.0961990055244975e+01;
    shift8[14] = 1.5147209944509135e+02;
    shift8[15] = 8.1172832959145967e+02;
    shift8[16] = 7.4387052648072859e+03;
  }
  else if (Nroot == 2) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N2.D17
    ampdeg4 = 2.7319580141958955e-01;
    amp4[0] = 5.8823531984206132e-08;
    amp4[1] = 2.3946566014604335e-07;
    amp4[2] = 9.3253429393734557e-07;
    amp4[3] = 3.6561356376572671e-06;
    amp4[4] = 1.4364387498292607e-05;
    amp4[5] = 5.6461787039729985e-05;
    amp4[6] = 2.2195510388015686e-04;
    amp4[7] = 8.7253906119992130e-04;
    amp4[8] = 3.4301058747753903e-03;
    amp4[9] = 1.3484518263348387e-02;
    amp4[10] = 5.3013527499218338e-02;
    amp4[11] = 2.0847272672941036e-01;
    amp4[12] = 8.2081202079206683e-01;
    amp4[13] = 3.2507404714849568e+00;
    amp4[14] = 1.3240848632890867e+01;
    amp4[15] = 6.1797616519257247e+01;
    amp4[16] = 5.8819149395555985e+02;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N2.D17
    shift4[0] = 1.6803999560431352e-08;
    shift4[1] = 1.5399240785757979e-07;
    shift4[2] = 8.2523448514894683e-07;
    shift4[3] = 4.0372081954992101e-06;
    shift4[4] = 1.9392029358782271e-05;
    shift4[5] = 9.2792553976486796e-05;
    shift4[6] = 4.4366784787376243e-04;
    shift4[7] = 2.1209515114118519e-03;
    shift4[8] = 1.0138856396106904e-02;
    shift4[9] = 4.8467056277158131e-02;
    shift4[10] = 2.3169468241568883e-01;
    shift4[11] = 1.1077574841077449e+00;
    shift4[12] = 5.2997701942716651e+00;
    shift4[13] = 2.5434759389770836e+01;
    shift4[14] = 1.2391785608047525e+02;
    shift4[15] = 6.5027486909542131e+02;
    shift4[16] = 5.1910896457795752e+03;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N2.D17
    ampdeg8 = 1.9120608307750344e+00;
    amp8[0] = -1.2723798036781749e-09;
    amp8[1] = -7.5566929907461411e-09;
    amp8[2] = -4.0219754688522530e-08;
    amp8[3] = -2.1229027214764527e-07;
    amp8[4] = -1.1192488199729725e-06;
    amp8[5] = -5.8997184983133171e-06;
    amp8[6] = -3.1096911862200753e-05;
    amp8[7] = -1.6390779591532795e-04;
    amp8[8] = -8.6393772827554518e-04;
    amp8[9] = -4.5537721444818052e-03;
    amp8[10] = -2.4004338130138837e-02;
    amp8[11] = -1.2657552810623532e-01;
    amp8[12] = -6.6847719990271448e-01;
    amp8[13] = -3.5568129671963353e+00;
    amp8[14] = -1.9613976840061142e+01;
    amp8[15] = -1.2872748839034739e+02;
    amp8[16] = -2.1544482595001487e+03;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N2.D17
    shift8[0] = 2.2144248345689134e-08;
    shift8[1] = 1.8208700187944502e-07;
    shift8[2] = 9.5994626516343153e-07;
    shift8[3] = 4.6808290080862901e-06;
    shift8[4] = 2.2466805568273845e-05;
    shift8[5] = 1.0748184107253685e-04;
    shift8[6] = 5.1384394330568437e-04;
    shift8[7] = 2.4562086982119046e-03;
    shift8[8] = 1.1740508127309332e-02;
    shift8[9] = 5.6118855050977461e-02;
    shift8[10] = 2.6825294660905474e-01;
    shift8[11] = 1.2824744728089221e+00;
    shift8[12] = 6.1359409536534200e+00;
    shift8[13] = 2.9463547473987340e+01;
    shift8[14] = 1.4396513728959229e+02;
    shift8[15] = 7.6695256022113119e+02;
    shift8[16] = 6.7537485613941853e+03;
  }
  else {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (16, 16) approximation for spectral range [1e-8, 500]
// Nroot 1 gives errors 1.930801e-05 and 1.041969e-05
// Nroot 2 gives errors 1.041969e-05 and 5.308129e-06
// Nroot 3 gives errors 7.043397e-06 and 3.550962e-06
void setup_rhmc16() {
  if (Nroot == 1) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D16
    ampdeg4 = 1.1381159010033026e-01;
    amp4[0] = 3.1368159472751575e-07;
    amp4[1] = 1.0379530999595052e-06;
    amp4[2] = 3.5204088525061730e-06;
    amp4[3] = 1.2161267294531965e-05;
    amp4[4] = 4.2178820233516370e-05;
    amp4[5] = 1.4640197448322531e-04;
    amp4[6] = 5.0823420150569211e-04;
    amp4[7] = 1.7643855300805726e-03;
    amp4[8] = 6.1253014978322863e-03;
    amp4[9] = 2.1265356989361137e-02;
    amp4[10] = 7.3837101894856996e-02;
    amp4[11] = 2.5655149488194506e-01;
    amp4[12] = 8.9462506692149435e-01;
    amp4[13] = 3.1794853813938597e+00;
    amp4[14] = 1.2498457827198328e+01;
    amp4[15] = 8.6619350678171045e+01;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D16
    shift4[0] = 3.0953531724723071e-09;
    shift4[1] = 3.2795938372653606e-08;
    shift4[2] = 1.9256063818129346e-07;
    shift4[3] = 1.0330839936823528e-06;
    shift4[4] = 5.4515562886856692e-06;
    shift4[5] = 2.8677958895879417e-05;
    shift4[6] = 1.5077112610221722e-04;
    shift4[7] = 7.9257305620300371e-04;
    shift4[8] = 4.1663166435714485e-03;
    shift4[9] = 2.1901286631244025e-02;
    shift4[10] = 1.1513809297400175e-01;
    shift4[11] = 6.0553414333768751e-01;
    shift4[12] = 3.1912000088293651e+00;
    shift4[13] = 1.7001988143746424e+01;
    shift4[14] = 9.6054797054654543e+01;
    shift4[15] = 7.7286879486442081e+02;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D16
    ampdeg8 = 2.9494911750496193e+00;
    amp8[0] = -1.7136012216236198e-10;
    amp8[1] = -1.2563107620600530e-09;
    amp8[2] = -8.2232210589162282e-09;
    amp8[3] = -5.3270632033841020e-08;
    amp8[4] = -3.4454475959468017e-07;
    amp8[5] = -2.2278122600727856e-06;
    amp8[6] = -1.4404165626120535e-05;
    amp8[7] = -9.3130898892645903e-05;
    amp8[8] = -6.0214629647883369e-04;
    amp8[9] = -3.8933897609219549e-03;
    amp8[10] = -2.5179508445120392e-02;
    amp8[11] = -1.6302647327310787e-01;
    amp8[12] = -1.0618255992813443e+00;
    amp8[13] = -7.1361925243124160e+00;
    amp8[14] = -5.6704443064427061e+01;
    amp8[15] = -1.2090695069449530e+03;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D16
    shift8[0] = 5.5120928105623584e-09;
    shift8[1] = 4.6608799537982133e-08;
    shift8[2] = 2.6522612567650073e-07;
    shift8[3] = 1.4144756151399664e-06;
    shift8[4] = 7.4533787380240382e-06;
    shift8[5] = 3.9185205870294104e-05;
    shift8[6] = 2.0592218211268006e-04;
    shift8[7] = 1.0820533195127393e-03;
    shift8[8] = 5.6857659480019727e-03;
    shift8[9] = 2.9876957935385882e-02;
    shift8[10] = 1.5701008304618089e-01;
    shift8[11] = 8.2556258812535521e-01;
    shift8[12] = 4.3530078538410573e+00;
    shift8[13] = 2.3295001342641651e+01;
    shift8[14] = 1.3510213826105300e+02;
    shift8[15] = 1.3058126606253536e+03;
  }
  else if (Nroot == 2) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N2.D16
    ampdeg4 = 3.3904152975917179e-01;
    amp4[0] = 1.6303778710353253e-08;
    amp4[1] = 7.1431767733078828e-08;
    amp4[2] = 3.0237078845752122e-07;
    amp4[3] = 1.2884662400874002e-06;
    amp4[4] = 5.4999264239975866e-06;
    amp4[5] = 2.3485018940731941e-05;
    amp4[6] = 1.0028913487709441e-04;
    amp4[7] = 4.2827509197523026e-04;
    amp4[8] = 1.8289221733257762e-03;
    amp4[9] = 7.8105316551896099e-03;
    amp4[10] = 3.3360540462057137e-02;
    amp4[11] = 1.4260607354810456e-01;
    amp4[12] = 6.1220331048026988e-01;
    amp4[13] = 2.6878691111512891e+00;
    amp4[14] = 1.3297193826746065e+01;
    amp4[15] = 1.2968073819831116e+02;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N2.D16
    shift4[0] = 3.8290331766315560e-09;
    shift4[1] = 3.7009036750689179e-08;
    shift4[2] = 2.1463832203552911e-07;
    shift4[3] = 1.1486310541774107e-06;
    shift4[4] = 6.0564759982083776e-06;
    shift4[5] = 3.1845088563703061e-05;
    shift4[6] = 1.6735304882154915e-04;
    shift4[7] = 8.7938899450425785e-04;
    shift4[8] = 4.6208443796943019e-03;
    shift4[9] = 2.4281016977879620e-02;
    shift4[10] = 1.2759917649917085e-01;
    shift4[11] = 6.7083670047411947e-01;
    shift4[12] = 3.5348788953885486e+00;
    shift4[13] = 1.8851838171095398e+01;
    shift4[14] = 1.0727588029649712e+02;
    shift4[15] = 9.0709648255902425e+02;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N2.D16
    ampdeg8 = 1.7163734360475886e+00;
    amp8[0] = -2.6891439993810777e-10;
    amp8[1] = -1.7410239191163245e-09;
    amp8[2] = -1.0226631931720848e-08;
    amp8[3] = -5.9665247534471882e-08;
    amp8[4] = -3.4779845766756873e-07;
    amp8[5] = -2.0270639286215837e-06;
    amp8[6] = -1.1813944861282250e-05;
    amp8[7] = -6.8852652082456958e-05;
    amp8[8] = -4.0128144441501019e-04;
    amp8[9] = -2.3388037707073712e-03;
    amp8[10] = -1.3634040481463966e-02;
    amp8[11] = -7.9562386211747688e-02;
    amp8[12] = -4.6684131816580604e-01;
    amp8[13] = -2.8194171509933774e+00;
    amp8[14] = -1.9858994854822772e+01;
    amp8[15] = -3.4286009453522632e+02;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N2.D16
    shift8[0] = 5.0631572284307751e-09;
    shift8[1] = 4.4053262642956242e-08;
    shift8[2] = 2.5172231083568974e-07;
    shift8[3] = 1.3433622987586869e-06;
    shift8[4] = 7.0789878959745810e-06;
    shift8[5] = 3.7214230231098813e-05;
    shift8[6] = 1.9554611315047803e-04;
    shift8[7] = 1.0274293971875915e-03;
    shift8[8] = 5.3982020634678824e-03;
    shift8[9] = 2.8363045928231537e-02;
    shift8[10] = 1.4903836857350333e-01;
    shift8[11] = 7.8354266449266285e-01;
    shift8[12] = 4.1302957349672740e+00;
    shift8[13] = 2.2079922043980979e+01;
    shift8[14] = 1.2736577602106890e+02;
    shift8[15] = 1.1842382656954812e+03;
  }
  else if (Nroot == 3) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N3.D16
    ampdeg4 = 4.8651272442129373e-01;
    amp4[0] = 5.1028512024641851e-09;
    amp4[1] = 2.4449808661391835e-08;
    amp4[2] = 1.1136005151542462e-07;
    amp4[3] = 5.0886892876132598e-07;
    amp4[4] = 2.3278215534419324e-06;
    amp4[5] = 1.0650978660404758e-05;
    amp4[6] = 4.8735786428942611e-05;
    amp4[7] = 2.2300287883221978e-04;
    amp4[8] = 1.0204135177629282e-03;
    amp4[9] = 4.6693406860135872e-03;
    amp4[10] = 2.1370065970249860e-02;
    amp4[11] = 9.7887854124219714e-02;
    amp4[12] = 4.5041252182190122e-01;
    amp4[13] = 2.1222934850807444e+00;
    amp4[14] = 1.1345936035359482e+01;
    amp4[15] = 1.2476971218739226e+02;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N3.D16
    shift4[0] = 4.0891033165882983e-09;
    shift4[1] = 3.8496872779776899e-08;
    shift4[2] = 2.2245357906375603e-07;
    shift4[3] = 1.1896018571195772e-06;
    shift4[4] = 6.2712867418616253e-06;
    shift4[5] = 3.2971386701601818e-05;
    shift4[6] = 1.7325849276753123e-04;
    shift4[7] = 9.1035256174564188e-04;
    shift4[8] = 4.7831936017209776e-03;
    shift4[9] = 2.5132275008926071e-02;
    shift4[10] = 1.3206336393577756e-01;
    shift4[11] = 6.9426824044113733e-01;
    shift4[12] = 3.6584310965047804e+00;
    shift4[13] = 1.9519250085049514e+01;
    shift4[14] = 1.1137562322744576e+02;
    shift4[15] = 9.5957257484268746e+02;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N3.D16
    ampdeg8 = 1.4334276218119852e+00;
    amp8[0] = -2.6225573246113791e-10;
    amp8[1] = -1.6280754458785749e-09;
    amp8[2] = -9.2233948084170965e-09;
    amp8[3] = -5.1966817243254352e-08;
    amp8[4] = -2.9260916933015383e-07;
    amp8[5] = -1.6474195120331030e-06;
    amp8[6] = -9.2749623131513802e-06;
    amp8[7] = -5.2217861520276720e-05;
    amp8[8] = -2.9398741611041002e-04;
    amp8[9] = -1.6552145057742405e-03;
    amp8[10] = -9.3210228202494118e-03;
    amp8[11] = -5.2542767820933443e-02;
    amp8[12] = -2.9776636685073526e-01;
    amp8[13] = -1.7354956771043597e+00;
    amp8[14] = -1.1746727647777330e+01;
    amp8[15] = -1.8951812128717765e+02;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N3.D16
    shift8[0] = 4.9177847838317216e-09;
    shift8[1] = 4.3225193965418047e-08;
    shift8[2] = 2.4735232339456305e-07;
    shift8[3] = 1.3203725912068091e-06;
    shift8[4] = 6.9580674464360451e-06;
    shift8[5] = 3.6578232777928485e-05;
    shift8[6] = 1.9220101473859237e-04;
    shift8[7] = 1.0098354946041536e-03;
    shift8[8] = 5.3056645288927819e-03;
    shift8[9] = 2.7876314956918578e-02;
    shift8[10] = 1.4647776316459266e-01;
    shift8[11] = 7.7005823566967657e-01;
    shift8[12] = 4.0589089990939273e+00;
    shift8[13] = 2.1691330265715528e+01;
    shift8[14] = 1.2491211508165769e+02;
    shift8[15] = 1.1475373265840901e+03;
  }
  else {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// Original (15, 15) approximation for spectral range [1e-7, 1000]
// Nroot 1 gives errors 1.975834e-05 and 1.066076e-05
// Nroot 2 gives errors 1.280809e-05 and 6.524555e-06
void setup_rhmc15() {
  if (Nroot == 1) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D15
    ampdeg4 = 9.5797060554725838e-02;
    amp4[0] = 1.7701746700099842e-06;
    amp4[1] = 5.8705983656937455e-06;
    amp4[2] = 1.9961158693570120e-05;
    amp4[3] = 6.9125367600088173e-05;
    amp4[4] = 2.4032965323696816e-04;
    amp4[5] = 8.3620125835371663e-04;
    amp4[6] = 2.9099006745502945e-03;
    amp4[7] = 1.0126504714418652e-02;
    amp4[8] = 3.5241454044660878e-02;
    amp4[9] = 1.2266034741624667e-01;
    amp4[10] = 4.2721681852328125e-01;
    amp4[11] = 1.4932820692676758e+00;
    amp4[12] = 5.3188766358452595e+00;
    amp4[13] = 2.0944763089672641e+01;
    amp4[14] = 1.4525770103354523e+02;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D15
    shift4[0] = 3.1085594175442315e-08;
    shift4[1] = 3.2994455960441383e-07;
    shift4[2] = 1.9424842756552213e-06;
    shift4[3] = 1.0453359626231250e-05;
    shift4[4] = 5.5337819905761986e-05;
    shift4[5] = 2.9204178440857227e-04;
    shift4[6] = 1.5403300046437174e-03;
    shift4[7] = 8.1233558140562465e-03;
    shift4[8] = 4.2840454273820550e-02;
    shift4[9] = 2.2594500626442715e-01;
    shift4[10] = 1.1921171782283737e+00;
    shift4[11] = 6.3026182343759860e+00;
    shift4[12] = 3.3683411978650057e+01;
    shift4[13] = 1.9083658214156412e+02;
    shift4[14] = 1.5386784635765257e+03;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D15
    ampdeg8 = 3.2148873149863206e+00;
    amp8[0] = -2.2977600408751347e-09;
    amp8[1] = -1.6898103706901084e-08;
    amp8[2] = -1.1099658368596436e-07;
    amp8[3] = -7.2162146587729939e-07;
    amp8[4] = -4.6841070484595924e-06;
    amp8[5] = -3.0396303865820389e-05;
    amp8[6] = -1.9723870959636086e-04;
    amp8[7] = -1.2798599250624023e-03;
    amp8[8] = -8.3051856063983548e-03;
    amp8[9] = -5.3904877281192094e-02;
    amp8[10] = -3.5026088217184553e-01;
    amp8[11] = -2.2893521967679966e+00;
    amp8[12] = -1.5436668340425719e+01;
    amp8[13] = -1.2297861076048798e+02;
    amp8[14] = -2.6252652966414048e+03;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D15
    shift8[0] = 5.5367335615411457e-08;
    shift8[1] = 4.6910257304582898e-07;
    shift8[2] = 2.6768223190551614e-06;
    shift8[3] = 1.4319657256375662e-05;
    shift8[4] = 7.5694473187855338e-05;
    shift8[5] = 3.9922490005559548e-04;
    shift8[6] = 2.1046795395127538e-03;
    shift8[7] = 1.1094832053548640e-02;
    shift8[8] = 5.8486687698920667e-02;
    shift8[9] = 3.0834388405073770e-01;
    shift8[10] = 1.6264534005778293e+00;
    shift8[11] = 8.6030459456576764e+00;
    shift8[12] = 4.6179583183155444e+01;
    shift8[13] = 2.6854965277696181e+02;
    shift8[14] = 2.6004158696112045e+03;
  }
  else if (Nroot == 2) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N2.D15
    ampdeg4 = 2.9684068727771656e-01;
    amp4[0] = 1.2696823706175989e-07;
    amp4[1] = 5.6926143584989885e-07;
    amp4[2] = 2.4727839343726422e-06;
    amp4[3] = 1.0812127017162854e-05;
    amp4[4] = 4.7352433370142964e-05;
    amp4[5] = 2.0744845100792545e-04;
    amp4[6] = 9.0887450499211122e-04;
    amp4[7] = 3.9820280652658564e-03;
    amp4[8] = 1.7446815553444940e-02;
    amp4[9] = 7.6451403658482478e-02;
    amp4[10] = 3.3524686893643368e-01;
    amp4[11] = 1.4757798789475023e+00;
    amp4[12] = 6.6339476338664829e+00;
    amp4[13] = 3.3438547944403901e+01;
    amp4[14] = 3.2877371690139836e+02;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N2.D15
    shift4[0] = 3.9820276984730121e-08;
    shift4[1] = 3.9146613425681298e-07;
    shift4[2] = 2.3275530853916078e-06;
    shift4[3] = 1.2809413737106821e-05;
    shift4[4] = 6.9525109323737315e-05;
    shift4[5] = 3.7639882291283061e-04;
    shift4[6] = 2.0368115485340666e-03;
    shift4[7] = 1.1020892239577923e-02;
    shift4[8] = 5.9632269276970143e-02;
    shift4[9] = 3.2268232551227521e-01;
    shift4[10] = 1.7467634802722962e+00;
    shift4[11] = 9.4751969185804512e+00;
    shift4[12] = 5.1976660608575500e+01;
    shift4[13] = 3.0340249698507904e+02;
    shift4[14] = 2.6128972051433507e+03;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N2.D15
    ampdeg8 = 1.8343259912728984e+00;
    amp8[0] = -3.2551031431925859e-09;
    amp8[1] = -2.1652841473314716e-08;
    amp8[2] = -1.3113997790911145e-07;
    amp8[3] = -7.8921682388705762e-07;
    amp8[4] = -4.7457388233365813e-06;
    amp8[5] = -2.8533257870842172e-05;
    amp8[6] = -1.7154909682365793e-04;
    amp8[7] = -1.0313973650395273e-03;
    amp8[8] = -6.2012159624839176e-03;
    amp8[9] = -3.7290770846619754e-02;
    amp8[10] = -2.2445268214487571e-01;
    amp8[11] = -1.3577116485906893e+00;
    amp8[12] = -8.4372448825019593e+00;
    amp8[13] = -6.0790296811231926e+01;
    amp8[14] = -1.0603557520126285e+03;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N2.D15
    shift8[0] = 5.2711987669369337e-08;
    shift8[1] = 4.6695583456511192e-07;
    shift8[2] = 2.7366404746365383e-06;
    shift8[3] = 1.5021257342329142e-05;
    shift8[4] = 8.1483737446225903e-05;
    shift8[5] = 4.4105529137588304e-04;
    shift8[6] = 2.3863892426513006e-03;
    shift8[7] = 1.2910961299772252e-02;
    shift8[8] = 6.9851628850909980e-02;
    shift8[9] = 3.7794547320333916e-01;
    shift8[10] = 2.0458557413480620e+00;
    shift8[11] = 1.1101162289724323e+01;
    shift8[12] = 6.1032295129849487e+01;
    shift8[13] = 3.6098164078351266e+02;
    shift8[14] = 3.4150029143423658e+03;
  }
  else {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (14, 14) approximation for spectral range [1e-6, 1900]
// Nroot 1 gives errors 1.977763e-05 and 1.066894e-05
// Nroot 2 gives errors 1.066894e-05 and 5.434572e-06
void setup_rhmc14() {
  if (Nroot == 1) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D14
    ampdeg4 = 8.1598413078092485e-02;
    amp4[0] = 9.9559072355053982e-06;
    amp4[1] = 3.3020873814450802e-05;
    amp4[2] = 1.1228922464674402e-04;
    amp4[3] = 3.8889737223977793e-04;
    amp4[4] = 1.3522272956591416e-03;
    amp4[5] = 4.7054168325320854e-03;
    amp4[6] = 1.6376156539288457e-02;
    amp4[7] = 5.6996535157360306e-02;
    amp4[8] = 1.9840054510008215e-01;
    amp4[9] = 6.9108460559199147e-01;
    amp4[10] = 2.4158405846450672e+00;
    amp4[11] = 8.6057190620501967e+00;
    amp4[12] = 3.3890251374088386e+01;
    amp4[13] = 2.3504525036382458e+02;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D14
    shift4[0] = 3.1091202709754253e-07;
    shift4[1] = 3.3002898614760278e-06;
    shift4[2] = 1.9432032603545606e-05;
    shift4[3] = 1.0458587783334595e-04;
    shift4[4] = 5.5372970932160166e-04;
    shift4[5] = 2.9226725474850892e-03;
    shift4[6] = 1.5417338259536074e-02;
    shift4[7] = 8.1319833302107583e-02;
    shift4[8] = 4.2894955441522714e-01;
    shift4[9] = 2.2635077002645363e+00;
    shift4[10] = 1.1968587669408299e+01;
    shift4[11] = 6.3972780834435760e+01;
    shift4[12] = 3.6248731018040093e+02;
    shift4[13] = 2.9229220219690665e+03;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D14
    ampdeg8 = 3.4833964183109063e+00;
    amp8[0] = -3.0646798675863912e-08;
    amp8[1] = -2.2540506364463865e-07;
    amp8[2] = -1.4807666706649540e-06;
    amp8[3] = -9.6280583331478298e-06;
    amp8[4] = -6.2504115748529369e-05;
    amp8[5] = -4.0565391295931943e-04;
    amp8[6] = -2.6325875514359208e-03;
    amp8[7] = -1.7085316119792183e-02;
    amp8[8] = -1.1090581156412292e-01;
    amp8[9] = -7.2072584558682851e-01;
    amp8[10] = -4.7113174344226216e+00;
    amp8[11] = -3.1771032521212383e+01;
    amp8[12] = -2.5313092054773401e+02;
    amp8[13] = -5.4038833200814788e+03;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D14
    shift8[0] = 5.5375630289984406e-07;
    shift8[1] = 4.6920420070699977e-06;
    shift8[2] = 2.6776516882928181e-05;
    shift8[3] = 1.4325573307166637e-04;
    shift8[4] = 7.5733807345999859e-04;
    shift8[5] = 3.9947542464893859e-03;
    shift8[6] = 2.1062339071416580e-02;
    shift8[7] = 1.1104428086980997e-01;
    shift8[8] = 5.8549391447179067e-01;
    shift8[9] = 3.0886978107077443e+00;
    shift8[10] = 1.6339251970144741e+01;
    shift8[11] = 8.7715121296249336e+01;
    shift8[12] = 5.1013904863747950e+02;
    shift8[13] = 4.9400764934764347e+03;
  }
  else if (Nroot == 2) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N2.D14
    ampdeg4 = 2.8707614061476772e-01;
    amp4[0] = 9.2076333378286609e-07;
    amp4[1] = 4.0446175648462113e-06;
    amp4[2] = 1.7170849964262899e-05;
    amp4[3] = 7.3381642320130997e-05;
    amp4[4] = 3.1414391855476802e-04;
    amp4[5] = 1.3452993555713470e-03;
    amp4[6] = 5.7615591883506071e-03;
    amp4[7] = 2.4676242203190361e-02;
    amp4[8] = 1.0570242143965101e-01;
    amp4[9] = 4.5314629694346681e-01;
    amp4[10] = 1.9508509568163237e+00;
    amp4[11] = 8.5879175414229980e+00;
    amp4[12] = 4.2574473478742618e+01;
    amp4[13] = 4.1558240439685522e+02;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N2.D14
    shift4[0] = 3.8460942912706409e-07;
    shift4[1] = 3.7244747389455358e-06;
    shift4[2] = 2.1661031438159155e-05;
    shift4[3] = 1.1628439315775908e-04;
    shift4[4] = 6.1514596650186204e-04;
    shift4[5] = 3.2451233958838074e-03;
    shift4[6] = 1.7110291364105374e-02;
    shift4[7] = 9.0208404373209705e-02;
    shift4[8] = 4.7562375124070089e-01;
    shift4[9] = 2.5087871144779519e+00;
    shift4[10] = 1.3262994501235704e+01;
    shift4[11] = 7.0957698057112779e+01;
    shift4[12] = 4.0494096112887928e+02;
    shift4[13] = 3.4311121878889867e+03;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N2.D14
    ampdeg8 = 1.8652631531961219e+00;
    amp8[0] = -3.6051427567814793e-08;
    amp8[1] = -2.3411573201402719e-07;
    amp8[2] = -1.3799104883156706e-06;
    amp8[3] = -8.0789153596603530e-06;
    amp8[4] = -4.7258077834724818e-05;
    amp8[5] = -2.7639739223737621e-04;
    amp8[6] = -1.6165257946717838e-03;
    amp8[7] = -9.4546417155204465e-03;
    amp8[8] = -5.5308476043598655e-02;
    amp8[9] = -3.2388013939229998e-01;
    amp8[10] = -1.9069073267361212e+00;
    amp8[11] = -1.1553379009656840e+01;
    amp8[12] = -8.1583860497980396e+01;
    amp8[13] = -1.4101265220565076e+03;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N2.D14
    shift8[0] = 5.0862459883361453e-07;
    shift8[1] = 4.4343135370670599e-06;
    shift8[2] = 2.5409825606379618e-05;
    shift8[3] = 1.3603283410698798e-04;
    shift8[4] = 7.1917587849026205e-04;
    shift8[5] = 3.7931325891586592e-03;
    shift8[6] = 1.9997119647636463e-02;
    shift8[7] = 1.0541627603267574e-01;
    shift8[8] = 5.5575311835761720e-01;
    shift8[9] = 2.9313733316982362e+00;
    shift8[10] = 1.5502495610328728e+01;
    shift8[11] = 8.3134974639193175e+01;
    shift8[12] = 4.8090147718127872e+02;
    shift8[13] = 4.4800441127053627e+03;
  }
  else {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (13, 13) approximation for spectral range [5e-5, 5000]
// Nroot 1 gives errors 9.655804e-06 and 5.207535e-06
// Nroot 2 gives errors 5.207535e-06 and 2.652469e-06
// Nroot 3 gives errors 3.519726e-06 and 1.774363e-06
void setup_rhmc13() {
  if (Nroot == 1) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D13
    ampdeg4 = 6.2206955393599973e-02;
    amp4[0] = 1.6848285353541665e-04;
    amp4[1] = 5.2338064801984400e-04;
    amp4[2] = 1.6533750881931315e-03;
    amp4[3] = 5.3271125303278365e-03;
    amp4[4] = 1.7246498856036803e-02;
    amp4[5] = 5.5893653588691534e-02;
    amp4[6] = 1.8119135032352549e-01;
    amp4[7] = 5.8752306936562049e-01;
    amp4[8] = 1.9070500579073184e+00;
    amp4[9] = 6.2206970959780703e+00;
    amp4[10] = 2.0777915067452604e+01;
    amp4[11] = 7.7858776368682243e+01;
    amp4[12] = 5.2966683816011061e+02;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D13
    shift4[0] = 1.3676835247681990e-05;
    shift4[1] = 1.3794424840269417e-04;
    shift4[2] = 7.5120149785107759e-04;
    shift4[3] = 3.6970035202075337e-03;
    shift4[4] = 1.7830868113201215e-02;
    shift4[5] = 8.5641717316970553e-02;
    shift4[6] = 4.1099100123578608e-01;
    shift4[7] = 1.9722128414394813e+00;
    shift4[8] = 9.4692060998832037e+00;
    shift4[9] = 4.5592497855547961e+01;
    shift4[10] = 2.2252432239085124e+02;
    shift4[11] = 1.1615328043259224e+03;
    shift4[12] = 8.8234028594217307e+03;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D13
    ampdeg8 = 3.9896189321666236e+00;
    amp8[0] = -2.1160057891713894e-06;
    amp8[1] = -1.4210652982457457e-05;
    amp8[2] = -8.4140965601095329e-05;
    amp8[3] = -4.9208846451904347e-04;
    amp8[4] = -2.8721756962033010e-03;
    amp8[5] = -1.6757717211315786e-02;
    amp8[6] = -9.7772127376433704e-02;
    amp8[7] = -5.7063548523312768e-01;
    amp8[8] = -3.3359863254047522e+00;
    amp8[9] = -1.9658973531246072e+01;
    amp8[10] = -1.2039519339286457e+02;
    amp8[11] = -8.9004624340848250e+02;
    amp8[12] = -1.8380488437544929e+04;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D13
    shift8[0] = 2.4192516250020111e-05;
    shift8[1] = 1.9349582686313278e-04;
    shift8[2] = 1.0181516733353962e-03;
    shift8[3] = 4.9755637735251637e-03;
    shift8[4] = 2.3954442825876218e-02;
    shift8[5] = 1.1497120637709825e-01;
    shift8[6] = 5.5147655736902479e-01;
    shift8[7] = 2.6453165768424083e+00;
    shift8[8] = 1.2698620346795309e+01;
    shift8[9] = 6.1188282106418086e+01;
    shift8[10] = 3.0025102721136665e+02;
    shift8[11] = 1.6132817300793333e+03;
    shift8[12] = 1.4810284890284607e+04;
  }
  else if (Nroot == 2) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N2.D13
    ampdeg4 = 2.5065050497365038e-01;
    amp4[0] = 2.4913097647765345e-05;
    amp4[1] = 1.0166925658158364e-04;
    amp4[2] = 3.9704309952140080e-04;
    amp4[3] = 1.5610680129311812e-03;
    amp4[4] = 6.1504754729976548e-03;
    amp4[5] = 2.4243815801225560e-02;
    amp4[6] = 9.5578114954099222e-02;
    amp4[7] = 3.7690698687608204e-01;
    amp4[8] = 1.4881145502938466e+00;
    amp4[9] = 5.9095729463472049e+00;
    amp4[10] = 2.4131262311766527e+01;
    amp4[11] = 1.1284136627197708e+02;
    amp4[12] = 1.0748609280837475e+03;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N2.D13
    shift4[0] = 1.6880161445374858e-05;
    shift4[1] = 1.5496363427341752e-04;
    shift4[2] = 8.3263661850524983e-04;
    shift4[3] = 4.0857496140388853e-03;
    shift4[4] = 1.9687178069158626e-02;
    shift4[5] = 9.4506647026124019e-02;
    shift4[6] = 4.5332842649322397e-01;
    shift4[7] = 2.1744574826849781e+00;
    shift4[8] = 1.0436477350662633e+01;
    shift4[9] = 5.0245562388375589e+01;
    shift4[10] = 2.4554298396526420e+02;
    shift4[11] = 1.2920175285063638e+03;
    shift4[12] = 1.0333774189354621e+04;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N2.D13
    ampdeg8 = 1.9962055625445860e+00;
    amp8[0] = -1.9698505558560397e-06;
    amp8[1] = -1.1732617080180879e-05;
    amp8[2] = -6.2652587858772182e-05;
    amp8[3] = -3.3181183933212832e-04;
    amp8[4] = -1.7553193511414826e-03;
    amp8[5] = -9.2840086508032930e-03;
    amp8[6] = -4.9104975367693530e-02;
    amp8[7] = -2.5980701497420511e-01;
    amp8[8] = -1.3767124800698658e+00;
    amp8[9] = -7.3491977439436731e+00;
    amp8[10] = -4.0649612189167364e+01;
    amp8[11] = -2.6740281870968391e+02;
    amp8[12] = -4.4798354215612489e+03;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N2.D13
    shift8[0] = 2.2246333589018706e-05;
    shift8[1] = 1.8326689835546973e-04;
    shift8[2] = 9.6875404148169498e-04;
    shift8[3] = 4.7380542154200683e-03;
    shift8[4] = 2.2812884665145750e-02;
    shift8[5] = 1.0948469158491782e-01;
    shift8[6] = 5.2510609097289973e-01;
    shift8[7] = 2.5185293375667093e+00;
    shift8[8] = 1.2088100449661113e+01;
    shift8[9] = 5.8226646947811716e+01;
    shift8[10] = 2.8536402829862243e+02;
    shift8[11] = 1.5242526787234522e+03;
    shift8[12] = 1.3446521616331240e+04;
  }
  else if (Nroot == 3) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N3.D13
    ampdeg4 = 3.9777427266721349e-01;
    amp4[0] = 1.1047335690086144e-05;
    amp4[1] = 4.9170905702653993e-05;
    amp4[2] = 2.0594923372042615e-04;
    amp4[3] = 8.6520366779990743e-04;
    amp4[4] = 3.6394302187193759e-03;
    amp4[5] = 1.5313756138268193e-02;
    amp4[6] = 6.4443841085160825e-02;
    amp4[7] = 2.7127031437200444e-01;
    amp4[8] = 1.1433468102778883e+00;
    amp4[9] = 4.8485343937248091e+00;
    amp4[10] = 2.1174746735611137e+01;
    amp4[11] = 1.0670826596895348e+02;
    amp4[12] = 1.1443566418286373e+03;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N3.D13
    shift4[0] = 1.8013143814078639e-05;
    shift4[1] = 1.6095634028347460e-04;
    shift4[2] = 8.6138632917052212e-04;
    shift4[3] = 4.2232607475215104e-03;
    shift4[4] = 2.0344955557432903e-02;
    shift4[5] = 9.7653266196664382e-02;
    shift4[6] = 4.6838188776896650e-01;
    shift4[7] = 2.2464926642634486e+00;
    shift4[8] = 1.0781632765029377e+01;
    shift4[9] = 5.1909699310534961e+01;
    shift4[10] = 2.5381058066643988e+02;
    shift4[11] = 1.3395442339594563e+03;
    shift4[12] = 1.0923680537447777e+04;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N3.D13
    ampdeg8 = 1.5852761162338231e+00;
    amp8[0] = -1.6141244673086449e-06;
    amp8[1] = -9.2314710608310351e-06;
    amp8[2] = -4.7623560980925085e-05;
    amp8[3] = -2.4401219091922302e-04;
    amp8[4] = -1.2492448653198273e-03;
    amp8[5] = -6.3947993048467612e-03;
    amp8[6] = -3.2735726318621150e-02;
    amp8[7] = -1.6762933825907150e-01;
    amp8[8] = -8.5966206955662183e-01;
    amp8[9] = -4.4404338724050394e+00;
    amp8[10] = -2.3742945075969342e+01;
    amp8[11] = -1.5028032935778936e+02;
    amp8[12] = -2.3542963381735935e+03;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N3.D13
    shift8[0] = 2.1615505536069084e-05;
    shift8[1] = 1.7994833559948766e-04;
    shift8[2] = 9.5275095292070386e-04;
    shift8[3] = 4.6611993257547404e-03;
    shift8[4] = 2.2443890476527898e-02;
    shift8[5] = 1.0771312033050995e-01;
    shift8[6] = 5.1660014460127535e-01;
    shift8[7] = 2.4776767136112108e+00;
    shift8[8] = 1.1891601018916921e+01;
    shift8[9] = 5.7274737020445130e+01;
    shift8[10] = 2.8059186290142122e+02;
    shift8[11] = 1.4959728529287738e+03;
    shift8[12] = 1.3034652658242361e+04;
  }
  else {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (12, 12) approximation for spectral range [5e-5, 2500]
// gives errors 1.651364e-05 and 8.903595e-06
void setup_rhmc12() {
  if (Nroot != 1) {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }

  // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D12
  ampdeg4 = 7.5612937920090051e-02;
  amp4[0] = 1.8216457158166084e-04;
  amp4[1] = 5.9379925266976337e-04;
  amp4[2] = 1.9805510810841850e-03;
  amp4[3] = 6.7305259043889251e-03;
  amp4[4] = 2.2968035814462363e-02;
  amp4[5] = 7.8446158076590208e-02;
  amp4[6] = 2.6801161968909804e-01;
  amp4[7] = 9.1638294964514777e-01;
  amp4[8] = 3.1455001608230782e+00;
  amp4[9] = 1.1015300940935630e+01;
  amp4[10] = 4.2804007219649421e+01;
  amp4[11] = 2.9528433327784637e+02;

  // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D12
  shift4[0] = 1.5040176129323931e-05;
  shift4[1] = 1.5748395080558076e-04;
  shift4[2] = 9.0824136753769424e-04;
  shift4[3] = 4.7741664713063219e-03;
  shift4[4] = 2.4663956324885342e-02;
  shift4[5] = 1.2699351312509560e-01;
  shift4[6] = 6.5351357742461591e-01;
  shift4[7] = 3.3640324149937921e+00;
  shift4[8] = 1.7354798935745059e+01;
  shift4[9] = 9.0565575140189637e+01;
  shift4[10] = 5.0212898660187273e+02;
  shift4[11] = 3.9849675183074896e+03;

  // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D12
  ampdeg8 = 3.6186931031844773e+00;
  amp8[0] = -2.3930839139052775e-06;
  amp8[1] = -1.7181239140141815e-05;
  amp8[2] = -1.0981630153120690e-04;
  amp8[3] = -6.9437167972036544e-04;
  amp8[4] = -4.3832262963637986e-03;
  amp8[5] = -2.7661879237314023e-02;
  amp8[6] = -1.7460165737364908e-01;
  amp8[7] = -1.1034404071593327e+00;
  amp8[8] = -7.0181229003145109e+00;
  amp8[9] = -4.6131109343683470e+01;
  amp8[10] = -3.6022476726756418e+02;
  amp8[11] = -7.6207918210876232e+03;

  // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D12
  shift8[0] = 2.6735960107323604e-05;
  shift8[1] = 2.2306727287285208e-04;
  shift8[2] = 1.2458325540584518e-03;
  shift8[3] = 6.5075515795739352e-03;
  shift8[4] = 3.3564360760126602e-02;
  shift8[5] = 1.7269705767541360e-01;
  shift8[6] = 8.8824779717055669e-01;
  shift8[7] = 4.5708480123957029e+00;
  shift8[8] = 2.3591600305750941e+01;
  shift8[9] = 1.2367293211540921e+02;
  shift8[10] = 7.0427529652865735e+02;
  shift8[11] = 6.7232191211233530e+03;
}
// -----------------------------------------------------------------




// -----------------------------------------------------------------
// (11, 11) approximation for spectral range [1e-5, 50]
// Nroot 1 gives errors 1.064032e-05 and 5.735037e-06
// Nroot 2 gives errors 5.735037e-06 and 2.920714e-06
void setup_rhmc11() {
  if (Nroot == 1) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D11
    ampdeg4 = 1.9748180236103505e-01;
    amp4[0] = 5.1088365802723218e-05;
    amp4[1] = 1.6003338487834137e-04;
    amp4[2] = 5.1036966915755293e-04;
    amp4[3] = 1.6597921340084090e-03;
    amp4[4] = 5.4234722425496587e-03;
    amp4[5] = 1.7742709041750043e-02;
    amp4[6] = 5.8113137000818688e-02;
    amp4[7] = 1.9124921824328966e-01;
    amp4[8] = 6.4404937803804974e-01;
    amp4[9] = 2.4284312000973571e+00;
    amp4[10] = 1.6558885067283203e+01;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D11
    shift4[0] = 2.7818179678949325e-06;
    shift4[1] = 2.8238764993579120e-05;
    shift4[2] = 1.5531382235812910e-04;
    shift4[3] = 7.7317635540915576e-04;
    shift4[4] = 3.7741083934698738e-03;
    shift4[5] = 1.8350836737594658e-02;
    shift4[6] = 8.9203180943308050e-02;
    shift4[7] = 4.3471535522870142e-01;
    shift4[8] = 2.1465885440424688e+00;
    shift4[9] = 1.1322523014309711e+01;
    shift4[10] = 8.6660800228024399e+01;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D11
    ampdeg8 = 2.2391954658813749e+00;
    amp8[0] = -3.5363622101017518e-07;
    amp8[1] = -2.4024443111274285e-06;
    amp8[2] = -1.4414646320691006e-05;
    amp8[3] = -8.5452752390562025e-05;
    amp8[4] = -5.0563198975080701e-04;
    amp8[5] = -2.9917201595653243e-03;
    amp8[6] = -1.7728072906135327e-02;
    amp8[7] = -1.0586065354081924e-01;
    amp8[8] = -6.5625958559320219e-01;
    amp8[9] = -4.8970608140017928e+00;
    amp8[10] = -1.0154172043999166e+02;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D11
    shift8[0] = 4.9243473302622236e-06;
    shift8[1] = 3.9671800968449227e-05;
    shift8[2] = 2.1090234404452169e-04;
    shift8[3] = 1.0426007462641042e-03;
    shift8[4] = 5.0800004851836514e-03;
    shift8[5] = 2.4682287075428813e-02;
    shift8[6] = 1.1994027687958879e-01;
    shift8[7] = 5.8487501074377135e-01;
    shift8[8] = 2.9029811669526673e+00;
    shift8[9] = 1.5754881262197461e+01;
    shift8[10] = 1.4560448531198813e+02;
  }
  else if (Nroot == 2) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N2.D11
    ampdeg4 = 4.4658897145738358e-01;
    amp4[0] = 6.1928956784528334e-06;
    amp4[1] = 2.5509619589569428e-05;
    amp4[2] = 1.0068991564687344e-04;
    amp4[3] = 4.0013560006087233e-04;
    amp4[4] = 1.5934197240741795e-03;
    amp4[5] = 6.3496373702466493e-03;
    amp4[6] = 2.5334117989714744e-02;
    amp4[7] = 1.0164563810664018e-01;
    amp4[8] = 4.1902499678953481e-01;
    amp4[9] = 1.9737323090795471e+00;
    amp4[10] = 1.8856372101311550e+01;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N2.D11
    shift4[0] = 3.4339601484710129e-06;
    shift4[1] = 3.1736196019433604e-05;
    shift4[2] = 1.7223673570189324e-04;
    shift4[3] = 8.5488350641646038e-04;
    shift4[4] = 4.1687414187142778e-03;
    shift4[5] = 2.0257442046274134e-02;
    shift4[6] = 9.8425187449942608e-02;
    shift4[7] = 4.7956996174386374e-01;
    shift4[8] = 2.3707654946426282e+00;
    shift4[9] = 1.2603410679481062e+01;
    shift4[10] = 1.0153629841000166e+02;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N2.D11
    ampdeg8 = 1.4954990416746980e+00;
    amp8[0] = -3.6354110566619805e-07;
    amp8[1] = -2.1890802286122657e-06;
    amp8[2] = -1.1837724035508550e-05;
    amp8[3] = -6.3501454869371309e-05;
    amp8[4] = -3.4029224677202947e-04;
    amp8[5] = -1.8237441422943575e-03;
    amp8[6] = -9.7879720563849148e-03;
    amp8[7] = -5.2905335519069077e-02;
    amp8[8] = -2.9601388568308901e-01;
    amp8[9] = -1.9645144670071346e+00;
    amp8[10] = -3.3037305399006478e+01;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N2.D11
    shift8[0] = 4.5274248133595928e-06;
    shift8[1] = 3.7562737436881169e-05;
    shift8[2] = 2.0059075052276780e-04;
    shift8[3] = 9.9239787562902882e-04;
    shift8[4] = 4.8356550463981504e-03;
    shift8[5] = 2.3492726897975016e-02;
    shift8[6] = 1.1414068766310201e-01;
    shift8[7] = 5.5639819364559784e-01;
    shift8[8] = 2.7582313389204565e+00;
    shift8[9] = 1.4881819082782400e+01;
    shift8[10] = 1.3218174828906723e+02;
  }
  else {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (10, 10) approximation for spectral range [5e-4, 1000]
// gives errors 1.718292e-05 and 9.257843e-06
void setup_rhmc10() {
  if (Nroot != 1) {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }

  // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D10
  ampdeg4 = 9.5236040698401025e-02;
  amp4[0] = 1.0305116214687513e-03;
  amp4[1] = 3.3718283049997588e-03;
  amp4[2] = 1.1293907313293374e-02;
  amp4[3] = 3.8540256520752894e-02;
  amp4[4] = 1.3207968447962981e-01;
  amp4[5] = 4.5334819932450859e-01;
  amp4[6] = 1.5622562711791996e+00;
  amp4[7] = 5.4911794756331380e+00;
  amp4[8] = 2.1399718600200291e+01;
  amp4[9] = 1.4779575007005877e+02;

  // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D10
  shift4[0] = 1.5149323791794220e-04;
  shift4[1] = 1.5909706611240905e-03;
  shift4[2] = 9.2168584704976960e-03;
  shift4[3] = 4.8698758452968574e-02;
  shift4[4] = 2.5295601995683098e-01;
  shift4[5] = 1.3101661690595596e+00;
  shift4[6] = 6.7963963422459379e+00;
  shift4[7] = 3.5653187401114494e+01;
  shift4[8] = 1.9861151960264147e+02;
  shift4[9] = 1.5816612805396308e+03;

  // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D10
  ampdeg8 = 3.2244477566414624e+00;
  amp8[0] = -3.2208707338912046e-05;
  amp8[1] = -2.3243430945415344e-04;
  amp8[2] = -1.4943579180777895e-03;
  amp8[3] = -9.5057857586941571e-03;
  amp8[4] = -6.0381776270618456e-02;
  amp8[5] = -3.8390036988977677e-01;
  amp8[6] = -2.4560147977775588e+00;
  amp8[7] = -1.6231889764931818e+01;
  amp8[8] = -1.2729189072873393e+02;
  amp8[9] = -2.6980978083468826e+03;

  // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D10
  shift8[0] = 2.6936957159554373e-04;
  shift8[1] = 2.2548188733747068e-03;
  shift8[2] = 1.2651142037133222e-02;
  shift8[3] = 6.6422206726939034e-02;
  shift8[4] = 3.4444127701857080e-01;
  shift8[5] = 1.7828719980804448e+00;
  shift8[6] = 9.2513825960872182e+00;
  shift8[7] = 4.8745127781844168e+01;
  shift8[8] = 2.7883366727955610e+02;
  shift8[9] = 2.6699190389084179e+03;
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (9, 9) approximation for spectral range [1e-4, 45]
// Nroot 1 gives errors 1.928152e-05 and 1.038366e-05
// Nroot 2 gives errors 1.038366e-05 and 5.287008e-06
void setup_rhmc9() {
  if (Nroot == 1) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D9
    ampdeg4 = 2.0777859903387064e-01;
    amp4[0] = 3.1361646774095720e-04;
    amp4[1] = 1.0376047912755866e-03;
    amp4[2] = 3.5188116165401893e-03;
    amp4[3] = 1.2155937785551100e-02;
    amp4[4] = 4.2190013023882304e-02;
    amp4[5] = 1.4707389241596666e-01;
    amp4[6] = 5.2261160990536404e-01;
    amp4[7] = 2.0541440716938171e+00;
    amp4[8] = 1.4235435645059507e+01;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D9
    shift4[0] = 3.0945740855689258e-05;
    shift4[1] = 3.2784330944557943e-04;
    shift4[2] = 1.9246508827843313e-03;
    shift4[3] = 1.0324786841812992e-02;
    shift4[4] = 5.4499729309375029e-02;
    shift4[5] = 2.8737303500233369e-01;
    shift4[6] = 1.5309893112867550e+00;
    shift4[7] = 8.6482893683193165e+00;
    shift4[8] = 6.9576998834492443e+01;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D9
    ampdeg8 = 2.1830271620728054e+00;
    amp8[0] = -5.4143795366382000e-06;
    amp8[1] = -3.9676818015731586e-05;
    amp8[2] = -2.5958109726990279e-04;
    amp8[3] = -1.6811247632604292e-03;
    amp8[4] = -1.0882543862047362e-02;
    amp8[5] = -7.0847423319728930e-02;
    amp8[6] = -4.7591272677901392e-01;
    amp8[7] = -3.7801496263213803e+00;
    amp8[8] = -8.0587284363165352e+01;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D9
    shift8[0] = 5.5083850325016191e-05;
    shift8[1] = 4.6563686474799176e-04;
    shift8[2] = 2.6486486150264711e-03;
    shift8[3] = 1.4120708057479768e-02;
    shift8[4] = 7.4420558484424110e-02;
    shift8[5] = 3.9242609363745878e-01;
    shift8[6] = 2.0993041046459315e+00;
    shift8[7] = 1.2170425789307121e+01;
    shift8[8] = 1.1759944538524526e+02;
  }
  else if (Nroot == 2) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N2.D9
    ampdeg4 = 4.5807950417368620e-01;
    amp4[0] = 5.1524872244207122e-05;
    amp4[1] = 2.2566198030965118e-04;
    amp4[2] = 9.5485529012639969e-04;
    amp4[3] = 4.0678905082870897e-03;
    amp4[4] = 1.7374228391146457e-02;
    amp4[5] = 7.4550051307359907e-02;
    amp4[6] = 3.2717892510985386e-01;
    amp4[7] = 1.6180914847540615e+00;
    amp4[8] = 1.5778331131992330e+01;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N2.D9
    shift4[0] = 3.8265486586764107e-05;
    shift4[1] = 3.6974877279590993e-04;
    shift4[2] = 2.1435674755463652e-03;
    shift4[3] = 1.1467127372415016e-02;
    shift4[4] = 6.0467162456753556e-02;
    shift4[5] = 3.1868090337129679e-01;
    shift4[6] = 1.6989796134037309e+00;
    shift4[7] = 9.6641832738811502e+00;
    shift4[8] = 8.1693635674489826e+01;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N2.D9
    ampdeg8 = 1.4766249613811473e+00;
    amp8[0] = -4.7777645279659199e-06;
    amp8[1] = -3.0916955714630042e-05;
    amp8[2] = -1.8150674530190134e-04;
    amp8[3] = -1.0586016557502791e-03;
    amp8[4] = -6.1750814162474807e-03;
    amp8[5] = -3.6213363701701237e-02;
    amp8[6] = -2.1858843404968301e-01;
    amp8[7] = -1.5390064752367809e+00;
    amp8[8] = -2.6565433043046731e+01;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N2.D9
    shift8[0] = 5.0592713965552382e-05;
    shift8[1] = 4.4004715334484935e-04;
    shift8[2] = 2.5133020451867344e-03;
    shift8[3] = 1.3407145211556958e-02;
    shift8[4] = 7.0655696364584145e-02;
    shift8[5] = 3.7245346190188205e-01;
    shift8[6] = 1.9902347942939507e+00;
    shift8[7] = 1.1475268309933229e+01;
    shift8[8] = 1.0666184114902636e+02;
  }
  else {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }
}
// -----------------------------------------------------------------




// -----------------------------------------------------------------
// (8, 8) approximation for spectral range [0.001, 50]
// Nroot 1 gives errors 1.205192e-05 and 6.486560e-06
// Nroot 2 gives errors 6.486560e-06 and 3.302261e-06
void setup_rhmc8() {
  if (Nroot == 1) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D8
    ampdeg4 = 1.9847855485120461e-01;
    amp4[0] = 1.6447767692749293e-03;
    amp4[1] = 5.2091545016137450e-03;
    amp4[2] = 1.6823654204678816e-02;
    amp4[3] = 5.5444365469241169e-02;
    amp4[4] = 1.8437888053401108e-01;
    amp4[5] = 6.2746826716341830e-01;
    amp4[6] = 2.3852840251249825e+00;
    amp4[7] = 1.6315143889652543e+01;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D8
    shift4[0] = 2.8432460169357867e-04;
    shift4[1] = 2.9108780584128227e-03;
    shift4[2] = 1.6221830544213445e-02;
    shift4[3] = 8.2026799734265451e-02;
    shift4[4] = 4.0801052401031673e-01;
    shift4[5] = 2.0476062496901357e+00;
    shift4[6] = 1.0951562209548896e+01;
    shift4[7] = 8.4659732253886020e+01;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D8
    ampdeg8 = 2.2336270511419518e+00;
    amp8[0] = -6.4667060419709420e-05;
    amp8[1] = -4.4599197309502802e-04;
    amp8[2] = -2.7234661408815967e-03;
    amp8[3] = -1.6461958362314753e-02;
    amp8[4] = -1.0004750758332101e-01;
    amp8[5] = -6.3021119918448276e-01;
    amp8[6] = -4.7606598099602264e+00;
    amp8[7] = -9.9243921490085825e+01;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D8
    shift8[0] = 5.0374382496533006e-04;
    shift8[1] = 4.0970063350602185e-03;
    shift8[2] = 2.2077737619020866e-02;
    shift8[3] = 1.1088619746225478e-01;
    shift8[4] = 5.5108791671543900e-01;
    shift8[5] = 2.7782277485822364e+00;
    shift8[6] = 1.5278036140176734e+01;
    shift8[7] = 1.4244275240229373e+02;
  }
  else if (Nroot == 2) {
    // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N2.D8
    ampdeg4 = 4.4770231426448098e-01;
    amp4[0] = 3.5564929858807357e-04;
    amp4[1] = 1.4829647783407749e-03;
    amp4[2] = 5.9367557425687549e-03;
    amp4[3] = 2.3953183981263053e-02;
    amp4[4] = 9.7347604972001983e-02;
    amp4[5] = 4.0626704825460364e-01;
    amp4[6] = 1.9319350656866709e+00;
    amp4[7] = 1.8529444619487144e+01;

    // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N2.D8
    shift4[0] = 3.5101821017040997e-04;
    shift4[1] = 3.2726719285939335e-03;
    shift4[2] = 1.7997084661441318e-02;
    shift4[3] = 9.0729624953504701e-02;
    shift4[4] = 4.5091274788297991e-01;
    shift4[5] = 2.2647248039093912e+00;
    shift4[6] = 1.2204032874473233e+01;
    shift4[7] = 9.9256799829638084e+01;

    // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N2.D8
    ampdeg8 = 1.4936435076760621e+00;
    amp8[0] = -4.9760035652837519e-05;
    amp8[1] = -3.0394530146087234e-04;
    amp8[2] = -1.6712444221041918e-03;
    amp8[3] = -9.1306264459042677e-03;
    amp8[4] = -5.0169015849943856e-02;
    amp8[5] = -2.8495286357031369e-01;
    amp8[6] = -1.9130894859245169e+00;
    amp8[7] = -3.2334300745135735e+01;

    // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N2.D8
    shift8[0] = 4.6302127841647730e-04;
    shift8[1] = 3.8774221414646505e-03;
    shift8[2] = 2.0985965442057102e-02;
    shift8[3] = 1.0547247993382347e-01;
    shift8[4] = 5.2407043127061881e-01;
    shift8[5] = 2.6388204650175395e+00;
    shift8[6] = 1.4427391478642752e+01;
    shift8[7] = 1.2929588313292328e+02;
  }
  else {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (7, 7) approximation for spectral range [0.01, 150]
// gives errors 1.781381e-05 and 9.580686e-06
void setup_rhmc7() {
  if (Nroot != 1) {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }

  // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D7
  ampdeg4 = 1.5326316573975857e-01;
  amp4[0] = 9.7994797921248308e-03;
  amp4[1] = 3.2179844694980766e-02;
  amp4[2] = 1.0829739662159377e-01;
  amp4[3] = 3.7267169688623547e-01;
  amp4[4] = 1.3130539823649245e+00;
  amp4[5] = 5.1297007503450658e+00;
  amp4[6] = 3.5464062062551541e+01;

  // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D7
  shift4[0] = 3.0500176202031704e-03;
  shift4[1] = 3.2121017568922355e-02;
  shift4[2] = 1.8694642203595604e-01;
  shift4[3] = 9.9502625138175738e-01;
  shift4[4] = 5.2656370536547890e+00;
  shift4[5] = 2.9482543290399242e+01;
  shift4[6] = 2.3556426043523533e+02;

  // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D7
  ampdeg8 = 2.5418686463319484e+00;
  amp8[0] = -9.4451046353977142e-04;
  amp8[1] = -6.8490012168947864e-03;
  amp8[2] = -4.4326125095649642e-02;
  amp8[3] = -2.8561230633721635e-01;
  amp8[4] = -1.8974336110743928e+00;
  amp8[5] = -1.4937228612606580e+01;
  amp8[6] = -3.1715417125536584e+02;

  // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D7
  shift8[0] = 5.4233671586606967e-03;
  shift8[1] = 4.5535405241877540e-02;
  shift8[2] = 2.5670185006942098e-01;
  shift8[3] = 1.3587031887080201e+00;
  shift8[4] = 7.2120298513631562e+00;
  shift8[5] = 4.1441512816953264e+01;
  shift8[6] = 3.9792560434365043e+02;
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (6, 6) approximation for spectral range [0.02, 50]
// gives errors 1.515132e-05 and 8.140949e-06
void setup_rhmc6() {
  if (Nroot != 1) {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }

  // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D6
  ampdeg4 = 2.0035838418319055e-01;
  amp4[0] = 1.6089619700034339e-02;
  amp4[1] = 5.2075939216247140e-02;
  amp4[2] = 1.7299810700423821e-01;
  amp4[3] = 5.9783724002907257e-01;
  amp4[4] = 2.3063654482894740e+00;
  amp4[5] = 1.5868596323671357e+01;

  // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D6
  shift4[0] = 5.9246187607994976e-03;
  shift4[1] = 6.1679058754489605e-02;
  shift4[2] = 3.5332103905499312e-01;
  shift4[3] = 1.8640825764563929e+00;
  shift4[4] = 1.0275478485280116e+01;
  shift4[5] = 8.1016349994659194e+01;

  // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D6
  ampdeg8 = 2.2231956780463324e+00;
  amp8[0] = -1.9829856353425174e-03;
  amp8[1] = -1.4094809881415832e-02;
  amp8[2] = -8.9639421822227741e-02;
  amp8[3] = -5.8322796414232880e-01;
  amp8[4] = -4.5123946696300674e+00;
  amp8[5] = -9.5059971756102911e+01;

  // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D6
  shift8[0] = 1.0516496796568211e-02;
  shift8[1] = 8.7160697505863152e-02;
  shift8[2] = 4.8363725652222034e-01;
  shift8[3] = 2.5473481002404794e+00;
  shift8[4] = 1.4405517772037626e+01;
  shift8[5] = 1.3666238033906589e+02;
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// (5, 5) approximation for spectral range [0.1, 50]
// gives errors 1.548364e-05 and 8.308677e-06
void setup_rhmc5() {
  if (Nroot != 1) {
    node0_printf("setup_rhmc: unrecognized Nroot %d\n", Nroot);
    terminate(1);
  }

  // awk '/res_MD/{print("amp4["$2"] =",$3";")}' < remez/out.N1.D5
  ampdeg4 = 2.0057814828187764e-01;
  amp4[0] = 5.4026803430958975e-02;
  amp4[1] = 1.7590005470348138e-01;
  amp4[2] = 5.9772503229277774e-01;
  amp4[3] = 2.2997285767889570e+00;
  amp4[4] = 1.5819178342283395e+01;

  // awk '/pole_MD/{print("shift4["$2"] =",$3";")}' < remez/out.N1.D5
  shift4[0] = 2.9769772029903337e-02;
  shift4[1] = 3.1110339537434900e-01;
  shift4[2] = 1.8074132732436818e+00;
  shift4[3] = 1.0165968473383909e+01;
  shift4[4] = 8.0573715946619146e+01;

  // awk '/res_GR/{print("amp8["$2"] =",$3";")}' < remez/out.N1.D5
  ampdeg8 = 2.2220375827770185e+00;
  amp8[0] = -1.2204111391487278e-02;
  amp8[1] = -8.7538464213535880e-02;
  amp8[2] = -5.7743852008615837e-01;
  amp8[3] = -4.4849784135647406e+00;
  amp8[4] = -9.4603555440254667e+01;

  // awk '/pole_GR/{print("shift8["$2"] =",$3";")}' < remez/out.N1.D5
  shift8[0] = 5.2850306687580832e-02;
  shift8[1] = 4.4009623019926597e-01;
  shift8[2] = 2.4868497380830941e+00;
  shift8[3] = 1.4278758280275570e+01;
  shift8[4] = 1.3600523930215593e+02;
}
// -----------------------------------------------------------------



// -----------------------------------------------------------------
// Switch between different sets of coefficients
// for (Mdag M)^(-1 / 4) and (Mdag M)^(1 / 8),
// For given spectral range, run with the smallest Norder
// that keeps Remez errors < 2e-5
void setup_rhmc() {
  node0_printf("Using Nroot = %d\n", Nroot);
  node0_printf("RHMC Norder %d for spectral range ", Norder);

  switch(Norder) {
    case 5:
      node0_printf("[0.1, 50]\n");
      setup_rhmc5();
      break;
    case 6:
      node0_printf("[0.02, 50]\n");
      setup_rhmc6();
      break;
    case 7:
      node0_printf("[0.01, 150]\n");
      setup_rhmc7();
      break;
    case 8:
      node0_printf("[0.001, 50]\n");
      setup_rhmc8();
      break;
    case 9:
      node0_printf("[1e-4, 45]\n");
      setup_rhmc9();
      break;
    case 10:
      node0_printf("[5e-4, 1000]\n");
      setup_rhmc10();
      break;
    case 11:
      node0_printf("[1e-5, 50]\n");
      setup_rhmc11();
      break;
    case 12:
      node0_printf("[5e-5, 2500]\n");
      setup_rhmc12();
      break;
    case 13:
      node0_printf("[5e-5, 5000]\n");
      setup_rhmc13();
      break;
    case 14:
      node0_printf("[1e-6, 1900]\n");
      setup_rhmc14();
      break;
    case 15:
      node0_printf("[1e-7, 1000]\n");
      setup_rhmc15();
      break;
    case 16:
      node0_printf("[1e-8, 500]\n");
      setup_rhmc16();
      break;
    case 17:
      node0_printf("[5e-8, 2500]\n");
      setup_rhmc17();
      break;
    case 18:
      node0_printf("[1e-9, 1000]\n");
      setup_rhmc18();
      break;
    case 19:
      node0_printf("[1e-8, 50000]\n");
      setup_rhmc19();
      break;
    default:
      node0_printf("setup_rhmc: unrecognized Norder %d\n", Norder);
      terminate(1);
  }

  // Test by zeroing out all amp4 and amp8, optionally setting Norder to 1
//  int i;
//  Norder = 1;
//  for (i = 0; i < Norder; i++) {
//    amp4[i] = 0;
//    amp8[i] = 0;
//  }
//  node0_printf("TEST VERSION: internal Norder %d\n", Norder);
//  ampdeg4 = 0;
//  amp4[0] = 1;
//  shift4[0] = 1e-3;
//  ampdeg8 = 1;
//  amp8[0] = 0;
//  shift8[0] = 1;

#ifdef DEBUG_CHECK
  int i;
  node0_printf("RHMC ampdeg4 %e\n", ampdeg4);
  for (i = 0; i < Norder; i++)
    node0_printf("RHMC params %d amp4 %e shift4 %e\n", i, amp4[i], shift4[i]);

  node0_printf("RHMC ampdeg8 %e\n", ampdeg8);
  for (i = 0; i < Norder; i++)
    node0_printf("RHMC params %d amp8 %e shift8 %e\n", i, amp8[i], shift8[i]);
#endif
}
// -----------------------------------------------------------------
