|
@@ -116,7 +116,8 @@ namespace ABACUS {
|
116
|
116
|
if (i % 2 && bdry[i] < xmax_ref) xmax_reg++;
|
117
|
117
|
}
|
118
|
118
|
|
119
|
|
- Vect<T> new_bdry(bdry.size() + 2 * (((xmin_reg + 1) % 2 && (xmax_reg + 1) % 2) - (xmax_reg - xmin_reg)/2));
|
|
119
|
+ Vect<T> new_bdry(bdry.size()
|
|
120
|
+ + 2 * (((xmin_reg + 1) % 2 && (xmax_reg + 1) % 2) - (xmax_reg - xmin_reg)/2));
|
120
|
121
|
|
121
|
122
|
int ishift = 0;
|
122
|
123
|
for (int i = 0; i <= xmin_reg; ++i) new_bdry[i] = bdry[i];
|
|
@@ -201,18 +202,40 @@ namespace ABACUS {
|
201
|
202
|
|
202
|
203
|
// ******************************** Recursive integration functions ******************************
|
203
|
204
|
|
204
|
|
- DP Integrate_Riemann (DP (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, DP xmin, DP xmax, int Npts);
|
205
|
|
- DP Integrate_Riemann_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
|
|
205
|
+ DP Integrate_Riemann (DP (*function) (Vect_DP),
|
|
206
|
+ Vect_DP& args, int arg_to_integ,
|
|
207
|
+ DP xmin, DP xmax,
|
|
208
|
+ int Npts);
|
|
209
|
+
|
|
210
|
+ DP Integrate_Riemann_using_table (DP (*function) (Vect_DP, I_table),
|
|
211
|
+ Vect_DP& args, int arg_to_integ,
|
|
212
|
+ I_table Itable,
|
206
|
213
|
DP xmin, DP xmax, int Npts);
|
207
|
214
|
|
208
|
|
- DP Integrate_rec (DP (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, DP xmin, DP xmax, DP req_prec, int max_rec_level);
|
209
|
|
- DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
|
210
|
|
- DP xmin, DP xmax, DP req_prec, int max_rec_level);
|
211
|
|
- DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable,
|
212
|
|
- DP xmin, DP xmax, DP req_prec, int max_rec_level, std::ofstream& outfile);
|
213
|
|
- DP Integrate_rec_using_table_and_file (DP (*function) (Vect_DP, I_table, std::ofstream&), Vect_DP& args,
|
214
|
|
- int arg_to_integ, I_table Itable,
|
215
|
|
- DP xmin, DP xmax, DP req_prec, int max_rec_level, std::ofstream& outfile);
|
|
215
|
+ DP Integrate_rec (DP (*function) (Vect_DP),
|
|
216
|
+ Vect_DP& args, int arg_to_integ,
|
|
217
|
+ DP xmin, DP xmax,
|
|
218
|
+ DP req_prec, int max_rec_level);
|
|
219
|
+
|
|
220
|
+ DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table),
|
|
221
|
+ Vect_DP& args, int arg_to_integ,
|
|
222
|
+ I_table Itable,
|
|
223
|
+ DP xmin, DP xmax,
|
|
224
|
+ DP req_prec, int max_rec_level);
|
|
225
|
+
|
|
226
|
+ DP Integrate_rec_using_table (DP (*function) (Vect_DP, I_table),
|
|
227
|
+ Vect_DP& args, int arg_to_integ,
|
|
228
|
+ I_table Itable,
|
|
229
|
+ DP xmin, DP xmax,
|
|
230
|
+ DP req_prec, int max_rec_level,
|
|
231
|
+ std::ofstream& outfile);
|
|
232
|
+
|
|
233
|
+ DP Integrate_rec_using_table_and_file (DP (*function) (Vect_DP, I_table, std::ofstream&),
|
|
234
|
+ Vect_DP& args, int arg_to_integ,
|
|
235
|
+ I_table Itable,
|
|
236
|
+ DP xmin, DP xmax,
|
|
237
|
+ DP req_prec, int max_rec_level,
|
|
238
|
+ std::ofstream& outfile);
|
216
|
239
|
|
217
|
240
|
|
218
|
241
|
|
|
@@ -248,34 +271,70 @@ namespace ABACUS {
|
248
|
271
|
DP xmax;
|
249
|
272
|
|
250
|
273
|
public:
|
251
|
|
- Integral_data (DP (*function_ref) (Vect_DP), Vect_DP& args, int arg_to_integ_ref, DP xmin_ref, DP xmax_ref);
|
252
|
|
- Integral_data (DP (*function_ref) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ_ref,
|
253
|
|
- I_table Itable, DP xmin_ref, DP xmax_ref);
|
254
|
|
- Integral_data (DP (*function_ref) (Vect_DP, Integral_table), Vect_DP& args, int arg_to_integ_ref,
|
255
|
|
- Integral_table Itable, DP xmin_ref, DP xmax_ref);
|
|
274
|
+ Integral_data (DP (*function_ref) (Vect_DP),
|
|
275
|
+ Vect_DP& args, int arg_to_integ_ref,
|
|
276
|
+ DP xmin_ref, DP xmax_ref);
|
|
277
|
+
|
|
278
|
+ Integral_data (DP (*function_ref) (Vect_DP, I_table),
|
|
279
|
+ Vect_DP& args, int arg_to_integ_ref,
|
|
280
|
+ I_table Itable,
|
|
281
|
+ DP xmin_ref, DP xmax_ref);
|
|
282
|
+
|
|
283
|
+ Integral_data (DP (*function_ref) (Vect_DP, Integral_table),
|
|
284
|
+ Vect_DP& args, int arg_to_integ_ref,
|
|
285
|
+ Integral_table Itable,
|
|
286
|
+ DP xmin_ref, DP xmax_ref);
|
|
287
|
+
|
256
|
288
|
void Save (std::ofstream& outfile);
|
257
|
|
- void Improve_estimate (DP (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, int Npts_max);
|
258
|
|
- void Improve_estimate (DP (*function) (Vect_DP, I_table), Vect_DP& args, int arg_to_integ, I_table Itable, int Npts_max);
|
259
|
|
- void Improve_estimate (DP (*function) (Vect_DP, Integral_table), Vect_DP& args, int arg_to_integ,
|
260
|
|
- Integral_table Itable, int Npts_max);
|
261
|
|
- ~Integral_data ();
|
262
|
289
|
|
263
|
|
- };
|
|
290
|
+ void Improve_estimate (DP (*function) (Vect_DP),
|
|
291
|
+ Vect_DP& args, int arg_to_integ,
|
|
292
|
+ int Npts_max);
|
264
|
293
|
|
265
|
|
- Integral_result Integrate_optimal (DP (*function) (Vect_DP), Vect_DP& args,
|
266
|
|
- int arg_to_integ, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
|
267
|
|
- Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
268
|
|
- I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
|
269
|
|
- Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, Integral_table Itable), Vect_DP& args, int arg_to_integ,
|
270
|
|
- Integral_table Itable, DP xmin, DP xmax, DP req_rel_prec,
|
271
|
|
- DP req_abs_prec, int max_nr_pts);
|
|
294
|
+ void Improve_estimate (DP (*function) (Vect_DP, I_table),
|
|
295
|
+ Vect_DP& args, int arg_to_integ,
|
|
296
|
+ I_table Itable,
|
|
297
|
+ int Npts_max);
|
272
|
298
|
|
273
|
|
- Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
274
|
|
- I_table Itable, DP xmin, DP xmax, DP req_rel_prec,
|
275
|
|
- DP req_abs_prec, int max_nr_pts, std::ofstream& outfile);
|
|
299
|
+ void Improve_estimate (DP (*function) (Vect_DP, Integral_table),
|
|
300
|
+ Vect_DP& args, int arg_to_integ,
|
|
301
|
+ Integral_table Itable,
|
|
302
|
+ int Npts_max);
|
276
|
303
|
|
|
304
|
+ ~Integral_data ();
|
277
|
305
|
|
278
|
|
- // ******************************** Recursive version: optimal, complex implementation ******************************
|
|
306
|
+ };
|
|
307
|
+
|
|
308
|
+ Integral_result Integrate_optimal (DP (*function) (Vect_DP),
|
|
309
|
+ Vect_DP& args, int arg_to_integ,
|
|
310
|
+ DP xmin, DP xmax,
|
|
311
|
+ DP req_rel_prec, DP req_abs_prec,
|
|
312
|
+ int max_nr_pts);
|
|
313
|
+
|
|
314
|
+ Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable),
|
|
315
|
+ Vect_DP& args, int arg_to_integ,
|
|
316
|
+ I_table Itable,
|
|
317
|
+ DP xmin, DP xmax,
|
|
318
|
+ DP req_rel_prec, DP req_abs_prec,
|
|
319
|
+ int max_nr_pts);
|
|
320
|
+
|
|
321
|
+ Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, Integral_table Itable),
|
|
322
|
+ Vect_DP& args, int arg_to_integ,
|
|
323
|
+ Integral_table Itable,
|
|
324
|
+ DP xmin, DP xmax,
|
|
325
|
+ DP req_rel_prec, DP req_abs_prec,
|
|
326
|
+ int max_nr_pts);
|
|
327
|
+
|
|
328
|
+ Integral_result Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable),
|
|
329
|
+ Vect_DP& args, int arg_to_integ,
|
|
330
|
+ I_table Itable,
|
|
331
|
+ DP xmin, DP xmax,
|
|
332
|
+ DP req_rel_prec, DP req_abs_prec,
|
|
333
|
+ int max_nr_pts,
|
|
334
|
+ std::ofstream& outfile);
|
|
335
|
+
|
|
336
|
+
|
|
337
|
+ // ********************** Recursive version: optimal, complex implementation ********************
|
279
|
338
|
|
280
|
339
|
// NB: function returns complex values but takes real arguments
|
281
|
340
|
|
|
@@ -307,23 +366,25 @@ namespace ABACUS {
|
307
|
366
|
DP xmax;
|
308
|
367
|
|
309
|
368
|
public:
|
310
|
|
- Integral_data_CX (std::complex<DP> (*function_ref) (Vect_DP), Vect_DP& args, int arg_to_integ_ref, DP xmin_ref, DP xmax_ref);
|
311
|
|
- void Save (std::ofstream& outfile);
|
312
|
|
- void Improve_estimate (std::complex<DP> (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, int Npts_max);
|
313
|
|
- ~Integral_data_CX ();
|
|
369
|
+ Integral_data_CX (std::complex<DP> (*function_ref) (Vect_DP),
|
|
370
|
+ Vect_DP& args, int arg_to_integ_ref,
|
|
371
|
+ DP xmin_ref, DP xmax_ref);
|
314
|
372
|
|
315
|
|
- };
|
316
|
|
-
|
317
|
|
- Integral_result_CX Integrate_optimal (std::complex<DP> (*function) (Vect_DP), Vect_DP& args, int arg_to_integ, DP xmin, DP xmax,
|
318
|
|
- DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
|
319
|
|
- //Integral_result_CX Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
320
|
|
- // I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts);
|
321
|
|
- //Integral_result_CX Integrate_optimal_using_table (DP (*function) (Vect_DP, I_table Itable), Vect_DP& args, int arg_to_integ,
|
322
|
|
- // I_table Itable, DP xmin, DP xmax, DP req_rel_prec, DP req_abs_prec, int max_nr_pts, std::ofstream& outfile);
|
|
373
|
+ void Save (std::ofstream& outfile);
|
323
|
374
|
|
|
375
|
+ void Improve_estimate (std::complex<DP> (*function) (Vect_DP),
|
|
376
|
+ Vect_DP& args, int arg_to_integ,
|
|
377
|
+ int Npts_max);
|
324
|
378
|
|
|
379
|
+ ~Integral_data_CX ();
|
325
|
380
|
|
|
381
|
+ };
|
326
|
382
|
|
|
383
|
+ Integral_result_CX Integrate_optimal (std::complex<DP> (*function) (Vect_DP),
|
|
384
|
+ Vect_DP& args, int arg_to_integ,
|
|
385
|
+ DP xmin, DP xmax,
|
|
386
|
+ DP req_rel_prec, DP req_abs_prec,
|
|
387
|
+ int max_nr_pts);
|
327
|
388
|
|
328
|
389
|
} // namespace ABACUS
|
329
|
390
|
|