Commit 7af3cf30 authored by niklas.baumgarten's avatar niklas.baumgarten
Browse files

moved to cpp

parent 2b9c796f
......@@ -41,3 +41,19 @@ void Kurtosis::Update(Averages avgs, Variances vars) {
3.0 * avgs.Y * avgs.Y * avgs.Y * avgs.Y) / vars.Y / vars.Y;
if (Y > 100.0) Warning("Kurtosis of Y above 100!")
}
void SampleCounter::UpdateSampleCounter(int dM) {
this->dM = dM;
if (parallel) {
for (int i = 0; i < ceil(log2(PPM->Size(0))) + 1; i++) {
if (dM >= PPM->Size(i)) {
dMComm = ceil((double) dM / PPM->Size(i));
commSplit = PPM->MaxCommSplit() - i;
break;
}
}
} else {
dMComm = dM;
commSplit = 0;
}
}
......@@ -143,10 +143,8 @@ public:
}
void UpdateParallel() {
M += PPM->SumOnCommSplit(Mcomm, 0) / PPM->Size(commSplit);
dM += PPM->SumOnCommSplit(dMcomm, 0) / PPM->Size(commSplit);
Mcomm = 0;
dMcomm = 0;
M = PPM->SumOnCommSplit(Mcomm, 0) / PPM->Size(commSplit);
dM = PPM->SumOnCommSplit(dMcomm, 0) / PPM->Size(commSplit);
MeanQ = (PPM->SumOnCommSplit(Mcomm * MeanQcomm, 0) / PPM->Size(commSplit)) / M;
MeanY = (PPM->SumOnCommSplit(Mcomm * MeanYcomm, 0) / PPM->Size(commSplit)) / M;
......@@ -212,21 +210,7 @@ struct SampleCounter {
UpdateSampleCounter(dM);
}
void UpdateSampleCounter(int dM) {
this->dM = dM;
if (parallel) {
for (int i = 0; i < ceil(log2(PPM->Size(0))) + 1; i++) {
if (dM >= PPM->Size(i)) {
dMComm = ceil((double) dM / PPM->Size(i));
commSplit = PPM->MaxCommSplit() - i;
break;
}
}
} else {
dMComm = dM;
commSplit = 0;
}
}
void UpdateSampleCounter(int dM);
SampleCounter(int M, int dM) :
M(M), dM(dM) {}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment