Changeset 449
- Timestamp:
- 07/29/09 15:33:44 (15 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
library/tests/test_util.cpp
r436 r449 86 86 double ystep = (yb(1) - yb(0)) / yn; 87 87 88 int i = 0;89 for ( double x = xb(0); x <= xb(1); x += xstep, i++) {88 double x = xb(0); 89 for (int i = 0; i <= xn; x += xstep, i++) { 90 90 rgr(0) = x; 91 int j = 0;92 for ( double y = yb(0); y <= yb(1); y += ystep, j++) {91 double y = yb(0); 92 for (int j = 0; j <= yn; y += ystep, j++) { 93 93 rgr(1) = y; 94 94 Pdf(i, j) = exp(ep->evallog(rgr)); … … 110 110 vec Si(yn + 1); 111 111 112 int i = 0;113 for ( double x = xb(0); x <= xb(1); x += xstep, i++) {112 double x = xb(0); 113 for (int i = 0; i <= xn; x += xstep, i++) { 114 114 Mu(i) = x; 115 115 rgr(0) = x; 116 int j = 0;117 for ( double y = yb(0); y <= yb(1); y += ystep, j++) {116 double y = yb(0); 117 for (int j = 0; j <= yn; y += ystep, j++) { 118 118 Si(j) = y; 119 119 rgr(1) = y; … … 123 123 124 124 vec fm = sum(Pdf, 2); 125 double sfm = sum(fm); 125 126 vec fs = sum(Pdf, 1); 126 return vec_2(Mu * fm / sum(fm), Si * fs / sum(fs)); 127 double sfs = sum(fs); 128 double vi0 = Mu * fm / sfm; 129 double vi1 = Si * fs / sfs; 130 return vec_2(vi0, vi1); 127 131 } 128 132