26 for(
int dim = 0; dim < 3; dim++) {
27 cube& dim_E =
m_E[dim];
28 dim_E = zeros(maxiA, maxiB, maxt + 1);
33 int iA,
int iB,
int jA,
int jB,
int kA,
int kB)
39 setupE(iA, iB, jA, jB, kA, kB);
43 if(t < 0 || t > (iA + iB) || iA < 0 || iB < 0) {
64 maxts[0] = iA + iB + 1;
65 maxts[1] = jA + jB + 1;
66 maxts[2] = kA + kB + 1;
71 double mu = a * b / (a + b);
76 for(
int dim = 0; dim < 3; dim++) {
78 double AB =
m_AB(dim);
79 double PA =
m_PA(dim);
80 double PB =
m_PB(dim);
82 int maxiA = maxiAs[dim];
83 int maxiB = maxiBs[dim];
84 int maxt = maxts[dim];
87 E(0,0,0) = exp(-mu * AB * AB);
90 for(
int iB = 0; iB < maxiB; iB++) {
91 for(
int t = 0; t < maxt; t++) {
93 if(iA == 0 && iB == 0 && t == 0) {
101 double E_iA_iBp_tp = 0;
103 E_iA_iBp_tp = E(iA, iBp, tp);
105 double E_iA_iBp_t = 0;
107 E_iA_iBp_t = E(iA, iBp, t);
109 double E_iA_iBp_tn = 0;
111 E_iA_iBp_tn = E(iA, iBp, tn);
113 E(iA,iB,t) = 1 / (2*p) * E_iA_iBp_tp + PB * E_iA_iBp_t + (t + 1)*E_iA_iBp_tn;
118 for(
int iA = 1; iA < maxiA; iA++) {
119 for(
int iB = 0; iB < maxiB; iB++) {
120 for(
int t = 0; t < maxt; t++) {
126 double E_iAp_iB_tp = 0;
128 E_iAp_iB_tp = E(iAp, iB, tp);
130 double E_iAp_iB_t = 0;
132 E_iAp_iB_t = E(iAp, iB, t);
134 double E_iAp_iB_tn = 0;
136 E_iAp_iB_tn = E(iAp, iB, tn);
138 E(iA,iB,t) = 1 / (2*p) * E_iAp_iB_tp + PA * E_iAp_iB_t + (t + 1)*E_iAp_iB_tn;