Commit 39a6998d authored by David Fairbrother's avatar David Fairbrother
Browse files

Fix Cppcheck warnings for 1.90

parent a200387f
...@@ -117,8 +117,8 @@ Expression &Expression::operator=(const Expression &expr) { ...@@ -117,8 +117,8 @@ Expression &Expression::operator=(const Expression &expr) {
m_funct = expr.m_funct; m_funct = expr.m_funct;
m_op = expr.m_op; m_op = expr.m_op;
m_terms = expr.m_terms; m_terms = expr.m_terms;
// m_expr = expr.m_expr; m_expr = expr.m_expr;
// m_tokens = expr.m_tokens; m_tokens = expr.m_tokens;
return *this; return *this;
} }
......
...@@ -559,10 +559,11 @@ std::vector<std::string> IFunction::getParameterNames() const { ...@@ -559,10 +559,11 @@ std::vector<std::string> IFunction::getParameterNames() const {
* @param handler :: A new handler * @param handler :: A new handler
*/ */
void IFunction::setHandler(std::unique_ptr<FunctionHandler> handler) { void IFunction::setHandler(std::unique_ptr<FunctionHandler> handler) {
m_handler = std::move(handler);
if (handler && handler->function().get() != this) { if (handler && handler->function().get() != this) {
throw std::runtime_error("Function handler points to a different function"); throw std::runtime_error("Function handler points to a different function");
} }
m_handler = std::move(handler);
m_handler->init(); m_handler->init();
} }
...@@ -661,6 +662,7 @@ private: ...@@ -661,6 +662,7 @@ private:
/// @param attr :: The attribute to copy from. /// @param attr :: The attribute to copy from.
IFunction::Attribute &IFunction::Attribute::operator=(const Attribute &attr) { IFunction::Attribute &IFunction::Attribute::operator=(const Attribute &attr) {
m_data = attr.m_data; m_data = attr.m_data;
m_quoteValue = attr.m_quoteValue;
return *this; return *this;
} }
......
...@@ -78,7 +78,6 @@ Indexing::SpectrumIndexSet IndexProperty::getIndices() const { ...@@ -78,7 +78,6 @@ Indexing::SpectrumIndexSet IndexProperty::getIndices() const {
static_cast<Indexing::SpectrumNumber>(static_cast<int32_t>(max))); static_cast<Indexing::SpectrumNumber>(static_cast<int32_t>(max)));
} }
} else { } else {
// cppcheck-suppress constArgument
MSVC_DIAG_OFF(4244); MSVC_DIAG_OFF(4244);
switch (type) { switch (type) {
case IndexType::WorkspaceIndex: case IndexType::WorkspaceIndex:
......
...@@ -1940,8 +1940,6 @@ MatrixWorkspace::findY(double value, ...@@ -1940,8 +1940,6 @@ MatrixWorkspace::findY(double value,
if (std::isnan(value)) { if (std::isnan(value)) {
for (int64_t i = idx.first; i < numHists; ++i) { for (int64_t i = idx.first; i < numHists; ++i) {
const auto &Y = this->y(i); const auto &Y = this->y(i);
// https://trac.cppcheck.net/ticket/9237 if init buggy with cppcheck
// cppcheck-suppress stlIfFind
if (auto it = std::find_if(std::next(Y.begin(), idx.second), Y.end(), if (auto it = std::find_if(std::next(Y.begin(), idx.second), Y.end(),
[](double v) { return std::isnan(v); }); [](double v) { return std::isnan(v); });
it != Y.end()) { it != Y.end()) {
...@@ -1952,7 +1950,6 @@ MatrixWorkspace::findY(double value, ...@@ -1952,7 +1950,6 @@ MatrixWorkspace::findY(double value,
} else { } else {
for (int64_t i = idx.first; i < numHists; ++i) { for (int64_t i = idx.first; i < numHists; ++i) {
const auto &Y = this->y(i); const auto &Y = this->y(i);
// cppcheck-suppress stlIfFind
if (auto it = std::find(std::next(Y.begin(), idx.second), Y.end(), value); if (auto it = std::find(std::next(Y.begin(), idx.second), Y.end(), value);
it != Y.end()) { it != Y.end()) {
out = {i, std::distance(Y.begin(), it)}; out = {i, std::distance(Y.begin(), it)};
......
...@@ -150,7 +150,7 @@ double ParamFunction::getParameter(const std::string &name) const { ...@@ -150,7 +150,7 @@ double ParamFunction::getParameter(const std::string &name) const {
*/ */
bool ParamFunction::hasParameter(const std::string &name) const { bool ParamFunction::hasParameter(const std::string &name) const {
return std::find(m_parameterNames.cbegin(), m_parameterNames.cend(), name) != return std::find(m_parameterNames.cbegin(), m_parameterNames.cend(), name) !=
m_parameterNames.end(); m_parameterNames.cend();
} }
/** /**
......
...@@ -186,7 +186,7 @@ public: ...@@ -186,7 +186,7 @@ public:
foundAlg = ("Cat" == descItr->category) && foundAlg = ("Cat" == descItr->category) &&
("ToyAlgorithm" == descItr->name) && ("ToyAlgorithm" == descItr->name) &&
("Dog" == descItr->alias) && (1 == descItr->version); ("Dog" == descItr->alias) && (1 == descItr->version);
descItr++; ++descItr;
} }
TS_ASSERT(foundAlg); TS_ASSERT(foundAlg);
......
...@@ -104,7 +104,6 @@ public: ...@@ -104,7 +104,6 @@ public:
void test_Shared_Pointer() { void test_Shared_Pointer() {
FunctionProperty prop("fun"); FunctionProperty prop("fun");
std::string error;
boost::shared_ptr<FunctionPropertyTest_Function> fun_p( boost::shared_ptr<FunctionPropertyTest_Function> fun_p(
new FunctionPropertyTest_Function); new FunctionPropertyTest_Function);
TS_ASSERT(fun_p); TS_ASSERT(fun_p);
......
...@@ -555,8 +555,7 @@ private: ...@@ -555,8 +555,7 @@ private:
LogManager runInfo; LogManager runInfo;
const std::string name = "T_prop"; const std::string name = "T_prop";
runInfo.addProperty<T>(name, value); runInfo.addProperty<T>(name, value);
int result(-1); int result = runInfo.getPropertyAsIntegerValue(name);
result = runInfo.getPropertyAsIntegerValue(name);
TS_ASSERT_THROWS_NOTHING(result = runInfo.getPropertyAsIntegerValue(name)); TS_ASSERT_THROWS_NOTHING(result = runInfo.getPropertyAsIntegerValue(name));
TS_ASSERT_EQUALS(value, static_cast<T>(result)); TS_ASSERT_EQUALS(value, static_cast<T>(result));
} }
...@@ -580,12 +579,11 @@ public: ...@@ -580,12 +579,11 @@ public:
} }
void test_Accessing_Single_Value_From_Times_Series_A_Large_Number_Of_Times() { void test_Accessing_Single_Value_From_Times_Series_A_Large_Number_Of_Times() {
double value(0.0);
for (size_t i = 0; i < 20000; ++i) { for (size_t i = 0; i < 20000; ++i) {
value = m_testRun.getPropertyAsSingleValue(m_propName); // This has an observable side-effect of calling, so we don't need
// to store its return value
m_testRun.getPropertyAsSingleValue(m_propName);
} }
// Enure variable is used so that it is not optimised away by the compiler
value += 1.0;
} }
LogManager m_testRun; LogManager m_testRun;
......
...@@ -324,7 +324,6 @@ public: ...@@ -324,7 +324,6 @@ public:
void test_attribute_domain_range() { void test_attribute_domain_range() {
multi.clearDomainIndices(); multi.clearDomainIndices();
multi.setLocalAttributeValue(0, "domains", "0-2"); multi.setLocalAttributeValue(0, "domains", "0-2");
return;
multi.setLocalAttributeValue(1, "domains", "i"); multi.setLocalAttributeValue(1, "domains", "i");
multi.setLocalAttributeValue(2, "domains", "i"); multi.setLocalAttributeValue(2, "domains", "i");
......
...@@ -632,10 +632,8 @@ public: ...@@ -632,10 +632,8 @@ public:
void test_Accessing_Single_Value_From_Times_Series_A_Large_Number_Of_Times() { void test_Accessing_Single_Value_From_Times_Series_A_Large_Number_Of_Times() {
double value(0.0); double value(0.0);
for (size_t i = 0; i < 20000; ++i) { for (size_t i = 0; i < 20000; ++i) {
value = m_testRun.getPropertyAsSingleValue(m_propName); m_testRun.getPropertyAsSingleValue(m_propName);
} }
// Enure variable is used so that it is not optimised away by the compiler
value += 1.0;
} }
Run m_testRun; Run m_testRun;
......
...@@ -404,7 +404,7 @@ void ConjoinXRuns::exec() { ...@@ -404,7 +404,7 @@ void ConjoinXRuns::exec() {
<< ". Reason: \"" << e.what() << "\". Skipping.\n"; << ". Reason: \"" << e.what() << "\". Skipping.\n";
sampleLogsBehaviour.resetSampleLogs(temp); sampleLogsBehaviour.resetSampleLogs(temp);
// remove the skipped one from the list // remove the skipped one from the list
m_inputWS.erase(it); it = m_inputWS.erase(it);
--it; --it;
} else { } else {
throw std::invalid_argument(e); throw std::invalid_argument(e);
......
...@@ -220,11 +220,10 @@ void CorrectKiKf::execEvent() { ...@@ -220,11 +220,10 @@ void CorrectKiKf::execEvent() {
PARALLEL_FOR_IF(Kernel::threadSafe(*outputWS)) PARALLEL_FOR_IF(Kernel::threadSafe(*outputWS))
for (int64_t i = 0; i < numHistograms; ++i) { for (int64_t i = 0; i < numHistograms; ++i) {
PARALLEL_START_INTERUPT_REGION PARALLEL_START_INTERUPT_REGION
double Efi = 0;
// Now get the detector object for this histogram to check if monitor // Now get the detector object for this histogram to check if monitor
// or to get Ef for indirect geometry // or to get Ef for indirect geometry
if (emodeStr == "Indirect") { if (emodeStr == "Indirect") {
double Efi = 0;
if (efixedProp != EMPTY_DBL()) { if (efixedProp != EMPTY_DBL()) {
Efi = efixedProp; Efi = efixedProp;
// If a DetectorGroup is present should provide a value as a property // If a DetectorGroup is present should provide a value as a property
......
...@@ -432,7 +432,6 @@ void CreateGroupingWorkspace::exec() { ...@@ -432,7 +432,6 @@ void CreateGroupingWorkspace::exec() {
sortnames = true; sortnames = true;
GroupNames = ""; GroupNames = "";
int maxRecurseDepth = this->getProperty("MaxRecursionDepth"); int maxRecurseDepth = this->getProperty("MaxRecursionDepth");
// cppcheck-suppress syntaxError // cppcheck-suppress syntaxError
PRAGMA_OMP(parallel for schedule(dynamic, 1) ) PRAGMA_OMP(parallel for schedule(dynamic, 1) )
for (int num = 0; num < 300; ++num) { for (int num = 0; num < 300; ++num) {
......
...@@ -590,11 +590,10 @@ void DiffractionFocussing2::determineRebinParameters() { ...@@ -590,11 +590,10 @@ void DiffractionFocussing2::determineRebinParameters() {
nGroups = group2minmax.size(); // Number of unique groups nGroups = group2minmax.size(); // Number of unique groups
double Xmin, Xmax, step;
const int64_t xPoints = nPoints + 1; const int64_t xPoints = nPoints + 1;
// Iterator over all groups to create the new X vectors // Iterator over all groups to create the new X vectors
for (gpit = group2minmax.begin(); gpit != group2minmax.end(); gpit++) { for (gpit = group2minmax.begin(); gpit != group2minmax.end(); ++gpit) {
double Xmin, Xmax, step;
Xmin = (gpit->second).first; Xmin = (gpit->second).first;
Xmax = (gpit->second).second; Xmax = (gpit->second).second;
......
...@@ -1771,7 +1771,6 @@ double FitPeaks::fitFunctionSD( ...@@ -1771,7 +1771,6 @@ double FitPeaks::fitFunctionSD(
errorid << ": " << e.what(); errorid << ": " << e.what();
g_log.warning() << "While fitting " + errorid.str(); g_log.warning() << "While fitting " + errorid.str();
return DBL_MAX; // probably the wrong thing to do return DBL_MAX; // probably the wrong thing to do
throw std::runtime_error("While fitting " + errorid.str());
} }
// Retrieve result // Retrieve result
...@@ -1847,7 +1846,6 @@ double FitPeaks::fitFunctionMD(API::IFunction_sptr fit_function, ...@@ -1847,7 +1846,6 @@ double FitPeaks::fitFunctionMD(API::IFunction_sptr fit_function,
double chi2 = DBL_MAX; double chi2 = DBL_MAX;
if (fitStatus == "success") { if (fitStatus == "success") {
chi2 = fit->getProperty("OutputChi2overDoF"); chi2 = fit->getProperty("OutputChi2overDoF");
fit_function = fit->getProperty("Function");
} }
return chi2; return chi2;
...@@ -1883,9 +1881,8 @@ double FitPeaks::fitFunctionHighBackground( ...@@ -1883,9 +1881,8 @@ double FitPeaks::fitFunctionHighBackground(
createMatrixWorkspace(vec_x, vec_y, vec_e); createMatrixWorkspace(vec_x, vec_y, vec_e);
// Fit peak with background // Fit peak with background
double cost = fitFunctionSD(fit, peakfunction, bkgdfunc, reduced_bkgd_ws, 0, fitFunctionSD(fit, peakfunction, bkgdfunc, reduced_bkgd_ws, 0, vec_x.front(),
vec_x.front(), vec_x.back(), expected_peak_center, vec_x.back(), expected_peak_center, observe_peak_shape, false);
observe_peak_shape, false);
// add the reduced background back // add the reduced background back
bkgdfunc->setParameter(0, bkgdfunc->getParameter(0) + bkgdfunc->setParameter(0, bkgdfunc->getParameter(0) +
...@@ -1893,9 +1890,9 @@ double FitPeaks::fitFunctionHighBackground( ...@@ -1893,9 +1890,9 @@ double FitPeaks::fitFunctionHighBackground(
bkgdfunc->setParameter(1, bkgdfunc->getParameter(1) + bkgdfunc->setParameter(1, bkgdfunc->getParameter(1) +
high_bkgd_function->getParameter(1)); high_bkgd_function->getParameter(1));
cost = fitFunctionSD(fit, peakfunction, bkgdfunc, m_inputMatrixWS, ws_index, double cost = fitFunctionSD(fit, peakfunction, bkgdfunc, m_inputMatrixWS,
vec_x.front(), vec_x.back(), expected_peak_center, false, ws_index, vec_x.front(), vec_x.back(),
false); expected_peak_center, false, false);
return cost; return cost;
} }
......
...@@ -456,10 +456,9 @@ void GenerateEventsFilter::setFilterByTimeOnly() { ...@@ -456,10 +456,9 @@ void GenerateEventsFilter::setFilterByTimeOnly() {
int64_t curtime_ns = m_startTime.totalNanoseconds(); int64_t curtime_ns = m_startTime.totalNanoseconds();
int wsindex = 0; int wsindex = 0;
while (curtime_ns < m_stopTime.totalNanoseconds()) { while (curtime_ns < m_stopTime.totalNanoseconds()) {
int64_t deltatime_ns;
for (size_t id = 0; id < numtimeintervals; ++id) { for (size_t id = 0; id < numtimeintervals; ++id) {
// get next time interval value // get next time interval value
deltatime_ns = vec_dtimens[id]; int64_t deltatime_ns = vec_dtimens[id];
// Calculate next.time // Calculate next.time
int64_t nexttime_ns = curtime_ns + deltatime_ns; int64_t nexttime_ns = curtime_ns + deltatime_ns;
bool breaklater = false; bool breaklater = false;
...@@ -831,7 +830,6 @@ void GenerateEventsFilter::makeFilterBySingleValue( ...@@ -831,7 +830,6 @@ void GenerateEventsFilter::makeFilterBySingleValue(
// Initialize control parameters // Initialize control parameters
bool lastGood = false; bool lastGood = false;
bool isGood = false;
time_duration tol = DateAndTime::durationFromSeconds(TimeTolerance); time_duration tol = DateAndTime::durationFromSeconds(TimeTolerance);
int numgood = 0; int numgood = 0;
DateAndTime lastTime, currT; DateAndTime lastTime, currT;
...@@ -844,8 +842,8 @@ void GenerateEventsFilter::makeFilterBySingleValue( ...@@ -844,8 +842,8 @@ void GenerateEventsFilter::makeFilterBySingleValue(
currT = m_dblLog->nthTime(i); currT = m_dblLog->nthTime(i);
// A good value? // A good value?
isGood = identifyLogEntry(i, currT, lastGood, min, max, startTime, stopTime, bool isGood = identifyLogEntry(i, currT, lastGood, min, max, startTime,
filterIncrease, filterDecrease); stopTime, filterIncrease, filterDecrease);
if (isGood) if (isGood)
numgood++; numgood++;
...@@ -1219,7 +1217,6 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog( ...@@ -1219,7 +1217,6 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog(
double currValue = m_dblLog->nthValue(i); double currValue = m_dblLog->nthValue(i);
// Filter out by time and direction (optional) // Filter out by time and direction (optional)
bool intime = true;
if (currTime < startTime) { if (currTime < startTime) {
// case i. Too early, do nothing // case i. Too early, do nothing
createsplitter = false; createsplitter = false;
...@@ -1254,7 +1251,6 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog( ...@@ -1254,7 +1251,6 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog(
prevDirection = direction; prevDirection = direction;
// Examine log value for filter // Examine log value for filter
if (intime) {
// Determine whether direction is fine // Determine whether direction is fine
bool correctdir = true; bool correctdir = true;
if (filterIncrease && filterDecrease) { if (filterIncrease && filterDecrease) {
...@@ -1285,9 +1281,8 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog( ...@@ -1285,9 +1281,8 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog(
if (g_log.is(Logger::Priority::PRIO_DEBUG)) { if (g_log.is(Logger::Priority::PRIO_DEBUG)) {
stringstream dbss; stringstream dbss;
dbss << "[DBx257] Examine Log Index " << i dbss << "[DBx257] Examine Log Index " << i << ", Value = " << currValue
<< ", Value = " << currValue << ", Data Range Index = " << index << ", Data Range Index = " << index << "; "
<< "; "
<< "Group Index = " << indexwsindexmap[index / 2] << "Group Index = " << indexwsindexmap[index / 2]
<< " (log value range vector size = " << logvalueranges.size() << " (log value range vector size = " << logvalueranges.size()
<< "): "; << "): ";
...@@ -1345,8 +1340,8 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog( ...@@ -1345,8 +1340,8 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog(
else { else {
// [Situation] Fall between interval (which is not likley happen) // [Situation] Fall between interval (which is not likley happen)
currindex = -1; currindex = -1;
g_log.warning() g_log.warning() << "Not likely to happen! Current value = "
<< "Not likely to happen! Current value = " << currValue << currValue
<< " is within value range but its index = " << index << " is within value range but its index = " << index
<< " has no map to group index. " << " has no map to group index. "
<< "\n"; << "\n";
...@@ -1377,7 +1372,6 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog( ...@@ -1377,7 +1372,6 @@ void GenerateEventsFilter::makeMultipleFiltersByValuesPartialLog(
createsplitter = true; createsplitter = true;
} }
} }
} // ENDIF (log entry in specified time)
// d) Create Splitter // d) Create Splitter
if (createsplitter) { if (createsplitter) {
......
...@@ -721,7 +721,7 @@ void GetDetOffsetsMultiPeaks::fitPeaksOffset( ...@@ -721,7 +721,7 @@ void GetDetOffsetsMultiPeaks::fitPeaksOffset(
// Set up GSL minimzer // Set up GSL minimzer
const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex; const gsl_multimin_fminimizer_type *T = gsl_multimin_fminimizer_nmsimplex;
gsl_multimin_fminimizer *s = nullptr;
gsl_vector *ss, *x; gsl_vector *ss, *x;
gsl_multimin_function minex_func; gsl_multimin_function minex_func;
...@@ -729,7 +729,6 @@ void GetDetOffsetsMultiPeaks::fitPeaksOffset( ...@@ -729,7 +729,6 @@ void GetDetOffsetsMultiPeaks::fitPeaksOffset(
size_t nopt = 1; size_t nopt = 1;
size_t iter = 0; size_t iter = 0;
int status = 0; int status = 0;
double size;
/* Starting point */ /* Starting point */
x = gsl_vector_alloc(nopt); x = gsl_vector_alloc(nopt);
...@@ -744,7 +743,7 @@ void GetDetOffsetsMultiPeaks::fitPeaksOffset( ...@@ -744,7 +743,7 @@ void GetDetOffsetsMultiPeaks::fitPeaksOffset(
minex_func.f = &gsl_costFunction; minex_func.f = &gsl_costFunction;
minex_func.params = &params; minex_func.params = &params;
s = gsl_multimin_fminimizer_alloc(T, nopt); gsl_multimin_fminimizer *s = gsl_multimin_fminimizer_alloc(T, nopt);
gsl_multimin_fminimizer_set(s, &minex_func, x, ss); gsl_multimin_fminimizer_set(s, &minex_func, x, ss);
do { do {
...@@ -753,7 +752,7 @@ void GetDetOffsetsMultiPeaks::fitPeaksOffset( ...@@ -753,7 +752,7 @@ void GetDetOffsetsMultiPeaks::fitPeaksOffset(
if (status) if (status)
break; break;
size = gsl_multimin_fminimizer_size(s); double size = gsl_multimin_fminimizer_size(s);
status = gsl_multimin_test_size(size, 1e-4); status = gsl_multimin_test_size(size, 1e-4);
} while (status == GSL_CONTINUE && iter < 50); } while (status == GSL_CONTINUE && iter < 50);
......
...@@ -755,14 +755,13 @@ double fitDIFCtZeroDIFA(std::vector<double> &peaks, double &difc, double &t0, ...@@ -755,14 +755,13 @@ double fitDIFCtZeroDIFA(std::vector<double> &peaks, double &difc, double &t0,
size_t iter = 0; // number of iterations size_t iter = 0; // number of iterations
const size_t MAX_ITER = 75 * numParams; const size_t MAX_ITER = 75 * numParams;
int status = 0; int status = 0;
double size;
do { do {
iter++; iter++;
status = gsl_multimin_fminimizer_iterate(minimizer); status = gsl_multimin_fminimizer_iterate(minimizer);
if (status) if (status)
break; break;
size = gsl_multimin_fminimizer_size(minimizer); double size = gsl_multimin_fminimizer_size(minimizer);
status = gsl_multimin_test_size(size, 1e-4); status = gsl_multimin_test_size(size, 1e-4);
} while (status == GSL_CONTINUE && iter < MAX_ITER); } while (status == GSL_CONTINUE && iter < MAX_ITER);
......
...@@ -96,30 +96,22 @@ void fourInputsCorrectedAndErrors( ...@@ -96,30 +96,22 @@ void fourInputsCorrectedAndErrors(
const auto diag1 = 1. / f1; const auto diag1 = 1. / f1;
const auto off1 = (f1 - 1.) / f1; const auto off1 = (f1 - 1.) / f1;
Eigen::Matrix4d F1m; Eigen::Matrix4d F1m;
// Suppress warnings about suspicious init with Eigen
// cppcheck-suppress constStatement
F1m << 1., 0., 0., 0., 0., 1., 0., 0., off1, 0., diag1, 0., 0., off1, 0., F1m << 1., 0., 0., 0., 0., 1., 0., 0., off1, 0., diag1, 0., 0., off1, 0.,
diag1; diag1;
const auto diag2 = 1. / f2; const auto diag2 = 1. / f2;
const auto off2 = (f2 - 1.) / f2; const auto off2 = (f2 - 1.) / f2;
Eigen::Matrix4d F2m; Eigen::Matrix4d F2m;
// cppcheck-suppress constStatement
F2m << 1., 0., 0., 0., off2, diag2, 0., 0., 0., 0., 1., 0., 0., 0., off2, F2m << 1., 0., 0., 0., off2, diag2, 0., 0., 0., 0., 1., 0., 0., 0., off2,
diag2; diag2;
const auto diag3 = (p1 - 1.) / (2. * p1 - 1.); const auto diag3 = (p1 - 1.) / (2. * p1 - 1.);
const auto off3 = p1 / (2. * p1 - 1); const auto off3 = p1 / (2. * p1 - 1);
Eigen::Matrix4d P1m; Eigen::Matrix4d P1m;
// cppcheck-suppress constStatement
P1m << diag3, 0, off3, 0, 0, diag3, 0, off3, off3, 0, diag3, 0, 0, off3, 0, P1m << diag3, 0, off3, 0, 0, diag3, 0, off3, off3, 0, diag3, 0, 0, off3, 0,
diag3; diag3;
const auto diag4 = (p2 - 1.) / (2. * p2 - 1.); const auto diag4 = (p2 - 1.) / (2. * p2 - 1.);
const auto off4 = p2 / (2. * p2 - 1.); const auto off4 = p2 / (2. * p2 - 1.);
Eigen::Matrix4d P2m; Eigen::Matrix4d P2m;
// cppcheck-suppress constStatement
P2m << diag4, off4, 0., 0., off4, diag4, 0., 0., 0., 0., diag4, off4, 0., 0., P2m << diag4, off4, 0., 0., off4, diag4, 0., 0., 0., 0., diag4, off4, 0., 0.,
off4, diag4; off4, diag4;
const Eigen::Vector4d intensities(ppy, pmy, mpy, mmy); const Eigen::Vector4d intensities(ppy, pmy, mpy, mmy);
...@@ -131,26 +123,18 @@ void fourInputsCorrectedAndErrors( ...@@ -131,26 +123,18 @@ void fourInputsCorrectedAndErrors(
// the matrices above, multiplied by the error. // the matrices above, multiplied by the error.
const auto elemE1 = -1. / pow<2>(f1) * f1E; const auto elemE1 = -