18 : xmin(fxmin), xmax(fxmax), x(fx), y(fy) {
27 for (n = 0; n < q - 1; n++) {
30 for (n = 0; n < q; n++) {
35 for (n = 0; n < q - 1; n++) {
36 a[n] = (y[n + 1] - y[n]) / (x[n + 1] - x[n]);
39 double y0 = y[0] - a[0] * (x[0] - xmin);
41 x[0] = x[0] - y[0] / a[0];
50 if (xmax > x[q - 1]) {
51 double yq = y[q - 1] + a[q - 2] * (xmax - x[q - 1]);
53 x[q - 1] = x[q - 1] - y[q - 1] / a[0];
66 for (n = 1; n < q; n++) {
67 iy[n] = iy[n - 1] + 0.5 * (x[n] - x[n - 1]) * (y[n - 1] + y[n]);
71 }
else if (xmin > x[n - 1]) {
73 (xmin - x[n - 1]) * (y[n - 1] + 0.5 * a[n - 1] * (xmin - x[n - 1]));
79 }
else if (xmax > x[n - 1]) {
81 (xmax - x[n - 1]) * (y[n - 1] + 0.5 * a[n - 1] * (xmax - x[n - 1]));
85 integ_active = integ_finish - integ_start;
115 mfunnamep(
"double PointsRan::ran(double flat_ran) const");
116 flat_ran = integ_start + integ_active * flat_ran;
121 while (n2 - n1 > 1) {
122 n3 = n1 + (n2 - n1) / 2;
123 if (flat_ran < iy[n3]) {
129 double dran = flat_ran - iy[n1];
133 dx = (-y[n1] +
sqrt(y[n1] * y[n1] + 2.0 * a[n1] * dran)) / a[n1];
135 dx = (x[n2] - x[n1]) / (iy[n2] - iy[n1]) * dran;
139 double r = x[n1] + dx;
144 Ifile <<
"PointsRan:\n";
146 Ifile <<
"xmin=" << xmin <<
" xmax=" << xmax <<
'\n';
147 Ifile <<
"n_start=" << n_start <<
" n_finish=" << n_finish <<
'\n';
148 Ifile <<
"integ_start=" << integ_start <<
" integ_finish=" << integ_finish
150 Ifile <<
"integ_total=" << integ_total <<
" integ_active=" << integ_active
156 for (n = 0; n < q; n++) {
157 file << std::setw(3) << n <<
' ' << std::setw(12) << x[n] <<
' '
158 << std::setw(12) << y[n] <<
' ' << std::setw(12) << iy[n];
159 if (n < q - 1) file <<
' ' << std::setw(12) << a[n];
DoubleAc sqrt(const DoubleAc &f)
#define check_econd11(a, signb, stream)
#define mfunnamep(string)
#define check_econd12(a, sign, b, stream)
double ran(double flat_ran) const
void print(std::ostream &file) const
#define Iprintn(file, name)