12 typedef std::pair<float, const GlobalPoint*> MyPair;
13 typedef std::pair<float, float> FloatPair;
14 typedef std::pair<GlobalPoint, float> GlPtWt;
15 typedef std::pair<float, const GlPtWt*> MyPairWt;
18 bool operator()(
const MyPair& pair1,
const MyPair& pair2) {
return (pair1.first < pair2.first); };
20 bool operator()(
const FloatPair& pair1,
const FloatPair& pair2) {
return (pair1.first < pair2.first); };
22 bool operator()(
const MyPairWt& pair1,
const MyPairWt& pair2) {
return (pair1.first < pair2.first); };
25 bool debug() {
return false; }
38 for (std::vector<MyPair>::const_iterator
i = pairs.begin();
i != (pairs.begin() + nq); ++
i)
39 location += *(
i->second);
46 for (std::vector<MyPairWt>::const_iterator
i = pairs.begin();
i != (pairs.begin() + nq); ++
i)
47 location += (
i->second)->first;
59 std::cout <<
"[SMS] warning: Weighted SMS was asked for, but data are "
60 <<
"weightless!" << std::endl;
62 int nobs = data.size();
67 std::vector<MyPair> pairs;
69 for (std::vector<GlobalPoint>::const_iterator
i = data.begin();
i != data.end(); ++
i) {
72 for (std::vector<GlobalPoint>::const_iterator
j = data.begin();
j != data.end(); ++
j) {
73 D.push_back((*
j - *
i).
mag2());
76 sort(D.begin(), D.end());
77 MyPair
tmp(D[nq - 1], &(*
i));
82 sort(pairs.begin(), pairs.end(), Sorter());
86 return *(pairs.begin()->second);
98 std::vector<GlobalPoint> data1;
99 std::vector<MyPair>::iterator
j;
101 for (j = pairs.begin(); j - pairs.begin() < nq; ++
j)
102 data1.push_back(*(j->second));
109 std::vector<GlobalPoint> points;
110 for (std::vector<GlPtWt>::const_iterator
i = wdata.begin();
i != wdata.end(); ++
i) {
111 points.push_back(
i->first);
114 std::cout <<
"[SMS] Unweighted SMS was asked for; ignoring the weights." << std::endl;
121 std::vector<GlPtWt>::const_iterator
i,
j;
122 for (i = wdata.begin(); i != wdata.end(); ++
i)
126 std::vector<MyPairWt> pairs;
127 for (i = wdata.begin(); i != wdata.end(); ++
i) {
128 std::vector<FloatPair>
D;
130 for (j = wdata.begin(); j != wdata.end(); ++
j)
131 D.push_back(FloatPair((j->first - i->first).mag2(), j->second));
133 sort(D.begin(), D.end());
135 std::vector<FloatPair>::const_iterator where;
136 for (where = D.begin(); where != D.end(); ++where) {
137 sumw += where->second;
142 MyPairWt
tmp(where->first, &(*i));
143 pairs.push_back(
tmp);
148 sort(pairs.begin(), pairs.end(), Sorter());
153 std::vector<MyPairWt>::const_iterator
k;
154 for (k = pairs.begin(); k != pairs.end(); ++
k) {
155 sumw += k->second->second;
166 return pairs.begin()->second->first;
178 std::vector<GlPtWt> wdata1;
180 for (k = pairs.begin(); k - pairs.begin() < nq; ++
k)
181 wdata1.push_back(*(k->second));
constexpr int32_t ceil(float num)
Global3DPoint GlobalPoint
T mag2() const
The vector magnitude squared. Equivalent to vec.dot(vec)
for(Iditer=Id.begin();Iditer!=Id.end();Iditer++)
DecomposeProduct< arg, typename Div::arg > D
Basic3DVector & operator/=(T t)
Scaling by a scalar value (division)
char data[epos_bytes_allocation]
SMS(SMSType tp=(SMSType)(Interpolate|Iterate|Weighted), float q=0.5)
GlobalPoint location(const std::vector< GlobalPoint > &) const
Basic3DVector & operator+=(const Basic3DVector< U > &p)