20 static symbol xwra(
"xwra");
23 expr.find(sqrt(
w), pows_set);
24 expr.find(pow(
w1,
w2), pows_set);
26 for(
auto item : pows_set) {
27 if(item.has(WRA(
w))) {
28 if(item.match(pow(
w1,
w2)) && !item.op(1).info(info_flags::integer)) {
29 pow_map[item] = exp(log(item.op(0)) * item.op(1));
30 }
else if(item.match(sqrt(
w))) {
31 pow_map[item] = exp(log(item.op(0))/2);
36 expr = expr.subs(pow_map);
41 expr.find(log(
w), logs_set);
44 for(
auto item : logs_set){
45 if(item.has(WRA(
w))) {
47 id_logz_lst.append(iWF(log_id,item.op(0)));
48 log_map[item] = iWF(log_id);
51 if(log_id<1)
return expr.subs(WRA(
w)==
w);
53 expr = expr.subs(log_map).subs(WRA(
w)==
w);
56 for(
auto id_logz : id_logz_lst) {
57 auto id = id_logz.op(0);
58 auto zz = id_logz.op(1);
60 zz.find(WRA(
w), wra_set);
61 if(wra_set.size()<1)
return expr;
62 if(wra_set.size()!=1) {
64 throw Error(
"ContinuousWRA: too many WRA.");
66 zz = zz.subs(WRA(
w)==xwra);
67 ex wra = (*(wra_set.begin())).op(0);
69 ex ret = log(zz.subs(xwra==wra));
71 log_map2[iWF(
id)] = ret;
76 for(
int k=0; k<=nc; k++) {
78 if(k==0) zzk =
NN(zz.subs(xwra==wra/(25*nc)));
79 else zzk =
NN(zz.subs(xwra==k*wra/nc));
80 if(!is_a<numeric>(zzk))
throw Error(
"ContinuousWRA: zzk is not numeric: "+
ex2str(zzk));
81 auto nzzk = ex_to<numeric>(zzk);
82 auto curR = real(nzzk);
83 auto curI = imag(nzzk);
84 if(is_zero(curI) && k==0 && curR<0)
ReIm[total][1] = -1;
85 else if(is_zero(curR) || is_zero(curR))
continue;
86 else ReIm[total][1] = curI>0 ? 1 : -1;
87 ReIm[total][0] = curR>0 ? 1 : -1;
92 for(
int k=0; k<total-1; k++) {
93 if(
ReIm[k][0]*
ReIm[k+1][0]<0 &&
ReIm[k][1]*
ReIm[k+1][1]<0)
throw Error(
"ContinuousWRA: 1<->3 or 2<->4 happened.");
95 if(
ReIm[k][1]>0) cutN++;
99 if(cutN!=0) ret += I * cutN * 2 * Pi;
100 log_map2[iWF(
id)] = ret;
102 expr = expr.subs(log_map2);
103 if(expr.has(iWF(
w)))
throw Error(
"ContinuousWRA: iWF(w) still exists in final result.");
121 ostringstream fsofn, sofn, cmd;
123 sofn << pid <<
".so";
124 fsofn << pid <<
"F.so";
127 sofn << key <<
".so";
129 garfn << key <<
".ci.gar";
131 ifstream in(garfn.str());
134 auto c = ar.unarchive_ex(
"c");
135 if(c!=19790923)
throw Error(
"Integrates: *.ci.gar error!");
136 auto gl = ar.unarchive_ex(
"soLimit");
137 eps_lst = ex_to<lst>(ar.unarchive_ex(
"eps_lst"));
139 auto res = ar.unarchive_ex(
"res");
141 for(
auto item : ex_to<lst>(res)) ciResult.push_back(ex_to<lst>(item));
145 if(pkey !=
"") garfn <<
"-" << pkey;
149 ifstream la_in(garfn.str());
152 auto la_c = la_ar.unarchive_ex(
"c");
153 auto la_res = la_ar.unarchive_ex(
"res");
154 if(la_c!=19790923)
throw Error(
"Integrates: *.ci.gar error!");
155 for(
auto item : ex_to<lst>(la_res)) {
156 LambdaMap[item.op(0)] = item.op(1);
164 if(pkey !=
"") garfn <<
"-" << pkey;
167 throw Error(
"Integrates: File Not Found: " + garfn.str());
171 ifstream res_in(garfn.str());
174 auto res_c = res_ar.unarchive_ex(
"c");
175 auto relst = res_ar.unarchive_ex(
"relst");
176 if(res_c!=19790923)
throw Error(
"*.res.gar error with kid!");
177 lstRE = ex_to<lst>(relst);
182 void* main_module = dlopen(sofn.str().c_str(), RTLD_NOW);
183 if(main_module ==
nullptr) {
184 main_module = dlopen((
"./"+sofn.str()).c_str(), RTLD_NOW);
185 if(main_module ==
nullptr) {
186 cout <<
"dlerror(): " << dlerror() << endl;
187 throw Error(
"Integrates: could not open main module!");
191 if(!
Debug && key ==
"") {
192 if(
file_exists(fsofn.str().c_str())) remove(fsofn.str().c_str());
193 remove(sofn.str().c_str());
195 vector<void*> ex_modules;
196 for(
int n=1;
true; n++) {
197 ostringstream ex_sofn;
199 ex_sofn << pid <<
"X" << n <<
".so";
201 ex_sofn << key <<
"X" << n <<
".so";
204 void*
module = dlopen(ex_sofn.str().c_str(), RTLD_NOW);
205 if(module ==
nullptr) {
206 module = dlopen(("./"+ex_sofn.str()).c_str(), RTLD_NOW);
207 if(module ==
nullptr) {
208 cout <<
"dlerror(): " << dlerror() << endl;
209 throw Error(
"Integrates: could not open ex-module!");
212 ex_modules.push_back(module);
213 if(!
Debug && key ==
"") remove(ex_sofn.str().c_str());
220 plRepl.append(PL(kv.first)==kv.second);
221 if(kv.first>npara) npara = kv.first;
226 int total = ciResult.size(), current = 0;
227 qREAL stot = sqrtq(total*1.Q);
231 for(
auto &item : ciResult) {
233 if(kid>0 && current != kid)
continue;
236 cout <<
PRE <<
"\\--Integrating [" <<current<<
"/"<<total<<
"] " << flush;
239 unsigned int xsize = 0;
242 xsize = ex_to<numeric>(item.op(1)).to_int();
250 ex res = VE(
NN(exint),0);
252 cout <<
"XDim=" << xsize << endl;
256 lstRE[kid-1] = res*co;
259 lstRE.append(res*co);
264 ex intid = item.op(0);
265 ex ftid = item.op(3);
267 if(co.is_zero())
continue;
269 if(co.is_zero())
continue;
270 if(co.has(PL(
w)))
throw Error(
"Integrates: PL found @ " +
ex2str(co));
273 if(
ReIm==3) reim = 3;
275 for(
int si=co.ldegree(
eps); si<=co.degree(
eps); si++) {
276 auto tmp = co.coeff(
eps, si);
277 if(tmp.has(
eps))
throw Error(
"Integrates: eps found @ " +
ex2str(tmp));
279 for(
int i=tmp.ldegree(
ep); i<=tmp.degree(
ep); i++) {
280 auto ccRes =
NN(tmp.coeff(
ep, i)).expand();
283 if(is_a<add>(ccRes)) {
284 for(
auto item : ccRes) css.append(item);
290 eps_map[epi.op(0)] = epn;
294 for(
int ci=0; ci<css.nops(); ci++) {
296 if(nt.has(
ep))
throw Error(
"Integrates: ep found @ nt = "+
ex2str(nt));
299 if(!is_a<numeric>(nt)) {
301 for(
auto nti : cv_lst) {
302 auto nnt = nti.op(0);
303 if(!is_a<numeric>(nnt))
throw Error(
"Integrates: Not a number with nt = "+
ex2str(nnt));
306 }
else nt_lst.append(nt);
308 for(
auto nnt : nt_lst) {
309 if(
ReIm!=3 && reim!=3) {
310 if(ex_to<numeric>(nnt).imag()==0) {
311 if(reim==2) reim = 3;
313 }
else if(ex_to<numeric>(nnt).real()==0) {
314 if(reim==1) reim = 3;
323 if(qnt > cmax) cmax = qnt;
331 if(is_zero(co2-co))
break;
334 if(normal(co).is_zero())
continue;
335 throw Error(
"Integrates: cmax<=0 with co = "+
ex2str(co));
337 if(reim!=3 &&
ReIm!=3) {
340 else if(reim==2) reim=1;
345 sprintf(d1,
"%.6G", (
double)(
EpsAbs/cmax/stot));
346 sprintf(d2,
"%.6G", (
double)cmax);
347 if(
Verbose>5) cout <<
"XDim=" << xsize <<
", EpsAbs=" << d1 <<
"/" << d2 << endl;
349 auto las = LambdaMap[ftid];
350 bool hasF = (ftid>0);
351 if(hasF && las.is_zero())
throw Error(
"Integrates: lambda with the key(ft_n=" +
ex2str(ftid) +
") is NOT found!");
353 if(hasF && !is_a<lst>(las)) {
354 if(!is_zero(las-ex(1979))) {
355 throw Error(
"Integrates: something is wrong with the F-term @ ft_n = "+
ex2str(ftid) +
", las=" +
ex2str(las));
365 int idx = ex_to<numeric>(intid).to_int();
366 auto module = main_module;
367 if(idx>=
soLimit)
module = ex_modules[idx/soLimit-1];
369 if(hasF) fname <<
"C";
370 fname <<
"SDD_" << idx;
374 cout <<
"dlerror(): " << dlerror() << endl;
375 throw Error(
"Integrates: fpD==NULL");
380 if(hasF) fname <<
"C";
381 fname <<
"SDQ_" << idx;
384 cout <<
"dlerror(): " << dlerror() << endl;
385 throw Error(
"Integrates: fpQ==NULL");
390 if(hasF) fname <<
"C";
391 fname <<
"SDMP_" << idx;
394 cout <<
"dlerror(): " << dlerror() << endl;
395 throw Error(
"Integrates: fpMP==NULL");
401 fname <<
"FT_" << idx;
404 cout <<
"dlerror(): " << dlerror() << endl;
405 throw Error(
"Integrates: ftp==NULL.");
409 dREAL dlas[las.nops()], dpl[npara];
410 qREAL qlas[las.nops()], qpl[npara];
411 mpREAL mplas[las.nops()], mppl[npara];
413 qpl[kv.first] =
ex2q(kv.second);
414 dpl[kv.first] = (
dREAL)qpl[kv.first];
415 mppl[kv.first] = qpl[kv.first];
437 qREAL lamax =
ex2q(las.op(las.nops()-1));
439 int ctryR = 0, ctry = 0, ctryL = 0;
443 qREAL log_lamax = log10q(lamax);
444 qREAL log_lamin = log_lamax-1.Q;
446 ostringstream las_fn;
448 if(pkey !=
"") las_fn <<
"-" << pkey;
449 las_fn <<
"-" << current <<
".las";
451 std::ifstream las_ifs;
452 las_ifs.open(las_fn.str(), ios::in);
453 if (!las_ifs)
throw Error(
"Integrates: failed to open *.las file!");
454 for(
int i=0; i<las.nops()-1; i++) {
463 auto res_tmp = res.subs(VE(
w1,
w2)==
w2);
464 auto err = real_part(res_tmp);
465 if(err < imag_part(res_tmp)) err = imag_part(res_tmp);
470 auto prec = cout.precision();
476 bool err_break =
false;
479 if(ctryR>0 || ctry>0 || ctryL>0)
480 cout <<
" ------------------------------" << endl;
482 auto log_cla = (log_lamin + s * (log_lamax-log_lamin) /
LambdaSplit);
483 auto cla = powq(10.Q, log_cla);
484 if(cla < 1E-10)
throw Error(
"NIntegrate: too small lambda.");
485 for(
int i=0; i<las.nops()-1; i++) {
486 qlas[i] =
ex2q(las.op(i)) * cla;
488 dlas[i] = (
dREAL)qlas[i];
498 if(res.has(
NaN) && s==0)
continue;
499 else if(res.has(
NaN))
break;
500 ex res_abs =
NN(abs(res.subs(VE(
w1,
w2)==
w1)));
501 if(lastResErr.is_zero()) lastResErr = res;
503 diff = diff.subs(VE(0,0)==0);
505 diff.find(VE(
w0,
w1), ves);
507 auto ve0 = abs(ve.op(0));
509 if(numeric(
"1.E10")*ve0<res_abs)
continue;
510 if(numeric(
"1.E10")*ve0<
q2ex(
EpsAbs))
continue;
521 auto res_tmp = res.subs(VE(
w1,
w2)==
w2);
522 auto err = real_part(res_tmp);
523 if(err < imag_part(res_tmp)) err = imag_part(res_tmp);
524 if(smin<0 || err < min_err) {
537 if(kid>0) lstRE[kid-1] = co * min_res;
538 else lstRE.append(co * min_res);
541 if(err > 100 * min_err)
break;
543 if(smin == -2)
break;
544 if(smin == -1)
throw Error(
"Integrates: smin = -1, too small lambda (<1E-10)!");
547 if((!err_break) && (ctryL >=
CTryL || ctryR>0))
break;
548 log_lamax = log_lamin;
550 if(!err_break) ctryL++;
552 if(ctryR >=
CTryR || ctryL>0)
break;
553 log_lamin = log_lamax;
557 if(ctry >=
CTryM)
break;
558 auto la1 = log_lamin + (smin-1) * (log_lamax-log_lamin) /
LambdaSplit;
559 auto la2 = log_lamin + (smin+1) * (log_lamax-log_lamin) /
LambdaSplit;
565 cout.precision(prec);
572 auto log_cla = (log_lamin + smin * (log_lamax-log_lamin) /
LambdaSplit);
573 auto cla = powq(10.Q, log_cla);
575 for(
int i=0; i<las.nops()-1; i++) {
576 qlas[i] =
ex2q(las.op(i)) * cla;
577 dlas[i] = (
dREAL)qlas[i];
591 dREAL oo[las.nops()-1], ip[las.nops()-1];
592 for(
int i=0; i<las.nops()-1; i++) ip[i] = oo[i] = (
dREAL)qlas[i];
601 for(
int i=0; i<las.nops()-1; i++) {
603 dlas[i] = (
dREAL)qlas[i];
612 for(
int i=0; i<xsize; i++) {
614 quadmath_snprintf(buffer,
sizeof buffer,
"%.6QG", qlas[i]);
615 cout << buffer <<
" ";
617 cout << endl <<
" ------------------------------" << endl;
623 std::ofstream las_ofs;
624 las_ofs.open(las_fn.str(), ios::out);
626 for(
int i=0; i<las.nops()-1; i++) {
628 las_ofs << la_tmp <<
" ";
644 if(kid>0) lstRE[kid-1] =
NaN;
645 else lstRE.append(
NaN);
649 lstRE[kid-1] = co * res;
651 }
else lstRE.append(co * res);
658 for(
auto module : ex_modules) dlclose(module);
659 dlclose(main_module);
671 if(pkey !=
"") garfn <<
"-" << pkey;
675 ar.archive_ex(lstRE,
"relst");
676 ar.archive_ex(19790923,
"c");
677 ofstream out(garfn.str());
695 ostringstream fsofn, sofn, cmd;
698 sofn << key <<
".so";
700 garfn << key <<
".ci.gar";
702 ifstream in(garfn.str());
705 auto c = ar.unarchive_ex(
"c");
706 if(c!=19790923)
throw Error(
"Integrates: *.ci.gar error!");
707 auto gl = ar.unarchive_ex(
"soLimit");
708 eps_lst = ex_to<lst>(ar.unarchive_ex(
"eps_lst"));
710 auto res = ar.unarchive_ex(
"res");
712 for(
auto item : ex_to<lst>(res)) ciResult.push_back(ex_to<lst>(item));
716 if(pkey !=
"") garfn <<
"-" << pkey;
720 ifstream la_in(garfn.str());
723 auto la_c = la_ar.unarchive_ex(
"c");
724 auto la_res = la_ar.unarchive_ex(
"res");
725 if(la_c!=19790923)
throw Error(
"Integrates: *.ci.gar error!");
726 for(
auto item : ex_to<lst>(la_res)) {
727 LambdaMap[item.op(0)] = item.op(1);
735 if(pkey !=
"") garfn <<
"-" << pkey;
738 throw Error(
"Integrates: File Not Found: " + garfn.str());
742 ifstream res_in(garfn.str());
745 auto res_c = res_ar.unarchive_ex(
"c");
746 auto relst = res_ar.unarchive_ex(
"relst");
747 if(res_c!=19790923)
throw Error(
"*.res.gar error with ReIntegrates!");
748 lstRE = ex_to<lst>(relst);
753 void* main_module = dlopen(sofn.str().c_str(), RTLD_NOW);
754 if(main_module ==
nullptr) {
755 main_module = dlopen((
"./"+sofn.str()).c_str(), RTLD_NOW);
756 if(main_module ==
nullptr) {
757 cout <<
"dlerror(): " << dlerror() << endl;
758 throw Error(
"Integrates: could not open main module!");
762 vector<void*> ex_modules;
763 for(
int n=1;
true; n++) {
764 ostringstream ex_sofn;
765 ex_sofn << key <<
"X" << n <<
".so";
767 void*
module = dlopen(ex_sofn.str().c_str(), RTLD_NOW);
768 if(module ==
nullptr) {
769 module = dlopen(("./"+ex_sofn.str()).c_str(), RTLD_NOW);
770 if(module ==
nullptr) {
771 cout <<
"dlerror(): " << dlerror() << endl;
772 throw Error(
"Integrates: could not open ex-module!");
775 ex_modules.push_back(module);
776 if(!
Debug && key ==
"") remove(ex_sofn.str().c_str());
783 plRepl.append(PL(kv.first)==kv.second);
784 if(kv.first>npara) npara = kv.first;
789 int total = ciResult.size(), current = 0;
790 qREAL stot = sqrtq(total*1.Q);
794 for(
auto &item : ciResult) {
797 if(cmerr < err)
continue;
800 quadmath_snprintf(es,
sizeof es,
"%.10QG", cmerr);
801 cout <<
PRE <<
"\\--Current Err: " << es << endl;
805 cout <<
PRE <<
"\\--Integrating [" <<current<<
"/"<<total<<
"] " << flush;
808 unsigned int xsize = 0;
811 xsize = ex_to<numeric>(item.op(1)).to_int();
819 ex res = VE(
NN(exint),0);
821 cout <<
"XDim=" << xsize << endl;
824 lstRE[current-1] = res*co;
829 ex intid = item.op(0);
830 ex ftid = item.op(3);
832 if(co.is_zero())
continue;
834 if(co.is_zero())
continue;
835 if(co.has(PL(
w)))
throw Error(
"Integrates: PL found @ " +
ex2str(co));
838 if(
ReIm==3) reim = 3;
840 for(
int si=co.ldegree(
eps); si<=co.degree(
eps); si++) {
841 auto tmp = co.coeff(
eps, si);
842 if(tmp.has(
eps))
throw Error(
"Integrates: eps found @ " +
ex2str(tmp));
844 for(
int i=tmp.ldegree(
ep); i<=tmp.degree(
ep); i++) {
845 auto ccRes =
NN(tmp.coeff(
ep, i)).expand();
848 if(is_a<add>(ccRes)) {
849 for(
auto item : ccRes) css.append(item);
855 eps_map[epi.op(0)] = epn;
859 for(
int ci=0; ci<css.nops(); ci++) {
861 if(nt.has(
ep))
throw Error(
"Integrates: ep found @ nt = "+
ex2str(nt));
864 if(!is_a<numeric>(nt)) {
866 for(
auto nti : cv_lst) {
867 auto nnt = nti.op(0);
868 if(!is_a<numeric>(nnt))
throw Error(
"Integrates: Not a number with nt = "+
ex2str(nnt));
871 }
else nt_lst.append(nt);
873 for(
auto nnt : nt_lst) {
874 if(
ReIm!=3 && reim!=3) {
875 if(ex_to<numeric>(nnt).imag()==0) {
876 if(reim==2) reim = 3;
878 }
else if(ex_to<numeric>(nnt).real()==0) {
879 if(reim==1) reim = 3;
888 if(qnt > cmax) cmax = qnt;
896 if(is_zero(co2-co))
break;
899 if(normal(co).is_zero())
continue;
900 throw Error(
"Integrates: cmax<=0 with co = "+
ex2str(co));
902 if(reim!=3 &&
ReIm!=3) {
905 else if(reim==2) reim=1;
910 sprintf(d1,
"%.6G", (
double)(
EpsAbs/cmax/stot));
911 sprintf(d2,
"%.6G", (
double)cmax);
912 if(
Verbose>5) cout <<
"XDim=" << xsize <<
", EpsAbs=" << d1 <<
"/" << d2 << endl;
913 auto las = LambdaMap[ftid];
914 bool hasF = (ftid>0);
915 if(hasF && las.is_zero())
throw Error(
"Integrates: lambda with the key(ft_n=" +
ex2str(ftid) +
") is NOT found!");
916 if(hasF && !is_a<lst>(las)) {
917 if(!is_zero(las-ex(1979))) {
918 throw Error(
"Integrates: something is wrong with the F-term @ ft_n = "+
ex2str(ftid) +
", las=" +
ex2str(las));
928 int idx = ex_to<numeric>(intid).to_int();
929 auto module = main_module;
930 if(idx>=
soLimit)
module = ex_modules[idx/soLimit-1];
932 if(hasF) fname <<
"C";
933 fname <<
"SDD_" << idx;
936 cout <<
"dlerror(): " << dlerror() << endl;
937 throw Error(
"Integrates: fpD==NULL");
942 if(hasF) fname <<
"C";
943 fname <<
"SDQ_" << idx;
946 cout <<
"dlerror(): " << dlerror() << endl;
947 throw Error(
"Integrates: fpQ==NULL");
952 if(hasF) fname <<
"C";
953 fname <<
"SDMP_" << idx;
959 fname <<
"FT_" << idx;
962 cout <<
"dlerror(): " << dlerror() << endl;
963 throw Error(
"Integrates: ftp==NULL.");
967 dREAL dlas[las.nops()], dpl[npara];
968 qREAL qlas[las.nops()], qpl[npara];
969 mpREAL mplas[las.nops()], mppl[npara];
971 qpl[kv.first] =
ex2q(kv.second);
972 dpl[kv.first] = (
dREAL)qpl[kv.first];
973 mppl[kv.first] = qpl[kv.first];
992 qREAL lamax =
ex2q(las.op(las.nops()-1));
995 int ctryR = 0, ctry = 0, ctryL = 0;
999 qREAL log_lamax = log10q(lamax);
1000 qREAL log_lamin = log_lamax-1.Q;
1002 ostringstream las_fn;
1004 if(pkey !=
"") las_fn <<
"-" << pkey;
1005 las_fn <<
"-" << current <<
".las";
1007 std::ifstream las_ifs;
1008 las_ifs.open(las_fn.str(), ios::in);
1009 if (!las_ifs)
throw Error(
"Integrates: failed to open *.las file!");
1010 for(
int i=0; i<las.nops()-1; i++) {
1014 dlas[i] = (
dREAL)qlas[i];
1019 auto res_tmp = res.subs(VE(
w1,
w2)==
w2);
1020 auto err = real_part(res_tmp);
1021 if(err < imag_part(res_tmp)) err = imag_part(res_tmp);
1030 bool err_break =
false;
1033 if(ctryR>0 || ctry>0 || ctryL>0)
1034 cout <<
" ------------------------------" << endl;
1036 auto log_cla = (log_lamin + s * (log_lamax-log_lamin) /
LambdaSplit);
1037 auto cla = powq(10.Q, log_cla);
1038 if(cla < 1E-10)
throw Error(
"NIntegrate: too small lambda.");
1039 for(
int i=0; i<las.nops()-1; i++) {
1040 qlas[i] =
ex2q(las.op(i)) * cla;
1041 dlas[i] = (
dREAL)qlas[i];
1052 if(res.has(
NaN) && s==0)
continue;
1053 else if(res.has(
NaN))
break;
1054 ex res_abs =
NN(abs(res.subs(VE(
w1,
w2)==
w1)));
1055 if(lastResErr.is_zero()) lastResErr = res;
1057 diff = diff.subs(VE(0,0)==0);
1059 diff.find(VE(
w0,
w1), ves);
1060 for(
auto ve : ves) {
1061 auto ve0 = abs(ve.op(0));
1063 if(numeric(
"1.E10")*ve0<res_abs)
continue;
1064 if(numeric(
"1.E10")*ve0<
q2ex(
EpsAbs))
continue;
1075 auto res_tmp = res.subs(VE(
w1,
w2)==
w2);
1076 auto err = real_part(res_tmp);
1077 if(err < imag_part(res_tmp)) err = imag_part(res_tmp);
1078 if(smin<0 || err < min_err) {
1084 if(s>0 && min_err <
q2ex(
EpsAbs/cmax/stot)) {
1091 lstRE[current-1] = co * min_res;
1094 if(err > 100 * min_err)
break;
1096 if(smin == -2)
break;
1097 if(smin == -1)
throw Error(
"Integrates: smin = -1, too small lambda (<1E-10)!");
1100 if((!err_break) && (ctryL >=
CTryL || ctryR>0))
break;
1101 log_lamax = log_lamin;
1103 if(!err_break) ctryL++;
1105 if(ctryR >=
CTryR || ctryL>0)
break;
1106 log_lamin = log_lamax;
1110 if(ctry >=
CTryM)
break;
1111 auto la1 = log_lamin + (smin-1) * (log_lamax-log_lamin) /
LambdaSplit;
1112 auto la2 = log_lamin + (smin+1) * (log_lamax-log_lamin) /
LambdaSplit;
1119 if(smin == -2)
continue;
1121 auto log_cla = (log_lamin + smin * (log_lamax-log_lamin) /
LambdaSplit);
1122 auto cla = powq(10.Q, log_cla);
1124 for(
int i=0; i<las.nops()-1; i++) {
1125 qlas[i] =
ex2q(las.op(i)) * cla;
1126 dlas[i] = (
dREAL)qlas[i];
1140 dREAL oo[las.nops()-1], ip[las.nops()-1];
1141 for(
int i=0; i<las.nops()-1; i++) ip[i] = oo[i] = (
dREAL)qlas[i];
1150 for(
int i=0; i<las.nops()-1; i++) {
1152 dlas[i] = (
dREAL)qlas[i];
1161 for(
int i=0; i<xsize; i++) {
1163 quadmath_snprintf(buffer,
sizeof buffer,
"%.6QG", qlas[i]);
1164 cout << buffer <<
" ";
1166 cout << endl <<
" ------------------------------" << endl;
1172 std::ofstream las_ofs;
1173 las_ofs.open(las_fn.str(), ios::out);
1175 for(
int i=0; i<las.nops()-1; i++) {
1177 las_ofs << la_tmp <<
" ";
1191 lstRE[current-1] =
NaN;
1193 lstRE[current-1] = co * res;
1201 for(
auto module : ex_modules) dlclose(module);
1202 dlclose(main_module);
1212 ostringstream garfn;
1214 if(pkey !=
"") garfn <<
"-" << pkey;
1215 garfn <<
".res.gar";
1218 ar.archive_ex(lstRE,
"relst");
1219 ar.archive_ex(19790923,
"c");
1220 ofstream out(garfn.str());