1 #include"taylor_fixedthrust.h"
4 int taylor_fixedthrust(
double y[6],
double t0,
double tf,
double thrust[3],
double abstol,
double reltol){
5 int i, j,
order=20, itmp=0, direction = 1, nsteps = -1;
6 double ftmp, dstep, tolerance, rtolerance, log10tolerance, log10rtolerance;
7 MY_FLOAT startT, stopT, nextT;
9 MY_FLOAT xx[10], yy[10], zz[10];
11 InitMyFloat(myFloatZero);
15 for(i=0; i<10; i++){InitMyFloat(xx[i]); InitMyFloat(yy[i]);InitMyFloat(zz[i]);}
17 MakeMyFloatA(myFloatZero, 0);
20 MakeMyFloatA(xx[0], (
double)y[0] );
21 MakeMyFloatA(xx[1], (
double)y[1] );
22 MakeMyFloatA(xx[2], (
double)y[2] );
23 MakeMyFloatA(xx[3], (
double)y[3] );
24 MakeMyFloatA(xx[4], (
double)y[4] );
25 MakeMyFloatA(xx[5], (
double)y[5] );
26 MakeMyFloatA(xx[6], (
double)thrust[0] );
27 MakeMyFloatA(xx[7], (
double)thrust[1] );
28 MakeMyFloatA(xx[8], (
double)thrust[2] );
29 MakeMyFloatA(startT, t0);
30 MakeMyFloatA(stopT, tf);
32 MakeMyFloatA(nextT, (
double)dstep);
34 log10tolerance = log10(abstol);
35 log10rtolerance = log10(reltol);
39 if(dstep < (
double)0.0) { direction = -1;}
42 itmp = taylor_step_kepler_info( &startT, xx, direction, 1, log10tolerance, log10rtolerance, &stopT, &nextT, &order);
81 int taylor_step_kepler_info(MY_FLOAT *ti,
150 MY_FLOAT **taylor_coefficients_kepler_info(MY_FLOAT, MY_FLOAT*,
int);
151 MY_FLOAT **taylor_coefficients_kepler_infoA(MY_FLOAT, MY_FLOAT*,
int,
int);
152 int compute_order_1_kepler_info(
double,
double,
double,
int*);
153 int comp_order_other_kepler_info(
double,
double,
double);
154 double compute_stepsize_1_kepler_info(MY_FLOAT**,
int,
double,
int);
155 double compute_stepsize_2_kepler_info(MY_FLOAT**,
int,
double,
int);
156 double comp_stepsize_other_kepler_info(MY_FLOAT**,
int,
int,
double,
double,
double);
158 static MY_FLOAT **s,h,mtmp;
160 int i,j,k,nt,flag_endtime,flag_err;
175 for (i=0; i<_N_DIM_; i++)
177 MyFloatToDouble(xi,x[i]);
179 if (xi > xnorm) xnorm=xi;
191 nt=(*order<2)? 2: *order;
194 nt=compute_order_1_kepler_info(xnorm,log10abserr,log10relerr,&flag_err);
197 nt=compute_order_1_kepler_info(xnorm,log10abserr,log10relerr,&flag_err);
200 nt=comp_order_other_kepler_info(xnorm,log10abserr,log10relerr);
203 fprintf(stderr,
"taylor_step: undefined step size control.\n");
204 fprintf(stderr,
"you must choose an existing step size control\n");
205 fprintf(stderr,
"method or supply a step size control procedure.\n");
213 s=taylor_coefficients_kepler_infoA(*ti,x,nt,1);
215 s=taylor_coefficients_kepler_info(*ti,x,nt);
226 AssignMyFloat(h,*ht);
229 dh=compute_stepsize_1_kepler_info(s,nt,xnorm,flag_err);
233 dh=compute_stepsize_2_kepler_info(s,nt,xnorm,flag_err);
237 dh=comp_stepsize_other_kepler_info(s,_N_DIM_,nt,xnorm,log10abserr,log10relerr);
241 fprintf(stderr,
"taylor_step: undefined step size control.\n");
242 fprintf(stderr,
"You must choose an existing step size control\n");
243 fprintf(stderr,
"method or supply a step size control procedure.\n");
252 if (dir == -1) { NegateMyFloatA(mtmp,h); AssignMyFloat(h, mtmp);}
258 AddMyFloatA(mtmp,h,*ti);
261 if (MyFloatA_GE_B(mtmp,*endtime))
263 SubstractMyFloatA(h,*endtime,*ti);
269 if (MyFloatA_GE_B(*endtime,mtmp))
271 SubstractMyFloatA(h,*endtime,*ti);
281 for(i=0; i<_N_DIM_; i++) {AssignMyFloat(x[i],s[i][nt]);}
284 for(i=0; i<_N_DIM_; i++)
286 MultiplyMyFloatA(mtmp, h, x[i]);
287 AddMyFloatA(x[i], mtmp, s[i][k]);
293 AssignMyFloat(*ht,h);
294 if (flag_endtime == 0)
296 AssignMyFloat(mtmp, *ti);
297 AddMyFloatA(*ti, mtmp, h);
301 AssignMyFloat(*ti,*endtime);
303 return(flag_endtime);
305 int compute_order_1_kepler_info(
double xnorm,
double log10abserr,
double log10relerr,
int* flag_err)
322 log10eps=log10abserr;
324 if (xnorm != (
double)0.0)
326 tmp=log10relerr+log10(xnorm);
327 if (tmp > log10abserr) {log10eps=log10relerr; *flag_err=2;}
332 nt=(int)(1.5-1.16*log10eps);
336 fprintf(stderr,
"taylor_step: order is %d\n",nt);
341 double compute_stepsize_1_kepler_info(MY_FLOAT **s,
int nt,
double xnorm,
int flag_err)
348 double double_log_MyFloat_kepler_info(MY_FLOAT x);
349 static MY_FLOAT z,v1,v2;
350 static MY_FLOAT of,uf;
351 double lnv1,lnv2,r,lnro1,lnro2,lnro;
364 r=pow((
double)2,(
double)LEXP2);
366 r=pow((
double)2,(
double)(-LEXP2));
373 fabsMyFloatA(v1,s[0][nt-1]);
374 fabsMyFloatA(v2,s[0][nt]);
375 for(i=1; i<_N_DIM_; i++)
377 fabsMyFloatA(z,s[i][nt-1]);
378 if (MyFloatA_GT_B(z,v1)) AssignMyFloat(v1,z);
379 fabsMyFloatA(z,s[i][nt]);
380 if (MyFloatA_GT_B(z,v2)) AssignMyFloat(v2,z);
391 if (MyFloatA_LE_B(v1,of) && MyFloatA_GE_B(v1,uf))
393 MyFloatToDouble(r,v1);
398 lnv1=double_log_MyFloat_kepler_info(v1);
400 if (MyFloatA_LE_B(v2,of) && MyFloatA_GE_B(v2,uf))
402 MyFloatToDouble(r,v2);
407 lnv2=double_log_MyFloat_kepler_info(v2);
420 lnro=(lnro1 < lnro2)? lnro1: lnro2;
422 r=exp(lnro-2-0.7/(nt-1));
425 double compute_stepsize_2_kepler_info(MY_FLOAT **s,
int nt,
double xnorm,
int flag_err)
433 double compute_stepsize_1_kepler_info(MY_FLOAT**,
int,
double,
int);
434 static MY_FLOAT h,hj,r,z,a,normj;
452 dh=compute_stepsize_1_kepler_info(s,nt,xnorm,flag_err);
459 MakeMyFloatA(z, 1.0);
460 }
else if (flag_err == 2) {
461 MakeMyFloatA(z,xnorm);
464 printf(
"compute_stepsize_2 internal error. flag_err: %d\n",flag_err);
471 MakeMyFloatA(hj,(
double)1.0);
475 MultiplyMyFloatA(r,h,hj);
478 MakeMyFloatC(normj,
"0", (
double)0);
479 for (i=0; i<_N_DIM_; i++)
481 fabsMyFloatA(a,s[i][j]);
482 if (MyFloatA_GT_B(a,normj)) AssignMyFloat(normj,a);
485 MultiplyMyFloatA(r,normj,hj);
486 if (MyFloatA_LE_B(r,z))
continue;
490 DivideMyFloatA(hj,z,normj);
492 DivideMyFloatA(a,r,z);
493 MyFloatToDouble(c,a);
494 c=pow(c,(
double)1.e0/(
double)j);
496 DivideMyFloatA(r,h,a);
500 fprintf(stderr,
"order %2d. reducing h from %14.6e to %14.6e\n",j,c*h,h);
504 MyFloatToDouble(rtmp,h);
508 double double_log_MyFloat_kepler_info(MY_FLOAT x)
513 static MY_FLOAT a,tmp;
514 static MY_FLOAT z,of,uf;
530 b=pow((
double)2,(
double)LEXP2);
532 b=pow((
double)2,(
double)(-LEXP2));
536 if (MyFloatA_EQ_B(x,z))
538 puts(
"double_log_MyFloat error: zero argument");
539 puts(
"(this is because one of the last two terms of your taylor");
540 puts(
" expansion is exactly zero)");
547 while(MyFloatA_LT_B(a,uf))
550 if(k>3000){fprintf(stderr,
"double_log_MyFloat overflow: %d\n", k); exit(1);}
551 MultiplyMyFloatA(tmp,a,of);
552 AssignMyFloat(a,tmp);
554 while(MyFloatA_GT_B(a,of))
557 if(k<-3000){fprintf(stderr,
"double_log_MyFloat underflow: %d\n", k); exit(1);}
558 MultiplyMyFloatA(tmp,a,uf);
559 AssignMyFloat(a,tmp);
562 MyFloatToDouble(b,a);
566 lx=log(b)-(LEXP2*0.69314718055994530942)*k;
572 int comp_order_other_kepler_info(
double lnxnorm,
double log10abserr,
double log10relerr){
574 puts(
"compute_order_user_defined:");
575 puts(
"you have to code this routine");
576 puts(
"or select a different value for the step_ctl parameter");
582 double comp_stepsize_other_kepler_info(MY_FLOAT **s,
int nd,
int nt,
double xnorm,
double log10abserr,
double log10relerr) {
585 puts(
"compute_timestep_user_defined:");
586 puts(
"you have to code this routine");
587 puts(
"or select a different value for the step_ctl parameter");
590 return((
double)0.00001);
605 MY_FLOAT **taylor_coefficients_kepler_infoA(MY_FLOAT t, MY_FLOAT *x,
int order,
int rflag)
623 static int _jz_ivars[2];
624 static MY_FLOAT *_jz_jet[28], *_jz_save = NULL, *_jz_oneOverN=NULL,*_jz_theNs=NULL;
625 static MY_FLOAT _jz_tvar1, _jz_tvar2, _jz_tvar3, _jz_tvar4;
626 static MY_FLOAT _jz_uvar1, _jz_uvar2;
627 static MY_FLOAT _jz_svar1, _jz_svar2, _jz_svar3, _jz_svar4, _jz_svar5;
628 static MY_FLOAT _jz_wvar3, _jz_wvar4;
629 static MY_FLOAT _jz_zvar1, _jz_zvar2;
630 static MY_FLOAT _jz_MyFloatZERO;
631 static int _jz_maxOrderUsed = -1;
632 static int _jz_lastOrder = 0, _jz_initialized=0, _jz_ginitialized=0;
633 int _jz_i, _jz_j, _jz_k, _jz_l, _jz_m, _jz_n, _jz_oorder ;
635 if(_jz_maxOrderUsed < order ) {
636 if(_jz_ginitialized == 0) {
637 InitMyFloat(_jz_tvar1); InitMyFloat(_jz_tvar2);InitMyFloat(_jz_tvar3);InitMyFloat(_jz_tvar4);
638 InitMyFloat(_jz_svar1); InitMyFloat(_jz_svar2);InitMyFloat(_jz_svar3);InitMyFloat(_jz_svar4);
639 InitMyFloat(_jz_svar5); InitMyFloat(_jz_zvar1);InitMyFloat(_jz_zvar2);
640 InitMyFloat(_jz_uvar1); InitMyFloat(_jz_uvar2);
641 InitMyFloat(_jz_wvar3);InitMyFloat(_jz_wvar4);
642 InitMyFloat(_jz_MyFloatZERO);
643 MakeMyFloatC(_jz_MyFloatZERO,
"0", (
double)0);
645 if(rflag > 0) rflag = 0;
646 _jz_oorder=_jz_maxOrderUsed;
647 _jz_maxOrderUsed = order;
648 if(_jz_ginitialized) {
649 for(_jz_i=0; _jz_i< _jz_oorder+1; _jz_i++) {ClearMyFloat(_jz_oneOverN[_jz_i]); ClearMyFloat(_jz_theNs[_jz_i]);} free(_jz_oneOverN); free(_jz_theNs);
651 _jz_theNs = (MY_FLOAT *)malloc((order+1) *
sizeof(MY_FLOAT));
652 _jz_oneOverN = (MY_FLOAT *)malloc((order+1) *
sizeof(MY_FLOAT));
653 for(_jz_i=0; _jz_i<order+1; _jz_i++) {InitMyFloat(_jz_oneOverN[_jz_i]);InitMyFloat(_jz_theNs[_jz_i]);}
654 MakeMyFloatC(_jz_theNs[0],
"0.0", (
double)0.0);
655 MakeMyFloatC(_jz_uvar1,
"1.0", (
double)1.0);
656 for(_jz_i = 1; _jz_i <= order; _jz_i++) {
657 AssignMyFloat(_jz_tvar2, _jz_theNs[_jz_i-1]);
658 AddMyFloatA(_jz_theNs[_jz_i], _jz_tvar2, _jz_uvar1);
660 AssignMyFloat(_jz_oneOverN[0],_jz_uvar1);
661 AssignMyFloat(_jz_oneOverN[1],_jz_uvar1);
662 for(_jz_i = 2; _jz_i <= order; _jz_i++) {
663 DivideMyFloatA(_jz_oneOverN[_jz_i], _jz_uvar1,_jz_theNs[_jz_i]);
665 if(_jz_ginitialized) {
666 for(_jz_i=0; _jz_i<(_jz_oorder+1)*(28); _jz_i++) { ClearMyFloat(_jz_save[_jz_i]);} free(_jz_save);
668 _jz_save = (MY_FLOAT *)malloc((order+1)* 28 *
sizeof(MY_FLOAT));
669 for(_jz_i=0; _jz_i<(order+1)*(28); _jz_i++) { InitMyFloat(_jz_save[_jz_i]);}
670 for(_jz_j = 0, _jz_k = 0; _jz_j < 28 ; _jz_j++, _jz_k += order+1) { _jz_jet[_jz_j] =& (_jz_save[_jz_k]); }
678 MakeMyFloatC(_jz_jet[25][0],
"0",(
double)0);
680 MakeMyFloatC(_jz_jet[26][0],
"0",(
double)0);
682 MakeMyFloatC(_jz_jet[27][0],
"0",(
double)0);
686 if(rflag < 0 )
return(NULL);
687 for(_jz_i = 0; rflag != 0 && _jz_i < 9; _jz_i++) {
688 if(MyFloatA_NEQ_B(_jz_jet[_jz_i][0], x[_jz_i])) rflag = 0;
695 AssignMyFloat(_jz_jet[0][0], x[0]);
696 AssignMyFloat(_jz_jet[1][0], x[1]);
697 AssignMyFloat(_jz_jet[2][0], x[2]);
698 AssignMyFloat(_jz_jet[3][0], x[3]);
699 AssignMyFloat(_jz_jet[4][0], x[4]);
700 AssignMyFloat(_jz_jet[5][0], x[5]);
701 AssignMyFloat(_jz_jet[6][0], x[6]);
702 AssignMyFloat(_jz_jet[7][0], x[7]);
703 AssignMyFloat(_jz_jet[8][0], x[8]);
705 NegateMyFloatA(_jz_jet[9][0],_jz_jet[0][0]);
708 AssignMyFloat(_jz_svar5,_jz_jet[0][0]);
711 case 0: AssignMyFloat(_jz_jet[10][0], _jz_oneOverN[0]);
break;
712 case 1: AssignMyFloat(_jz_jet[10][0], _jz_svar5);
break;
713 case 2: AssignMyFloat(_jz_svar1, _jz_svar5); MultiplyMyFloatA(_jz_jet[10][0],_jz_svar1,_jz_svar5);
break;
714 case 3: AssignMyFloat(_jz_svar1, _jz_svar5); MultiplyMyFloatA(_jz_svar2,_jz_svar1,_jz_svar5);
715 MultiplyMyFloatA(_jz_jet[10][0],_jz_svar1,_jz_svar2);
break;
717 AssignMyFloat(_jz_svar1, _jz_oneOverN[0]); AssignMyFloat(_jz_svar2, _jz_svar5);
719 m=n; n /=2;
if(n+n != m) {
720 AssignMyFloat(_jz_svar3, _jz_svar1); MultiplyMyFloatA(_jz_svar1, _jz_svar3, _jz_svar2);
721 if(n==0){ mn=1; AssignMyFloat(_jz_jet[10][0],_jz_svar1);}
723 if(mn==0) {AssignMyFloat(_jz_svar3, _jz_svar2);AssignMyFloat(_jz_svar4, _jz_svar2);
724 MultiplyMyFloatA(_jz_svar2, _jz_svar3,_jz_svar4);}
731 AssignMyFloat(_jz_svar5,_jz_jet[1][0]);
734 case 0: AssignMyFloat(_jz_jet[11][0], _jz_oneOverN[0]);
break;
735 case 1: AssignMyFloat(_jz_jet[11][0], _jz_svar5);
break;
736 case 2: AssignMyFloat(_jz_svar1, _jz_svar5); MultiplyMyFloatA(_jz_jet[11][0],_jz_svar1,_jz_svar5);
break;
737 case 3: AssignMyFloat(_jz_svar1, _jz_svar5); MultiplyMyFloatA(_jz_svar2,_jz_svar1,_jz_svar5);
738 MultiplyMyFloatA(_jz_jet[11][0],_jz_svar1,_jz_svar2);
break;
740 AssignMyFloat(_jz_svar1, _jz_oneOverN[0]); AssignMyFloat(_jz_svar2, _jz_svar5);
742 m=n; n /=2;
if(n+n != m) {
743 AssignMyFloat(_jz_svar3, _jz_svar1); MultiplyMyFloatA(_jz_svar1, _jz_svar3, _jz_svar2);
744 if(n==0){ mn=1; AssignMyFloat(_jz_jet[11][0],_jz_svar1);}
746 if(mn==0) {AssignMyFloat(_jz_svar3, _jz_svar2);AssignMyFloat(_jz_svar4, _jz_svar2);
747 MultiplyMyFloatA(_jz_svar2, _jz_svar3,_jz_svar4);}
753 AddMyFloatA(_jz_jet[12][0], _jz_jet[10][0], _jz_jet[11][0]);
756 AssignMyFloat(_jz_svar5,_jz_jet[2][0]);
759 case 0: AssignMyFloat(_jz_jet[13][0], _jz_oneOverN[0]);
break;
760 case 1: AssignMyFloat(_jz_jet[13][0], _jz_svar5);
break;
761 case 2: AssignMyFloat(_jz_svar1, _jz_svar5); MultiplyMyFloatA(_jz_jet[13][0],_jz_svar1,_jz_svar5);
break;
762 case 3: AssignMyFloat(_jz_svar1, _jz_svar5); MultiplyMyFloatA(_jz_svar2,_jz_svar1,_jz_svar5);
763 MultiplyMyFloatA(_jz_jet[13][0],_jz_svar1,_jz_svar2);
break;
765 AssignMyFloat(_jz_svar1, _jz_oneOverN[0]); AssignMyFloat(_jz_svar2, _jz_svar5);
767 m=n; n /=2;
if(n+n != m) {
768 AssignMyFloat(_jz_svar3, _jz_svar1); MultiplyMyFloatA(_jz_svar1, _jz_svar3, _jz_svar2);
769 if(n==0){ mn=1; AssignMyFloat(_jz_jet[13][0],_jz_svar1);}
771 if(mn==0) {AssignMyFloat(_jz_svar3, _jz_svar2);AssignMyFloat(_jz_svar4, _jz_svar2);
772 MultiplyMyFloatA(_jz_svar2, _jz_svar3,_jz_svar4);}
778 AddMyFloatA(_jz_jet[14][0], _jz_jet[12][0], _jz_jet[13][0]);
780 sqrtMyFloatA(_jz_jet[15][0], _jz_jet[14][0]);
783 AssignMyFloat(_jz_svar5,_jz_jet[15][0]);
786 case 0: AssignMyFloat(_jz_jet[16][0], _jz_oneOverN[0]);
break;
787 case 1: AssignMyFloat(_jz_jet[16][0], _jz_svar5);
break;
788 case 2: AssignMyFloat(_jz_svar1, _jz_svar5); MultiplyMyFloatA(_jz_jet[16][0],_jz_svar1,_jz_svar5);
break;
789 case 3: AssignMyFloat(_jz_svar1, _jz_svar5); MultiplyMyFloatA(_jz_svar2,_jz_svar1,_jz_svar5);
790 MultiplyMyFloatA(_jz_jet[16][0],_jz_svar1,_jz_svar2);
break;
792 AssignMyFloat(_jz_svar1, _jz_oneOverN[0]); AssignMyFloat(_jz_svar2, _jz_svar5);
794 m=n; n /=2;
if(n+n != m) {
795 AssignMyFloat(_jz_svar3, _jz_svar1); MultiplyMyFloatA(_jz_svar1, _jz_svar3, _jz_svar2);
796 if(n==0){ mn=1; AssignMyFloat(_jz_jet[16][0],_jz_svar1);}
798 if(mn==0) {AssignMyFloat(_jz_svar3, _jz_svar2);AssignMyFloat(_jz_svar4, _jz_svar2);
799 MultiplyMyFloatA(_jz_svar2, _jz_svar3,_jz_svar4);}
805 DivideMyFloatA(_jz_jet[17][0], _jz_jet[9][0], _jz_jet[16][0]);
807 AddMyFloatA(_jz_jet[18][0], _jz_jet[6][0], _jz_jet[17][0]);
809 NegateMyFloatA(_jz_jet[19][0],_jz_jet[1][0]);
811 DivideMyFloatA(_jz_jet[20][0], _jz_jet[19][0], _jz_jet[16][0]);
813 AddMyFloatA(_jz_jet[21][0], _jz_jet[7][0], _jz_jet[20][0]);
815 NegateMyFloatA(_jz_jet[22][0],_jz_jet[2][0]);
817 DivideMyFloatA(_jz_jet[23][0], _jz_jet[22][0], _jz_jet[16][0]);
819 AddMyFloatA(_jz_jet[24][0], _jz_jet[8][0], _jz_jet[23][0]);
823 AssignMyFloat(_jz_jet[0][1], _jz_jet[3][0]);
825 AssignMyFloat(_jz_jet[1][1], _jz_jet[4][0]);
827 AssignMyFloat(_jz_jet[2][1], _jz_jet[5][0]);
829 AssignMyFloat(_jz_jet[3][1], _jz_jet[18][0]);
831 AssignMyFloat(_jz_jet[4][1], _jz_jet[21][0]);
833 AssignMyFloat(_jz_jet[5][1], _jz_jet[24][0]);
835 AssignMyFloat(_jz_jet[6][1], _jz_jet[25][0]);
837 AssignMyFloat(_jz_jet[7][1], _jz_jet[26][0]);
839 AssignMyFloat(_jz_jet[8][1], _jz_jet[27][0]);
843 for(_jz_k = _jz_lastOrder; _jz_k < order; _jz_k++) {
846 NegateMyFloatA(_jz_jet[9][_jz_k], _jz_jet[0][_jz_k]);
850 static MY_FLOAT tmp1, tmp2, tmp;
851 int parity=(_jz_k&1), half=(_jz_k+1)>>1;
852 if(_jz_initialized==0) { InitMyFloat(tmp1);InitMyFloat(tmp2); InitMyFloat(tmp);}
853 AssignMyFloat(tmp, _jz_MyFloatZERO);
854 for(_jz_l=0; _jz_l<half; _jz_l++) {
855 MultiplyMyFloatA(tmp1, _jz_jet[0][_jz_l], _jz_jet[0][_jz_k-_jz_l]);
856 AssignMyFloat(tmp2, tmp);
857 AddMyFloatA(tmp, tmp2, tmp1);
859 AssignMyFloat(tmp2, tmp);
860 AddMyFloatA(tmp1, tmp2, tmp);
862 MultiplyMyFloatA(tmp2, _jz_jet[0][half], _jz_jet[0][half]);
863 AddMyFloatA(_jz_jet[10][_jz_k], tmp2, tmp1);
865 AssignMyFloat(_jz_jet[10][_jz_k], tmp1);
871 static MY_FLOAT tmp1, tmp2, tmp;
872 int parity=(_jz_k&1), half=(_jz_k+1)>>1;
873 if(_jz_initialized==0) { InitMyFloat(tmp1);InitMyFloat(tmp2); InitMyFloat(tmp);}
874 AssignMyFloat(tmp, _jz_MyFloatZERO);
875 for(_jz_l=0; _jz_l<half; _jz_l++) {
876 MultiplyMyFloatA(tmp1, _jz_jet[1][_jz_l], _jz_jet[1][_jz_k-_jz_l]);
877 AssignMyFloat(tmp2, tmp);
878 AddMyFloatA(tmp, tmp2, tmp1);
880 AssignMyFloat(tmp2, tmp);
881 AddMyFloatA(tmp1, tmp2, tmp);
883 MultiplyMyFloatA(tmp2, _jz_jet[1][half], _jz_jet[1][half]);
884 AddMyFloatA(_jz_jet[11][_jz_k], tmp2, tmp1);
886 AssignMyFloat(_jz_jet[11][_jz_k], tmp1);
890 AddMyFloatA(_jz_jet[12][_jz_k], _jz_jet[10][_jz_k],_jz_jet[11][_jz_k]);
894 static MY_FLOAT tmp1, tmp2, tmp;
895 int parity=(_jz_k&1), half=(_jz_k+1)>>1;
896 if(_jz_initialized==0) { InitMyFloat(tmp1);InitMyFloat(tmp2); InitMyFloat(tmp);}
897 AssignMyFloat(tmp, _jz_MyFloatZERO);
898 for(_jz_l=0; _jz_l<half; _jz_l++) {
899 MultiplyMyFloatA(tmp1, _jz_jet[2][_jz_l], _jz_jet[2][_jz_k-_jz_l]);
900 AssignMyFloat(tmp2, tmp);
901 AddMyFloatA(tmp, tmp2, tmp1);
903 AssignMyFloat(tmp2, tmp);
904 AddMyFloatA(tmp1, tmp2, tmp);
906 MultiplyMyFloatA(tmp2, _jz_jet[2][half], _jz_jet[2][half]);
907 AddMyFloatA(_jz_jet[13][_jz_k], tmp2, tmp1);
909 AssignMyFloat(_jz_jet[13][_jz_k], tmp1);
913 AddMyFloatA(_jz_jet[14][_jz_k], _jz_jet[12][_jz_k],_jz_jet[13][_jz_k]);
916 static MY_FLOAT tmp1, tmp2, tmp3, tmp;
917 if(_jz_initialized==0) {
918 InitMyFloat(tmp);InitMyFloat(tmp1);InitMyFloat(tmp2);
921 AssignMyFloat(tmp, _jz_jet[14][_jz_k]);
922 for(_jz_l=1; _jz_l< _jz_k; _jz_l++) {
923 MultiplyMyFloatA(tmp1, _jz_jet[15][_jz_k-_jz_l],_jz_jet[15][_jz_l]);
924 SubstractMyFloatA(tmp3, tmp, tmp1);
925 AssignMyFloat(tmp, tmp3);
927 AssignMyFloat(tmp1, _jz_jet[15][0]);
928 AddMyFloatA(tmp3, tmp1, tmp1);
929 DivideMyFloatA(_jz_jet[15][_jz_k], tmp, tmp3);
934 int ppk=(3)*_jz_k, qqk=_jz_k, pq=(3+1);
935 static MY_FLOAT tmp1, tmp2, tmp3, tmpC, tmp;
936 if(_jz_initialized==0) {
937 InitMyFloat(tmp1);InitMyFloat(tmp2); InitMyFloat(tmp3);
938 InitMyFloat(tmpC);InitMyFloat(tmp);
940 AssignMyFloat(tmp, _jz_MyFloatZERO);
941 for(_jz_l=0; _jz_l<_jz_k; _jz_l++) {
942 MakeMyFloatA(tmpC, ppk);
944 MultiplyMyFloatA(tmp1, _jz_jet[16][_jz_l],_jz_jet[15][_jz_k-_jz_l]);
945 MultiplyMyFloatA(tmp2, tmpC, tmp1);
946 AddMyFloatA(tmp1, tmp, tmp2);
947 AssignMyFloat(tmp, tmp1);
949 MakeMyFloatA(tmp3,qqk);
950 MultiplyMyFloatA(tmp1, _jz_jet[15][0], tmp3);
951 DivideMyFloatA(_jz_jet[16][_jz_k], tmp, tmp1);
955 static MY_FLOAT tmp1, tmp2, tmp;
956 if(_jz_initialized==0) { InitMyFloat(tmp1);InitMyFloat(tmp2); InitMyFloat(tmp);}
957 AssignMyFloat(tmp, _jz_MyFloatZERO);
958 for(_jz_l=1; _jz_l<=_jz_k; _jz_l++) {
959 MultiplyMyFloatA(tmp1, _jz_jet[16][_jz_l],_jz_jet[17][_jz_k-_jz_l]);
960 AssignMyFloat(tmp2, tmp);
961 AddMyFloatA(tmp, tmp2, tmp1);
963 AssignMyFloat(tmp2, tmp);
964 SubstractMyFloatA(tmp, _jz_jet[9][_jz_k], tmp2);
965 DivideMyFloatA(_jz_jet[17][_jz_k], tmp, _jz_jet[16][0]);
968 AddMyFloatA(_jz_jet[18][_jz_k], _jz_jet[6][_jz_k],_jz_jet[17][_jz_k]);
970 NegateMyFloatA(_jz_jet[19][_jz_k], _jz_jet[1][_jz_k]);
973 static MY_FLOAT tmp1, tmp2, tmp;
974 if(_jz_initialized==0) { InitMyFloat(tmp1);InitMyFloat(tmp2); InitMyFloat(tmp);}
975 AssignMyFloat(tmp, _jz_MyFloatZERO);
976 for(_jz_l=1; _jz_l<=_jz_k; _jz_l++) {
977 MultiplyMyFloatA(tmp1, _jz_jet[16][_jz_l],_jz_jet[20][_jz_k-_jz_l]);
978 AssignMyFloat(tmp2, tmp);
979 AddMyFloatA(tmp, tmp2, tmp1);
981 AssignMyFloat(tmp2, tmp);
982 SubstractMyFloatA(tmp, _jz_jet[19][_jz_k], tmp2);
983 DivideMyFloatA(_jz_jet[20][_jz_k], tmp, _jz_jet[16][0]);
986 AddMyFloatA(_jz_jet[21][_jz_k], _jz_jet[7][_jz_k],_jz_jet[20][_jz_k]);
988 NegateMyFloatA(_jz_jet[22][_jz_k], _jz_jet[2][_jz_k]);
991 static MY_FLOAT tmp1, tmp2, tmp;
992 if(_jz_initialized==0) { InitMyFloat(tmp1);InitMyFloat(tmp2); InitMyFloat(tmp);}
993 AssignMyFloat(tmp, _jz_MyFloatZERO);
994 for(_jz_l=1; _jz_l<=_jz_k; _jz_l++) {
995 MultiplyMyFloatA(tmp1, _jz_jet[16][_jz_l],_jz_jet[23][_jz_k-_jz_l]);
996 AssignMyFloat(tmp2, tmp);
997 AddMyFloatA(tmp, tmp2, tmp1);
999 AssignMyFloat(tmp2, tmp);
1000 SubstractMyFloatA(tmp, _jz_jet[22][_jz_k], tmp2);
1001 DivideMyFloatA(_jz_jet[23][_jz_k], tmp, _jz_jet[16][0]);
1004 AddMyFloatA(_jz_jet[24][_jz_k], _jz_jet[8][_jz_k],_jz_jet[23][_jz_k]);
1006 AssignMyFloat(_jz_jet[25][_jz_k], _jz_MyFloatZERO);
1008 AssignMyFloat(_jz_jet[26][_jz_k], _jz_MyFloatZERO);
1010 AssignMyFloat(_jz_jet[27][_jz_k], _jz_MyFloatZERO);
1014 DivideMyFloatByInt(_jz_jet[0][_jz_m], _jz_jet[3][_jz_k], _jz_m);
1016 DivideMyFloatByInt(_jz_jet[1][_jz_m], _jz_jet[4][_jz_k], _jz_m);
1018 DivideMyFloatByInt(_jz_jet[2][_jz_m], _jz_jet[5][_jz_k], _jz_m);
1020 DivideMyFloatByInt(_jz_jet[3][_jz_m], _jz_jet[18][_jz_k], _jz_m);
1022 DivideMyFloatByInt(_jz_jet[4][_jz_m], _jz_jet[21][_jz_k], _jz_m);
1024 DivideMyFloatByInt(_jz_jet[5][_jz_m], _jz_jet[24][_jz_k], _jz_m);
1026 DivideMyFloatByInt(_jz_jet[6][_jz_m], _jz_jet[25][_jz_k], _jz_m);
1028 DivideMyFloatByInt(_jz_jet[7][_jz_m], _jz_jet[26][_jz_k], _jz_m);
1030 DivideMyFloatByInt(_jz_jet[8][_jz_m], _jz_jet[27][_jz_k], _jz_m);
1033 _jz_lastOrder = order;
1037 MY_FLOAT **taylor_coefficients_kepler_info(MY_FLOAT t, MY_FLOAT *x,
int order)
1039 return(taylor_coefficients_kepler_infoA(t,x,order,0));
std::vector< population::size_type > order(const std::vector< T > &values)
Sort according the the values in the values vector but return the permutation.