Commit 026b6647 authored by Dimitar Tasev's avatar Dimitar Tasev
Browse files

Re #16959 applied feedback

parent db46fac6
......@@ -143,7 +143,7 @@ void GeneralisedSecondDifference::computePrefactors() {
m_Cij.resize(3);
m_Cij.assign(previous.begin(), previous.end());
m_Cij2.resize(3);
std::transform(m_Cij.begin(), m_Cij.end(), m_Cij2.begin(),
std::transform(m_Cij.cbegin(), m_Cij.cend(), m_Cij2.begin(),
VectorHelper::Squares<double>());
return;
}
......@@ -163,9 +163,7 @@ void GeneralisedSecondDifference::computePrefactors() {
next[i] += previous[index];
}
}
previous.resize(n_el);
std::copy(next.begin(), next.end(), previous.begin());
previous.assign(next.begin(), next.end());
previous = next;
max_index_prev = max_index;
n_el_prev = n_el;
} while (zz != m_z);
......@@ -173,7 +171,7 @@ void GeneralisedSecondDifference::computePrefactors() {
m_Cij.resize(2 * m_z * m_m + 3);
m_Cij.assign(previous.begin(), previous.end());
m_Cij2.resize(2 * m_z * m_m + 3);
std::transform(m_Cij.begin(), m_Cij.end(), m_Cij2.begin(),
std::transform(m_Cij.cbegin(), m_Cij.cend(), m_Cij2.begin(),
VectorHelper::Squares<double>());
}
......
......@@ -377,9 +377,12 @@ void GetEi::getPeakEstimates(double &height, int64_t &centreInd,
height = Y[0];
centreInd = 0;
background = std::accumulate(Y.begin(), Y.end(), 0.0);
// then loop through all the Y values and find the tallest peak
std::accumulate(Y.begin(), Y.end(), background);
std::max(Y.begin(), Y.end(), height);
// Todo use std::max to find max element and record index?
auto maxHeight = std::max_element(Y.begin(), Y.end());
height = *maxHeight;
centreInd = std::distance(Y.begin(), maxHeight);
background = background / static_cast<double>(Y.size());
if (height < PEAK_THRESH_H * background) {
......
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