1 #ifndef QNANO_NEW_INTEGRATOR_DEFINED_H 2 #define QNANO_NEW_INTEGRATOR_DEFINED_H 4 #include "tools/Integrable_Function.h" 5 #include "tools/List_Class.h" 18 for(
size_t i=0; i<D; i++){
37 std::cerr<<
"Integrator_Riemann: discr.size()="<<discr.size()<<
" < D="<<D<<std::endl;
41 std::cerr<<
"Integrator_Riemann: x.size()="<<x.size()<<
" < D="<<D<<std::endl;
46 double h=(discr[D-1].lim_b-discr[D-1].lim_a)/discr[D-1].N;
48 for(
size_t i=0; i<discr[D-1].N; i++){
49 x[D-1] = discr[D-1].lim_a + i * h;
55 std::vector<double> x(D,0);
56 return integrate(ifct, discr, x);
63 return ifct.evaluate(x);
73 std::cerr<<
"Integrator_Riemann: discr.size()="<<discr.size()<<
" < D="<<D<<std::endl;
77 std::cerr<<
"Integrator_Riemann: x.size()="<<x.size()<<
" < D="<<D<<std::endl;
81 double h=(discr[D-1].lim_b-discr[D-1].lim_a)/discr[D-1].N;
84 x[D-1]=discr[D-1].lim_a;
87 x[D-1]=discr[D-1].lim_b;
91 for(
size_t i=1; i<discr[D-1].N; i+=2){
92 x[D-1]=discr[D-1].lim_a+h*i;
96 for(
size_t i=2; i<discr[D-1].N-1; i+=2){
97 x[D-1]=discr[D-1].lim_a+h*i;
104 std::vector<double> x(D,0);
105 return integrate(ifct, discr, x);
111 return ifct.evaluate(x);
Definition: List_Class.h:8
Definition: Integrator.h:26
Integrator using Riemann sums.
Definition: Integrator.h:32
Definition: Integrator.h:13
Interface for integrable functions.
Definition: Integrable_Function.h:10
Integrator using Simpson's rule.
Definition: Integrator.h:68
Interface for integrators.
Definition: Integrator.h:8