Skip to content
Snippets Groups Projects
Commit 92af804e authored by Xavier Valls Pla's avatar Xavier Valls Pla
Browse files

Fix undefined default initialization

It worked because VecCore depends on the backend default
initialization (in this case Vc initializes to 0.)
parent cbc475ca
No related branches found
No related tags found
No related merge requests found
...@@ -133,7 +133,7 @@ struct Chi2 { ...@@ -133,7 +133,7 @@ struct Chi2 {
x = &x1; x = &x1;
} }
T fval{}; T fval(0.);
#ifdef USE_PARAMCACHE #ifdef USE_PARAMCACHE
fval = func(x); fval = func(x);
...@@ -152,7 +152,7 @@ struct Chi2 { ...@@ -152,7 +152,7 @@ struct Chi2 {
return chi2; return chi2;
}; };
auto redFunction = [](const std::vector<T> &objs) { return std::accumulate(objs.begin(), objs.end(), T{}); }; auto redFunction = [](const std::vector<T> &objs) { return std::accumulate(objs.begin(), objs.end(), T(0.)); };
#ifndef R__USE_IMT #ifndef R__USE_IMT
(void)nChunks; (void)nChunks;
...@@ -165,7 +165,7 @@ struct Chi2 { ...@@ -165,7 +165,7 @@ struct Chi2 {
} }
#endif #endif
T res{}; T res(0.);
if (executionPolicy == ROOT::Fit::ExecutionPolicy::kSerial) { if (executionPolicy == ROOT::Fit::ExecutionPolicy::kSerial) {
ROOT::TSequentialExecutor pool; ROOT::TSequentialExecutor pool;
res = pool.MapReduce(mapFunction, ROOT::TSeq<unsigned>(0, data.Size() / vecSize), redFunction); res = pool.MapReduce(mapFunction, ROOT::TSeq<unsigned>(0, data.Size() / vecSize), redFunction);
......
...@@ -48,7 +48,7 @@ namespace FitUtil { ...@@ -48,7 +48,7 @@ namespace FitUtil {
template <class T> template <class T>
class LikelihoodAux { class LikelihoodAux {
public: public:
LikelihoodAux(T logv = {}, T w = {}, T w2 = {}) : logvalue(logv), weight(w), weight2(w2) {} LikelihoodAux(T logv = 0., T w = 0., T w2 = 0.) : logvalue(logv), weight(w), weight2(w2) {}
LikelihoodAux operator+(const LikelihoodAux &l) const LikelihoodAux operator+(const LikelihoodAux &l) const
{ {
...@@ -180,9 +180,9 @@ struct LogL { ...@@ -180,9 +180,9 @@ struct LogL {
unsigned int numVectors = n / vecSize; unsigned int numVectors = n / vecSize;
auto mapFunction = [&, p](const unsigned i) { auto mapFunction = [&, p](const unsigned i) {
T W{}; T W(0.);
T W2{}; T W2(0.);
T fval{}; T fval(0.);
(void)p; /* avoid unused lambda capture warning if PARAMCACHE is disabled */ (void)p; /* avoid unused lambda capture warning if PARAMCACHE is disabled */
...@@ -222,7 +222,7 @@ struct LogL { ...@@ -222,7 +222,7 @@ struct LogL {
// function EvalLog protects against negative or too small values of fval // function EvalLog protects against negative or too small values of fval
auto logval = ROOT::Math::Util::EvalLog(fval); auto logval = ROOT::Math::Util::EvalLog(fval);
if (iWeight > 0) { if (iWeight > 0) {
T weight{}; T weight(0.);
if (data.WeightsPtr(i) == nullptr) if (data.WeightsPtr(i) == nullptr)
weight = 1; weight = 1;
else else
...@@ -262,9 +262,9 @@ struct LogL { ...@@ -262,9 +262,9 @@ struct LogL {
} }
#endif #endif
T logl_v{}; T logl_v(0.);
T sumW_v{}; T sumW_v(0.);
T sumW2_v{}; T sumW2_v(0.);
ROOT::Fit::FitUtil::LikelihoodAux<T> resArray; ROOT::Fit::FitUtil::LikelihoodAux<T> resArray;
if (executionPolicy == ROOT::Fit::ExecutionPolicy::kSerial) { if (executionPolicy == ROOT::Fit::ExecutionPolicy::kSerial) {
ROOT::TSequentialExecutor pool; ROOT::TSequentialExecutor pool;
......
...@@ -105,7 +105,7 @@ struct PoissonLogL { ...@@ -105,7 +105,7 @@ struct PoissonLogL {
auto mapFunction = [&](unsigned int i) { auto mapFunction = [&](unsigned int i) {
T y; T y;
vecCore::Load<T>(y, data.ValuePtr(i * vecSize)); vecCore::Load<T>(y, data.ValuePtr(i * vecSize));
T fval{}; T fval(0.);
if (data.NDim() > 1) { if (data.NDim() > 1) {
std::vector<T> x(data.NDim()); std::vector<T> x(data.NDim());
...@@ -131,7 +131,7 @@ struct PoissonLogL { ...@@ -131,7 +131,7 @@ struct PoissonLogL {
// negative values of fval // negative values of fval
vecCore::MaskedAssign<T>(fval, fval < 0.0, 0.0); vecCore::MaskedAssign<T>(fval, fval < 0.0, 0.0);
T nloglike{}; // negative loglikelihood T nloglike(0.); // negative loglikelihood
if (useW2) { if (useW2) {
// apply weight correction . Effective weight is error^2/ y // apply weight correction . Effective weight is error^2/ y
...@@ -168,7 +168,7 @@ struct PoissonLogL { ...@@ -168,7 +168,7 @@ struct PoissonLogL {
}; };
#ifdef R__USE_IMT #ifdef R__USE_IMT
auto redFunction = [](const std::vector<T> &objs) { return std::accumulate(objs.begin(), objs.end(), T{}); }; auto redFunction = [](const std::vector<T> &objs) { return std::accumulate(objs.begin(), objs.end(), T(0.)); };
#else #else
(void)nChunks; (void)nChunks;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment