51 if (x_sampling.
size()!=y_sampling.
size()){
59 auto iter = sampling.begin();
60 while (iter != sampling.end()) {
61 m_x_sampling.push_back((*iter).first);
62 m_y_sampling.push_back((*iter).second);
72 auto iter = sampling.
begin();
73 while (iter != sampling.
end()) {
74 xs.push_back((*iter).first);
75 ys.push_back((*iter).second);
85 auto iter_pdf = pdf_sampling.
cbegin();
87 while (iter_pdf != pdf_sampling.
cend()) {
89 cumul.push_back(total);
102 cumul.push_back(*iter/total);
111 if (ratio>1. || ratio<0.){
112 throw Elements::Exception(
"Cumulative::findValue : ratio parameter must be in range [0,1]");
121 double begin = *iter_x;
122 double tray = *iter_y;
128 double end = *(--iter_x);
132 case TrayPosition::begin: result =
begin;
break;
133 case TrayPosition::middle: result = 0.5*(
begin +
end);
break;
134 case TrayPosition::end: result =
end;
break;
144 if (rate>1. || rate<=0.){
145 throw Elements::Exception(
"Cumulative::findMinInterval : rate parameter must be in range ]0,1]");
159 while (iter_2_x!=
m_x_sampling.
cend() && (*iter_2_y-*iter_1_y + first_correction)<rate){
166 if ( (*iter_2_x - *iter_1_x) <= (*max_x - *min_x)){
181 if (rate>1. || rate<=0.){
182 throw Elements::Exception(
"Cumulative::findCenteredInterval : rate parameter must be in range ]0,1]");
185 double min_rate = 0.5 - rate/2.0;
186 double max_rate = 0.5 + rate/2.0;
188 double min_x =
findValue(min_rate, TrayPosition::end);
189 double max_x =
findValue(max_rate, TrayPosition::begin);