15 const std::vector<float>& xtabulated,
16 const std::vector<float>& ytabulated) {
24 if ( xtabulated.size() != ytabulated.size() ) {
25 std::cerr <<
"TRT_PAI_Process::TRT_PAI_utils::Interpolate:";
26 std::cerr <<
" ERROR - tabulated arrays must be of similar size"
28 std::cerr <<
"xsize= " << xtabulated.size()
29 <<
" ysize= " << ytabulated.size()
34 if ( xtabulated.empty() ) {
35 std::cerr <<
"TRT_PAI_Process::TRT_PAI_utils::Interpolate:"
36 <<
"ERROR - tabulated arrays are empty"
46 if ( xtabulated.size()==1 ) {
47 return ytabulated.at(1);
50 const std::vector<float>::const_iterator xBeginIter(xtabulated.begin());
51 const std::vector<float>::const_iterator xEndIter(xtabulated.end());
53 const std::vector<float>::const_iterator xLowerBoundIter(lower_bound(xBeginIter, xEndIter,
xval));
90 if ( xLowerBoundIter==xEndIter ) {
93 const std::vector<float>::const_iterator yEndIter(ytabulated.end());
97 if ( ((*xLowerBoundIter)-
xval)<std::numeric_limits<float>::epsilon() ) {
100 std::vector<float>::const_iterator yIter(ytabulated.begin());
101 std::advance(yIter,
std::distance(xBeginIter, xLowerBoundIter));
109 if (xLowerBoundIter==xBeginIter) {
111 const std::vector<float>::const_iterator yBeginIter(ytabulated.begin());
116 std::vector<float>::const_iterator
ylo(ytabulated.begin());